Skip to content

Commit

Permalink
Showing 60 changed files with 181 additions and 183 deletions.
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ public Object execute(VirtualFrame frame) {
}

final Object[] arguments = ArrayUtils.unshift(RubyArguments.getArguments(frame), methodSymbol);
return toEnumNode.call(frame, RubyArguments.getSelf(frame), "to_enum", null, arguments);
return toEnumNode.call(frame, RubyArguments.getSelf(frame), "to_enum", arguments);
} else {
return method.execute(frame);
}
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ public Object execute(VirtualFrame frame) {
Object self = RubyArguments.getSelf(frame);

for (String requiredLibrary : getRequiredLibraries()) {
requireNode.call(frame, self, "require", null, createString(StringOperations.encodeRope(requiredLibrary, UTF8Encoding.INSTANCE)));
requireNode.call(frame, self, "require", createString(StringOperations.encodeRope(requiredLibrary, UTF8Encoding.INSTANCE)));
}

return nil();
Original file line number Diff line number Diff line change
@@ -160,10 +160,10 @@ public Object vmExtendedModules(VirtualFrame frame, Object object) {
final DynamicObject metaClass = coreLibrary().getMetaClass(object);

if (Layouts.CLASS.getIsSingleton(metaClass)) {
final Object ret = newArrayNode.call(frame, coreLibrary().getArrayClass(), "new", null);
final Object ret = newArrayNode.call(frame, coreLibrary().getArrayClass(), "new");

for (DynamicObject included : Layouts.MODULE.getFields(metaClass).prependedAndIncludedModules()) {
arrayAppendNode.call(frame, ret, "<<", null, included);
arrayAppendNode.call(frame, ret, "<<", included);
}

return ret;
30 changes: 15 additions & 15 deletions truffle/src/main/java/org/jruby/truffle/core/array/ArrayNodes.java
Original file line number Diff line number Diff line change
@@ -234,7 +234,7 @@ public Object mulObject(
DynamicObject array,
DynamicObject string,
@Cached("createMethodCall()") CallDispatchHeadNode callNode) {
return callNode.call(frame, array, "join", null, string);
return callNode.call(frame, array, "join", string);
}

@Specialization(guards = { "!isInteger(object)", "!isRubyString(object)" })
@@ -349,8 +349,8 @@ public Object fallback(VirtualFrame frame, DynamicObject array, DynamicObject ar
}

InternalMethod method = RubyArguments.getMethod(frame);
return fallbackNode.call(frame, array, "element_reference_fallback", null,
createString(StringOperations.encodeRope(method.getName(), UTF8Encoding.INSTANCE)), args);
return fallbackNode.call(frame, array, "element_reference_fallback", createString(StringOperations.encodeRope(method.getName(), UTF8Encoding.INSTANCE)),
args);
}

}
@@ -911,13 +911,13 @@ protected Object value(Object[] args) {
@Specialization
protected Object fillFallback(VirtualFrame frame, DynamicObject array, Object[] args, NotProvided block,
@Cached("createMethodCall()") CallDispatchHeadNode callFillInternal) {
return callFillInternal.call(frame, array, "fill_internal", null, args);
return callFillInternal.call(frame, array, "fill_internal", args);
}

@Specialization
protected Object fillFallback(VirtualFrame frame, DynamicObject array, Object[] args, DynamicObject block,
@Cached("createMethodCall()") CallDispatchHeadNode callFillInternal) {
return callFillInternal.call(frame, array, "fill_internal", block, args);
return callFillInternal.callWithBlock(frame, array, "fill_internal", block, args);
}

}
@@ -947,7 +947,7 @@ public long hash(VirtualFrame frame, DynamicObject array,

for (int n = 0; n < size; n++) {
final Object value = store.get(n);
final long valueHash = toLong(frame, toHashNode.call(frame, value, "hash", null));
final long valueHash = toLong(frame, toHashNode.call(frame, value, "hash"));
h = Helpers.murmurCombine(h, valueHash);
}

@@ -1132,7 +1132,7 @@ protected Object callToAry(VirtualFrame frame, Object object) {
CompilerDirectives.transferToInterpreterAndInvalidate();
toAryNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
}
return toAryNode.call(frame, object, "to_ary", null);
return toAryNode.call(frame, object, "to_ary");
}

protected int toInt(VirtualFrame frame, Object value) {
@@ -1262,7 +1262,7 @@ public Object injectSymbolHelper(VirtualFrame frame, DynamicObject array, Dynami

try {
for (; n < getSize(array); n++) {
accumulator = dispatch.call(frame, accumulator, symbol, null, store.get(n));
accumulator = dispatch.call(frame, accumulator, symbol, store.get(n));
}
} finally {
if (CompilerDirectives.inInterpreter()) {
@@ -1374,7 +1374,7 @@ public Object max(VirtualFrame frame, DynamicObject array, NotProvided blockNotP
maxBlock.getSharedMethodInfo(), maxBlock.getCallTarget(), maxBlock.getCallTarget(),
maximumClosureFrame.materialize(), method, array, null);

eachNode.call(frame, array, "each", block);
eachNode.callWithBlock(frame, array, "each", block);

if (maximum.get() == null) {
return nil();
@@ -1389,7 +1389,7 @@ public Object max(
DynamicObject array,
DynamicObject block,
@Cached("createMethodCall()") CallDispatchHeadNode callNode) {
return callNode.call(frame, array, "max_internal", block);
return callNode.callWithBlock(frame, array, "max_internal", block);
}

}
@@ -1415,7 +1415,7 @@ public DynamicObject max(VirtualFrame frame, Object maximumObject, Object value)
if (current == null) {
maximum.set(value);
} else {
final Object compared = compareNode.call(frame, value, "<=>", null, current);
final Object compared = compareNode.call(frame, value, "<=>", current);

if (compared instanceof Integer) {
if ((int) compared > 0) {
@@ -1496,7 +1496,7 @@ public Object min(VirtualFrame frame, DynamicObject array, NotProvided blockNotP
minBlock.getSharedMethodInfo(), minBlock.getCallTarget(), minBlock.getCallTarget(),
minimumClosureFrame.materialize(), method, array, null);

eachNode.call(frame, array, "each", block);
eachNode.callWithBlock(frame, array, "each", block);

if (minimum.get() == null) {
return nil();
@@ -1537,7 +1537,7 @@ public DynamicObject min(VirtualFrame frame, Object minimumObject, Object value)
if (current == null) {
minimum.set(value);
} else {
final Object compared = compareNode.call(frame, value, "<=>", null, current);
final Object compared = compareNode.call(frame, value, "<=>", current);

if (compared instanceof Integer) {
if ((int) compared < 0) {
@@ -2140,7 +2140,7 @@ public DynamicObject sortVeryShort(VirtualFrame frame, DynamicObject array, NotP
if (j < size) {
final Object a = store.get(i);
final Object b = store.get(j);
if (castSortValue(compareDispatchNode.call(frame, b, "<=>", null, a)) < 0) {
if (castSortValue(compareDispatchNode.call(frame, b, "<=>", a)) < 0) {
store.set(j, a);
store.set(i, b);
}
@@ -2258,7 +2258,7 @@ private Object zipRuby(VirtualFrame frame, DynamicObject array, DynamicObject bl

final Object[] others = RubyArguments.getArguments(frame);

return zipInternalCall.call(frame, array, "zip_internal", block, others);
return zipInternalCall.callWithBlock(frame, array, "zip_internal", block, others);
}

protected static boolean fallback(DynamicObject array, DynamicObject other, Object[] others) {
Original file line number Diff line number Diff line change
@@ -325,7 +325,7 @@ public Object send(VirtualFrame frame, Object self, Object name, Object[] args,

@Specialization
public Object send(VirtualFrame frame, Object self, Object name, Object[] args, DynamicObject block) {
return dispatchNode.call(frame, self, name, block, args);
return dispatchNode.callWithBlock(frame, self, name, block, args);
}

}
Original file line number Diff line number Diff line change
@@ -99,7 +99,7 @@ public Object cast(Object nil) {
@Specialization(guards = {"!isNil(object)", "!isRubyBignum(object)", "!isRubyArray(object)"})
public Object cast(VirtualFrame frame, DynamicObject object,
@Cached("create()") BranchProfile errorProfile) {
final Object result = toArrayNode.call(frame, object, "to_ary", null);
final Object result = toArrayNode.call(frame, object, "to_ary");

if (result == nil()) {
return nil();
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ public DynamicObject castHash(DynamicObject hash) {
@Specialization(guards = {"!isNil(object)", "!isRubyBignum(object)", "!isRubyHash(object)"})
public Object cast(VirtualFrame frame, DynamicObject object,
@Cached("create()") BranchProfile errorProfile) {
final Object result = toHashNode.call(frame, object, "to_hash", null);
final Object result = toHashNode.call(frame, object, "to_hash");

if (result == DispatchNode.MISSING) {
return nil();
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ public String coerceObjectToStr(VirtualFrame frame, Object object,
@Cached("createMethodCall()") CallDispatchHeadNode toStr) {
final Object coerced;
try {
coerced = toStr.call(frame, object, "to_str", null);
coerced = toStr.call(frame, object, "to_str");
} catch (RaiseException e) {
errorProfile.enter();
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public DynamicObject coerceObject(VirtualFrame frame, Object object,
@Cached("create()") BranchProfile errorProfile) {
final Object coerced;
try {
coerced = toStr.call(frame, object, "to_str", null);
coerced = toStr.call(frame, object, "to_str");
} catch (RaiseException e) {
errorProfile.enter();
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ private Object callToFloat(VirtualFrame frame, DynamicObject value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
toFloatCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), MissingBehavior.RETURN_MISSING));
}
return toFloatCallNode.call(frame, value, method, null);
return toFloatCallNode.call(frame, value, method);
}

@Specialization(guards = "isNumeric(frame, value)")
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ public Object splatNil(VirtualFrame frame, Object nil) {
return Layouts.ARRAY.createArray(coreLibrary().getArrayFactory(), new Object[]{nil()}, 1);

case CONVERT:
return toA.call(frame, nil, "to_a", null);
return toA.call(frame, nil, "to_a");

case NIL:
return nil;
@@ -95,9 +95,9 @@ public DynamicObject splat(VirtualFrame frame, DynamicObject array) {
public DynamicObject splat(VirtualFrame frame, Object object,
@Cached("create()") BranchProfile errorProfile) {
// MRI tries to call dynamic respond_to? here.
Object respondToResult = respondToToA.call(frame, object, "respond_to?", null, conversionMethod, true);
Object respondToResult = respondToToA.call(frame, object, "respond_to?", conversionMethod, true);
if (respondToResult != DispatchNode.MISSING && respondToCast.executeBoolean(frame, respondToResult)) {
final Object array = toA.call(frame, object, conversionMethod, null);
final Object array = toA.call(frame, object, conversionMethod);

if (RubyGuards.isRubyArray(array)) {
return (DynamicObject) array;
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public DynamicObject coerceObject(VirtualFrame frame, Object object,

final Object coerced;
try {
coerced = toAryNode.call(frame, object, "to_ary", null);
coerced = toAryNode.call(frame, object, "to_ary");
} catch (RaiseException e) {
errorProfile.enter();
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ private double coerceObject(VirtualFrame frame, Object object, BranchProfile err

final Object coerced;
try {
coerced = toFNode.call(frame, object, "to_f", null);
coerced = toFNode.call(frame, object, "to_f");
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
errorProfile.enter();
Original file line number Diff line number Diff line change
@@ -114,7 +114,7 @@ private Object coerceObject(VirtualFrame frame, Object object, BranchProfile err

final Object coerced;
try {
coerced = toIntNode.call(frame, object, "to_int", null);
coerced = toIntNode.call(frame, object, "to_int");
} catch (RaiseException e) {
errorProfile.enter();
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public DynamicObject doObject(VirtualFrame frame, Object object,
@Cached("create()") BranchProfile errorProfile) {
final Object coerced;
try {
coerced = toProc.call(frame, object, "to_proc", null);
coerced = toProc.call(frame, object, "to_proc");
} catch (RaiseException e) {
errorProfile.enter();
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ public DynamicObject toS(DynamicObject string) {

@Specialization(guards = "!isRubyString(object)", rewriteOn = UnexpectedResultException.class)
public DynamicObject toS(VirtualFrame frame, Object object) throws UnexpectedResultException {
final Object value = callToSNode.call(frame, object, "to_s", null);
final Object value = callToSNode.call(frame, object, "to_s");

if (RubyGuards.isRubyString(value)) {
return (DynamicObject) value;
@@ -61,7 +61,7 @@ public DynamicObject toS(VirtualFrame frame, Object object) throws UnexpectedRes

@Specialization(guards = "!isRubyString(object)")
public DynamicObject toSFallback(VirtualFrame frame, Object object) {
final Object value = callToSNode.call(frame, object, "to_s", null);
final Object value = callToSNode.call(frame, object, "to_s");

if (RubyGuards.isRubyString(value)) {
return (DynamicObject) value;
Original file line number Diff line number Diff line change
@@ -47,7 +47,7 @@ public DynamicObject coerceObject(VirtualFrame frame, Object object,
@Cached("create()") BranchProfile errorProfile) {
final Object coerced;
try {
coerced = toStrNode.call(frame, object, "to_str", null);
coerced = toStrNode.call(frame, object, "to_str");
} catch (RaiseException e) {
if (Layouts.BASIC_OBJECT.getLogicalClass(e.getException()) == coreLibrary().getNoMethodErrorClass()) {
errorProfile.enter();
Original file line number Diff line number Diff line change
@@ -159,27 +159,27 @@ public TranscodingMapNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object transcodingMap(VirtualFrame frame) {
final Object ret = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new", null);
final Object ret = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new");

for (CaseInsensitiveBytesHash<TranscoderDB.Entry> sourceEntry : TranscoderDB.transcoders) {
Object key = null;
final Object value = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new", null);
final Object value = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new");

for (Hash.HashEntry<TranscoderDB.Entry> destinationEntry : sourceEntry.entryIterator()) {
final TranscoderDB.Entry e = destinationEntry.value;

if (key == null) {
final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.getSource())), "upcase", null);
key = toSymNode.call(frame, upcased, "to_sym", null);
final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.getSource())), "upcase");
key = toSymNode.call(frame, upcased, "to_sym");
}

final Object upcasedLookupTableKey = upcaseNode.call(frame, createString(new ByteList(e.getDestination())), "upcase", null);
final Object lookupTableKey = toSymNode.call(frame, upcasedLookupTableKey, "to_sym", null);
final Object lookupTableValue = newTranscodingNode.call(frame, coreLibrary().getTranscodingClass(), "create", null, key, lookupTableKey);
lookupTableWriteNode.call(frame, value, "[]=", null, lookupTableKey, lookupTableValue);
final Object upcasedLookupTableKey = upcaseNode.call(frame, createString(new ByteList(e.getDestination())), "upcase");
final Object lookupTableKey = toSymNode.call(frame, upcasedLookupTableKey, "to_sym");
final Object lookupTableValue = newTranscodingNode.call(frame, coreLibrary().getTranscodingClass(), "create", key, lookupTableKey);
lookupTableWriteNode.call(frame, value, "[]=", lookupTableKey, lookupTableValue);
}

lookupTableWriteNode.call(frame, ret, "[]=", null, key, value);
lookupTableWriteNode.call(frame, ret, "[]=", key, value);
}

return ret;
@@ -387,18 +387,17 @@ public Object encodingConverterLastError(VirtualFrame frame, DynamicObject encod
return nil();
}

Object ret = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new", null);
Object ret = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new");

lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("result"), eConvResultToSymbol(lastError.getResult()));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("source_encoding_name"), createString(new ByteList(lastError.getSource())));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("destination_encoding_name"), createString(new ByteList(lastError.getDestination())));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("error_bytes"), createString(new ByteList(lastError.getErrorBytes())));
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("result"), eConvResultToSymbol(lastError.getResult()));
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("source_encoding_name"), createString(new ByteList(lastError.getSource())));
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("destination_encoding_name"), createString(new ByteList(lastError.getDestination())));
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("error_bytes"), createString(new ByteList(lastError.getErrorBytes())));

if (lastError.getReadAgainLength() != 0) {
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("read_again_bytes"),
createString(new ByteList(lastError.getErrorBytes(),
lastError.getErrorBytesLength() + lastError.getErrorBytesP(),
lastError.getReadAgainLength())));
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("read_again_bytes"), createString(new ByteList(lastError.getErrorBytes(),
lastError.getErrorBytesLength() + lastError.getErrorBytesP(),
lastError.getReadAgainLength())));
}

return ret;
Original file line number Diff line number Diff line change
@@ -478,53 +478,53 @@ public EncodingMapNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object encodingMap(VirtualFrame frame) {
Object ret = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new", null);
Object ret = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new");

final DynamicObject[] encodings = getContext().getEncodingManager().getUnsafeEncodingList();
for (int i = 0; i < encodings.length; i++) {
final Object upcased = upcaseNode.call(frame, Layouts.ENCODING.getName(encodings[i]), "upcase", null);
final Object key = toSymNode.call(frame, upcased, "to_sym", null);
final Object value = newTupleNode.call(frame, coreLibrary().getTupleClass(), "create", null, nil(), i);
final Object upcased = upcaseNode.call(frame, Layouts.ENCODING.getName(encodings[i]), "upcase");
final Object key = toSymNode.call(frame, upcased, "to_sym");
final Object value = newTupleNode.call(frame, coreLibrary().getTupleClass(), "create", nil(), i);

lookupTableWriteNode.call(frame, ret, "[]=", null, key, value);
lookupTableWriteNode.call(frame, ret, "[]=", key, value);
}

final Hash<EncodingDB.Entry>.HashEntryIterator i = EncodingDB.getAliases().entryIterator();
while (i.hasNext()) {
final CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry> e =
((CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<EncodingDB.Entry>) i.next());

final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.bytes, e.p, e.end - e.p)), "upcase", null);
final Object key = toSymNode.call(frame, upcased, "to_sym", null);
final Object upcased = upcaseNode.call(frame, createString(new ByteList(e.bytes, e.p, e.end - e.p)), "upcase");
final Object key = toSymNode.call(frame, upcased, "to_sym");
final DynamicObject alias = createString(new ByteList(e.bytes, e.p, e.end - e.p));
final int index = e.value.getIndex();


final Object value = newTupleNode.call(frame, coreLibrary().getTupleClass(), "create", null, alias, index);
lookupTableWriteNode.call(frame, ret, "[]=", null, key, value);
final Object value = newTupleNode.call(frame, coreLibrary().getTupleClass(), "create", alias, index);
lookupTableWriteNode.call(frame, ret, "[]=", key, value);
}

final Encoding defaultInternalEncoding = getContext().getJRubyRuntime().getDefaultInternalEncoding();
final Object internalTuple = makeTuple(frame, newTupleNode, create7BitString("internal", UTF8Encoding.INSTANCE), indexLookup(encodings, defaultInternalEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("INTERNAL"), internalTuple);
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("INTERNAL"), internalTuple);

final Encoding defaultExternalEncoding = getContext().getJRubyRuntime().getDefaultExternalEncoding();
final Object externalTuple = makeTuple(frame, newTupleNode, create7BitString("external", UTF8Encoding.INSTANCE), indexLookup(encodings, defaultExternalEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("EXTERNAL"), externalTuple);
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("EXTERNAL"), externalTuple);

final Encoding localeEncoding = getContext().getEncodingManager().getLocaleEncoding();
final Object localeTuple = makeTuple(frame, newTupleNode, create7BitString("locale", UTF8Encoding.INSTANCE), indexLookup(encodings, localeEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("LOCALE"), localeTuple);
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("LOCALE"), localeTuple);

final Encoding filesystemEncoding = getContext().getEncodingManager().getLocaleEncoding();
final Object filesystemTuple = makeTuple(frame, newTupleNode, create7BitString("filesystem", UTF8Encoding.INSTANCE), indexLookup(encodings, filesystemEncoding));
lookupTableWriteNode.call(frame, ret, "[]=", null, getSymbol("FILESYSTEM"), filesystemTuple);
lookupTableWriteNode.call(frame, ret, "[]=", getSymbol("FILESYSTEM"), filesystemTuple);

return ret;
}

private Object makeTuple(VirtualFrame frame, CallDispatchHeadNode newTupleNode, Object... values) {
return newTupleNode.call(frame, coreLibrary().getTupleClass(), "create", null, values);
return newTupleNode.call(frame, coreLibrary().getTupleClass(), "create", values);
}

@TruffleBoundary
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ public Object toInteger(VirtualFrame frame, Object value) {
integerNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
}

return integerNode.call(frame, getContext().getCoreLibrary().getKernelModule(), "Integer", null, value);
return integerNode.call(frame, getContext().getCoreLibrary().getKernelModule(), "Integer", value);
}

}
Original file line number Diff line number Diff line change
@@ -84,7 +84,7 @@ public long toLong(VirtualFrame frame, Object object) {
toIntNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true, MissingBehavior.RETURN_MISSING));
}

final Object value = toIntNode.call(frame, object, "to_int", null);
final Object value = toIntNode.call(frame, object, "to_int");

if (redoNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ public byte[] toString(VirtualFrame frame, DynamicObject array) {
MissingBehavior.RETURN_MISSING));
}

final Object value = toSNode.call(frame, array, "to_s", null);
final Object value = toSNode.call(frame, array, "to_s");

if (RubyGuards.isRubyString(value)) {
if (taintedProfile.profile(isTaintedNode.executeIsTainted(value))) {
@@ -123,7 +123,7 @@ public byte[] toString(VirtualFrame frame, Object object) {
MissingBehavior.RETURN_MISSING));
}

final Object value = toStrNode.call(frame, object, conversionMethod, null);
final Object value = toStrNode.call(frame, object, conversionMethod);

if (RubyGuards.isRubyString(value)) {
if (taintedProfile.profile(isTaintedNode.executeIsTainted(value))) {
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ public Object read(VirtualFrame frame, Object[] source) {
fetchNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true));
}

return fetchNode.call(frame, hash, "fetch", null, key);
return fetchNode.call(frame, hash, "fetch", key);
}

}
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ public Object execute(VirtualFrame frame) {

if (stringKeyProfile.profile(RubyGuards.isRubyString(key))) {
if (!isFrozen(key)) {
key = freezeNode.call(frame, dupNode.call(frame, key, "dup", null), "freeze", null);
key = freezeNode.call(frame, dupNode.call(frame, key, "dup"), "freeze");
}
}

Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ public HashNode(RubyContext context, SourceSection sourceSection) {
}

public int hash(VirtualFrame frame, Object key) {
final Object hashedObject = hashNode.call(frame, key, "hash", null);
final Object hashedObject = hashNode.call(frame, key, "hash");

if (isIntegerProfile.profile(hashedObject instanceof Integer)) {
return (int) hashedObject;
12 changes: 6 additions & 6 deletions truffle/src/main/java/org/jruby/truffle/core/hash/HashNodes.java
Original file line number Diff line number Diff line change
@@ -200,7 +200,7 @@ public Object getNull(VirtualFrame frame, DynamicObject hash, Object key) {
if (undefinedValue != null) {
return undefinedValue;
} else {
return callDefaultNode.call(frame, hash, "default", null, key);
return callDefaultNode.call(frame, hash, "default", key);
}
}

@@ -311,7 +311,7 @@ public Object getPackedArray(VirtualFrame frame, DynamicObject hash, Object key,
}

useDefaultProfile.enter();
return callDefaultNode.call(frame, hash, "default", null, key);
return callDefaultNode.call(frame, hash, "default", key);

}

@@ -339,7 +339,7 @@ public Object getPackedArrayByIdentity(VirtualFrame frame, DynamicObject hash, O
}

useDefaultProfile.enter();
return callDefaultNode.call(frame, hash, "default", null, key);
return callDefaultNode.call(frame, hash, "default", key);

}

@@ -360,7 +360,7 @@ public Object getBuckets(VirtualFrame frame, DynamicObject hash, Object key,
}

useDefaultProfile.enter();
return callDefaultNode.call(frame, hash, "default", null, key);
return callDefaultNode.call(frame, hash, "default", key);
}

public void setUndefinedValue(Object undefinedValue) {
@@ -644,7 +644,7 @@ public Object each(VirtualFrame frame, DynamicObject hash, NotProvided block) {
}

InternalMethod method = RubyArguments.getMethod(frame);
return toEnumNode.call(frame, hash, "to_enum", null, getSymbol(method.getName()));
return toEnumNode.call(frame, hash, "to_enum", getSymbol(method.getName()));
}

private Object yieldPair(VirtualFrame frame, DynamicObject block, Object key, Object value) {
@@ -1197,7 +1197,7 @@ public Object merge(VirtualFrame frame, DynamicObject hash, Object other, Object
block = (DynamicObject) maybeBlock;
}

return fallbackCallNode.call(frame, hash, "merge_fallback", block, other);
return fallbackCallNode.callWithBlock(frame, hash, "merge_fallback", block, other);
}

}
Original file line number Diff line number Diff line change
@@ -243,15 +243,15 @@ private Object dup(VirtualFrame frame, Object value) {
CompilerDirectives.transferToInterpreterAndInvalidate();
dupNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}
return dupNode.call(frame, value, "dup", null);
return dupNode.call(frame, value, "dup");
}

private Object freeze(VirtualFrame frame, Object value) {
if (freezeNode == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
freezeNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}
return freezeNode.call(frame, value, "freeze", null);
return freezeNode.call(frame, value, "freeze");
}

}
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ public DynamicObject backtick(VirtualFrame frame, DynamicObject command) {
}

final DynamicObject env = getContext().getCoreLibrary().getENV();
final DynamicObject envAsHash = (DynamicObject) toHashNode.call(frame, env, "to_hash", null);
final DynamicObject envAsHash = (DynamicObject) toHashNode.call(frame, env, "to_hash");

return spawnAndCaptureOutput(command, envAsHash);
}
@@ -398,7 +398,7 @@ public CopyNode(RubyContext context, SourceSection sourceSection) {
@Specialization
public DynamicObject copy(VirtualFrame frame, DynamicObject self) {
final DynamicObject rubyClass = Layouts.BASIC_OBJECT.getLogicalClass(self);
final DynamicObject newObject = (DynamicObject) allocateNode.call(frame, rubyClass, "allocate", null);
final DynamicObject newObject = (DynamicObject) allocateNode.call(frame, rubyClass, "allocate");
copyInstanceVariables(self, newObject);
return newObject;
}
@@ -447,7 +447,7 @@ public DynamicObject clone(VirtualFrame frame, DynamicObject self,
Layouts.MODULE.getFields(newObjectMetaClass).initCopy(selfMetaClass);
}

initializeCloneNode.call(frame, newObject, "initialize_clone", null, self);
initializeCloneNode.call(frame, newObject, "initialize_clone", self);

if (isFrozenProfile.profile(isFrozenNode.executeIsFrozen(self))) {
freezeNode.executeFreeze(newObject);
@@ -480,7 +480,7 @@ public DupNode(RubyContext context, SourceSection sourceSection) {
public DynamicObject dup(VirtualFrame frame, DynamicObject self) {
final DynamicObject newObject = copyNode.executeCopy(frame, self);

initializeDupNode.call(frame, newObject, "initialize_dup", null, self);
initializeDupNode.call(frame, newObject, "initialize_dup", self);

return newObject;
}
@@ -500,7 +500,7 @@ public DynamicObject dupClass(VirtualFrame frame, DynamicObject self) {
assert Layouts.CLASS.getIsSingleton(Layouts.BASIC_OBJECT.getMetaClass(newObject));

Layouts.MODULE.getFields(newObjectMetaClass).initCopy(selfMetaClass); // copies class methods
initializeDupNode.call(frame, newObject, "initialize_dup", null, self);
initializeDupNode.call(frame, newObject, "initialize_dup", self);
Layouts.CLASS.setSuperclass(newObject, Layouts.CLASS.getSuperclass(self));

return newObject;
@@ -727,7 +727,7 @@ public Object exec(VirtualFrame frame, Object command, Object[] args) {
final String[] commandLine = buildCommandLine(command, args);

final DynamicObject env = coreLibrary().getENV();
final DynamicObject envAsHash = (DynamicObject) toHashNode.call(frame, env, "to_hash", null);
final DynamicObject envAsHash = (DynamicObject) toHashNode.call(frame, env, "to_hash");

exec(getContext(), envAsHash, commandLine);

@@ -937,7 +937,7 @@ public InitializeDupCloneNode(RubyContext context, SourceSection sourceSection)

@Specialization
public Object initializeDup(VirtualFrame frame, DynamicObject self, DynamicObject from) {
return initializeCopyNode.call(frame, self, "initialize_copy", null, from);
return initializeCopyNode.call(frame, self, "initialize_copy", from);
}

}
@@ -1218,7 +1218,7 @@ public CallMethodMissingWithStaticName(RubyContext context, SourceSection source
public Object execute(VirtualFrame frame) {
final Object[] originalUserArguments = RubyArguments.getArguments(frame);
final Object[] newUserArguments = ArrayUtils.unshift(originalUserArguments, methodName);
return methodMissing.call(frame, RubyArguments.getSelf(frame), "method_missing", RubyArguments.getBlock(frame), newUserArguments);
return methodMissing.callWithBlock(frame, RubyArguments.getSelf(frame), "method_missing", RubyArguments.getBlock(frame), newUserArguments);
}
}

@@ -1397,7 +1397,7 @@ public Object send(VirtualFrame frame, Object self, Object name, Object[] args,

@Specialization
public Object send(VirtualFrame frame, Object self, Object name, Object[] args, DynamicObject block) {
return dispatchNode.call(frame, self, name, block, args);
return dispatchNode.callWithBlock(frame, self, name, block, args);
}

}
Original file line number Diff line number Diff line change
@@ -268,8 +268,8 @@ public Object newInstance(VirtualFrame frame, DynamicObject rubyClass, Object[]
}

private Object doNewInstance(VirtualFrame frame, DynamicObject rubyClass, Object[] args, DynamicObject block) {
final Object instance = allocateNode.call(frame, rubyClass, "allocate", null);
initialize.call(frame, instance, "initialize", block, args);
final Object instance = allocateNode.call(frame, rubyClass, "allocate");
initialize.callWithBlock(frame, instance, "initialize", block, args);
return instance;
}
}
@@ -285,7 +285,7 @@ void triggerInheritedHook(VirtualFrame frame, DynamicObject subClass, DynamicObj
CompilerDirectives.transferToInterpreterAndInvalidate();
inheritedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}
inheritedNode.call(frame, superClass, "inherited", null, subClass);
inheritedNode.call(frame, superClass, "inherited", subClass);
}

void moduleInitialize(VirtualFrame frame, DynamicObject rubyClass, DynamicObject block) {
Original file line number Diff line number Diff line change
@@ -1719,7 +1719,7 @@ private void removeMethod(VirtualFrame frame, DynamicObject module, String name)

if (Layouts.MODULE.getFields(module).getMethod(name) != null) {
Layouts.MODULE.getFields(module).removeMethod(name);
methodRemovedNode.call(frame, module, "method_removed", null, getSymbol(name));
methodRemovedNode.call(frame, module, "method_removed", getSymbol(name));
} else {
errorProfile.enter();
throw new RaiseException(coreExceptions().nameErrorMethodNotDefinedIn(module, name, this));
@@ -1766,7 +1766,7 @@ private void undefMethod(VirtualFrame frame, DynamicObject module, String name)
raiseIfFrozenNode.execute(frame);

Layouts.MODULE.getFields(module).undefMethod(getContext(), this, name);
methodUndefinedNode.call(frame, module, "method_undefined", null, getSymbol(name));
methodUndefinedNode.call(frame, module, "method_undefined", getSymbol(name));
}

}
Original file line number Diff line number Diff line change
@@ -317,7 +317,7 @@ public boolean equal(VirtualFrame frame, DynamicObject a, DynamicObject b) {
reverseCallNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

final Object reversedResult = reverseCallNode.call(frame, b, "==", null, a);
final Object reversedResult = reverseCallNode.call(frame, b, "==", a);

return booleanCastNode.executeBoolean(frame, reversedResult);
}
Original file line number Diff line number Diff line change
@@ -584,7 +584,7 @@ public boolean equal(long a, DynamicObject b) {
"!isLong(b)",
"!isRubyBignum(b)" })
public Object equal(VirtualFrame frame, Object a, Object b) {
return reverseCallNode.call(frame, b, "==", null, a);
return reverseCallNode.call(frame, b, "==", a);
}

}
@@ -856,7 +856,7 @@ public Object leftShiftFallback(VirtualFrame frame, Object a, Object b) {
CompilerDirectives.transferToInterpreterAndInvalidate();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}
return fallbackCallNode.call(frame, a, "left_shift_fallback", null, b);
return fallbackCallNode.call(frame, a, "left_shift_fallback", b);
}

static boolean canShiftIntoInt(int a, int b) {
@@ -936,7 +936,7 @@ public Object rightShiftFallback(VirtualFrame frame, Object a, Object b) {
CompilerDirectives.transferToInterpreterAndInvalidate();
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}
return fallbackCallNode.call(frame, a, "right_shift_fallback", null, b);
return fallbackCallNode.call(frame, a, "right_shift_fallback", b);
}

protected static boolean isPositive(DynamicObject b) {
Original file line number Diff line number Diff line change
@@ -171,9 +171,9 @@ public Object pow(VirtualFrame frame, double a, double b) {
complexPowNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

final Object aComplex = complexConvertNode.call(frame, coreLibrary().getComplexClass(), "convert", null, a, 0);
final Object aComplex = complexConvertNode.call(frame, coreLibrary().getComplexClass(), "convert", a, 0);

return complexPowNode.call(frame, aComplex, "**", null, b);
return complexPowNode.call(frame, aComplex, "**", b);
} else {
return Math.pow(a, b);
}
@@ -226,7 +226,7 @@ public Object div(VirtualFrame frame, double a, Object b) {
redoCoercedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return redoCoercedNode.call(frame, a, "redo_coerced", null, getSymbol("/"), b);
return redoCoercedNode.call(frame, a, "redo_coerced", getSymbol("/"), b);
}

}
@@ -420,7 +420,7 @@ public Object equal(VirtualFrame frame, double a, DynamicObject b) {
fallbackCallNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}

return fallbackCallNode.call(frame, a, "equal_fallback", null, b);
return fallbackCallNode.call(frame, a, "equal_fallback", b);
}
}

@@ -698,7 +698,7 @@ public Object round(
double n,
Object ndigits,
@Cached("createMethodCall()") CallDispatchHeadNode callNode) {
return callNode.call(frame, n, "round_internal", null, ndigits);
return callNode.call(frame, n, "round_internal", ndigits);
}

}
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ public Object downto(VirtualFrame frame, Object from, Object to, DynamicObject b
downtoInternalCall = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return downtoInternalCall.call(frame, from, "downto_internal", block, to);
return downtoInternalCall.callWithBlock(frame, from, "downto_internal", block, to);
}

}
@@ -251,7 +251,7 @@ public Object upto(VirtualFrame frame, Object from, Object to, DynamicObject blo
uptoInternalCall = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return uptoInternalCall.call(frame, from, "upto_internal", block, to);
return uptoInternalCall.callWithBlock(frame, from, "upto_internal", block, to);
}

}
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ public DynamicObject procSpecial(VirtualFrame frame, DynamicObject procClass, Ob
Layouts.PROC.getBlock(block),
Layouts.PROC.getFrameOnStackMarker(block));

getInitializeNode().call(frame, proc, "initialize", block, args);
getInitializeNode().callWithBlock(frame, proc, "initialize", block, args);

return proc;
}
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ private Object eachInternal(VirtualFrame frame, DynamicObject range, DynamicObje
eachInternalCall = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return eachInternalCall.call(frame, range, "each_internal", block);
return eachInternalCall.callWithBlock(frame, range, "each_internal", block);
}

@Specialization(guards = "isLongRange(range)")
@@ -341,7 +341,7 @@ private Object stepInternal(VirtualFrame frame, DynamicObject range, Object step
stepInternalCall = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return stepInternalCall.call(frame, range, "step_internal", block, step);
return stepInternalCall.callWithBlock(frame, range, "step_internal", block, step);
}

@Specialization(guards = { "isIntRange(range)", "wasProvided(step)" })
@@ -447,7 +447,7 @@ public Object toA(VirtualFrame frame, DynamicObject range) {
toAInternalCall = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return toAInternalCall.call(frame, range, "to_a_internal", null);
return toAInternalCall.call(frame, range, "to_a_internal");
}

}
@@ -570,7 +570,7 @@ public Object objectRange(

final Object cmpResult;
try {
cmpResult = cmpNode.call(frame, begin, "<=>", null, end);
cmpResult = cmpNode.call(frame, begin, "<=>", end);
} catch (RaiseException e) {
throw new RaiseException(coreExceptions().argumentError("bad value for range", this));
}
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ protected DynamicObject[] executeChildren(VirtualFrame frame) {
DynamicObject[] values = new DynamicObject[children.length];
for (int i = 0; i < children.length; i++) {
final Object value = children[i].execute(frame);
values[i] = (DynamicObject) toS.call(frame, value, "to_s", null);
values[i] = (DynamicObject) toS.call(frame, value, "to_s");
}
return values;
}
Original file line number Diff line number Diff line change
@@ -322,7 +322,7 @@ public Object full(VirtualFrame frame, DynamicObject matchData) {
final Object fullTuple = newTupleNode.call(frame,
coreLibrary().getTupleClass(),
"create",
null, Layouts.MATCH_DATA.getBegin(matchData), Layouts.MATCH_DATA.getEnd(matchData));
Layouts.MATCH_DATA.getBegin(matchData), Layouts.MATCH_DATA.getEnd(matchData));

Layouts.MATCH_DATA.setFullTuple(matchData, fullTuple);

Original file line number Diff line number Diff line change
@@ -426,7 +426,7 @@ public Object match(VirtualFrame frame, DynamicObject regexp, DynamicObject symb
toSNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

return match(regexp, (DynamicObject) toSNode.call(frame, symbol, "to_s", null));
return match(regexp, (DynamicObject) toSNode.call(frame, symbol, "to_s"));
}

@Specialization(guards = "isNil(nil)")
@@ -563,7 +563,7 @@ public Object rubiniusNames(VirtualFrame frame, DynamicObject regexp) {
lookupTableWriteNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

final Object namesLookupTable = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new", null);
final Object namesLookupTable = newLookupTableNode.call(frame, coreLibrary().getLookupTableClass(), "new");

for (final Iterator<NameEntry> i = Layouts.REGEXP.getRegex(regexp).namedBackrefIterator(); i.hasNext();) {
final NameEntry e = i.next();
@@ -572,7 +572,7 @@ public Object rubiniusNames(VirtualFrame frame, DynamicObject regexp) {
final int[] backrefs = e.getBackRefs();
final DynamicObject backrefsRubyArray = Layouts.ARRAY.createArray(coreLibrary().getArrayFactory(), backrefs, backrefs.length);

lookupTableWriteNode.call(frame, namesLookupTable, "[]=", null, name, backrefsRubyArray);
lookupTableWriteNode.call(frame, namesLookupTable, "[]=", name, backrefsRubyArray);
}

setCachedNames(regexp, namesLookupTable);
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ public IOAllocatePrimitiveNode(RubyContext context, SourceSection sourceSection)

@Specialization
public DynamicObject allocate(VirtualFrame frame, DynamicObject classToAllocate) {
final DynamicObject buffer = (DynamicObject) newBufferNode.call(frame, coreLibrary().getInternalBufferClass(), "new", null);
final DynamicObject buffer = (DynamicObject) newBufferNode.call(frame, coreLibrary().getInternalBufferClass(), "new");
return allocateNode.allocate(classToAllocate, buffer, 0, 0, 0);
}

@@ -321,7 +321,7 @@ private void performReopen(DynamicObject self, DynamicObject target) {
public Object reopen(VirtualFrame frame, DynamicObject file, DynamicObject io) {
performReopen(file, io);

resetBufferingNode.call(frame, io, "reset_buffering", null);
resetBufferingNode.call(frame, io, "reset_buffering");

return nil();
}
@@ -372,7 +372,7 @@ public void performReopenPath(DynamicObject self, DynamicObject path, int mode)
public Object reopenPath(VirtualFrame frame, DynamicObject file, DynamicObject path, int mode) {
performReopenPath(file, path, mode);

resetBufferingNode.call(frame, file, "reset_buffering", null);
resetBufferingNode.call(frame, file, "reset_buffering");

return nil();
}
@@ -507,7 +507,7 @@ public IOClosePrimitiveNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public int close(VirtualFrame frame, DynamicObject io) {
ensureOpenNode.call(frame, io, "ensure_open", null);
ensureOpenNode.call(frame, io, "ensure_open");

final int fd = Layouts.IO.getDescriptor(io);

Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@ private Object concat(VirtualFrame frame, Object[] strings) {
assert RubyGuards.isRubyString(string);

if (builder == null) {
builder = (DynamicObject) dupNode.call(frame, string, "dup", null);
builder = (DynamicObject) dupNode.call(frame, string, "dup");
} else {
builder = appendNode.executeStringAppend(builder, (DynamicObject) string);
}
Original file line number Diff line number Diff line change
@@ -397,7 +397,7 @@ public Object compare(VirtualFrame frame, DynamicObject a, Object b) {
cmpNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

final Object cmpResult = cmpNode.call(frame, b, "<=>", null, a);
final Object cmpResult = cmpNode.call(frame, b, "<=>", a);

if (cmpResult == nil()) {
return nil();
@@ -457,7 +457,7 @@ public Object concat(
DynamicObject string,
Object other,
@Cached("createMethodCall()") CallDispatchHeadNode callNode) {
return callNode.call(frame, string, "concat_internal", null, other);
return callNode.call(frame, string, "concat_internal", other);
}

}
@@ -597,7 +597,7 @@ public Object slice2(VirtualFrame frame, DynamicObject string, DynamicObject mat
dupNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

throw new TaintResultNode.DoNotTaint(dupNode.call(frame, matchStr, "dup", null));
throw new TaintResultNode.DoNotTaint(dupNode.call(frame, matchStr, "dup"));
}

return nil();
@@ -1367,7 +1367,7 @@ public Object insertAppend(VirtualFrame frame, DynamicObject string, int index,
appendNode = insert(DispatchHeadNodeFactory.createMethodCall(getContext()));
}

appendNode.call(frame, string, "append", null, other);
appendNode.call(frame, string, "append", other);

return taintResultNode.maybeTaint(other, string);
}
@@ -1986,11 +1986,11 @@ public Object sum(VirtualFrame frame, DynamicObject string, long bits) {
if (bits >= 8 * 8) { // long size * bits in byte
Object sum = 0;
while (p < end) {
sum = addNode.call(frame, sum, "+", null, bytes[p++] & 0xff);
sum = addNode.call(frame, sum, "+", bytes[p++] & 0xff);
}
if (bits != 0) {
final Object mod = shiftNode.call(frame, 1, "<<", null, bits);
sum = andNode.call(frame, sum, "&", null, subNode.call(frame, mod, "-", null, 1));
final Object mod = shiftNode.call(frame, 1, "<<", bits);
sum = andNode.call(frame, sum, "&", subNode.call(frame, mod, "-", 1));
}
return sum;
} else {
@@ -2337,8 +2337,8 @@ public UpcaseNode(RubyContext context, SourceSection sourceSection) {

@Specialization
public Object upcase(VirtualFrame frame, DynamicObject string) {
final Object duped = dupNode.call(frame, string, "dup", null);
upcaseBangNode.call(frame, duped, "upcase!", null);
final Object duped = dupNode.call(frame, string, "dup");
upcaseBangNode.call(frame, duped, "upcase!");

return duped;
}
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ public Object callMethod(
Object name,
Object stringName,
boolean isIVar) {
return getCallNode().call(frame, receiver, stringName, null);
return getCallNode().call(frame, receiver, stringName);
}

@Specialization(guards = {
@@ -77,7 +77,7 @@ public Object index(
Object name,
Object stringName,
boolean isIVar) {
return getCallNode().call(frame, receiver, "[]", null, name);
return getCallNode().call(frame, receiver, "[]", name);
}

protected DoesRespondDispatchHeadNode getDefinedNode() {
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ public Object callMethod(
boolean isIVar,
Object value,
@Cached("createWriteMethodName(stringName)") String writeMethodName) {
return getCallNode().call(frame, receiver, writeMethodName, null, value);
return getCallNode().call(frame, receiver, writeMethodName, value);
}

// Workaround for DSL bug
@@ -91,7 +91,7 @@ public Object index(
boolean isIVar,
Object value,
@Cached("createWriteMethodName(stringName)") String writeMethodName) {
return getCallNode().call(frame, receiver, "[]=", null, name, value);
return getCallNode().call(frame, receiver, "[]=", name, value);
}

protected DoesRespondDispatchHeadNode getDefinedNode() {
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ public Object execute(VirtualFrame frame) {
callToHashNode = insert(CallDispatchHeadNode.createMethodCall());
}

final Object converted = callToHashNode.call(frame, lastArgument, "to_hash", null);
final Object converted = callToHashNode.call(frame, lastArgument, "to_hash");

if (RubyGuards.isRubyHash(converted)) {
RubyArguments.setArgument(frame, argumentCount - 1, converted);
Original file line number Diff line number Diff line change
@@ -102,7 +102,7 @@ private Object doMissingConstant(
constMissingNode = insert(createConstMissingNode());
}

return constMissingNode.call(frame, module, "const_missing", null, symbolName);
return constMissingNode.call(frame, module, "const_missing", symbolName);
}

@TruffleBoundary
Original file line number Diff line number Diff line change
@@ -42,18 +42,17 @@ public CallDispatchHeadNode(RubyContext context, boolean ignoreVisibility, Missi
super(context, ignoreVisibility, missingBehavior, DispatchAction.CALL_METHOD);
}

public Object call(
public Object call(VirtualFrame frame, Object receiver, Object method, Object... arguments) {
return dispatch(frame, receiver, method, null, arguments);
}

public Object callWithBlock(
VirtualFrame frame,
Object receiverObject,
Object methodName,
DynamicObject blockObject,
Object... argumentsObjects) {
return dispatch(
frame,
receiverObject,
methodName,
blockObject,
argumentsObjects);
Object receiver,
Object method,
DynamicObject block,
Object... arguments) {
return dispatch(frame, receiver, method, block, arguments);
}

public boolean callBoolean(
@@ -76,7 +75,7 @@ public double callFloat(
Object methodName,
DynamicObject blockObject,
Object... argumentsObjects) {
final Object value = call(frame, receiverObject, methodName, blockObject, argumentsObjects);
final Object value = dispatch(frame, receiverObject, methodName, blockObject, argumentsObjects);

if (value instanceof Double) {
return (double) value;
@@ -96,7 +95,7 @@ public long callLongFixnum(
Object methodName,
DynamicObject blockObject,
Object... argumentsObjects) {
final Object value = call(frame, receiverObject, methodName, blockObject, argumentsObjects);
final Object value = dispatch(frame, receiverObject, methodName, blockObject, argumentsObjects);

if (value instanceof Integer) {
return (int) value;
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ public Object execute(VirtualFrame frame) {
dispatchHead = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), ignoreVisibility));
}

return dispatchHead.call(frame, receiverObject, methodName, blockObject, argumentsObjects);
return dispatchHead.dispatch(frame, receiverObject, methodName, blockObject, argumentsObjects);
}

private DynamicObject executeBlock(VirtualFrame frame) {
@@ -209,7 +209,7 @@ private Object respondToMissing(VirtualFrame frame, Object receiverObject) {
respondToMissing = insert(DispatchHeadNodeFactory.createMethodCall(getContext(), true, MissingBehavior.RETURN_MISSING));
}
final DynamicObject method = getContext().getSymbolTable().getSymbol(methodName);
return respondToMissing.call(frame, receiverObject, "respond_to_missing?", null, method, false);
return respondToMissing.call(frame, receiverObject, "respond_to_missing?", method, false);
}

private boolean castRespondToMissingToBoolean(VirtualFrame frame, final Object r) {
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ public Object execute(VirtualFrame frame) {
return nil();
}

return getGetBacktraceNode().call(frame, lastException, "backtrace", null);
return getGetBacktraceNode().call(frame, lastException, "backtrace");
}

@Override
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ public Object execute(VirtualFrame frame) {

final Object newBacktrace = child.execute(frame);

getSetBacktraceNode().call(frame, lastException, "set_backtrace", null, newBacktrace);
getSetBacktraceNode().call(frame, lastException, "set_backtrace", newBacktrace);

return newBacktrace;
}
Original file line number Diff line number Diff line change
@@ -207,7 +207,7 @@ public boolean isFeatureLoaded(VirtualFrame frame, DynamicObject feature) {
private void addToLoadedFeatures(VirtualFrame frame, DynamicObject feature) {
final DynamicObject loadedFeatures = coreLibrary().getLoadedFeatures();
synchronized (getContext().getFeatureLoader().getLoadedFeaturesLock()) {
addToLoadedFeatures.call(frame, loadedFeatures, "<<", null, feature);
addToLoadedFeatures.call(frame, loadedFeatures, "<<", feature);
}
}

Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ public Object execute(VirtualFrame frame) {
1,
RubyArguments.getArgumentsCount(frame));

return getCallNode().call(frame, receiver, symbol, block, arguments);
return getCallNode().callWithBlock(frame, receiver, symbol, block, arguments);
}

private CallDispatchHeadNode getCallNode() {
Original file line number Diff line number Diff line change
@@ -111,7 +111,7 @@ private void callInherited(VirtualFrame frame, DynamicObject superClass, Dynamic
CompilerDirectives.transferToInterpreterAndInvalidate();
inheritedNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}
inheritedNode.call(frame, superClass, "inherited", null, childClass);
inheritedNode.call(frame, superClass, "inherited", childClass);
}

private RubyConstant lookupForExistingModule(VirtualFrame frame, String name, DynamicObject lexicalParent) {
Original file line number Diff line number Diff line change
@@ -91,7 +91,7 @@ private Object callMethodMissing(VirtualFrame frame, Object receiver, DynamicObj
CompilerDirectives.transferToInterpreterAndInvalidate();
callMethodMissingNode = insert(DispatchHeadNodeFactory.createMethodCallOnSelf(getContext()));
}
return callMethodMissingNode.call(frame, receiver, "method_missing", block, arguments);
return callMethodMissingNode.callWithBlock(frame, receiver, "method_missing", block, arguments);
}

}
Original file line number Diff line number Diff line change
@@ -77,8 +77,8 @@ public Object doOther(
@Cached("createMethodCall()") CallDispatchHeadNode denominatorCallNode,
@Cached("createMethodCall()") CallDispatchHeadNode toFCallNode) {
if (roundingMode instanceof RoundingMode && (boolean) isRationalSnippet.execute(frame, "value.is_a?(Rational)", "value", value)) {
final Object numerator = numeratorCallNode.call(frame, value, "numerator", null);
final Object denominator = denominatorCallNode.call(frame, value, "denominator", null);
final Object numerator = numeratorCallNode.call(frame, value, "numerator");
final Object denominator = denominatorCallNode.call(frame, value, "denominator");

final RubyRational rubyRationalValue = RubyRational.newRationalRaw(
getContext().getJRubyRuntime(),
@@ -96,7 +96,7 @@ public Object doOther(
throw e;
}
} else {
final Object result = toFCallNode.call(frame, value, "to_f", null);
final Object result = toFCallNode.call(frame, value, "to_f");

if (result != nil()) {
return new BigDecimal((double) result);
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ protected DynamicObject initializeBigDecimal(VirtualFrame frame, Object value, D
protected RoundingMode getRoundMode(VirtualFrame frame) {
return toRoundingMode(getRoundModeIntegerCast().executeCastInt(
// TODO (pitr 21-Jun-2015): read the actual constant
getRoundModeCall().call(frame, getBigDecimalClass(), "mode", null, 256)));
getRoundModeCall().call(frame, getBigDecimalClass(), "mode", 256)));
}

protected DynamicObject getBigDecimalClass() {
@@ -104,7 +104,7 @@ protected static int defaultDivisionPrecision(BigDecimal a, BigDecimal b, int li
}

protected int getLimit(VirtualFrame frame) {
return getLimitIntegerCast().executeCastInt(getLimitCall().call(frame, getBigDecimalClass(), "limit", null));
return getLimitIntegerCast().executeCastInt(getLimitCall().call(frame, getBigDecimalClass(), "limit"));
}

private CreateBigDecimalNode getCreateBigDecimal() {
Original file line number Diff line number Diff line change
@@ -324,7 +324,7 @@ public Object div(
throw new RaiseException(coreExceptions().zeroDivisionError(this));
} else {
final Object result = div(frame, a, b, 0);
return floorNode.call(frame, result, "floor", null);
return floorNode.call(frame, result, "floor");
}
}

@@ -521,7 +521,7 @@ public Object divmodSpecial(

if (negNormalProfile.profile(aType == BigDecimalType.POSITIVE_INFINITY || aType == BigDecimalType.NEGATIVE_INFINITY)) {
final int signA = aType == BigDecimalType.POSITIVE_INFINITY ? 1 : -1;
final int signB = Integer.signum(signIntegerCast.executeCastInt(signCall.call(frame, b, "sign", null)));
final int signB = Integer.signum(signIntegerCast.executeCastInt(signCall.call(frame, b, "sign")));
final int sign = signA * signB; // is between -1 and 1, 0 when nan

final BigDecimalType type = new BigDecimalType[]{ BigDecimalType.NEGATIVE_INFINITY, BigDecimalType.NAN, BigDecimalType.POSITIVE_INFINITY }[sign + 1];
Original file line number Diff line number Diff line change
@@ -64,7 +64,7 @@ public final DynamicObject executeCreate(VirtualFrame frame, Object value) {
return executeInitialize(
frame,
value,
(DynamicObject) allocateNode.call(frame, getBigDecimalClass(), "allocate", null),
(DynamicObject) allocateNode.call(frame, getBigDecimalClass(), "allocate"),
NotProvided.INSTANCE);
}

@@ -121,7 +121,7 @@ public DynamicObject createInfinity(

final boolean raise = booleanCastNode.executeBoolean(
frame,
modeCallNode.call(frame, getBigDecimalClass(), "boolean_mode", null, exceptionConstant));
modeCallNode.call(frame, getBigDecimalClass(), "boolean_mode", exceptionConstant));

if (raiseProfile.profile(raise)) {
throw new RaiseException(coreExceptions().floatDomainErrorResultsToInfinity(this));
@@ -148,7 +148,7 @@ public DynamicObject createNaN(

final boolean raise = booleanCastNode.executeBoolean(
frame,
modeCallNode.call(frame, getBigDecimalClass(), "boolean_mode", null, exceptionConstant));
modeCallNode.call(frame, getBigDecimalClass(), "boolean_mode", exceptionConstant));

if (raiseProfile.profile(raise)) {
throw new RaiseException(coreExceptions().floatDomainErrorResultsToNaN(this));
Original file line number Diff line number Diff line change
@@ -124,9 +124,9 @@ public DynamicObject initialize(
@Cached("createMethodCall()") CallDispatchHeadNode canonicalCallNode,
@Cached("createMethodCall()") CallDispatchHeadNode indentationCallNode) {
final DumperOptions options = new DumperOptions();
options.setWidth((int) lineWidthCallNode.call(frame, optionsSet, "line_width", null));
options.setCanonical((boolean) canonicalCallNode.call(frame, optionsSet, "canonical", null));
options.setIndent((int) indentationCallNode.call(frame, optionsSet, "indentation", null));
options.setWidth((int) lineWidthCallNode.call(frame, optionsSet, "line_width"));
options.setCanonical((boolean) canonicalCallNode.call(frame, optionsSet, "canonical"));
options.setIndent((int) indentationCallNode.call(frame, optionsSet, "indentation"));
Layouts.PSYCH_EMITTER.setOptions(emitter, options);
Layouts.PSYCH_EMITTER.setIo(emitter, io);
return nil();
Original file line number Diff line number Diff line change
@@ -187,7 +187,7 @@ public Object parse(

try {
if (isNil(path) && respondToPathNode.doesRespondTo(frame, "path", yaml)) {
path = (DynamicObject) callPathNode.call(frame, yaml, "path", null);
path = (DynamicObject) callPathNode.call(frame, yaml, "path");
}

final Object handler = readHandlerNode.execute(parserObject);
@@ -196,7 +196,7 @@ public Object parse(
Event event = parser.getEvent();

if (event.is(Event.ID.StreamStart)) {
callStartStreamNode.call(frame, handler, "start_stream", null, YAMLEncoding.YAML_ANY_ENCODING.ordinal());
callStartStreamNode.call(frame, handler, "start_stream", YAMLEncoding.YAML_ANY_ENCODING.ordinal());
} else if (event.is(Event.ID.DocumentStart)) {
final DocumentStartEvent startEvent = (DocumentStartEvent) event;

@@ -229,15 +229,15 @@ public Object parse(
}

Object notExplicit = !startEvent.getExplicit();
callStartDocumentNode.call(frame, handler, "start_document", null, versionArray, tags, notExplicit);
callStartDocumentNode.call(frame, handler, "start_document", versionArray, tags, notExplicit);
} else if (event.is(Event.ID.DocumentEnd)) {
final DocumentEndEvent endEvent = (DocumentEndEvent) event;
Object notExplicit = !endEvent.getExplicit();
callEndDocumentNode.call(frame, handler, "end_document", null, notExplicit);
callEndDocumentNode.call(frame, handler, "end_document", notExplicit);
} else if (event.is(Event.ID.Alias)) {
final AliasEvent aliasEvent = (AliasEvent) event;
Object alias = stringOrNilFor(aliasEvent.getAnchor(), tainted, taintNode);
callAliasNode.call(frame, handler, "alias", null, alias);
callAliasNode.call(frame, handler, "alias", alias);
} else if (event.is(Event.ID.Scalar)) {
final ScalarEvent scalarEvent = (ScalarEvent) event;

@@ -248,8 +248,8 @@ public Object parse(
Object style = translateStyle(scalarEvent.getStyle());
Object val = stringFor(scalarEvent.getValue(), tainted, taintNode);

callScalarNode.call(frame, handler, "scalar", null, val, anchor, tag, plain_implicit,
quoted_implicit, style);
callScalarNode.call(frame, handler, "scalar", val, anchor, tag, plain_implicit, quoted_implicit,
style);
} else if (event.is(Event.ID.SequenceStart)) {
final SequenceStartEvent sequenceStartEvent = (SequenceStartEvent) event;

@@ -258,9 +258,9 @@ public Object parse(
Object implicit = sequenceStartEvent.getImplicit();
Object style = translateFlowStyle(sequenceStartEvent.getFlowStyle());

callStartSequenceNode.call(frame, handler, "start_sequence", null, anchor, tag, implicit, style);
callStartSequenceNode.call(frame, handler, "start_sequence", anchor, tag, implicit, style);
} else if (event.is(Event.ID.SequenceEnd)) {
callEndSequenceNode.call(frame, handler, "end_sequence", null);
callEndSequenceNode.call(frame, handler, "end_sequence");
} else if (event.is(Event.ID.MappingStart)) {
final MappingStartEvent mappingStartEvent = (MappingStartEvent) event;

@@ -269,11 +269,11 @@ public Object parse(
Object implicit = mappingStartEvent.getImplicit();
Object style = translateFlowStyle(mappingStartEvent.getFlowStyle());

callStartMappingNode.call(frame, handler, "start_mapping", null, anchor, tag, implicit, style);
callStartMappingNode.call(frame, handler, "start_mapping", anchor, tag, implicit, style);
} else if (event.is(Event.ID.MappingEnd)) {
callEndMappingNode.call(frame, handler, "end_mapping", null);
callEndMappingNode.call(frame, handler, "end_mapping");
} else if (event.is(Event.ID.StreamEnd)) {
callEndStreamNode.call(frame, handler, "end_stream", null);
callEndStreamNode.call(frame, handler, "end_stream");
break;
}
}

0 comments on commit ca2ae66

Please sign in to comment.