|
18 | 18 | import com.oracle.truffle.api.dsl.Bind;
|
19 | 19 | import com.oracle.truffle.api.interop.InvalidArrayIndexException;
|
20 | 20 | import com.oracle.truffle.api.nodes.ExplodeLoop;
|
21 |
| -import com.oracle.truffle.api.nodes.Node; |
22 | 21 | import com.oracle.truffle.api.profiles.InlinedBranchProfile;
|
23 | 22 | import com.oracle.truffle.api.profiles.LoopConditionProfile;
|
24 | 23 | import org.truffleruby.language.NotProvided;
|
|
28 | 27 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
|
29 | 28 | import com.oracle.truffle.api.dsl.Cached;
|
30 | 29 | import com.oracle.truffle.api.dsl.Cached.Shared;
|
31 |
| -import com.oracle.truffle.api.dsl.Cached.Exclusive; |
32 | 30 | import com.oracle.truffle.api.dsl.Fallback;
|
33 | 31 | import com.oracle.truffle.api.dsl.GenerateUncached;
|
34 | 32 | import com.oracle.truffle.api.dsl.ImportStatic;
|
@@ -159,18 +157,17 @@ protected ValueWrapper longToWrapper(long value,
|
159 | 157 | return nativeToWrapperNode.execute(value);
|
160 | 158 | }
|
161 | 159 |
|
162 |
| - @Specialization(guards = { "!isWrapper(value)", "values.isPointer(value)" }, limit = "getCacheLimit()") |
163 |
| - protected static ValueWrapper genericToWrapper(Object value, |
164 |
| - @CachedLibrary("value") InteropLibrary values, |
| 160 | + @Fallback |
| 161 | + protected ValueWrapper genericToWrapper(Object value, |
| 162 | + @CachedLibrary(limit = "getCacheLimit()") InteropLibrary values, |
165 | 163 | @Cached @Shared NativeToWrapperNode nativeToWrapperNode,
|
166 |
| - @Cached InlinedBranchProfile unsupportedProfile, |
167 |
| - @Bind("this") Node node) { |
| 164 | + @Cached InlinedBranchProfile unsupportedProfile) { |
168 | 165 | long handle;
|
169 | 166 | try {
|
170 | 167 | handle = values.asPointer(value);
|
171 | 168 | } catch (UnsupportedMessageException e) {
|
172 |
| - unsupportedProfile.enter(node); |
173 |
| - throw new RaiseException(getContext(node), coreExceptions(node).argumentError(e.getMessage(), node, e)); |
| 169 | + unsupportedProfile.enter(this); |
| 170 | + throw new RaiseException(getContext(), coreExceptions().argumentError(e.getMessage(), this, e)); |
174 | 171 | }
|
175 | 172 | return nativeToWrapperNode.execute(handle);
|
176 | 173 | }
|
@@ -253,22 +250,21 @@ protected long unwrapValueTaggedLong(ValueWrapper value) {
|
253 | 250 |
|
254 | 251 | @Specialization
|
255 | 252 | protected Object longToWrapper(long value,
|
256 |
| - @Cached @Exclusive UnwrapNativeNode unwrapNode) { |
257 |
| - return unwrapNode.execute(value); |
| 253 | + @Cached @Shared UnwrapNativeNode unwrapNativeNode) { |
| 254 | + return unwrapNativeNode.execute(value); |
258 | 255 | }
|
259 | 256 |
|
260 |
| - @Specialization(guards = { "!isWrapper(value)", "values.isPointer(value)" }, limit = "getCacheLimit()") |
261 |
| - protected static Object unwrapGeneric(Object value, |
262 |
| - @CachedLibrary("value") InteropLibrary values, |
263 |
| - @Cached @Exclusive UnwrapNativeNode unwrapNativeNode, |
264 |
| - @Cached InlinedBranchProfile unsupportedProfile, |
265 |
| - @Bind("this") Node node) { |
| 257 | + @Specialization(guards = { "!isWrapper(value)", "!isImplicitLong(value)" }) |
| 258 | + protected Object unwrapGeneric(Object value, |
| 259 | + @CachedLibrary(limit = "getCacheLimit()") InteropLibrary values, |
| 260 | + @Cached @Shared UnwrapNativeNode unwrapNativeNode, |
| 261 | + @Cached InlinedBranchProfile unsupportedProfile) { |
266 | 262 | long handle;
|
267 | 263 | try {
|
268 | 264 | handle = values.asPointer(value);
|
269 | 265 | } catch (UnsupportedMessageException e) {
|
270 |
| - unsupportedProfile.enter(node); |
271 |
| - throw new RaiseException(getContext(node), coreExceptions(node).argumentError(e.getMessage(), node, e)); |
| 266 | + unsupportedProfile.enter(this); |
| 267 | + throw new RaiseException(getContext(), coreExceptions().argumentError(e.getMessage(), this, e)); |
272 | 268 | }
|
273 | 269 | return unwrapNativeNode.execute(handle);
|
274 | 270 | }
|
|
0 commit comments