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

Commits on Sep 27, 2014

  1. Copy the full SHA
    52a3845 View commit details
  2. Copy the full SHA
    bad7219 View commit details
  3. Copy the full SHA
    4940e0f View commit details
  4. Copy the full SHA
    bc69707 View commit details
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/truffle/TruffleBridgeImpl.java
Original file line number Diff line number Diff line change
@@ -17,12 +17,12 @@
import org.jruby.TruffleBridge;
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.truffle.nodes.RubyRootNode;
import org.jruby.truffle.nodes.core.CoreMethodNodeManager;
import org.jruby.truffle.nodes.methods.MethodDefinitionNode;
import org.jruby.truffle.runtime.NilPlaceholder;
import org.jruby.truffle.runtime.RubyArguments;
import org.jruby.truffle.runtime.RubyContext;
import org.jruby.truffle.runtime.RubyParserResult;
import org.jruby.truffle.runtime.backtrace.Backtrace;
import org.jruby.truffle.runtime.control.RaiseException;
import org.jruby.truffle.runtime.core.RubyArray;
@@ -115,8 +115,8 @@ public Object execute(TranslatorDriver.ParserContext parserContext, Object self,
source = Source.fromBytes(bytes, inputFile, new BytesDecoder.UTF8BytesDecoder());
}

final RubyParserResult parseResult = truffleContext.getTranslator().parse(truffleContext, source, parserContext, parentFrame, null);
final CallTarget callTarget = Truffle.getRuntime().createCallTarget(parseResult.getRootNode());
final RubyRootNode parsedRootNode = truffleContext.getTranslator().parse(truffleContext, source, parserContext, parentFrame, null);
final CallTarget callTarget = Truffle.getRuntime().createCallTarget(parsedRootNode);
return callTarget.call(RubyArguments.pack(null, parentFrame, self, null, new Object[]{}));
} catch (RaiseException e) {
// TODO(CS): what's this cast about?

This file was deleted.

25 changes: 0 additions & 25 deletions core/src/main/java/org/jruby/truffle/runtime/InputReader.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -21,9 +21,4 @@ public final class NilPlaceholder {
private NilPlaceholder() {
}

@Override
public String toString() {
return "";
}

}
41 changes: 3 additions & 38 deletions core/src/main/java/org/jruby/truffle/runtime/RubyContext.java
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.truffle.TruffleHooks;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.RubyRootNode;
import org.jruby.truffle.nodes.debug.RubyASTProber;
import org.jruby.truffle.runtime.control.*;
import org.jruby.truffle.runtime.core.*;
@@ -158,45 +159,9 @@ public Object eval(String code, RubyBinding binding, RubyNode currentNode) {
return execute(this, source, TranslatorDriver.ParserContext.TOP_LEVEL, binding.getSelf(), binding.getFrame(), currentNode);
}

public void runShell(Node node, MaterializedFrame frame) {
final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

MaterializedFrame existingLocals = frame;

String prompt = "Ruby> ";
if (node != null) {
final SourceSection src = node.getSourceSection();
if (src != null) {
prompt = (src.getSource().getName() + ":" + src.getStartLine() + "> ");
}
}

while (true) {
try {
System.out.print(prompt);
final String line = reader.readLine();

final ShellResult result = evalShell(line, existingLocals);

System.out.println("=> " + result.getResult());

existingLocals = result.getFrame();
} catch (BreakShellException e) {
return;
} catch (Exception e) {
e.printStackTrace();
}
}
}

public ShellResult evalShell(String code, MaterializedFrame existingLocals) {
final Source source = Source.fromText(code, "shell");
return (ShellResult) execute(this, source, TranslatorDriver.ParserContext.SHELL, coreLibrary.getMainObject(), existingLocals, null);
}

public Object execute(RubyContext context, Source source, TranslatorDriver.ParserContext parserContext, Object self, MaterializedFrame parentFrame, RubyNode currentNode) {
final RubyParserResult parseResult = translator.parse(context, source, parserContext, parentFrame, currentNode);
final CallTarget callTarget = Truffle.getRuntime().createCallTarget(parseResult.getRootNode());
final RubyRootNode rootNode = translator.parse(context, source, parserContext, parentFrame, currentNode);
final CallTarget callTarget = Truffle.getRuntime().createCallTarget(rootNode);
return callTarget.call(RubyArguments.pack(null, parentFrame, self, null, new Object[]{}));
}

33 changes: 0 additions & 33 deletions core/src/main/java/org/jruby/truffle/runtime/RubyParserResult.java

This file was deleted.

39 changes: 0 additions & 39 deletions core/src/main/java/org/jruby/truffle/runtime/ShellResult.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ public MethodDefinitionNode parse(RubyContext context, org.jruby.ast.Node parseT
return translator.compileFunctionNode(sourceSection, "(unknown)", argsNode, bodyNode, false);
}

public RubyParserResult parse(RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame, RubyNode currentNode) {
public RubyRootNode parse(RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame, RubyNode currentNode) {
// Set up the JRuby parser

final org.jruby.parser.Parser parser = new org.jruby.parser.Parser(context.getRuntime());
@@ -115,7 +115,7 @@ public RubyParserResult parse(RubyContext context, Source source, ParserContext
return parse(currentNode, context, source, parserContext, parentFrame, node);
}

public RubyParserResult parse(RubyNode currentNode, RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame, org.jruby.ast.RootNode rootNode) {
public RubyRootNode parse(RubyNode currentNode, RubyContext context, Source source, ParserContext parserContext, MaterializedFrame parentFrame, org.jruby.ast.RootNode rootNode) {
final SourceSection sourceSection = source.createSection("<main>", 0, source.getCode().length());
final SharedMethodInfo sharedMethodInfo = new SharedMethodInfo(sourceSection, "<main>", false, rootNode);

@@ -177,12 +177,7 @@ public RubyParserResult parse(RubyNode currentNode, RubyContext context, Source

// Shell result

if (parserContext == TranslatorDriver.ParserContext.SHELL) {
truffleNode = new ShellResultNode(context, truffleNode.getSourceSection(), truffleNode);
}

final RootNode root = new RubyRootNode(context, truffleNode.getSourceSection(), environment.getFrameDescriptor(), environment.getSharedMethodInfo(), truffleNode);
return new RubyParserResult(root);
return new RubyRootNode(context, truffleNode.getSourceSection(), environment.getFrameDescriptor(), environment.getSharedMethodInfo(), truffleNode);
}

private Object getData(RubyContext context) {