Skip to content

Commit 6085151

Browse files
committed
[GR-15990] Remove some context fields
PullRequest: truffleruby/2406
2 parents 6b960e7 + 5063141 commit 6085151

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

src/main/java/org/truffleruby/language/control/WhileNode.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ private static abstract class WhileRepeatingBaseNode extends RubyContextNode imp
4747
protected final BranchProfile redoUsed = BranchProfile.create();
4848
protected final BranchProfile nextUsed = BranchProfile.create();
4949

50-
public WhileRepeatingBaseNode(RubyContext context, RubyNode condition, RubyNode body) {
50+
public WhileRepeatingBaseNode(RubyNode condition, RubyNode body) {
5151
this.condition = BooleanCastNodeGen.create(condition);
5252
this.body = body;
5353
}
@@ -61,8 +61,8 @@ public String toString() {
6161

6262
public static class WhileRepeatingNode extends WhileRepeatingBaseNode implements RepeatingNode {
6363

64-
public WhileRepeatingNode(RubyContext context, RubyNode condition, RubyNode body) {
65-
super(context, condition, body);
64+
public WhileRepeatingNode(RubyNode condition, RubyNode body) {
65+
super(condition, body);
6666
}
6767

6868
@Override
@@ -90,8 +90,8 @@ public boolean executeRepeating(VirtualFrame frame) {
9090

9191
public static class DoWhileRepeatingNode extends WhileRepeatingBaseNode implements RepeatingNode {
9292

93-
public DoWhileRepeatingNode(RubyContext context, RubyNode condition, RubyNode body) {
94-
super(context, condition, body);
93+
public DoWhileRepeatingNode(RubyNode condition, RubyNode body) {
94+
super(condition, body);
9595
}
9696

9797
@Override

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

Lines changed: 4 additions & 10 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
}
@@ -76,7 +71,6 @@ protected InternalMethod lookupMethodUncached(
7671
@CachedContext(RubyLanguage.class) RubyContext context,
7772
@Cached MetaClassNode metaClassNode,
7873
@Cached ConditionProfile noCallerMethodProfile,
79-
@Cached ConditionProfile isSendProfile,
8074
@Cached ConditionProfile foreignProfile,
8175
@Cached ConditionProfile noPrependedModulesProfile,
8276
@Cached ConditionProfile onMetaClassProfile,

src/main/java/org/truffleruby/parser/BodyTranslator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3258,9 +3258,9 @@ private RubyNode translateWhileNode(WhileParseNode node, boolean conditionInvers
32583258
final RubyNode loop;
32593259

32603260
if (node.evaluateAtStart()) {
3261-
loop = new WhileNode(new WhileNode.WhileRepeatingNode(context, condition, body));
3261+
loop = new WhileNode(new WhileNode.WhileRepeatingNode(condition, body));
32623262
} else {
3263-
loop = new WhileNode(new WhileNode.DoWhileRepeatingNode(context, condition, body));
3263+
loop = new WhileNode(new WhileNode.DoWhileRepeatingNode(condition, body));
32643264
}
32653265

32663266
final RubyNode ret = new CatchBreakNode(whileBreakID, loop, true);

src/main/java/org/truffleruby/parser/TranslatorDriver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ public RubyRootNode parse(RubySource rubySource, ParserContext parserContext, St
316316
sourceIndexLength,
317317
Arrays.asList(new ChompLoopNode(), truffleNode));
318318
}
319-
truffleNode = new WhileNode(new WhileNode.WhileRepeatingNode(context, new KernelGetsNode(), truffleNode));
319+
truffleNode = new WhileNode(new WhileNode.WhileRepeatingNode(new KernelGetsNode(), truffleNode));
320320
}
321321

322322
if (beginNode != null) {

0 commit comments

Comments
 (0)