-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8350182: [s390x] Relativize locals in interpreter frames #23660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,15 @@ void InterpreterMacroAssembler::dispatch_base(TosState state, address* table, bo | |
| } | ||
| { Label OK; | ||
| // check if the locals pointer in Z_locals is correct | ||
| z_cg(Z_locals, _z_ijava_state_neg(locals), Z_fp); | ||
|
|
||
| // _z_ijava_state_neg(locals)) is fp relativized, so we need to | ||
| // extract the pointer. | ||
|
|
||
| z_lg(Z_R1_scratch, Address(Z_fp, _z_ijava_state_neg(locals))); | ||
| z_sllg(Z_R1_scratch, Z_R1_scratch, Interpreter::logStackElementSize); | ||
| z_agr(Z_R1_scratch, Z_fp); | ||
|
|
||
| z_cgr(Z_locals, Z_R1_scratch); | ||
|
Comment on lines
-109
to
+117
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. By default assertion was failing, Because stored value is fp relativised and Z_locals is holding pointer. So I have updated it. I have done some manual step through and found that it should be okay to keep, unless we don't want to kill another register here. diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
index c40be5edec7..fc5b9f10af1 100644
--- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
+++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp
@@ -1134,8 +1134,16 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
__ z_agr(Z_locals, Z_esp);
// z_ijava_state->locals - i*BytesPerWord points to i-th Java local (i starts at 0)
// z_ijava_state->locals = Z_esp + parameter_count bytes
+ __ z_sgrk(Z_locals, Z_locals, fp); // Z_R1 = Z_locals - fp();
+ __ z_srlg(Z_locals, Z_locals, Interpreter::logStackElementSize);
+ // Store relativized Z_locals, see frame::interpreter_frame_locals().
__ z_stg(Z_locals, _z_ijava_state_neg(locals), fp);
// z_ijava_state->oop_temp = nullptr;
__ store_const(Address(fp, oop_tmp_offset), 0);with this change, (gdb) i r r12
r12 0x1 1
(gdb) x/2gx $r9 - 88
0x3fffb37be98: 0x0000000000000001 0x000003fffb37be80
(gdb)Similarly, with the change I have pushed: |
||
| z_bre(OK); | ||
| reentry = stop_chain_static(reentry, "invalid locals pointer Z_locals: " FILE_AND_LINE); | ||
| bind(OK); | ||
|
|
@@ -686,6 +694,8 @@ void InterpreterMacroAssembler::save_mdp(Register mdp) { | |
| void InterpreterMacroAssembler::restore_locals() { | ||
| asm_assert_ijava_state_magic(Z_locals); | ||
| z_lg(Z_locals, Address(Z_fp, _z_ijava_state_neg(locals))); | ||
| z_sllg(Z_locals, Z_locals, Interpreter::logStackElementSize); | ||
| z_agr(Z_locals, Z_fp); | ||
| } | ||
|
|
||
| void InterpreterMacroAssembler::get_method(Register reg) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a function?
Also, names starting with
_aren't common in HotSpot code, except for fields in C++ objects.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is similar to ppc ijava_idx
I did it for keeping the parity with:
Do you want me to revert it ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no good reason to use a macro here. If a function can be a function, and this one can, let it be one. However, there is no reason to change anything else. Leave that for a "macros to functions" patch some other day.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could only achieve this implementation: macro to method, which looks dirty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. It's not worth doing that, and what you do here does match PPC. OK.