|
50 | 50 | import com.oracle.graal.python.util.PythonUtils; |
51 | 51 | import com.oracle.truffle.api.CompilerDirectives; |
52 | 52 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
| 53 | +import com.oracle.truffle.api.dsl.Bind; |
53 | 54 | import com.oracle.truffle.api.dsl.Cached; |
54 | 55 | import com.oracle.truffle.api.dsl.GenerateCached; |
55 | 56 | import com.oracle.truffle.api.dsl.GenerateInline; |
@@ -120,10 +121,11 @@ boolean isSet(int traits) { |
120 | 121 | public abstract PythonManagedClass execute(Object object); |
121 | 122 |
|
122 | 123 | // isSingleContext() because making cachedTraits PE constant has no value in multi-context |
123 | | - @Specialization(guards = {"isSingleContext()", "getTraits(object, interop) == cachedTraits"}, limit = "getCallSiteInlineCacheMaxDepth()") |
| 124 | + @Specialization(guards = {"isSingleContext()", "traits == cachedTraits"}, limit = "getCallSiteInlineCacheMaxDepth()") |
124 | 125 | PythonManagedClass cached(Object object, |
125 | 126 | @CachedLibrary("object") InteropLibrary interop, |
126 | | - @Cached("getTraits(object, interop)") int cachedTraits) { |
| 127 | + @Bind("getTraits(object, interop)") int traits, |
| 128 | + @Cached("traits") int cachedTraits) { |
127 | 129 | assert IsForeignObjectNode.executeUncached(object); |
128 | 130 | return classForTraits(cachedTraits); |
129 | 131 | } |
@@ -167,6 +169,7 @@ private PythonManagedClass classForTraits(int traits) { |
167 | 169 | private PythonManagedClass resolvePolyglotForeignClass(int traits) { |
168 | 170 | PythonBuiltinClass base = getContext().lookupType(PythonBuiltinClassType.ForeignObject); |
169 | 171 | if (traits == 0) { |
| 172 | + getContext().polyglotForeignClasses[traits] = base; |
170 | 173 | return base; |
171 | 174 | } |
172 | 175 |
|
|
0 commit comments