[JDK8] RFR (XS): JSR292: IncompatibleClassChangeError in LambdaForm for CharSequence.toString() method handle type converter
christian.thalinger at oracle.com
Wed Jan 15 17:51:09 UTC 2014
[I’m resending something I sent earlier today to Vladimir directly.]
On Jan 15, 2014, at 7:31 AM, Vladimir Ivanov <vladimir.x.ivanov at oracle.com> wrote:
> InvokeBytecodeGenerator can produce incorrect bytecode for a LambdaForm
> when invoking a method from Object declared in an interface.
> The problem is the following:
> (1) java.lang.CharSequence interface declares abstract method "String
> (2) after 8014013 fix, VM resolves
> CharSequence::toString()/invokeInterface to
Without having looked at the changes of 8014013, why did the invoke type change? Is it an optimization that was added?
> (3) during LambdaForm compilation, CharSequence is considered
> statically invocable (see
> InvokeBytecodeGenerator::isStaticallyInvocable) and invokevirtual for
> CharSequence::toString() is issued, which is wrong (invokevirtual throws
> ICCE if it references an interface);
> The fix is straightforward: during LambdaForm compilation, switch back
> from invokevirtual to invokeinterface instruction when invoking a method
> on an interface.
I find this risky. Right now MemberName is only used in a couple places in java.lang.invoke but in the future it might be used for other things (e.g. java.lang.reflect). The information MemberName contains should be correct and usable without changing. Otherwise all users have to patch the information the same way as you do in your patch.
I would like to see the VM passing correct information (whatever the definition of correct is here).
> The fix is targeted for 8. Will be also integrated into 9.
> Testing: regression test, jdk/test/java/lang/invoke, vm.mlvm.testlist,
> nashorn, jruby.
> Best regards,
> Vladimir Ivanov
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
More information about the core-libs-dev