3737import com .oracle .svm .core .Uninterruptible ;
3838import com .oracle .svm .core .attach .AttachApiSupport ;
3939import com .oracle .svm .core .heap .Heap ;
40+ import com .oracle .svm .core .jdk .SystemPropertiesSupport ;
4041import com .oracle .svm .core .thread .VMOperation ;
4142import com .oracle .svm .core .thread .VMOperationListener ;
4243import com .oracle .svm .core .util .BasedOnJDKFile ;
@@ -128,15 +129,16 @@ public void allocate() {
128129 loadedClasses .allocate (numberOfLoadedClasses ());
129130 processors .allocate (getAvailableProcessors ());
130131
131- tempDir .allocate (getSystemProperty ("java.io.tmpdir" ));
132- javaVersion .allocate (getSystemProperty ("java.version" ));
133- vmName .allocate (getSystemProperty ("java.vm.name" ));
134- vmVendor .allocate (getSystemProperty ("java.vm.vendor" ));
135- vmVersion .allocate (getSystemProperty ("java.vm.version" ));
136- osArch .allocate (getSystemProperty ("os.arch" ));
137- osName .allocate (getSystemProperty ("os.name" ));
138- userDir .allocate (getSystemProperty ("user.dir" ));
139- userName .allocate (getSystemProperty ("user.name" ));
132+ SystemPropertiesSupport properties = SystemPropertiesSupport .singleton ();
133+ tempDir .allocate (properties .getInitialProperty ("java.io.tmpdir" ));
134+ javaVersion .allocate (properties .getInitialProperty ("java.version" ));
135+ vmName .allocate (properties .getInitialProperty ("java.vm.name" ));
136+ vmVendor .allocate (properties .getInitialProperty ("java.vm.vendor" ));
137+ vmVersion .allocate (properties .getInitialProperty ("java.vm.version" ));
138+ osArch .allocate (properties .getInitialProperty ("os.arch" ));
139+ osName .allocate (properties .getInitialProperty ("os.name" ));
140+ userDir .allocate (properties .getInitialProperty ("user.dir" ));
141+ userName .allocate (properties .getInitialProperty ("user.name" ));
140142 jvmCapabilities .allocate (getJvmCapabilities ());
141143
142144 gcInProgress .allocate ();
@@ -151,15 +153,6 @@ public void allocate() {
151153 initDoneTime .allocate (Isolates .getInitDoneTimeMillis ());
152154 }
153155
154- private static String getSystemProperty (String s ) {
155- /* Certain system properties (e.g., "user.dir"), may throw an exception. */
156- try {
157- return System .getProperty (s );
158- } catch (Throwable e ) {
159- return "" ;
160- }
161- }
162-
163156 @ BasedOnJDKFile ("https://github.com/openjdk/jdk/blob/jdk-24+18/src/hotspot/share/services/runtimeService.cpp#L68-L77" ) //
164157 private static String getJvmCapabilities () {
165158 /*
0 commit comments