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

Commits on Feb 23, 2016

  1. Copy the full SHA
    6dd3ad0 View commit details
  2. Copy the full SHA
    6f53943 View commit details
  3. Copy the full SHA
    3b0817a View commit details
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.arguments.RubyArguments;
import org.jruby.truffle.language.translator.ReadLocalNode;
import org.jruby.truffle.language.translator.Translator;

import java.util.Collections;
Original file line number Diff line number Diff line change
@@ -20,39 +20,38 @@ public abstract class ReadFrameSlotNode extends Node {
protected final FrameSlot frameSlot;

public ReadFrameSlotNode(FrameSlot slot) {
assert slot != null;
this.frameSlot = slot;
}

public abstract Object executeRead(Frame frame);

@Specialization(rewriteOn = {FrameSlotTypeException.class})
@Specialization(rewriteOn = FrameSlotTypeException.class)
public boolean readBoolean(Frame frame) throws FrameSlotTypeException {
return frame.getBoolean(frameSlot);
}

@Specialization(rewriteOn = {FrameSlotTypeException.class})
public int readInteger(Frame frame) throws FrameSlotTypeException {
@Specialization(rewriteOn = FrameSlotTypeException.class)
public int readInt(Frame frame) throws FrameSlotTypeException {
return frame.getInt(frameSlot);
}

@Specialization(rewriteOn = {FrameSlotTypeException.class})
@Specialization(rewriteOn = FrameSlotTypeException.class)
public long readLong(Frame frame) throws FrameSlotTypeException {
return frame.getLong(frameSlot);
}

@Specialization(rewriteOn = {FrameSlotTypeException.class})
@Specialization(rewriteOn = FrameSlotTypeException.class)
public double readDouble(Frame frame) throws FrameSlotTypeException {
return frame.getDouble(frameSlot);
}

@Specialization(rewriteOn = {FrameSlotTypeException.class})
@Specialization(rewriteOn = FrameSlotTypeException.class)
public Object readObject(Frame frame) throws FrameSlotTypeException {
return frame.getObject(frameSlot);
}

@Specialization
public Object doValue(Frame frame) {
public Object readAny(Frame frame) {
return frame.getValue(frameSlot);
}

Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.translator.ReadLocalNode;
import org.jruby.truffle.language.translator.Translator;

public class ReadLocalVariableNode extends ReadLocalNode {
Original file line number Diff line number Diff line change
@@ -21,71 +21,71 @@
@ImportStatic(RubyGuards.class)
public abstract class WriteFrameSlotNode extends Node {

protected final FrameSlot frameSlot;
private final FrameSlot frameSlot;

public WriteFrameSlotNode(FrameSlot frameSlot) {
assert frameSlot != null;
this.frameSlot = frameSlot;
}

public abstract Object executeWrite(Frame frame, Object value);

@Specialization(guards = "isBooleanKind(frame)")
@Specialization(guards = "checkBooleanKind(frame)")
public boolean writeBoolean(Frame frame, boolean value) {
frame.setBoolean(frameSlot, value);
return value;
}

@Specialization(guards = "isIntegerKind(frame)")
@Specialization(guards = "checkIntegerKind(frame)")
public int writeInteger(Frame frame, int value) {
frame.setInt(frameSlot, value);
return value;
}

@Specialization(guards = "isLongKind(frame)")
@Specialization(guards = "checkLongKind(frame)")
public long writeLong(Frame frame, long value) {
frame.setLong(frameSlot, value);
return value;
}

@Specialization(guards = "isDoubleKind(frame)")
@Specialization(guards = "checkDoubleKind(frame)")
public double writeDouble(Frame frame, double value) {
frame.setDouble(frameSlot, value);
return value;
}

@Specialization(guards = "isObjectKind(frame)")
@Specialization(guards = "checkObjectKind(frame)")
public Object writeObject(Frame frame, Object value) {
assert RubyGuards.wasProvided(value); // Useful debug aid to catch a running-away NotProvided
frame.setObject(frameSlot, value);
return value;
}

protected final boolean isBooleanKind(Frame frame) {
return isKind(FrameSlotKind.Boolean);
protected boolean checkBooleanKind(Frame frame) {
return checkKind(FrameSlotKind.Boolean);
}

protected final boolean isIntegerKind(Frame frame) {
return isKind(FrameSlotKind.Int);
protected boolean checkIntegerKind(Frame frame) {
return checkKind(FrameSlotKind.Int);
}

protected final boolean isLongKind(Frame frame) {
return isKind(FrameSlotKind.Long);
protected boolean checkLongKind(Frame frame) {
return checkKind(FrameSlotKind.Long);
}

protected final boolean isDoubleKind(Frame frame) {
return isKind(FrameSlotKind.Double);
protected boolean checkDoubleKind(Frame frame) {
return checkKind(FrameSlotKind.Double);
}

protected final boolean isObjectKind(Frame frame) {
protected boolean checkObjectKind(Frame frame) {
if (frameSlot.getKind() != FrameSlotKind.Object) {
CompilerDirectives.transferToInterpreter();
frameSlot.setKind(FrameSlotKind.Object);
}

return true;
}

private boolean isKind(FrameSlotKind kind) {
private boolean checkKind(FrameSlotKind kind) {
if (frameSlot.getKind() == kind) {
return true;
} else {
@@ -99,6 +99,7 @@ private boolean initialSetKind(FrameSlotKind kind) {
frameSlot.setKind(kind);
return true;
}

return false;
}

Original file line number Diff line number Diff line change
@@ -134,7 +134,6 @@
import org.jruby.truffle.language.locals.FlipFlopStateNode;
import org.jruby.truffle.language.locals.InitFlipFlopSlotNode;
import org.jruby.truffle.language.locals.LocalFlipFlopStateNode;
import org.jruby.truffle.language.locals.ReadLocalNode;
import org.jruby.truffle.language.locals.ReadLocalVariableNode;
import org.jruby.truffle.language.locals.WriteLocalVariableNode;
import org.jruby.truffle.language.methods.AddMethodNodeGen;
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.language.locals;
package org.jruby.truffle.language.translator;

import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@
import org.jruby.truffle.language.control.BreakID;
import org.jruby.truffle.language.control.ReturnID;
import org.jruby.truffle.language.locals.ReadDeclarationVariableNode;
import org.jruby.truffle.language.locals.ReadLocalNode;
import org.jruby.truffle.language.locals.ReadLocalVariableNode;
import org.jruby.truffle.language.methods.SharedMethodInfo;