37
37
import com .oracle .svm .core .Uninterruptible ;
38
38
import com .oracle .svm .core .attach .AttachApiSupport ;
39
39
import com .oracle .svm .core .heap .Heap ;
40
+ import com .oracle .svm .core .jdk .SystemPropertiesSupport ;
40
41
import com .oracle .svm .core .thread .VMOperation ;
41
42
import com .oracle .svm .core .thread .VMOperationListener ;
42
43
import com .oracle .svm .core .util .BasedOnJDKFile ;
@@ -128,15 +129,16 @@ public void allocate() {
128
129
loadedClasses .allocate (numberOfLoadedClasses ());
129
130
processors .allocate (getAvailableProcessors ());
130
131
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" ));
140
142
jvmCapabilities .allocate (getJvmCapabilities ());
141
143
142
144
gcInProgress .allocate ();
@@ -151,15 +153,6 @@ public void allocate() {
151
153
initDoneTime .allocate (Isolates .getInitDoneTimeMillis ());
152
154
}
153
155
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
-
163
156
@ BasedOnJDKFile ("https://github.com/openjdk/jdk/blob/jdk-24+18/src/hotspot/share/services/runtimeService.cpp#L68-L77" ) //
164
157
private static String getJvmCapabilities () {
165
158
/*
0 commit comments