Skip to content

Commit

Permalink
Showing 17 changed files with 191 additions and 216 deletions.
8 changes: 0 additions & 8 deletions truffle/src/main/java/org/jruby/truffle/nodes/RubyNode.java
Original file line number Diff line number Diff line change
@@ -265,14 +265,6 @@ 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.transferToInterpreter();
}

// ruby() helper

protected Object ruby(VirtualFrame frame, String expression, Object... arguments) {
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.NodeChildren;
@@ -32,14 +33,14 @@ public ArrayDropTailNode(RubyContext context, SourceSection sourceSection, int i

@Specialization(guards = "isNull(array)")
public RubyArray getHeadNull(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return new RubyArray(getContext().getCoreLibrary().getArrayClass());
}

@Specialization(guards = "isIntegerFixnum(array)")
public RubyArray getHeadIntegerFixnum(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
@@ -50,7 +51,7 @@ public RubyArray getHeadIntegerFixnum(RubyArray array) {

@Specialization(guards = "isLongFixnum(array)")
public RubyArray geHeadLongFixnum(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
@@ -62,7 +63,7 @@ public RubyArray geHeadLongFixnum(RubyArray array) {

@Specialization(guards = "isFloat(array)")
public RubyArray getHeadFloat(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
@@ -74,7 +75,7 @@ public RubyArray getHeadFloat(RubyArray array) {

@Specialization(guards = "isObject(array)")
public RubyArray getHeadObject(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.NodeChildren;
@@ -32,14 +33,14 @@ public ArrayGetTailNode(RubyContext context, SourceSection sourceSection, int in

@Specialization(guards = "isNull(array)")
public RubyArray getTailNull(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return new RubyArray(getContext().getCoreLibrary().getArrayClass());
}

@Specialization(guards = "isIntegerFixnum(array)")
public RubyArray getTailIntegerFixnum(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
@@ -50,7 +51,7 @@ public RubyArray getTailIntegerFixnum(RubyArray array) {

@Specialization(guards = "isLongFixnum(array)")
public RubyArray getTailLongFixnum(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
@@ -61,7 +62,7 @@ public RubyArray getTailLongFixnum(RubyArray array) {

@Specialization(guards = "isFloat(array)")
public RubyArray getTailFloat(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
@@ -72,7 +73,7 @@ public RubyArray getTailFloat(RubyArray array) {

@Specialization(guards = "isObject(array)")
public RubyArray getTailObject(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (index >= array.getSize()) {
return new RubyArray(getContext().getCoreLibrary().getArrayClass());
57 changes: 28 additions & 29 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -22,7 +22,6 @@
import com.oracle.truffle.api.nodes.UnexpectedResultException;
import com.oracle.truffle.api.source.SourceSection;
import com.oracle.truffle.api.utilities.BranchProfile;
import com.oracle.truffle.api.utilities.ConditionProfile;
import org.jcodings.specific.USASCIIEncoding;
import org.jcodings.specific.UTF8Encoding;
import org.jruby.truffle.nodes.CoreSourceSection;
@@ -270,13 +269,13 @@ public RubyArray mulObject(RubyArray array, int count) {

@Specialization(guards = "isRubyString(string)")
public Object mulObject(VirtualFrame frame, RubyArray array, RubyString string) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
return ruby(frame, "join(sep)", "sep", string);
}

@Specialization(guards = {"!isRubyString(object)"})
public Object mulObjectCount(VirtualFrame frame, RubyArray array, Object object) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
if (respondToToStrNode == null) {
CompilerDirectives.transferToInterpreter();
respondToToStrNode = insert(KernelNodesFactory.RespondToNodeFactory.create(getContext(), getSourceSection(), new RubyNode[]{null, null, null}));
@@ -466,7 +465,7 @@ public Object setObject(VirtualFrame frame, RubyArray array, Object startObject,

@Specialization(guards = { "!isRubyArray(value)", "!isUndefinedPlaceholder(value)" })
public Object setObject(VirtualFrame frame, RubyArray array, int start, int length, Object value) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (length < 0) {
CompilerDirectives.transferToInterpreter();
@@ -557,7 +556,7 @@ public Object setOtherArray(VirtualFrame frame, RubyArray array, Object startObj

@Specialization
public Object setOtherArray(VirtualFrame frame, RubyArray array, int start, int length, RubyArray value) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (length < 0) {
CompilerDirectives.transferToInterpreter();
@@ -862,7 +861,7 @@ public RubyArray concatNull(RubyArray array, RubyArray other) {

@Specialization(guards = "areBothIntegerFixnum(array, other)")
public RubyArray concatIntegerFixnum(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final int newSize = array.getSize() + other.getSize();
int[] store = (int[]) array.getStore();
@@ -878,7 +877,7 @@ public RubyArray concatIntegerFixnum(RubyArray array, RubyArray other) {

@Specialization(guards = "areBothLongFixnum(array, other)")
public RubyArray concatLongFixnum(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final int newSize = array.getSize() + other.getSize();
long[] store = (long[]) array.getStore();
@@ -894,7 +893,7 @@ public RubyArray concatLongFixnum(RubyArray array, RubyArray other) {

@Specialization(guards = "areBothFloat(array, other)")
public RubyArray concatDouble(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final int newSize = array.getSize() + other.getSize();
double[] store = (double[]) array.getStore();
@@ -910,7 +909,7 @@ public RubyArray concatDouble(RubyArray array, RubyArray other) {

@Specialization(guards = "areBothObject(array, other)")
public RubyArray concatObject(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final int size = array.getSize();
final int newSize = size + other.getSize();
@@ -927,7 +926,7 @@ public RubyArray concatObject(RubyArray array, RubyArray other) {

@Specialization
public RubyArray concat(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final int newSize = array.getSize() + other.getSize();

@@ -1081,7 +1080,7 @@ public int deleteAtIntegerFixnumInBounds(RubyArray array, int index) throws Unex

@Specialization(contains = "deleteAtIntegerFixnumInBounds", guards = "isIntegerFixnum(array)")
public Object deleteAtIntegerFixnum(RubyArray array, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

int normalizedIndex = index;

@@ -1123,7 +1122,7 @@ public long deleteAtLongFixnumInBounds(RubyArray array, int index) throws Unexpe

@Specialization(contains = "deleteAtLongFixnumInBounds", guards = "isLongFixnum(array)")
public Object deleteAtLongFixnum(RubyArray array, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

int normalizedIndex = index;

@@ -1165,7 +1164,7 @@ public double deleteAtFloatInBounds(RubyArray array, int index) throws Unexpecte

@Specialization(contains = "deleteAtFloatInBounds", guards = "isFloat(array)")
public Object deleteAtFloat(RubyArray array, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

int normalizedIndex = index;

@@ -1207,7 +1206,7 @@ public Object deleteAtObjectInBounds(RubyArray array, int index) throws Unexpect

@Specialization(contains = "deleteAtObjectInBounds", guards = "isObject(array)")
public Object deleteAtObject(RubyArray array, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

int normalizedIndex = index;

@@ -1849,14 +1848,14 @@ public Object initializeNegative(VirtualFrame frame, RubyArray array, int size,

@Specialization
public RubyArray initialize(RubyArray array, RubyArray copy, UndefinedPlaceholder defaultValue, UndefinedPlaceholder block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
array.setStore(copy.slowToArray(), copy.getSize());
return array;
}

@Specialization
public RubyArray initialize(RubyArray array, RubyArray copy, UndefinedPlaceholder defaultValue, RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
array.setStore(copy.slowToArray(), copy.getSize());
return array;
}
@@ -2046,7 +2045,7 @@ public Object injectNull(VirtualFrame frame, RubyArray array, Object initial, Ru

@Specialization
public Object inject(VirtualFrame frame, RubyArray array, RubySymbol symbol, UndefinedPlaceholder unused) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final Object[] store = array.slowToArray();

@@ -2081,7 +2080,7 @@ public InsertNode(RubyContext context, SourceSection sourceSection) {

@Specialization(guards = {"isNull(array)", "isIntIndexAndOtherSingleObjectArg(array, values)"})
public Object insertNull(RubyArray array, Object[] values) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
final int index = (int) values[0];
if (index < 0) {
CompilerDirectives.transferToInterpreter();
@@ -2108,7 +2107,7 @@ public Object insert(RubyArray array, Object[] values) {

@Specialization(contains = {"insert", "insertNull"})
public Object insertBoxed(VirtualFrame frame, RubyArray array, Object[] values) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
if (values.length == 1) {
return array;
}
@@ -3451,7 +3450,7 @@ public Object selectObject(VirtualFrame frame, RubyArray array, RubyProc block)

final Object value = store[n];

notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (! yieldIsTruthy(frame, block, new Object[]{value})) {
selectedStore = arrayBuilder.append(selectedStore, selectedSize, value);
@@ -3484,7 +3483,7 @@ public Object selectFixnumInteger(VirtualFrame frame, RubyArray array, RubyProc

final Object value = store[n];

notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (! yieldIsTruthy(frame, block, value)) {
selectedStore = arrayBuilder.append(selectedStore, selectedSize, value);
@@ -3759,39 +3758,39 @@ public ReplaceNode(RubyContext context, SourceSection sourceSection) {

@Specialization(guards = "isOtherNull(array, other)")
public RubyArray replace(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

array.setStore(null, 0);
return array;
}

@Specialization(guards = "isOtherIntegerFixnum(array, other)")
public RubyArray replaceIntegerFixnum(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

array.setStore(Arrays.copyOf((int[]) other.getStore(), other.getSize()), other.getSize());
return array;
}

@Specialization(guards = "isOtherLongFixnum(array, other)")
public RubyArray replaceLongFixnum(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

array.setStore(Arrays.copyOf((long[]) other.getStore(), other.getSize()), other.getSize());
return array;
}

@Specialization(guards = "isOtherFloat(array, other)")
public RubyArray replaceFloat(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

array.setStore(Arrays.copyOf((double[]) other.getStore(), other.getSize()), other.getSize());
return array;
}

@Specialization(guards = "isOtherObject(array, other)")
public RubyArray replaceObject(RubyArray array, RubyArray other) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

array.setStore(Arrays.copyOf((Object[]) other.getStore(), other.getSize()), other.getSize());
return array;
@@ -3832,7 +3831,7 @@ public Object selectObject(VirtualFrame frame, RubyArray array, RubyProc block)

final Object value = store[n];

notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (yieldIsTruthy(frame, block, new Object[]{value})) {
selectedStore = arrayBuilder.append(selectedStore, selectedSize, value);
@@ -3865,7 +3864,7 @@ public Object selectFixnumInteger(VirtualFrame frame, RubyArray array, RubyProc

final Object value = store[n];

notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (yieldIsTruthy(frame, block, value)) {
selectedStore = arrayBuilder.append(selectedStore, selectedSize, value);
@@ -4488,7 +4487,7 @@ public UnshiftNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray unshift(RubyArray array, Object... args) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

array.slowUnshift(args);
return array;
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.ImportStatic;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.NodeChildren;
@@ -36,14 +37,14 @@ public ArraySliceNode(RubyContext context, SourceSection sourceSection, int from

@Specialization(guards = "isNull(array)")
public RubyArray sliceNull(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return new RubyArray(getContext().getCoreLibrary().getArrayClass());
}

@Specialization(guards = "isIntegerFixnum(array)")
public RubyArray sliceIntegerFixnum(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
final int to = array.getSize() + this.to;

if (from >= to) {
@@ -55,7 +56,7 @@ public RubyArray sliceIntegerFixnum(RubyArray array) {

@Specialization(guards = "isLongFixnum(array)")
public RubyArray sliceLongFixnum(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
final int to = array.getSize() + this.to;

if (from >= to) {
@@ -67,7 +68,7 @@ public RubyArray sliceLongFixnum(RubyArray array) {

@Specialization(guards = "isFloat(array)")
public RubyArray sliceFloat(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
final int to = array.getSize() + this.to;

if (from >= to) {
@@ -79,7 +80,7 @@ public RubyArray sliceFloat(RubyArray array) {

@Specialization(guards = "isObject(array)")
public RubyArray sliceObject(RubyArray array) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
final int to = array.getSize() + this.to;

if (from >= to) {
Original file line number Diff line number Diff line change
@@ -181,7 +181,7 @@ public InstanceEvalNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object instanceEval(VirtualFrame frame, Object receiver, RubyString string, UndefinedPlaceholder block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return getContext().instanceEval(string.getByteList(), receiver, this);
}
@@ -202,7 +202,7 @@ public InstanceExecNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object instanceExec(VirtualFrame frame, Object receiver, Object[] arguments, RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return yieldWithModifiedSelf(frame, block, receiver, arguments);
}
@@ -225,14 +225,14 @@ public MethodMissingNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object methodMissing(Object self, Object[] args, UndefinedPlaceholder block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return methodMissing(self, args, (RubyProc) null);
}

@Specialization
public Object methodMissing(Object self, Object[] args, RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubySymbol name = (RubySymbol) args[0];
final Object[] sentArgs = ArrayUtils.extractRange(args, 1, args.length);
Original file line number Diff line number Diff line change
@@ -580,7 +580,7 @@ public CoerceNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray coerce(RubyBignum a, int b) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO (eregon, 16 Feb. 2015): This is NOT spec, but let's try to see if we can make it work.
// b is converted to a Bignum here in other implementations.
@@ -590,7 +590,7 @@ public RubyArray coerce(RubyBignum a, int b) {

@Specialization
public RubyArray coerce(RubyBignum a, long b) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO (eregon, 16 Feb. 2015): This is NOT spec, but let's try to see if we can make it work.
// b is converted to a Bignum here in other implementations.
@@ -600,7 +600,7 @@ public RubyArray coerce(RubyBignum a, long b) {

@Specialization
public RubyArray coerce(RubyBignum a, RubyBignum b) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

Object[] store = new Object[] { b, a };
return new RubyArray(getContext().getCoreLibrary().getArrayClass(), store, store.length);
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.Truffle;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.frame.FrameSlot;
@@ -36,7 +37,7 @@ public InitializeCopyNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object initializeCopy(RubyBinding self, RubyBinding from) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (self == from) {
return self;
@@ -67,7 +68,7 @@ public LocalVariableGetNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object localVariableGet(RubyBinding binding, RubySymbol symbol) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final MaterializedFrame frame = binding.getFrame();

@@ -91,7 +92,7 @@ public LocalVariableSetNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object localVariableSetNode(RubyBinding binding, RubySymbol symbol, Object value) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO(CS): temporary hack for $_
if (symbol.toString().equals("$_")) {
@@ -126,7 +127,7 @@ public LocalVariablesNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray localVariables(RubyBinding binding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyArray array = new RubyArray(getContext().getCoreLibrary().getArrayClass());

Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ public AsciiCompatibleNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object isCompatible(RubyEncoding encoding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
return encoding.getEncoding().isAsciiCompatible();
}
}
@@ -186,7 +186,7 @@ public SetDefaultExternalNode(RubyContext context, SourceSection sourceSection)

@Specialization
public RubyEncoding defaultExternal(RubyEncoding encoding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().getRuntime().setDefaultExternalEncoding(encoding.getEncoding());

@@ -195,7 +195,7 @@ public RubyEncoding defaultExternal(RubyEncoding encoding) {

@Specialization
public RubyEncoding defaultExternal(RubyString encodingString) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyEncoding rubyEncoding = RubyEncoding.getEncoding(encodingString.toString());
getContext().getRuntime().setDefaultExternalEncoding(rubyEncoding.getEncoding());
@@ -232,7 +232,7 @@ public SetDefaultInternalNode(RubyContext context, SourceSection sourceSection)

@Specialization
public RubyEncoding defaultInternal(RubyEncoding encoding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().getRuntime().setDefaultInternalEncoding(encoding.getEncoding());

@@ -241,7 +241,7 @@ public RubyEncoding defaultInternal(RubyEncoding encoding) {

@Specialization
public RubyNilClass defaultInternal(RubyNilClass encoding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().getRuntime().setDefaultInternalEncoding(null);

@@ -250,7 +250,7 @@ public RubyNilClass defaultInternal(RubyNilClass encoding) {

@Specialization(guards = { "!isRubyEncoding(encoding)", "!isRubyNilClass(encoding)" })
public RubyString defaultInternal(VirtualFrame frame, Object encoding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (toStrNode == null) {
CompilerDirectives.transferToInterpreter();
@@ -274,7 +274,7 @@ public ListNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray list() {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyEncoding[] encodings = RubyEncoding.cloneEncodingList();

@@ -292,7 +292,7 @@ public LocaleCharacterMapNode(RubyContext context, SourceSection sourceSection)

@Specialization
public RubyString localeCharacterMap() {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
final ByteList name = new ByteList(getContext().getRuntime().getEncodingService().getLocaleEncoding().getName());
return getContext().makeString(name);
}
@@ -307,7 +307,7 @@ public DummyNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean isDummy(RubyEncoding encoding) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return encoding.isDummy();
}
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.runtime.RubyCallStack;
@@ -31,15 +32,15 @@ public InitializeNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyNilClass initialize(RubyException exception, UndefinedPlaceholder message) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

exception.initialize(getContext().makeString(""));
return nil();
}

@Specialization
public RubyNilClass initialize(RubyException exception, RubyString message) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

exception.initialize(message);
return nil();
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@ protected Object singleValue(VirtualFrame frame, Object[] args) {

@Specialization
protected Object transfer(VirtualFrame frame, RubyFiber fiber, boolean isYield, Object[] args) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (!fiber.isAlive()) {
throw new RaiseException(getContext().getCoreLibrary().deadFiberCalledError(this));
@@ -76,7 +76,7 @@ public InitializeNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyNilClass initialize(RubyFiber fiber, RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

fiber.initialize(block);
return nil();
38 changes: 8 additions & 30 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/HashNodes.java
Original file line number Diff line number Diff line change
@@ -267,7 +267,6 @@ public Object setNull(VirtualFrame frame, RubyHash hash, Object key, Object valu

@Specialization(guards = "isNullStorage(hash)")
public Object setNull(VirtualFrame frame, RubyHash hash, RubyString key, Object value) {
notDesignedForCompilation();
if (hash.isCompareByIdentity()) {
return setNull(frame, hash, (Object) key, value);
} else {
@@ -323,7 +322,6 @@ public Object setPackedArray(VirtualFrame frame, RubyHash hash, Object key, Obje

@Specialization(guards = "isPackedArrayStorage(hash)")
public Object setPackedArray(VirtualFrame frame, RubyHash hash, RubyString key, Object value) {
notDesignedForCompilation();
if (hash.isCompareByIdentity()) {
return setPackedArray(frame, hash, (Object) key, value);
} else {
@@ -333,7 +331,7 @@ public Object setPackedArray(VirtualFrame frame, RubyHash hash, RubyString key,

@Specialization(guards = {"isBucketsStorage(hash)", "!isRubyString(key)"})
public Object setBuckets(RubyHash hash, Object key, Object value) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

assert HashOperations.verifyStore(hash);

@@ -346,7 +344,6 @@ public Object setBuckets(RubyHash hash, Object key, Object value) {

@Specialization(guards = "isBucketsStorage(hash)")
public Object setBuckets(VirtualFrame frame, RubyHash hash, RubyString key, Object value) {
notDesignedForCompilation();
if (hash.isCompareByIdentity()) {
return setBuckets(hash, key, value);
} else {
@@ -490,8 +487,6 @@ public Object deletePackedArray(VirtualFrame frame, RubyHash hash, Object key, O

@Specialization(guards = "isBucketsStorage(hash)")
public Object delete(VirtualFrame frame, RubyHash hash, Object key, Object block) {
notDesignedForCompilation();

assert HashOperations.verifyStore(hash);

final HashSearchResult hashSearchResult = findEntryNode.search(frame, hash, key);
@@ -601,8 +596,6 @@ private Collection<KeyValue> verySlowToKeyValues(RubyHash hash) {

@Specialization
public Object each(VirtualFrame frame, RubyHash hash, UndefinedPlaceholder block) {
notDesignedForCompilation();

if (toEnumNode == null) {
CompilerDirectives.transferToInterpreter();
toEnumNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
@@ -684,8 +677,6 @@ public InitializeCopyNode(RubyContext context, SourceSection sourceSection) {

@Specialization(guards = "isNullStorage(from)")
public RubyHash dupNull(RubyHash self, RubyHash from) {
notDesignedForCompilation();

if (self == from) {
return self;
}
@@ -698,8 +689,6 @@ public RubyHash dupNull(RubyHash self, RubyHash from) {

@Specialization(guards = "isPackedArrayStorage(from)")
public RubyHash dupPackedArray(RubyHash self, RubyHash from) {
notDesignedForCompilation();

if (self == from) {
return self;
}
@@ -714,10 +703,9 @@ public RubyHash dupPackedArray(RubyHash self, RubyHash from) {
return self;
}

@CompilerDirectives.TruffleBoundary
@Specialization(guards = "isBucketsStorage(from)")
public RubyHash dupBuckets(RubyHash self, RubyHash from) {
notDesignedForCompilation();

if (self == from) {
return self;
}
@@ -794,9 +782,9 @@ public RubyArray mapPackedArray(VirtualFrame frame, RubyHash hash, RubyProc bloc

@Specialization(guards = "isBucketsStorage(hash)")
public RubyArray mapBuckets(VirtualFrame frame, RubyHash hash, RubyProc block) {
assert HashOperations.verifyStore(hash);
CompilerDirectives.transferToInterpreter();

notDesignedForCompilation();
assert HashOperations.verifyStore(hash);

final RubyArray array = new RubyArray(getContext().getCoreLibrary().getArrayClass(), null, 0);

@@ -926,7 +914,7 @@ public RubyHash mergePackedArrayPackedArray(VirtualFrame frame, RubyHash hash, R
// TODO CS 3-Mar-15 need negative guards on this
@Specialization(guards = "!isCompareByIdentity(hash)")
public RubyHash mergeBucketsBuckets(RubyHash hash, RubyHash other, UndefinedPlaceholder block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyHash merged = new RubyHash(hash.getLogicalClass(), null, null, new Entry[BucketsStrategy.capacityGreaterThan(hash.getSize() + other.getSize())], 0, null);

@@ -952,7 +940,7 @@ public RubyHash mergeBucketsBuckets(RubyHash hash, RubyHash other, UndefinedPlac

@Specialization(guards = "!isCompareByIdentity(hash)")
public RubyHash merge(VirtualFrame frame, RubyHash hash, RubyHash other, RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyHash merged = new RubyHash(hash.getLogicalClass(), null, null, new Entry[BucketsStrategy.capacityGreaterThan(hash.getSize() + other.getSize())], 0, null);

@@ -987,8 +975,6 @@ public RubyHash merge(VirtualFrame frame, RubyHash hash, RubyHash other, RubyPro

@Specialization(guards = {"!isRubyHash(other)", "!isCompareByIdentity(hash)"})
public Object merge(VirtualFrame frame, RubyHash hash, Object other, Object block) {
notDesignedForCompilation();

if (fallbackCallNode == null) {
CompilerDirectives.transferToInterpreter();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
@@ -1016,10 +1002,7 @@ public SetDefaultNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object setDefault(VirtualFrame frame, RubyHash hash, Object defaultValue) {
notDesignedForCompilation();

ruby(frame, "Rubinius.check_frozen");

hash.setDefaultValue(defaultValue);
hash.setDefaultBlock(null);
return defaultValue;
@@ -1046,15 +1029,11 @@ public Object shiftEmpyDefaultValue(RubyHash hash) {

@Specialization(guards = {"isEmpty(hash)", "!hasDefaultValue(hash)", "hasDefaultBlock(hash)"})
public Object shiftEmptyDefaultProc(RubyHash hash) {
notDesignedForCompilation();

return hash.getDefaultBlock().rootCall(hash, nil());
}

@Specialization(guards = {"!isEmpty(hash)", "isPackedArrayStorage(hash)"})
public RubyArray shiftPackedArray(RubyHash hash) {
notDesignedForCompilation();

assert HashOperations.verifyStore(hash);

final Object[] store = (Object[]) hash.getStore();
@@ -1073,8 +1052,6 @@ public RubyArray shiftPackedArray(RubyHash hash) {

@Specialization(guards = {"!isEmpty(hash)", "isBucketsStorage(hash)"})
public RubyArray shiftBuckets(RubyHash hash) {
notDesignedForCompilation();

assert HashOperations.verifyStore(hash);

final Entry first = hash.getFirstInSequence();
@@ -1175,7 +1152,8 @@ public RubyHash rehashPackedArray(RubyHash hash) {

@Specialization(guards = "isBucketsStorage(hash)")
public RubyHash rehashBuckets(RubyHash hash) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

assert HashOperations.verifyStore(hash);

HashOperations.verySlowSetKeyValues(hash, HashOperations.verySlowToKeyValues(hash), hash.isCompareByIdentity());
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
*/
package org.jruby.truffle.nodes.core;

import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.ASCIIEncoding;
@@ -37,7 +38,7 @@ public InteroplatedRegexpNode(RubyContext context, SourceSection sourceSection,

@Override
public RubyRegexp executeRubyRegexp(VirtualFrame frame) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final org.jruby.RubyString[] strings = new org.jruby.RubyString[children.length];

70 changes: 35 additions & 35 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ public BacktickNode(RubyContext context, SourceSection sourceSection) {
public RubyString backtick(RubyString command) {
// Command is lexically a string interoplation, so variables will already have been expanded

notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyContext context = getContext();

@@ -239,7 +239,7 @@ public AtExitNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object atExit(RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().getAtExitManager().add(block);
return nil();
@@ -295,7 +295,7 @@ public CalleeNameNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubySymbol calleeName(VirtualFrame frame) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
// the "called name" of a method.
return getContext().getSymbolTable().getSymbol(RubyCallStack.getCallingMethod(frame).getName());
}
@@ -405,7 +405,7 @@ public CloneNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyBasicObject clone(VirtualFrame frame, RubyBasicObject self) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyBasicObject newObject = copyNode.executeCopy(frame, self);

@@ -479,36 +479,36 @@ protected RubyBinding getCallerBinding(VirtualFrame frame) {

@Specialization
public Object eval(VirtualFrame frame, RubyString source, UndefinedPlaceholder binding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), getCallerBinding(frame), true, this);
}

@Specialization
public Object eval(VirtualFrame frame, RubyString source, RubyNilClass noBinding, RubyString filename, int lineNumber) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO (nirvdrum Dec. 29, 2014) Do something with the supplied filename.
return eval(frame, source, UndefinedPlaceholder.INSTANCE, UndefinedPlaceholder.INSTANCE, UndefinedPlaceholder.INSTANCE);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, UndefinedPlaceholder filename, UndefinedPlaceholder lineNumber) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, UndefinedPlaceholder lineNumber) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
}

@Specialization
public Object eval(RubyString source, RubyBinding binding, RubyString filename, int lineNumber) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return getContext().eval(source.getByteList(), binding, false, filename.toString(), this);
}
@@ -528,7 +528,7 @@ public ExecNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object require(Object[] args) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final String[] commandLine = new String[args.length];

@@ -587,7 +587,7 @@ public Object exit(UndefinedPlaceholder exitCode) {

@Specialization
public Object exit(int exitCode) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().shutdown();
System.exit(exitCode);
@@ -596,7 +596,7 @@ public Object exit(int exitCode) {

@Specialization
public Object exit(boolean status) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().shutdown();
System.exit(status ? 0 : -1);
@@ -635,7 +635,7 @@ public ForkNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object fork(Object[] args) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
getContext().getWarnings().warn("Kernel#fork not implemented - defined to satisfy some metaprogramming in RubySpec");
return nil();
}
@@ -693,7 +693,7 @@ public GetsNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyString gets(VirtualFrame frame) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO(CS): having some trouble interacting with JRuby stdin - so using this hack
final InputStream in = getContext().getRuntime().getInstanceConfig().getInput();
@@ -783,7 +783,7 @@ public InitializeCopyNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object initializeCopy(RubyBasicObject self, RubyBasicObject from) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (self.getLogicalClass() != from.getLogicalClass()) {
CompilerDirectives.transferToInterpreter();
@@ -838,14 +838,14 @@ public InstanceVariableDefinedNode(RubyContext context, SourceSection sourceSect

@Specialization
public boolean isInstanceVariableDefined(RubyBasicObject object, RubyString name) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return object.isFieldDefined(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
}

@Specialization
public boolean isInstanceVariableDefined(RubyBasicObject object, RubySymbol name) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return object.isFieldDefined(RubyContext.checkInstanceVariableName(getContext(), name.toString(), this));
}
@@ -911,7 +911,7 @@ public InstanceVariablesNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray instanceVariables(RubyBasicObject self) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final Object[] instanceVariableNames = self.getObjectType().getFieldNames(self);

@@ -947,7 +947,7 @@ public boolean isA(RubyBasicObject self, RubyNilClass nil) {
@TruffleBoundary
@Specialization
public boolean isA(Object self, RubyModule rubyClass) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
// TODO(CS): fast path
return ModuleOperations.assignableTo(getContext().getCoreLibrary().getMetaClass(self), rubyClass);
}
@@ -979,7 +979,7 @@ public LoadNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean load(RubyString file) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

try {
getContext().loadFile(file.toString(), this);
@@ -1007,7 +1007,7 @@ public LocalVariablesNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray localVariables() {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyArray array = new RubyArray(getContext().getCoreLibrary().getArrayClass());

@@ -1031,7 +1031,7 @@ public MethodNameNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubySymbol methodName(VirtualFrame frame) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();
// the "original/definition name" of the method.
return getContext().getSymbolTable().getSymbol(RubyCallStack.getCallingMethod(frame).getSharedMethodInfo().getName());
}
@@ -1056,7 +1056,7 @@ public RubyMethod method(Object object, RubyString name) {
}

private RubyMethod method(Object object, String name) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO(CS, 11-Jan-15) cache this lookup

@@ -1087,7 +1087,7 @@ public RubyArray methods(RubyBasicObject self, UndefinedPlaceholder unused) {

@Specialization
public RubyArray methods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());

@@ -1137,7 +1137,7 @@ public RubyArray private_methods(RubyBasicObject self, UndefinedPlaceholder unus

@Specialization
public RubyArray private_methods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());

@@ -1169,7 +1169,7 @@ public ProcNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyProc proc(RubyProc block) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return new RubyProc(getContext().getCoreLibrary().getProcClass(), RubyProc.Type.PROC,
block.getSharedMethodInfo(), block.getCallTargetForProcs(), block.getCallTargetForProcs(),
@@ -1187,7 +1187,7 @@ public PublicMethodsNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray methods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (!includeInherited) {
getContext().getRuntime().getWarnings().warn(IRubyWarnings.ID.TRUFFLE, Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection().getSource().getName(), Truffle.getRuntime().getCallerFrame().getCallNode().getEncapsulatingSourceSection().getStartLine(), "Object#methods always returns inherited methods at the moment");
@@ -1198,7 +1198,7 @@ public RubyArray methods(RubyBasicObject self, boolean includeInherited) {

@Specialization
public RubyArray methods(RubyBasicObject self, UndefinedPlaceholder includeInherited) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());

@@ -1274,7 +1274,7 @@ public RequireNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean require(RubyString feature) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO CS 1-Mar-15 ERB will use strscan if it's there, but strscan is not yet complete, so we need to hide it

@@ -1302,7 +1302,7 @@ public RequireRelativeNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean requireRelative(RubyString feature) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final FeatureManager featureManager = getContext().getFeatureManager();

@@ -1437,15 +1437,15 @@ public SetTraceFuncNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyNilClass setTraceFunc(RubyNilClass nil) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().getTraceManager().setTraceFunc(null);
return nil;
}

@Specialization
public RubyProc setTraceFunc(RubyProc traceFunc) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

getContext().getTraceManager().setTraceFunc(traceFunc);
return traceFunc;
@@ -1478,7 +1478,7 @@ public SingletonMethodsNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray singletonMethods(RubyBasicObject self, boolean includeInherited) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final RubyArray array = new RubyArray(self.getContext().getCoreLibrary().getArrayClass());

@@ -1744,7 +1744,7 @@ public SystemNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public boolean system(RubyString command) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

// TODO(CS 5-JAN-15): very simplistic implementation

@@ -1852,7 +1852,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyString toS(VirtualFrame frame, Object self) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

String className = classNode.executeGetClass(frame, self).getName();
Object id = objectIDNode.executeObjectID(frame, self);
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ public GetIndexNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object getIndex(RubyMatchData matchData, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final Object[] values = matchData.getValues();
final int normalizedIndex = RubyArray.normalizeIndex(values.length, index);
@@ -54,7 +54,7 @@ public Object getIndex(RubyMatchData matchData, int index) {

@Specialization
public Object getIndex(RubyMatchData matchData, RubySymbol index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

try {
final int i = matchData.getBackrefNumber(index.getSymbolBytes());
@@ -70,7 +70,7 @@ public Object getIndex(RubyMatchData matchData, RubySymbol index) {

@Specialization
public Object getIndex(RubyMatchData matchData, RubyString index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

try {
final int i = matchData.getBackrefNumber(index.getByteList());
@@ -87,7 +87,7 @@ public Object getIndex(RubyMatchData matchData, RubyString index) {

@Specialization(guards = {"!isRubySymbol(index)", "!isRubyString(index)", "!isIntegerFixnumRange(index)"})
public Object getIndex(VirtualFrame frame, RubyMatchData matchData, Object index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (toIntNode == null) {
CompilerDirectives.transferToInterpreter();
@@ -122,7 +122,7 @@ public BeginNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object begin(RubyMatchData matchData, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (badIndexProfile.profile((index < 0) || (index >= matchData.getNumberOfRegions()))) {
CompilerDirectives.transferToInterpreter();
@@ -146,7 +146,7 @@ public CapturesNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray toA(RubyMatchData matchData) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), matchData.getCaptures());
}
@@ -163,7 +163,7 @@ public EndNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object end(RubyMatchData matchData, int index) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

if (badIndexProfile.profile((index < 0) || (index >= matchData.getNumberOfRegions()))) {
CompilerDirectives.transferToInterpreter();
@@ -228,7 +228,7 @@ public ToANode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray toA(RubyMatchData matchData) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), matchData.getValues());
}
@@ -243,7 +243,7 @@ public ToSNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyString toS(RubyMatchData matchData) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final ByteList bytes = matchData.getGlobal().getByteList().dup();
return getContext().makeString(bytes);
@@ -259,7 +259,7 @@ public ValuesAtNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyArray valuesAt(RubyMatchData matchData, Object[] args) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

final int[] indicies = new int[args.length];

Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ public NameNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubySymbol name(RubyMethod method) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

return getContext().getSymbol(method.getMethod().getName());
}
@@ -156,7 +156,7 @@ public SourceLocationNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object sourceLocation(RubyMethod method) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

SourceSection sourceSection = method.getMethod().getSharedMethodInfo().getSourceSection();

@@ -183,7 +183,7 @@ public UnbindNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public RubyUnboundMethod unbind(VirtualFrame frame, RubyMethod method) {
notDesignedForCompilation();
CompilerDirectives.transferToInterpreter();

RubyClass receiverClass = classNode.executeGetClass(frame, method.getReceiver());
return new RubyUnboundMethod(getContext().getCoreLibrary().getUnboundMethodClass(), receiverClass, method.getMethod());
122 changes: 61 additions & 61 deletions truffle/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java

Large diffs are not rendered by default.

0 comments on commit 76ac629

Please sign in to comment.