Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c07f00212790
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a408b5179856
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 29, 2016

  1. [Truffle] We can create the coverage manager earlier and so simplify …

    …some logic in the translator.
    chrisseaton committed Dec 29, 2016
    Copy the full SHA
    80ed88d View commit details
  2. Copy the full SHA
    1cd7889 View commit details
  3. Copy the full SHA
    a408b51 View commit details
3 changes: 1 addition & 2 deletions truffle/src/main/java/org/jruby/truffle/RubyContext.java
Original file line number Diff line number Diff line change
@@ -183,6 +183,7 @@ public RubyContext(TruffleLanguage.Env env) {
final Instrumenter instrumenter = env.lookup(Instrumenter.class);
traceManager = new TraceManager(this, instrumenter);
coreMethods = new CoreMethods(this);
coverageManager = new CoverageManager(this, instrumenter);

// Load the reset of the core library

@@ -201,8 +202,6 @@ public RubyContext(TruffleLanguage.Env env) {
instrumentationServerManager = null;
}

coverageManager = new CoverageManager(this, instrumenter);

coreLibrary.initializePostBoot();

consoleHolder = new ConsoleHolder();
21 changes: 16 additions & 5 deletions truffle/src/main/java/org/jruby/truffle/language/RubyBaseNode.java
Original file line number Diff line number Diff line change
@@ -46,8 +46,9 @@
public abstract class RubyBaseNode extends Node {

private static final int FLAG_NEWLINE = 0;
private static final int FLAG_CALL = 1;
private static final int FLAG_ROOT = 2;
private static final int FLAG_COVERAGE_LINE = 1;
private static final int FLAG_CALL = 2;
private static final int FLAG_ROOT = 3;

@CompilationFinal private RubyContext context;

@@ -259,6 +260,10 @@ public void unsafeSetIsNewLine() {
flags |= 1 << FLAG_NEWLINE;
}

public void unsafeSetIsCoverageLine() {
flags |= 1 << FLAG_COVERAGE_LINE;
}

public void unsafeSetIsCall() {
flags |= 1 << FLAG_CALL;
}
@@ -271,6 +276,10 @@ private boolean isNewLine() {
return ((flags >> FLAG_NEWLINE) & 1) == 1;
}

private boolean isCoverageLine() {
return ((flags >> FLAG_COVERAGE_LINE) & 1) == 1;
}

private boolean isCall() {
return ((flags >> FLAG_CALL) & 1) == 1;
}
@@ -285,12 +294,14 @@ protected boolean isTaggedWith(Class<?> tag) {
return isCall();
}

if (tag == TraceManager.LineTag.class
|| tag == CoverageManager.LineTag.class
|| tag == StandardTags.StatementTag.class) {
if (tag == TraceManager.LineTag.class || tag == StandardTags.StatementTag.class) {
return isNewLine();
}

if (tag == CoverageManager.LineTag.class) {
return isCoverageLine();
}

if (tag == StandardTags.RootTag.class) {
return isRoot();
}
Original file line number Diff line number Diff line change
@@ -3362,7 +3362,8 @@ private RubyNode addNewlineIfNeeded(ParseNode jrubyNode, RubyNode node) {
return node;
}

if (context.getCoverageManager() != null) {
if (context.getCoverageManager().isEnabled()) {
node.unsafeSetIsCoverageLine();
context.getCoverageManager().setLineHasCode(source, current.getStartLine());
}

Original file line number Diff line number Diff line change
@@ -52,10 +52,6 @@ public CoverageManager(RubyContext context, Instrumenter instrumenter) {
}

public synchronized void setLineHasCode(Source source, int line) {
if (!enabled) {
return;
}

BitSet bitmap = linesHaveCode.get(source);

if (bitmap == null) {
@@ -215,4 +211,8 @@ private long getMaxCount() {
return max;
}

public boolean isEnabled() {
return enabled;
}

}