Skip to content

Commit

Permalink
Showing 3 changed files with 15 additions and 6 deletions.
15 changes: 13 additions & 2 deletions truffle/src/main/java/org/jruby/truffle/language/RubyNode.java
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.language;

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.TypeSystemReference;
import com.oracle.truffle.api.frame.VirtualFrame;
@@ -37,11 +38,11 @@
public abstract class RubyNode extends Node {

private final RubyContext context;
@CompilationFinal private SourceSection sourceSection;

public RubyNode(RubyContext context, SourceSection sourceSection) {
super(sourceSection);
assert context != null;
this.context = context;
this.sourceSection = sourceSection;
}

public RubyNode(RubyNode node) {
@@ -206,4 +207,14 @@ public RubyContext getContext() {
return context;
}

// Source section

public void unsafeSetSourceSection(SourceSection sourceSection) {
this.sourceSection = sourceSection;
}

@Override
public SourceSection getSourceSection() {
return sourceSection;
}
}
Original file line number Diff line number Diff line change
@@ -38,8 +38,7 @@ public RubyRootNode(RubyContext context, SourceSection sourceSection, FrameDescr
this.body = body;

final SourceSection currentBodySourceSection = body.getEncapsulatingSourceSection();
body.clearSourceSection();
body.assignSourceSection(currentBodySourceSection.withTags(TraceManager.CALL_TAG));
body.unsafeSetSourceSection(currentBodySourceSection.withTags(TraceManager.CALL_TAG));

if (context.getCallGraph() != null) {
context.getCallGraph().registerRootNode(this);
Original file line number Diff line number Diff line change
@@ -3149,8 +3149,7 @@ private RubyNode addNewlineIfNeeded(org.jruby.ast.Node jrubyNode, RubyNode node)
if (context.getCoverageManager() != null) {
context.getCoverageManager().setLineHasCode(current.getLineLocation());
}
node.clearSourceSection();
node.assignSourceSection(current.withTags(AttachmentsManager.LINE_TAG, TraceManager.LINE_TAG, CoverageManager.LINE_TAG));
node.unsafeSetSourceSection(current.withTags(AttachmentsManager.LINE_TAG, TraceManager.LINE_TAG, CoverageManager.LINE_TAG));
}

return node;

0 comments on commit aded0cb

Please sign in to comment.