File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -412,12 +412,18 @@ public boolean shouldEnableRedefinition() {
412
412
return false ;
413
413
}
414
414
415
- public synchronized void grantReadAccessToUnnamedModules (ModuleTable .ModuleEntry module ) {
415
+ public void grantReadAccessToUnnamedModules (ModuleTable .ModuleEntry module ) {
416
416
if (module != null && module .isNamed () && !module .hasDefaultReads ()) {
417
- getContext ().getMeta ().jdk_internal_module_Modules_transformedByAgent .invokeDirect (module .module ());
418
- // no reason to call into guest for a module more than once,
419
- // so flip the hasDefaultReads flag
420
- module .setHasDefaultReads ();
417
+ synchronized (module ) {
418
+ if (module .hasDefaultReads ()) {
419
+ // we lost the race, so nothing to do
420
+ return ;
421
+ }
422
+ getContext ().getMeta ().jdk_internal_module_Modules_transformedByAgent .invokeDirect (module .module ());
423
+ // no reason to call into guest for a module more than once,
424
+ // so flip the hasDefaultReads flag
425
+ module .setHasDefaultReads ();
426
+ }
421
427
}
422
428
}
423
429
You can’t perform that action at this time.
0 commit comments