diff options
author | jfrijters <jfrijters> | 2014-07-01 19:04:06 +0400 |
---|---|---|
committer | jfrijters <jfrijters> | 2014-07-01 19:04:06 +0400 |
commit | 3315d085eafe00dcfaae4120bce2b63a39dc07d9 (patch) | |
tree | 0a8c78ec3b260bd76657eb84b07e121bb8cbac76 | |
parent | 021ca974f9a23b87c36f46039d1caaf106bda980 (diff) |
Bug fix. If an invokedynamic bootstrap argument conversion fails, the exception should not be wrapped in BootstrapMethodError.
-rw-r--r-- | runtime/compiler.cs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/runtime/compiler.cs b/runtime/compiler.cs index 4d4000c4..650f166d 100644 --- a/runtime/compiler.cs +++ b/runtime/compiler.cs @@ -3088,7 +3088,7 @@ sealed class Compiler parameters[2].EmitConvStackTypeToSignatureType(ilgen, CoreClasses.java.lang.invoke.MethodType.Wrapper); for (int i = 0; i < fixedArgs; i++) { - EmitExtraArg(compiler, ilgen, bsm, i, parameters[i + 3]); + EmitExtraArg(compiler, ilgen, bsm, i, parameters[i + 3], ok); } if (varArgs >= 0) { @@ -3099,7 +3099,7 @@ sealed class Compiler { ilgen.Emit(OpCodes.Dup); ilgen.EmitLdc_I4(i); - EmitExtraArg(compiler, ilgen, bsm, i + fixedArgs, elemType); + EmitExtraArg(compiler, ilgen, bsm, i + fixedArgs, elemType, ok); ilgen.Emit(OpCodes.Stelem_Ref); } } @@ -3116,7 +3116,7 @@ sealed class Compiler return true; } - private static void EmitExtraArg(Compiler compiler, CodeEmitter ilgen, ClassFile.BootstrapMethod bsm, int index, TypeWrapper targetType) + private static void EmitExtraArg(Compiler compiler, CodeEmitter ilgen, ClassFile.BootstrapMethod bsm, int index, TypeWrapper targetType, CodeEmitterLocal wrapException) { int constant = bsm.GetArgument(index); compiler.EmitLoadConstant(ilgen, constant); @@ -3152,6 +3152,8 @@ sealed class Compiler } if (constType != targetType) { + ilgen.EmitLdc_I4(1); + ilgen.Emit(OpCodes.Stloc, wrapException); if (constType.IsPrimitive) { string dummy; @@ -3170,6 +3172,8 @@ sealed class Compiler ilgen.Emit(OpCodes.Castclass, targetType.TypeAsBaseType); } targetType.EmitConvStackTypeToSignatureType(ilgen, targetType); + ilgen.EmitLdc_I4(0); + ilgen.Emit(OpCodes.Stloc, wrapException); } } |