Skip to content

Commit e4e596c

Browse files
committed
[GR-15990] Disable coverage in translator when multiple contexts are used
PullRequest: truffleruby/2027
2 parents 38651b8 + 36ec2a0 commit e4e596c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/main/java/org/truffleruby/RubyLanguage.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,9 @@ public class RubyLanguage extends TruffleLanguage<RubyContext> {
134134

135135
private final CyclicAssumption tracingCyclicAssumption = new CyclicAssumption("object-space-tracing");
136136
@CompilationFinal private volatile Assumption tracingAssumption = tracingCyclicAssumption.getAssumption();
137+
public final Assumption singleContextAssumption = Truffle
138+
.getRuntime()
139+
.createAssumption("single RubyContext per RubyLanguage instance");
137140

138141
public final CoreStrings coreStrings;
139142
public final CoreSymbols coreSymbols;
@@ -223,6 +226,7 @@ public void invalidateTracingAssumption() {
223226
protected void initializeMultipleContexts() {
224227
// TODO Make Symbol.all_symbols per context, by having a SymbolTable per context and creating new symbols with
225228
// the per-language SymbolTable.
229+
singleContextAssumption.invalidate();
226230
}
227231

228232
@Override

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3157,11 +3157,10 @@ private RubyNode addNewlineIfNeeded(ParseNode jrubyNode, RubyNode node) {
31573157
return node;
31583158
}
31593159

3160-
if (context.getCoverageManager().isEnabled()) {
3160+
if (language.singleContextAssumption.isValid() && context.getCoverageManager().isEnabled()) {
31613161
node.unsafeSetIsCoverageLine();
31623162
context.getCoverageManager().setLineHasCode(source, current.toSourceSection(source).getStartLine());
31633163
}
3164-
31653164
node.unsafeSetIsNewLine();
31663165
}
31673166

0 commit comments

Comments
 (0)