From 6c6a6ce47c1cfbdaae41949b1b18d487ca272e25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Thu, 22 Oct 2020 09:39:43 +0000 Subject: [PATCH 1/4] 8255233: InterpreterRuntime::at_unwind should be a JRT_LEAF --- src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp | 4 +++- src/hotspot/cpu/x86/interp_masm_x86.cpp | 4 +++- src/hotspot/share/interpreter/interpreterRuntime.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 44b9f59bbb390..366c2aee79b18 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -551,7 +551,9 @@ void InterpreterMacroAssembler::remove_activation( br(Assembler::AL, fast_path); bind(slow_path); push(state); - call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind)); + set_last_Java_frame(esp, rfp, pc(), rscratch1); + super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind), rthread); + reset_last_Java_frame(true); pop(state); bind(fast_path); diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index 2c7f861b1a2e0..08c35745c67bb 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -999,7 +999,9 @@ void InterpreterMacroAssembler::remove_activation( jmp(fast_path); bind(slow_path); push(state); - call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind)); + set_last_Java_frame(noreg, rbp, pc()); + super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind), rthread); + reset_last_Java_frame(rthread, true); pop(state); NOT_LP64(get_thread(rthread);) // call_VM clobbered it, restore bind(fast_path); diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index 40c7d09800934..067774af20fa2 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -1172,7 +1172,7 @@ JRT_ENTRY(void, InterpreterRuntime::at_safepoint(JavaThread* thread)) } JRT_END -JRT_ENTRY(void, InterpreterRuntime::at_unwind(JavaThread* thread)) +JRT_LEAF(void, InterpreterRuntime::at_unwind(JavaThread* thread)) // JRT_END does an implicit safepoint check, hence we are guaranteed to block // if this is called during a safepoint From cc3929d194ab5b1727910699812de9350c2bac4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Mon, 26 Oct 2020 08:22:52 +0000 Subject: [PATCH 2/4] address cast --- src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp | 2 +- src/hotspot/cpu/x86/interp_masm_x86.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp index 366c2aee79b18..09632154630b9 100644 --- a/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp @@ -551,7 +551,7 @@ void InterpreterMacroAssembler::remove_activation( br(Assembler::AL, fast_path); bind(slow_path); push(state); - set_last_Java_frame(esp, rfp, pc(), rscratch1); + set_last_Java_frame(esp, rfp, (address)pc(), rscratch1); super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind), rthread); reset_last_Java_frame(true); pop(state); diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index 08c35745c67bb..d934332e58c0d 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -999,7 +999,7 @@ void InterpreterMacroAssembler::remove_activation( jmp(fast_path); bind(slow_path); push(state); - set_last_Java_frame(noreg, rbp, pc()); + set_last_Java_frame(noreg, rbp, (address)pc()); super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind), rthread); reset_last_Java_frame(rthread, true); pop(state); From a9a59f3ba960bf3020c2ee50b12d514cf53415ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Tue, 27 Oct 2020 12:34:29 +0000 Subject: [PATCH 3/4] Remove comment --- src/hotspot/share/interpreter/interpreterRuntime.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index 067774af20fa2..07d3c0ea0b8a6 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -1173,9 +1173,6 @@ JRT_ENTRY(void, InterpreterRuntime::at_safepoint(JavaThread* thread)) JRT_END JRT_LEAF(void, InterpreterRuntime::at_unwind(JavaThread* thread)) - // JRT_END does an implicit safepoint check, hence we are guaranteed to block - // if this is called during a safepoint - // This function is called by the interpreter when the return poll found a reason // to call the VM. The reason could be that we are returning into a not yet safe // to access frame. We handle that below. From 5786f6cea3cdacc938049d94b05555cc6b3662c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20=C3=96sterlund?= Date: Wed, 28 Oct 2020 09:32:09 +0000 Subject: [PATCH 4/4] x86 32 bit fix --- src/hotspot/cpu/x86/interp_masm_x86.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hotspot/cpu/x86/interp_masm_x86.cpp b/src/hotspot/cpu/x86/interp_masm_x86.cpp index d934332e58c0d..f47707a08c648 100644 --- a/src/hotspot/cpu/x86/interp_masm_x86.cpp +++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp @@ -999,7 +999,7 @@ void InterpreterMacroAssembler::remove_activation( jmp(fast_path); bind(slow_path); push(state); - set_last_Java_frame(noreg, rbp, (address)pc()); + set_last_Java_frame(rthread, noreg, rbp, (address)pc()); super_call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::at_unwind), rthread); reset_last_Java_frame(rthread, true); pop(state);