8178480: Wrong exception being thrown on an invalid MethodType

Reviewed-by: psandoz
This commit is contained in:
Claes Redestad 2017-04-11 22:32:49 +02:00
parent 864cf0d5ca
commit 3b47209a32
2 changed files with 8 additions and 5 deletions

View File

@ -673,9 +673,7 @@ class InvokerBytecodeGenerator {
/**
* Generate customized bytecode for a given LambdaForm.
*/
static MemberName generateCustomizedCode(LambdaForm form) {
final MethodType invokerType = form.methodType();
static MemberName generateCustomizedCode(LambdaForm form, MethodType invokerType) {
MemberName pregenerated = lookupPregenerated(form, invokerType);
if (pregenerated != null) return pregenerated; // pre-generated bytecode

View File

@ -847,9 +847,14 @@ class LambdaForm {
if (vmentry != null && isCompiled) {
return; // already compiled somehow
}
assert(vmentry == null || vmentry.getMethodType().basicType().equals(methodType()));
// Obtain the invoker MethodType outside of the following try block.
// This ensures that an IllegalArgumentException is directly thrown if the
// type would have 256 or more parameters
MethodType invokerType = methodType();
assert(vmentry == null || vmentry.getMethodType().basicType().equals(invokerType));
try {
vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this);
vmentry = InvokerBytecodeGenerator.generateCustomizedCode(this, invokerType);
if (TRACE_INTERPRETER)
traceInterpreter("compileToBytecode", this);
isCompiled = true;