Skip to content
Snippets Groups Projects
Commit 2bc503b2 authored by Tomas Stupka's avatar Tomas Stupka
Browse files

always encapsulate arguments when creating internalDispatchCall in RCallNode

parent 336c0120
No related branches found
No related tags found
No related merge requests found
......@@ -306,17 +306,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS
try {
boolean isFieldAccess = builtin.isFieldAccess();
if (internalDispatchCall == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
AlteredArguments alteredArguments = null;
if (isFieldAccess) {
RSyntaxNode[] newArgs = Arrays.copyOf(arguments, arguments.length);
newArgs[1] = RContext.getASTBuilder().constant(newArgs[1].getSourceSection(), CallUtils.unevaluatedArgAsFieldName(this, newArgs[1]));
// we know that there are no varargs in the signature, but this RCallNode
// instance could have been confused by lookup of "..." as the field, in which
// case it would think it should lookup varargs.
alteredArguments = new AlteredArguments(newArgs, new int[0]);
}
internalDispatchCall = insert(FunctionDispatchNodeGen.create(this, alteredArguments, false, slot));
createInternDispatchCall(isFieldAccess, slot);
}
if (isAttributableProfile.profile(dispatchObject instanceof RAttributeStorage) && isS4Profile.profile(((RAttributeStorage) dispatchObject).isS4())) {
......@@ -348,8 +338,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS
resultFunction = function;
}
if (internalDispatchCall == null || internalDispatchCall.tempFrameSlot != slot) {
CompilerDirectives.transferToInterpreterAndInvalidate();
internalDispatchCall = insert(FunctionDispatchNodeGen.create(this, false, slot));
createInternDispatchCall(isFieldAccess, slot);
}
return internalDispatchCall.execute(frame, resultFunction, lookupVarArgs(frame, isFieldAccess), s3Args, null);
} finally {
......@@ -357,6 +346,20 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS
}
}
private void createInternDispatchCall(boolean isFieldAccess, FrameSlot slot) {
CompilerDirectives.transferToInterpreterAndInvalidate();
AlteredArguments alteredArguments = null;
if (isFieldAccess) {
RSyntaxNode[] newArgs = Arrays.copyOf(arguments, arguments.length);
newArgs[1] = RContext.getASTBuilder().constant(newArgs[1].getSourceSection(), CallUtils.unevaluatedArgAsFieldName(this, newArgs[1]));
// we know that there are no varargs in the signature, but this RCallNode
// instance could have been confused by lookup of "..." as the field, in which
// case it would think it should lookup varargs.
alteredArguments = new AlteredArguments(newArgs, new int[0]);
}
internalDispatchCall = insert(FunctionDispatchNodeGen.create(this, alteredArguments, false, slot));
}
@Specialization(guards = {"explicitArgs != null", "isInternalGenericDispatch(function)"})
public Object callInternalGenericExplicit(VirtualFrame frame, RFunction function,
@Cached("create()") ClassHierarchyNode classHierarchyNode,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment