JDK-8022574 : remove HaltNode code after uncommon trap calls
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: hs25,8,9,10,11,15
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2013-08-07
  • Updated: 2022-02-06
  • Resolved: 2020-05-12
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 11 JDK 13 JDK 15
11.0.10-oracleFixed 13.0.4Fixed 15 b23Fixed
Related Reports
Relates :  
Relates :  
Description
On x86 the usual uncommon trap code looks like this:

  0x000000010598efb6: mov    $0xffffffad,%esi
  0x000000010598efbb: callq  0x0000000105965f20  ; OopMap{rbp=Oop [0]=Oop off=64}
                                                ;*if_acmpne
                                                ; - java.lang.Object::equals@2 (line 149)
                                                ;   {runtime_call}
  0x000000010598efc0: callq  0x00000001048e2834  ;   {runtime_call}

The first call is to the uncommon trap blob.  The second one comes from the HaltNode basically putting verification code there to make sure we are not returning from the deopt blob.  We don't need in a product build.

The Halt node is matched in the .ad files to int3 of the MacroAssembler.

A possible fix would be to change the implementation of MacroAssembler::int3 in all assembler_<os>_x86.cpp files.  But that might break some other uses of int3.
Comments
Fix request (13u): I would like to backport this fix to 13u as a followup for JDK-8225653. The original change applies cleanly.
08-06-2020

The review for the 11u downport can be found here: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-May/003160.html
25-05-2020

Fix Request (11u). This patch avoids generating code for Halt nodes when they are unreachable, e.g., immediately after an uncommon trap. Applies cleanly except for a small change to arm.ad. Webrev http://cr.openjdk.java.net/~phh/8022574/webrev.11u.00/ This is the third and final backport in a series starting with JDK-8225653 and continuing through JDK-8231720.
23-05-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/08fda454c3df User: simonis Date: 2020-05-12 09:02:40 +0000
12-05-2020

aarch64 before: 0x0000ffffb106193c: bl 0x0000ffffb1035000 ; ImmutableOopMap {} ;*getstatic UNSAFE {reexecute=1 rethrow=0 return_oop=0} ; - (reexecute) java.lang.invoke.MethodHandle::<clinit>@16 (line 1758) ; {runtime_call UncommonTrapBlob} 0x0000ffffb1061940: dcps1 #0xdeae ;*getstatic UNSAFE {reexecute=0 rethrow=0 return_oop=0} ; - java.lang.invoke.MethodHandle::<clinit>@16 (line 1758) After: 0x0000ffff9906193c: bl 0x0000ffff99035000 ; ImmutableOopMap {} ;*getstatic UNSAFE {reexecute=1 rethrow=0 return_oop=0} ; - (reexecute) java.lang.invoke.MethodHandle::<clinit>@16 (line 1758) ; {runtime_call UncommonTrapBlob} each Uncommon_trap save 1 instruction, or 4 bytes.
07-05-2020

before the change: HaltNode expands to 4 instrucitons for x86_64. 0x00007fc81d038f23: callq 0x00007fc81d111cc0 ; ImmutableOopMap {rbp=Oop [0]=Oop } ;*invokestatic parseBoolean {reexecute=0 rethrow=0 return_oop=0} ; - java.lang.invoke.MethodHandleStatics::<clinit>@16 (line 62) ; {runtime_call UncommonTrapBlob} 0x00007fc81d038f28: movabs $0x7fc826ccf9a8,%rdi ; {external_word} 0x00007fc81d038f32: and $0xfffffffffffffff0,%rsp 0x00007fc81d038f36: callq 0x00007fc826490970 ; {runtime_call MacroAssembler::debug64(char*, long, long*)} 0x00007fc81d038f3b: hlt ;*invokestatic parseBoolean {reexecute=0 rethrow=0 return_oop=0} ; - java.lang.invoke.MethodHandleStatics::<clinit>@16 (line 62) ;; B11: # out( B4 B12 ) <- in( B3 ) Freq: 0.000999966 0x00007f1ea1038f3c: mov 0x70(%rbp),%r10d after the change: 0x00007fb67d06969b: callq 0x00007fb67d048d80 ; ImmutableOopMap {rbp=Oop [0]=Oop } ;*invokestatic parseBoolean {reexecute=0 rethrow=0 return_oop=0} ; - java.lang.invoke.MethodHandleStatics::<clinit>@16 (line 62) ; {runtime_call UncommonTrapBlob} it can save 4 instructions, or 20bytes for the HaltNode expansion. it's not easy to do statistics for Uncommon Trap using the release build, For a debug build, It will generate up to 11k uncommon trap calls even for a trivial -version. java -Xcomp -XX:-TieredCompilation -XX:+TraceOptoParse -version |& grep "Uncommon trap" | wc -l 10982
06-05-2020

8-pool is an invalid affects version. Set 8 and hs25.
12-11-2013