-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Describe the issue
Regression from 23.0.6 to 23.0.10: ArrayIndexOutOfBoundsException in HostExecuteNode doOverloadedCached (truffle-api) - possibly when var args method is invoked with 0 args.
Steps to reproduce the issue
The class UriBuilder has two methods which are similar
javax.ws.rs.core.UriBuilder.build(Object[], boolean)
and
javax.ws.rs.core.UriBuilder.build(Object...)
My script does.
UriBuilder.fromUri('http://localhost').build();
so I am invoking the second method, which yields ArrayIndexOutOfBoundsException (see details).
Describe GraalVM and your environment:
truffle-api and graal 23.0.10
More details
In this method com.oracle.truffle.host.HostExecuteNode.doOverloadedCached()
And this section:
int parameterCount = cachedArgTypes.length;
if (overload.isVarArgs()) {
seenVargArgs.enter(node);
Class<?> varArgParamType = overload.getParameterTypes()[parameterCount - 1];
asVarArgs = !HostToTypeNode.canConvert(node, args[parameterCount - 1], varArgParamType,
overload.getGenericParameterTypes()[parameterCount - 1],
null, hostContext, HostToTypeNode.COERCE,
varArgsMappingInterop, varArgsMappingNode);
} else {
asVarArgs = false;
}
parameterCount is 0 and the line
Class<?> varArgParamType = overload.getParameterTypes()[parameterCount - 1];
runs into ArrayIndexOutOfBoundsException with message "Index -1 out of bounds for length 1".
overload.parameterTypes holds an array [class [Ljava.lang.Object;].
This "used to work" with 23.0.6.