[foreign-abi] RFR: 8256080: AArch64: fatal error with unexpected intrinsic id _linkToNative

Nick Gasson ngasson at openjdk.java.net
Wed Nov 11 06:19:07 UTC 2020


On Tue, 10 Nov 2020 21:12:21 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Thanks for this! I'm currently testing the patch. One thing I noted is that this PR has been filed against the `foreign-jextract` branch and not the `foreign-abi` one which would be more appropriate.
>
> The following tests seem to fail:
> 
> * java/foreign/TestUpcallHighArity.java
> * java/foreign/TestIntrinsics.java
> * java/foreign/StdLibTest.java
> * java/foreign/stackwalk/TestStackWalk.java
> 
> The last three of them fail with a crash:
> 
> #
> # A fatal error has been detected by the Java Runtime Environment:
> #
> #  Internal Error (doCall.cpp:662), pid=6557, tid=6572
> #  guarantee(failing()) failed: call failed to generate:  calls should work
> #
> # JRE version: Java(TM) SE Runtime Environment (16.0) (build 16-internal+0-2020-11-10-1203454.maurizio.cimadamore.dev)
> # Java VM: Java HotSpot(TM) 64-Bit Server VM (16-internal+0-2020-11-10-1203454.maurizio.cimadamore.dev, mixed mode, tiered, compressed oops, g1 gc, linux-aarch64)
> # Problematic frame:
> # V  [libjvm.so+0x5ee0ec]  Parse::do_call()+0x72c
> #
> `TestHighArity` seems to fail because of a bad method handle adaptation. I believe in all cases the problem is related with the specialization and intrinsifics support.
> 
> Let me know what you want to do; I'm ok to approve these changes as is (as they obviously make the world a lot better) and fix the other issues as followup - or wait until we have fixes for these tests as well.

I've changed the target branch to `foreign-abi`.

@JornVernee the stack trace looks like this:

V  [libjvm.so+0xeed41c]  MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler*, vmIntrinsics::ID)+0x290
V  [libjvm.so+0xee4edc]  MethodHandlesAdapterGenerator::generate()+0x68
V  [libjvm.so+0xee4e30]  MethodHandles::generate_adapters()+0x130
V  [libjvm.so+0xab6954]  init_globals()+0xe4
V  [libjvm.so+0x121b424]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x34c
V  [libjvm.so+0xbd1120]  JNI_CreateJavaVM_inner(JavaVM_**, void**, void*)+0x100
V  [libjvm.so+0xbd1408]  JNI_CreateJavaVM+0x2c

`MethodHandlesAdapterGenerator::generate()` calls `MethodHandles::generate_method_handle_interpreter_entry()` once for each intrinsic ID. (I think the second change in `methodHandles_aarch64.cpp` is perhaps not strictly necessary.)

@mcimadamore The C2 crash should be fixed with the extra commit I pushed just now. We need to call `C->record_failure(..)` if the native invoker is not implemented otherwise a C2 assertion fails later.

TestIntrinsics.java was crashing because the `CallNative` opcode is not implemented. I've restricted this test to just x86 for now.

The failure of TestUpcallHighArity.java seems unrelated to linkToNative and this PR - I'll look at that separately.

-------------

PR: https://git.openjdk.java.net/panama-foreign/pull/391


More information about the panama-dev mailing list