Skip to content

Commit 367675c

Browse files
committed
Add store-store fence when writing to possibly shared symbol cache
1 parent 910e49c commit 367675c

File tree

1 file changed

+4
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+4
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848

4949
import java.io.IOException;
5050
import java.io.PrintStream;
51+
import java.lang.invoke.VarHandle;
5152
import java.nio.file.LinkOption;
5253
import java.util.ArrayList;
5354
import java.util.Arrays;
@@ -469,7 +470,9 @@ private static Object lookupNativeSymbol(Object[] nativeSymbolCache, NativeCAPIS
469470
String name = symbol.getName();
470471
try {
471472
Object nativeSymbol = InteropLibrary.getUncached().readMember(PythonContext.get(null).getCApiContext().getLLVMLibrary(), name);
472-
return nativeSymbolCache[symbol.ordinal()] = CExtContext.ensureExecutable(nativeSymbol, symbol);
473+
nativeSymbol = CExtContext.ensureExecutable(nativeSymbol, symbol);
474+
VarHandle.storeStoreFence();
475+
return nativeSymbolCache[symbol.ordinal()] = nativeSymbol;
473476
} catch (UnsupportedMessageException | UnknownIdentifierException e) {
474477
throw CompilerDirectives.shouldNotReachHere(e);
475478
}

0 commit comments

Comments
 (0)