RFR: 8365047: Remove exception handler stub code in C2 [v4]
Martin Doerr
mdoerr at openjdk.org
Wed Sep 24 09:16:35 UTC 2025
On Fri, 12 Sep 2025 16:36:56 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 incrementally with two additional commits since the last revision:
>
> - Offset the deoptimization handler entry point
>
> Change-Id: I596317ec6a364b341e4642636fa5cf08f87ed722
> - Revert "Ensure stub code is not adjacent to a call"
Right, it works after adapting C1 deopt handler (see below). So, you convinced me that your new solution is better. Please don't add Copyright headers everywhere. Arm has contributed less than 1% of ppc.ad. I don't think that justifies a Copyright for the whole file. We don't want everyone's Copyright in every file.
Thanks a lot for debugging the issue!
diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
index 3ca75305eca..fe735c8831b 100644
--- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
+++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp
@@ -263,13 +263,17 @@ int LIR_Assembler::emit_deopt_handler() {
return -1;
}
- int offset = code_offset();
+ Label start;
+
+ __ bind(start);
__ bl64_patchable(SharedRuntime::deopt_blob()->unpack(), relocInfo::runtime_call_type);
+ int entry_point = __ offset();
+ __ b(start);
- guarantee(code_offset() - offset <= deopt_handler_size(), "overflow");
+ guarantee(code_offset() - entry_point <= deopt_handler_size(), "overflow");
__ end_a_stub();
- return offset;
+ return entry_point;
}
diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad
index 1f6819c4bf6..9473dd3d57b 100644
--- a/src/hotspot/cpu/ppc/ppc.ad
+++ b/src/hotspot/cpu/ppc/ppc.ad
@@ -1,7 +1,6 @@
//
// Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved.
// Copyright (c) 2012, 2025 SAP SE. All rights reserved.
-// Copyright 2025 Arm Limited and/or its affiliates.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// This code is free software; you can redistribute it and/or modify it
diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
index ced1b38541b..3d037540766 100644
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp
@@ -2965,7 +2965,6 @@ void SharedRuntime::generate_deopt_blob() {
// The return_pc has been stored in the frame of the deoptee and
// will replace the address of the deopt_handler in the call
// to Deoptimization::fetch_unroll_info below.
- const int return_pc_adjustment_no_exception = -MacroAssembler::bl64_patchable_size;
// Push the "unpack frame"
// Save everything in sight.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/26678#issuecomment-3327362075
More information about the hotspot-dev
mailing list