46
46
import com .oracle .svm .core .feature .AutomaticallyRegisteredFeature ;
47
47
import com .oracle .svm .core .feature .InternalFeature ;
48
48
import com .oracle .svm .core .option .HostedOptionKey ;
49
+ import com .oracle .svm .core .util .BasedOnJDKFile ;
49
50
import com .oracle .svm .core .util .VMError ;
50
51
51
52
import jdk .graal .compiler .options .Option ;
@@ -195,12 +196,12 @@ final class Target_sun_nio_fs_UnixFileSystem {
195
196
private Target_sun_nio_fs_UnixPath rootDirectory ;
196
197
197
198
/**
198
- * Flag to check if re-initialization at run time already happened. The initial value of this
199
- * flag in the image heap is non-zero, and it is set to zero when re-initialization is done.
200
- * This ensures that UnixFileSystem instances allocated at run time are not re-initialized,
201
- * because they are allocated with the field value . Note that UnixFileSystem instances should
202
- * not be allocated at run time, since only the singleton from the image heap should exist.
203
- * However, there were JDK bugs in various JDK versions where unwanted allocations happened.
199
+ * Flag to check if reinitialization at run time is needed. For objects in the image heap, this
200
+ * field is initially non-zero and set to zero after reinitialization. If UnixFileSystem
201
+ * instances are allocated at run time, the field will be set to zero right away (default value)
202
+ * as there is no need for reinitialization . Note that UnixFileSystem instances should not be
203
+ * allocated at run time, as only the singleton from the image heap should exist. However, there
204
+ * were JDK bugs in various JDK versions where unwanted allocations happened.
204
205
*/
205
206
@ Inject //
206
207
@ RecomputeFieldValue (kind = Kind .Custom , declClass = NeedsReinitializationProvider .class )//
@@ -295,6 +296,10 @@ static void setRootDirectory(Target_sun_nio_fs_UnixFileSystem that, Target_sun_n
295
296
that .injectedRootDirectory = value ;
296
297
}
297
298
299
+ @ BasedOnJDKFile ("https://github.com/openjdk/jdk/blob/jdk-25+20/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystem.java#L44-L46" )
300
+ @ BasedOnJDKFile ("https://github.com/openjdk/jdk/blob/jdk-25+20/src/java.base/linux/classes/sun/nio/fs/LinuxFileSystemProvider.java#L45-L47" )
301
+ @ BasedOnJDKFile ("https://github.com/openjdk/jdk/blob/jdk-25+20/src/java.base/unix/classes/sun/nio/fs/UnixFileSystemProvider.java#L75-L77" )
302
+ @ BasedOnJDKFile ("https://github.com/openjdk/jdk/blob/jdk-25+20/src/java.base/unix/classes/sun/nio/fs/UnixFileSystem.java#L78-L108" )
298
303
private static synchronized void reinitialize (Target_sun_nio_fs_UnixFileSystem that ) {
299
304
if (that .needsReinitialization != NeedsReinitializationProvider .STATUS_NEEDS_REINITIALIZATION ) {
300
305
/* Field initialized is volatile, so double-checked locking is OK. */
@@ -311,10 +316,10 @@ private static synchronized void reinitialize(Target_sun_nio_fs_UnixFileSystem t
311
316
* with the same value it is already set to, so this is harmless. All other field writes are
312
317
* redirected to the set-accessors of this class and write the injected fields.
313
318
*
314
- * Note that the `System.getProperty("user.dir" )` value is always used when re-initializing
315
- * a UnixFileSystem, which is not the case with the WindowsFileSystem (JDK-8066709).
319
+ * Note that the `StaticProperty.userDir( )` value is always used when re-initializing a
320
+ * UnixFileSystem, which is not the case with the WindowsFileSystem (JDK-8066709).
316
321
*/
317
- that .originalConstructor (that .provider , System . getProperty ( UserSystemProperty . DIR ));
322
+ that .originalConstructor (that .provider , StaticProperty . userDir ( ));
318
323
319
324
/*
320
325
* Now the object is completely re-initialized and can be used by any thread without
0 commit comments