Skip to content

Commit b9feeba

Browse files
committed
Inject slow-path branch probability in PThreadState.getThreadState
1 parent c0b632b commit b9feeba

File tree

1 file changed

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

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import com.oracle.graal.python.builtins.objects.dict.PDict;
5252
import com.oracle.graal.python.runtime.PythonContext;
5353
import com.oracle.graal.python.runtime.PythonContext.PythonThreadState;
54+
import com.oracle.truffle.api.CompilerDirectives;
5455
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
5556
import com.oracle.truffle.api.interop.InteropLibrary;
5657

@@ -78,7 +79,7 @@ public static Object getThreadState(PythonLanguage language, PythonContext conte
7879

7980
public static Object getThreadState(PythonThreadState threadState) {
8081
PThreadState nativeWrapper = threadState.getNativeWrapper();
81-
if (nativeWrapper == null) {
82+
if (CompilerDirectives.injectBranchProbability(CompilerDirectives.SLOWPATH_PROBABILITY, nativeWrapper == null)) {
8283
nativeWrapper = new PThreadState(threadState);
8384
threadState.setNativeWrapper(nativeWrapper);
8485
}

0 commit comments

Comments
 (0)