RFR: 8365047: Remove exception handler stub code in C2 [v7]

Martin Doerr mdoerr at openjdk.org
Wed Oct 15 14:03:14 UTC 2025


On Mon, 13 Oct 2025 11:45:02 GMT, Ruben <duke at openjdk.org> wrote:

>> The C2 exception handler stub code is only a trampoline to the generated exception handler blob. This change removes the extra step on the way to the generated blob.
>> 
>> According to some comments in the source code, the exception handler stub code used to be patched upon deoptimization, however presumably these comments are outdated as the patching upon deoptimization happens for post-call NOPs only.
>
> Ruben has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 10 commits:
> 
>  - Merge from the main branch
>  - Address review comments
>  - Address review comments
>  - Address review comments
>  - The patch is contributed by @TheRealMDoerr
>  - Offset the deoptimization handler entry point
>    
>    Change-Id: I596317ec6a364b341e4642636fa5cf08f87ed722
>  - Revert "Ensure stub code is not adjacent to a call"
>  - Ensure stub code is not adjacent to a call
>  - Address review comments
>  - 8365047: Remove exception handler stub code in C2
>    
>    The C2 exception handler stub code is only a trampoline to the
>    generated exception handler blob. This change removes the extra
>    step on the way to the generated blob.
>    
>    According to some comments in the source code, the exception handler
>    stub code used to be patched upon deoptimization, however presumably
>    these comments are outdated as the patching upon deoptimization happens
>    for post-call NOPs only.

One probably related issue on linuxaarch64 while testing "gc/epsilon/TestObjects.java":
SIGSEGV in caller_is_deopted:

Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x5531b8]  caller_is_deopted(JavaThread*)+0x2f8  (nativeInst_aarch64.hpp:536)
V  [libjvm.so+0x555000]  Runtime1::move_mirror_patching(JavaThread*)+0x20  (c1_Runtime1.cpp:1400)
v  ~RuntimeStub::C1 Runtime load_mirror_patching_blob 0x0000f7cf038f316c



R0 =0x00000000f001cee8 is an oop: java.util.HashMap 
{0x00000000f001cee8} - klass: 'java/util/HashMap' - flags: is_cloneable_fast 
 - ---- fields (total size 5 words):
 - transient 'keySet' 'Ljava/util/Set;' @8  null (0x00000000)
 - transient 'values' 'Ljava/util/Collection;' @12  null (0x00000000)
 - transient 'table' '[Ljava/util/HashMap$Node;' @16  a 'java/util/HashMap$Node'[128] {0x00000000f001cf10} (0xf001cf10)
 - transient 'entrySet' 'Ljava/util/Set;' @20  null (0x00000000)
 - transient 'size' 'I' @24  60 (0x0000003c)
 - transient 'modCount' 'I' @28  60 (0x0000003c)
 - 'threshold' 'I' @32  96 (0x00000060)
 - final 'loadFactor' 'F' @36  0.750000 (0x3f400000)
R1 =0x0000001fd503201f is an unknown value
R2 =0x0000f7cf03c5fffc is at entry_point+276 in (nmethod*)0x0000f7cf03c5fdc8
Compiled method (c1) 5966 2946       1       java.util.HashMap::values (25 bytes)
 total in heap  [0x0000f7cf03c5fdc8,0x0000f7cf03c60000] = 568
 main code      [0x0000f7cf03c5fec0,0x0000f7cf03c5ffd0] = 272
 stub code      [0x0000f7cf03c5ffd0,0x0000f7cf03c60000] = 48
 mutable data [0x0000f7ced888a580,0x0000f7ced888a5c0] = 64
 relocation     [0x0000f7ced888a580,0x0000f7ced888a5b0] = 48
 metadata       [0x0000f7ced888a5b0,0x0000f7ced888a5c0] = 16
 immutable data [0x0000f7ced888a500,0x0000f7ced888a578] = 120
 dependencies   [0x0000f7ced888a500,0x0000f7ced888a508] = 8
 scopes pcs     [0x0000f7ced888a508,0x0000f7ced888a558] = 80
 scopes data    [0x0000f7ced888a558,0x0000f7ced888a570] = 24
 speculations   [0x0000f7ced888a570,0x0000f7ced888a574] = 4
0x0000f7cf03c5fff8:   62 74 ef 17 ff ff ff 17 
--------------------------------------------------------------------------------
  0x0000f7cf03c5fff8:   b	0x0000f7cf0383d180
  0x0000f7cf03c5fffc:   b	0x0000f7cf03c5fff8
