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
Branches
No related tags found
No related merge requests found
...@@ -306,17 +306,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS ...@@ -306,17 +306,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS
try { try {
boolean isFieldAccess = builtin.isFieldAccess(); boolean isFieldAccess = builtin.isFieldAccess();
if (internalDispatchCall == null) { if (internalDispatchCall == null) {
CompilerDirectives.transferToInterpreterAndInvalidate(); createInternDispatchCall(isFieldAccess, slot);
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));
} }
if (isAttributableProfile.profile(dispatchObject instanceof RAttributeStorage) && isS4Profile.profile(((RAttributeStorage) dispatchObject).isS4())) { if (isAttributableProfile.profile(dispatchObject instanceof RAttributeStorage) && isS4Profile.profile(((RAttributeStorage) dispatchObject).isS4())) {
...@@ -348,8 +338,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS ...@@ -348,8 +338,7 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS
resultFunction = function; resultFunction = function;
} }
if (internalDispatchCall == null || internalDispatchCall.tempFrameSlot != slot) { if (internalDispatchCall == null || internalDispatchCall.tempFrameSlot != slot) {
CompilerDirectives.transferToInterpreterAndInvalidate(); createInternDispatchCall(isFieldAccess, slot);
internalDispatchCall = insert(FunctionDispatchNodeGen.create(this, false, slot));
} }
return internalDispatchCall.execute(frame, resultFunction, lookupVarArgs(frame, isFieldAccess), s3Args, null); return internalDispatchCall.execute(frame, resultFunction, lookupVarArgs(frame, isFieldAccess), s3Args, null);
} finally { } finally {
...@@ -357,6 +346,20 @@ public abstract class RCallNode extends RCallBaseNode implements RSyntaxNode, RS ...@@ -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)"}) @Specialization(guards = {"explicitArgs != null", "isInternalGenericDispatch(function)"})
public Object callInternalGenericExplicit(VirtualFrame frame, RFunction function, public Object callInternalGenericExplicit(VirtualFrame frame, RFunction function,
@Cached("create()") ClassHierarchyNode classHierarchyNode, @Cached("create()") ClassHierarchyNode classHierarchyNode,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment