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: aed5b517ff1c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bb77a2b7b54d
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Oct 19, 2016

  1. Copy the full SHA
    f0b8ec6 View commit details
  2. Copy the full SHA
    bb77a2b View commit details
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.RootNode;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.core.rope.CodeRange;
import org.jruby.truffle.language.backtrace.InternalRootNode;
@@ -25,14 +26,16 @@
*/
public class FormatRootNode extends RootNode implements InternalRootNode {

private final RubyContext context;
private final FormatEncoding encoding;

@Child private FormatNode child;

@CompilationFinal private int expectedLength = 0;

public FormatRootNode(SourceSection sourceSection, FormatEncoding encoding, FormatNode child) {
public FormatRootNode(RubyContext context, SourceSection sourceSection, FormatEncoding encoding, FormatNode child) {
super(RubyLanguage.class, sourceSection, FormatFrameDescriptor.FRAME_DESCRIPTOR);
this.context = context;
this.encoding = encoding;
this.child = child;
}
@@ -124,4 +127,7 @@ public String toString() {
return getName();
}

public RubyContext getContext() {
return context;
}
}
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ public CallTarget compile(String format) {
parser.sequence();

return Truffle.getRuntime().createCallTarget(
new FormatRootNode(currentNode.getEncapsulatingSourceSection(), builder.getEncoding(), builder.getNode()));
new FormatRootNode(context, currentNode.getEncapsulatingSourceSection(), builder.getEncoding(), builder.getNode()));
}

}
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public CallTarget compile(byte[] format) {
final PrintfSimpleTreeBuilder builder = new PrintfSimpleTreeBuilder(context, configs);

return Truffle.getRuntime().createCallTarget(
new FormatRootNode(currentNode.getEncapsulatingSourceSection(),
new FormatRootNode(context, currentNode.getEncapsulatingSourceSection(),
FormatEncoding.DEFAULT, builder.getNode()));
}

Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
import org.jruby.truffle.core.CoreLibrary;
import org.jruby.truffle.core.array.ArrayHelpers;
import org.jruby.truffle.core.exception.CoreExceptions;
import org.jruby.truffle.core.format.FormatRootNode;
import org.jruby.truffle.core.kernel.TraceManager;
import org.jruby.truffle.core.numeric.BignumOperations;
import org.jruby.truffle.core.rope.CodeRange;
@@ -192,6 +193,11 @@ public RubyContext getContext() {
break;
}

if (parent instanceof FormatRootNode) {
context = ((FormatRootNode) parent).getContext();
break;
}

parent = parent.getParent();
}