Skip to content

Commit a3d23b7

Browse files
committed
Do not cache the RubyContext in LookupMethodNode
1 parent d1e8698 commit a3d23b7

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.truffleruby.language.objects.MetaClassNode;
2424

2525
import com.oracle.truffle.api.CompilerAsserts;
26-
import com.oracle.truffle.api.TruffleLanguage;
2726
import com.oracle.truffle.api.dsl.Cached;
2827
import com.oracle.truffle.api.dsl.CachedContext;
2928
import com.oracle.truffle.api.dsl.GenerateUncached;
@@ -45,24 +44,20 @@ public abstract InternalMethod execute(Frame frame, RubyClass metaClass, String
4544
DispatchConfiguration config);
4645

4746
@Specialization(
48-
guards = {
49-
"metaClass == cachedMetaClass",
50-
"name == cachedName",
51-
"config == cachedConfig",
52-
"contextReference.get() == cachedContext" },
47+
// no need to guard on the context, the metaClass is context-specific
48+
guards = { "metaClass == cachedMetaClass", "name == cachedName", "config == cachedConfig" },
5349
assumptions = "methodLookupResult.getAssumptions()",
5450
limit = "getCacheLimit()")
5551
protected InternalMethod lookupMethodCached(
5652
Frame frame,
5753
RubyClass metaClass,
5854
String name,
5955
DispatchConfiguration config,
60-
@CachedContext(RubyLanguage.class) TruffleLanguage.ContextReference<RubyContext> contextReference,
61-
@Cached("contextReference.get()") RubyContext cachedContext,
56+
@CachedContext(RubyLanguage.class) RubyContext context,
6257
@Cached("metaClass") RubyClass cachedMetaClass,
6358
@Cached("name") String cachedName,
6459
@Cached("config") DispatchConfiguration cachedConfig,
65-
@Cached("lookupCached(cachedContext, frame, cachedMetaClass, cachedName, config)") MethodLookupResult methodLookupResult) {
60+
@Cached("lookupCached(context, frame, cachedMetaClass, cachedName, config)") MethodLookupResult methodLookupResult) {
6661

6762
return methodLookupResult.getMethod();
6863
}

0 commit comments

Comments
 (0)