|
162 | 162 | import com.oracle.truffle.api.interop.UnsupportedTypeException;
|
163 | 163 | import com.oracle.truffle.api.library.CachedLibrary;
|
164 | 164 | import com.oracle.truffle.api.nodes.ExplodeLoop;
|
| 165 | +import com.oracle.truffle.api.nodes.InvalidAssumptionException; |
165 | 166 | import com.oracle.truffle.api.nodes.Node;
|
166 | 167 | import com.oracle.truffle.api.nodes.NodeUtil;
|
167 | 168 | import com.oracle.truffle.api.profiles.BranchProfile;
|
@@ -3114,25 +3115,31 @@ public abstract static class ResolveHandleNode extends Node {
|
3114 | 3115 |
|
3115 | 3116 | @Specialization(limit = "3", //
|
3116 | 3117 | guards = {"cachedPointer == pointer", "cachedValue != null"}, //
|
3117 |
| - assumptions = {"singleContextAssumption()", "getHandleValidAssumption(cachedValue)"}) |
3118 |
| - static PythonNativeWrapper doLongCachedSingleContext(@SuppressWarnings("unused") long pointer, |
| 3118 | + assumptions = "singleContextAssumption()", // |
| 3119 | + rewriteOn = InvalidAssumptionException.class) |
| 3120 | + static PythonNativeWrapper resolveLongCached(@SuppressWarnings("unused") long pointer, |
3119 | 3121 | @Cached("pointer") @SuppressWarnings("unused") long cachedPointer,
|
3120 |
| - @Cached("resolveHandleUncached(pointer)") PythonNativeWrapper cachedValue) { |
| 3122 | + @Cached("resolveHandleUncached(pointer)") PythonNativeWrapper cachedValue, |
| 3123 | + @Cached("getHandleValidAssumption(cachedValue)") Assumption associationValidAssumption) throws InvalidAssumptionException { |
| 3124 | + associationValidAssumption.check(); |
3121 | 3125 | return cachedValue;
|
3122 | 3126 | }
|
3123 | 3127 |
|
3124 | 3128 | @Specialization(limit = "3", //
|
3125 | 3129 | guards = {"isSame(referenceLibrary, cachedPointerObject, pointerObject)", "cachedValue != null"}, //
|
3126 |
| - assumptions = {"singleContextAssumption()", "getHandleValidAssumption(cachedValue)"}) |
3127 |
| - static PythonNativeWrapper doObjectCachedSingleContext(@SuppressWarnings("unused") Object pointerObject, |
| 3130 | + assumptions = "singleContextAssumption()", // |
| 3131 | + rewriteOn = InvalidAssumptionException.class) |
| 3132 | + static PythonNativeWrapper resolveObjectCached(@SuppressWarnings("unused") Object pointerObject, |
3128 | 3133 | @Cached("pointerObject") @SuppressWarnings("unused") Object cachedPointerObject,
|
3129 | 3134 | @CachedLibrary("cachedPointerObject") @SuppressWarnings("unused") ReferenceLibrary referenceLibrary,
|
3130 |
| - @Cached("resolveHandleUncached(pointerObject)") PythonNativeWrapper cachedValue) { |
| 3135 | + @Cached("resolveHandleUncached(pointerObject)") PythonNativeWrapper cachedValue, |
| 3136 | + @Cached("getHandleValidAssumption(cachedValue)") Assumption associationValidAssumption) throws InvalidAssumptionException { |
| 3137 | + associationValidAssumption.check(); |
3131 | 3138 | return cachedValue;
|
3132 | 3139 | }
|
3133 | 3140 |
|
3134 |
| - @Specialization(replaces = {"doObjectCachedSingleContext", "doLongCachedSingleContext"}) |
3135 |
| - static Object doGeneric(Object pointerObject, |
| 3141 | + @Specialization(replaces = {"resolveLongCached", "resolveObjectCached"}) |
| 3142 | + static Object resolveGeneric(Object pointerObject, |
3136 | 3143 | @Cached PCallCapiFunction callTruffleCannotBeHandleNode,
|
3137 | 3144 | @Cached PCallCapiFunction callTruffleManagedFromHandleNode) {
|
3138 | 3145 | if (!((boolean) callTruffleCannotBeHandleNode.call(NativeCAPISymbols.FUN_TRUFFLE_CANNOT_BE_HANDLE, pointerObject))) {
|
|
0 commit comments