Skip to content

Commit 08392ce

Browse files
committed
Use TruffleBoundary to invalidate nonconstant assumptions.
1 parent cc07558 commit 08392ce

File tree

1 file changed

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

1 file changed

+9
-2
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
import com.oracle.truffle.api.CompilerAsserts;
142142
import com.oracle.truffle.api.CompilerDirectives;
143143
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
144+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
144145
import com.oracle.truffle.api.TruffleLanguage.ContextReference;
145146
import com.oracle.truffle.api.TruffleLogger;
146147
import com.oracle.truffle.api.dsl.Cached;
@@ -3034,8 +3035,9 @@ static void doPrimitiveNativeWrapper(@SuppressWarnings("unused") Object delegate
30343035
@Cached("createCountingProfile()") ConditionProfile hasHandleValidAssumptionProfile,
30353036
@Shared("contextRef") @CachedContext(PythonLanguage.class) ContextReference<PythonContext> contextRef) {
30363037
assert !isSmallIntegerWrapperSingleton(contextRef, nativeWrapper) : "clearing primitive native wrapper singleton of small integer";
3037-
if (hasHandleValidAssumptionProfile.profile(nativeWrapper.getHandleValidAssumption() != null)) {
3038-
nativeWrapper.getHandleValidAssumption().invalidate("releasing handle for native wrapper");
3038+
Assumption handleValidAssumption = nativeWrapper.getHandleValidAssumption();
3039+
if (hasHandleValidAssumptionProfile.profile(handleValidAssumption != null)) {
3040+
invalidate(handleValidAssumption);
30393041
}
30403042
}
30413043

@@ -3056,6 +3058,11 @@ static void doOther(@SuppressWarnings("unused") Object delegate, @SuppressWarnin
30563058
// ignore
30573059
}
30583060

3061+
@TruffleBoundary
3062+
private static void invalidate(Assumption assumption) {
3063+
assumption.invalidate("releasing handle for native wrapper");
3064+
}
3065+
30593066
static boolean isPrimitiveNativeWrapper(PythonNativeWrapper nativeWrapper) {
30603067
return nativeWrapper instanceof PrimitiveNativeWrapper;
30613068
}

0 commit comments

Comments
 (0)