11/*
22 * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
3- * Copyright (c) 2012, 2024 SAP SE. All rights reserved.
3+ * Copyright (c) 2012, 2025 SAP SE. All rights reserved.
44 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55 *
66 * This code is free software; you can redistribute it and/or modify it
@@ -254,6 +254,18 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
254254 goto run_stub;
255255 }
256256
257+ // SIGTRAP-based nmethod entry barriers.
258+ else if (sig == SIGTRAP && TrapBasedNMethodEntryBarriers &&
259+ nativeInstruction_at (pc)->is_sigtrap_nmethod_entry_barrier () &&
260+ CodeCache::contains ((void *) pc)) {
261+ if (TraceTraps) {
262+ tty->print_cr (" trap: nmethod entry barrier at " INTPTR_FORMAT " (SIGTRAP)" , p2i (pc));
263+ }
264+ stub = StubRoutines::method_entry_barrier ();
265+ uc->uc_mcontext .jmp_context .lr = (uintptr_t )(pc + BytesPerInstWord); // emulate call by setting LR
266+ goto run_stub;
267+ }
268+
257269 // SIGTRAP-based ic miss check in compiled code.
258270 else if (sig == SIGTRAP && TrapBasedICMissChecks &&
259271 nativeInstruction_at (pc)->is_sigtrap_ic_miss_check ()) {
@@ -282,6 +294,7 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
282294 tty->print_cr (" trap: null_check at " INTPTR_FORMAT " (SIGSEGV)" , p2i (pc));
283295 }
284296 stub = SharedRuntime::continuation_for_implicit_exception (thread, pc, SharedRuntime::IMPLICIT_NULL);
297+ goto run_stub;
285298 }
286299
287300#ifdef COMPILER2
@@ -296,17 +309,6 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
296309 }
297310#endif
298311
299- // SIGTRAP-based nmethod entry barriers.
300- else if (sig == SIGTRAP && TrapBasedNMethodEntryBarriers &&
301- nativeInstruction_at (pc)->is_sigtrap_nmethod_entry_barrier () &&
302- CodeCache::contains ((void *) pc)) {
303- if (TraceTraps) {
304- tty->print_cr (" trap: nmethod entry barrier at " INTPTR_FORMAT " (SIGTRAP)" , p2i (pc));
305- }
306- stub = StubRoutines::method_entry_barrier ();
307- uc->uc_mcontext .jmp_context .lr = (uintptr_t )(pc + BytesPerInstWord); // emulate call by setting LR
308- }
309-
310312 else if (sig == SIGFPE /* && info->si_code == FPE_INTDIV */ ) {
311313 if (TraceTraps) {
312314 tty->print_raw_cr (" Fix SIGFPE handler, trying divide by zero handler." );
0 commit comments