JDK-8280901 : MethodHandle::linkToNative stub is missing w/ -Xint
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 16,17,18,19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-01-28
  • Updated: 2022-04-04
  • Resolved: 2022-02-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17 JDK 18 JDK 19
17.0.4-oracleFixed 18.0.2Fixed 19 b12Fixed
Related Reports
Relates :  
Description
Lots of java/foreign testd crash when run in -Xint. For example, this one:

$ CONF=linux-x86_64-server-fastdebug make run-test TEST=java/foreign/TestDowncall.java TEST_VM_OPTS="-Xint"

STDOUT:
STDERR:

TEST RESULT: Failed. Unexpected exit from test [exit code: 139]
--------------------------------------------------

The crash produces no hs_err, and debugging is quite complicated, but I think the crash is somewhere within C2I adapter for LJJL shape.

AHE@0x00007fb9a0486750: 0xbbebeb i2c: 0x00007fb995284ee0 c2i: 0x00007fb995284fcc c2iUV: 0x00007fb995284f96 c2iNCI: 0x00007fb995285009
i2c argument handler #218 for: LJJL 0xbbebeb (606 bytes generated)
c2i argument handler starts at 0x7fb995284fcc

  0x00007fb9952850f6:   popfq  
  0x00007fb9952850f7:   mov    %r13,%rsp
  0x00007fb9952850fa:   pop    %rax
  0x00007fb9952850fb:   mov    %rsp,%r13
  0x00007fb9952850fe:   sub    $0x40,%rsp
  0x00007fb995285102:   mov    %rax,(%rsp) ;<---- somewhere here
  0x00007fb995285106:   mov    %rsi,0x30(%rsp)
  0x00007fb99528510b:   movabs $0xdeadffffdeadaaab,%rax
  0x00007fb995285115:   mov    %rax,0x28(%rsp)

Reading the code, I stumbled upon:

address MethodHandles::generate_method_handle_interpreter_entry(MacroAssembler* _masm,
                                                                vmIntrinsics::ID iid) {
...
  // No need in interpreter entry for linkToNative for now.
  // Interpreter calls compiled entry through i2c.
  if (iid == vmIntrinsics::_linkToNative) {
    __ hlt();
    return NULL;
  }
...
}

I wonder if that is too optimistic when no compilers present?
Comments
A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk17u-dev/pull/311 Date: 2022-03-30 10:42:31 +0000
30-03-2022

Fix Request (17u): Should get backported for parity with 17.0.4-oracle. Applies cleanly. Test has passed.
30-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk18u/pull/71 Date: 2022-03-29 15:31:52 +0000
29-03-2022

Fix Request (JDK 18u) Fixes a crash due to a missing stub. The fix is low risk and applies cleanly. Already tested and about to be backported to Oracle JDK 17u. Tier 1-3 testing is running for JDK 18u.
29-03-2022

Changeset: f86f38a8 Author: Vladimir Ivanov <vlivanov@openjdk.org> Date: 2022-02-23 20:29:23 +0000 URL: https://git.openjdk.java.net/jdk/commit/f86f38a8afd31c76039206f8f1f33371ad814396
23-02-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7459 Date: 2022-02-14 13:40:32 +0000
14-02-2022

ILW = Multiple foreign tests crash when run with -Xint, low? only seen with -Xint when no compilers are present, run with compilers (remove -Xint) = HLL = P4
02-02-2022