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

Commits on Apr 30, 2015

  1. Copy the full SHA
    89e1459 View commit details
  2. Copy the full SHA
    a94d7b2 View commit details
Showing with 14 additions and 28 deletions.
  1. +14 −28 truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
42 changes: 14 additions & 28 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -43,10 +43,14 @@ public RubyNode(RubyContext context, SourceSection sourceSection) {
this.context = context;
}

// Fundamental execute method
// Fundamental execute methods

public abstract Object execute(VirtualFrame frame);

public Object isDefined(VirtualFrame frame) {
return getContext().makeString("expression");
}

// Execute without returing the result

public void executeVoid(VirtualFrame frame) {
@@ -217,24 +221,10 @@ public Object[] executeObjectArray(VirtualFrame frame) throws UnexpectedResultEx

// Guards which use the context and so can't be static

public boolean isRubyNilObject(Object value) {
return value == nil();
}

public boolean isRubiniusUndefined(Object value) {
return value == getContext().getCoreLibrary().getRubiniusUndefined();
}

public boolean isRational(RubyBasicObject o) {
// TODO(CS, 10-Jan-15) should this be a full is_a? test? We'd need a node for that.
return o.getLogicalClass() == getContext().getCoreLibrary().getRationalClass();
}

public boolean isComplex(RubyBasicObject o) {
// TODO(BF, 4-4-15) COPIED from isRational - should this be a full is_a? test? We'd need a node for that.
return o.getLogicalClass() == getContext().getCoreLibrary().getComplexClass();
}

// Helpers methods for terseness

protected RubyNilClass nil() {
@@ -257,10 +247,6 @@ public ProbeNode.WrapperNode createWrapperNode() {
return new RubyWrapperNode(this);
}

public RubyNode getNonWrapperNode() {
return this;
}

public void setAtNewline() {
atNewline = true;
}
@@ -273,23 +259,22 @@ public RubyNode getNonProxyNode() {
return this;
}

/**
* Ruby's parallel semantic path.
*
* @see DefinedNode
*/
public Object isDefined(VirtualFrame frame) {
return getContext().makeString("expression");
}
// Accessors

public RubyContext getContext() {
return context;
}

// notDesignedForCompilation() helper

// TODO CS 30-Apr-15 inline this when we think it's working well

public static void notDesignedForCompilation() {
CompilerDirectives.bailout("this code either doesn't implement Ruby semantics properly, or is a basic implementation that will not compile");
CompilerDirectives.transferToInterpreter();
}

// ruby() helper

protected Object ruby(VirtualFrame frame, String expression, Object... arguments) {
return rubyWithSelf(frame, RubyArguments.getSelf(frame.getArguments()), expression, arguments);
}
@@ -320,4 +305,5 @@ private MaterializedFrame setupFrame(Object self, Object... arguments) {

return evalFrame;
}

}