Skip to content

Commit 6b515da

Browse files
committed
Return @TruffleBoundary to LookupSuperMethodNode#doLookup
1 parent daa4b20 commit 6b515da

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

src/main/java/org/truffleruby/language/methods/InternalMethod.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ public boolean isBuiltIn() {
178178
return builtIn;
179179
}
180180

181-
public boolean isRefined() {
182-
return activeRefinements != null;
183-
}
184-
185181
public RootCallTarget getCallTarget() {
186182
return callTarget;
187183
}

src/main/java/org/truffleruby/language/supercall/LookupSuperMethodNode.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.truffleruby.language.objects.MetaClassNode;
2020

2121
import com.oracle.truffle.api.CompilerDirectives;
22+
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
2223
import com.oracle.truffle.api.dsl.Cached;
2324
import com.oracle.truffle.api.dsl.Specialization;
2425
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -47,15 +48,15 @@ public abstract class LookupSuperMethodNode extends RubyContextNode {
4748
protected InternalMethod lookupSuperMethodCachedDynamicObject(VirtualFrame frame, DynamicObject self,
4849
@Cached("getCurrentMethod(frame)") InternalMethod currentMethod,
4950
@Cached("metaClass(self)") DynamicObject selfMetaClass,
50-
@Cached("doLookup(frame, currentMethod, selfMetaClass)") MethodLookupResult superMethod) {
51+
@Cached("doLookup(currentMethod, selfMetaClass)") MethodLookupResult superMethod) {
5152
return superMethod.getMethod();
5253
}
5354

5455
@Specialization
5556
protected InternalMethod lookupSuperMethodUncached(VirtualFrame frame, Object self) {
5657
final InternalMethod currentMethod = getCurrentMethod(frame);
5758
final DynamicObject selfMetaClass = metaClass(self);
58-
return doLookup(frame, currentMethod, selfMetaClass).getMethod();
59+
return doLookup(currentMethod, selfMetaClass).getMethod();
5960
}
6061

6162
protected InternalMethod getCurrentMethod(VirtualFrame frame) {
@@ -70,15 +71,16 @@ protected DynamicObject metaClass(Object object) {
7071
return metaClassNode.executeMetaClass(object);
7172
}
7273

73-
protected MethodLookupResult doLookup(VirtualFrame frame, InternalMethod currentMethod,
74+
@TruffleBoundary
75+
protected MethodLookupResult doLookup(InternalMethod currentMethod,
7476
DynamicObject selfMetaClass) {
7577
assert RubyGuards.isRubyClass(selfMetaClass);
7678

7779
MethodLookupResult superMethod = ModuleOperations
7880
.lookupSuperMethod(
7981
currentMethod,
8082
selfMetaClass,
81-
getDeclarationContext(frame, currentMethod, selfMetaClass));
83+
getDeclarationContext(currentMethod, selfMetaClass));
8284
// TODO (eregon, 12 June 2015): Is this correct?
8385
if (!superMethod.isDefined()) {
8486
return superMethod.withNoMethod();
@@ -90,15 +92,14 @@ protected int getCacheLimit() {
9092
return getContext().getOptions().METHOD_LOOKUP_CACHE;
9193
}
9294

93-
private DeclarationContext getDeclarationContext(VirtualFrame frame, InternalMethod currentMethod,
95+
private DeclarationContext getDeclarationContext(InternalMethod currentMethod,
9496
DynamicObject selfMetaClass) {
95-
final DeclarationContext context = RubyArguments.getDeclarationContext(frame);
97+
final DeclarationContext context = currentMethod.getDeclarationContext();
98+
final DeclarationContext activeRefinements = currentMethod.getActiveRefinements();
9699

97-
if (currentMethod.isRefined()) {
100+
if (activeRefinements != null) {
98101
// super from the refined method has access to the parent's active refinements for the selfMetaClass
99-
final DynamicObject[] classRefinements = currentMethod
100-
.getActiveRefinements()
101-
.getRefinementsFor(selfMetaClass);
102+
final DynamicObject[] classRefinements = activeRefinements.getRefinementsFor(selfMetaClass);
102103

103104
if (classRefinements == null) {
104105
return context;

0 commit comments

Comments
 (0)