--------------------------------------------------------------------------------
R3 =0x0000f7cf03817578 points into unknown readable memory: 0x0000000000000000 | 00 00 00 00 00 00 00 00
R4 =0x0000f7cf038f3040 points into unknown readable memory: 0x0000000100000008 | 08 00 00 00 01 00 00 00
R5 =0x0000f7cf14430000 points into unknown readable memory: 0x0706050403020100 | 00 01 02 03 04 05 06 07
R6 =0x0000000000000006 is an unknown value
R7 =0x000000000000016c is an unknown value
R8 =0x0000f7cf1484ca18 is pointing into the stack for thread: 0x0000f7cf100305c0
R9 =0x0 is null
R10=0x0000f7cf1484c140 is pointing into the stack for thread: 0x0000f7cf100305c0
R11=0x000000000000003d is an unknown value
R12=0x000000000000003c is an unknown value
R13=0x0000f7cf1484ca60 is pointing into the stack for thread: 0x0000f7cf100305c0
R14=0x0000000000000008 is an unknown value
R15=0x0000f7cf15ef5ed9: <offset 0x00000000015c5ed9> in /testee-vm/lib/server/libjvm.so at 0x0000f7cf14930000
R16=0x0000000000000001 is an unknown value
R17=0x0000f7cf1602a6f4: __pthread_mutex_unlock+0x0000000000000000 in /lib/aarch64-linux-gnu/libc.so.6 at 0x0000f7cf15fa0000
R18=0x0000f7cf15ef5e01: <offset 0x00000000015c5e01> in /testee-vm/lib/server/libjvm.so at 0x0000f7cf14930000
R19=0x0000f7cf03c5fffc is at entry_point+276 in (nmethod*)0x0000f7cf03c5fdc8
Compiled method (c1) 5973 2946       1       java.util.HashMap::values (25 bytes)
 total in heap  [0x0000f7cf03c5fdc8,0x0000f7cf03c60000] = 568
 main code      [0x0000f7cf03c5fec0,0x0000f7cf03c5ffd0] = 272
 stub code      [0x0000f7cf03c5ffd0,0x0000f7cf03c60000] = 48
 mutable data [0x0000f7ced888a580,0x0000f7ced888a5c0] = 64
 relocation     [0x0000f7ced888a580,0x0000f7ced888a5b0] = 48
 metadata       [0x0000f7ced888a5b0,0x0000f7ced888a5c0] = 16
 immutable data [0x0000f7ced888a500,0x0000f7ced888a578] = 120
 dependencies   [0x0000f7ced888a500,0x0000f7ced888a508] = 8
 scopes pcs     [0x0000f7ced888a508,0x0000f7ced888a558] = 80
 scopes data    [0x0000f7ced888a558,0x0000f7ced888a570] = 24
 speculations   [0x0000f7ced888a570,0x0000f7ced888a574] = 4
0x0000f7cf03c5fff8:   62 74 ef 17 ff ff ff 17 
--------------------------------------------------------------------------------
  0x0000f7cf03c5fff8:   b	0x0000f7cf0383d180
  0x0000f7cf03c5fffc:   b	0x0000f7cf03c5fff8
--------------------------------------------------------------------------------
R20=0x0000f7cf1484ca18 is pointing into the stack for thread: 0x0000f7cf100305c0
R21=0x0000f7cf1484ca98 is pointing into the stack for thread: 0x0000f7cf100305c0
R22=0x0000f7cf1484d380 is pointing into the stack for thread: 0x0000f7cf100305c0
R23=0x0000f7cf1484d370 is pointing into the stack for thread: 0x0000f7cf100305c0
R24=0x0000f7cf1484d470 is pointing into the stack for thread: 0x0000f7cf100305c0
R25=0x000000000000000a is an unknown value
R26=0x000000ff0052b2b8 is pointing into metadata
R27=0x0 is null
R28=0x0000f7cf100305c0 is a thread
R29=0x0000f7cf1484c9d0 is pointing into the stack for thread: 0x0000f7cf100305c0
R30=0x0000f7cf14e83058: <offset 0x0000000000553058> in /testee-vm/lib/server/libjvm.so at 0x0000f7cf14930000

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

PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3406595840


More information about the serviceability-dev mailing list