Skip to content

Commit 8275301

Browse files
authored
Merge 904c78e into 7131f05
2 parents 7131f05 + 904c78e commit 8275301

File tree

15 files changed

+70
-35
lines changed

15 files changed

+70
-35
lines changed

src/hotspot/cpu/aarch64/aarch64.ad

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
16591659
}
16601660
}
16611661

1662+
int MachSafePointNode::ret_addr_offset() {
1663+
// Size of polling page load
1664+
return NativeInstruction::instruction_size;
1665+
}
1666+
16621667
//=============================================================================
16631668

16641669
#ifndef PRODUCT
@@ -16020,16 +16025,20 @@ instruct cmpFastUnlockLightweight(rFlagsReg cr, iRegP object, iRegP box, iRegPNo
1602016025
// TODO
1602116026
// provide a near and far version of this code
1602216027

16023-
instruct safePoint(rFlagsReg cr, iRegP poll)
16028+
// Note: MachSafePointNode::ret_addr_offset() should match this encoding.
16029+
// The return would happen to safepoint poll itself, not to polling page load.
16030+
instruct safePoint(rFlagsReg cr)
1602416031
%{
16025-
match(SafePoint poll);
16032+
match(SafePoint);
1602616033
effect(KILL cr);
1602716034

1602816035
format %{
16029-
"ldrw zr, [$poll]\t# Safepoint: poll for GC"
16036+
"ldr rscratch1, [rthread, #polling_page_offset]\n\t"
16037+
"ldrw zr, [rscratch1]\t# Safepoint: poll for GC"
1603016038
%}
1603116039
ins_encode %{
16032-
__ read_polling_page(as_Register($poll$$reg), relocInfo::poll_type);
16040+
__ get_polling_page(rscratch1);
16041+
__ read_polling_page(rscratch1);
1603316042
%}
1603416043
ins_pipe(pipe_serial); // ins_pipe(iload_reg_mem);
1603516044
%}

src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,10 @@ void LIR_Assembler::return_op(LIR_Opr result, C1SafepointPollStub* code_stub) {
490490

491491
int LIR_Assembler::safepoint_poll(LIR_Opr tmp, CodeEmitInfo* info) {
492492
guarantee(info != nullptr, "Shouldn't be null");
493-
__ get_polling_page(rscratch1, relocInfo::poll_type);
493+
__ get_polling_page(rscratch1);
494494
add_debug_info_for_branch(info); // This isn't just debug info:
495495
// it's the oop map
496-
__ read_polling_page(rscratch1, relocInfo::poll_type);
496+
__ read_polling_page(rscratch1);
497497
return __ offset();
498498
}
499499

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5386,22 +5386,19 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
53865386
}
53875387

53885388
// Move the address of the polling page into dest.
5389-
void MacroAssembler::get_polling_page(Register dest, relocInfo::relocType rtype) {
5389+
void MacroAssembler::get_polling_page(Register dest) {
53905390
ldr(dest, Address(rthread, JavaThread::polling_page_offset()));
53915391
}
53925392

53935393
// Read the polling page. The address of the polling page must
5394-
// already be in r.
5395-
address MacroAssembler::read_polling_page(Register r, relocInfo::relocType rtype) {
5396-
address mark;
5394+
// already be in addr.
5395+
void MacroAssembler::read_polling_page(Register addr) {
53975396
{
53985397
InstructionMark im(this);
5399-
code_section()->relocate(inst_mark(), rtype);
5400-
ldrw(zr, Address(r, 0));
5401-
mark = inst_mark();
5398+
code_section()->relocate(inst_mark(), relocInfo::poll_type);
5399+
ldrw(zr, Address(addr, 0));
54025400
}
54035401
verify_cross_modify_fence_not_required();
5404-
return mark;
54055402
}
54065403

54075404
void MacroAssembler::adrp(Register reg1, const Address &dest, uint64_t &byte_offset) {

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,8 +1425,8 @@ class MacroAssembler: public Assembler {
14251425
}
14261426
}
14271427

1428-
address read_polling_page(Register r, relocInfo::relocType rtype);
1429-
void get_polling_page(Register dest, relocInfo::relocType rtype);
1428+
void read_polling_page(Register addr);
1429+
void get_polling_page(Register dest);
14301430

14311431
// CRC32 code for java.util.zip.CRC32::updateBytes() intrinsic.
14321432
void update_byte_crc32(Register crc, Register val, Register table);

src/hotspot/cpu/arm/arm_32.ad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
447447
bool far = maybe_far_call(this);
448448
return (far ? 3 : 1) * NativeInstruction::instruction_size;
449449
}
450+
451+
int MachSafePointNode::ret_addr_offset() {
452+
Unimplemented();
453+
return 0;
454+
}
450455
%}
451456

452457
// The intptr_t operand types, defined by textual substitution.

src/hotspot/cpu/ppc/ppc.ad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
11341134
return 4;
11351135
}
11361136

1137+
int MachSafePointNode::ret_addr_offset() {
1138+
Unimplemented();
1139+
return 0;
1140+
}
1141+
11371142
//=============================================================================
11381143

11391144
// condition code conversions

src/hotspot/cpu/riscv/riscv.ad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
12771277
}
12781278
}
12791279

1280+
int MachSafePointNode::ret_addr_offset() {
1281+
Unimplemented();
1282+
return 0;
1283+
}
1284+
12801285
//
12811286
// Compute padding required for nodes which need alignment
12821287
//

src/hotspot/cpu/s390/s390.ad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
641641
return 12 + MacroAssembler::call_far_patchable_ret_addr_offset();
642642
}
643643

644+
int MachSafePointNode::ret_addr_offset() {
645+
Unimplemented();
646+
return 0;
647+
}
648+
644649
// Compute padding required for nodes which need alignment
645650
//
646651
// The addresses of the call instructions needs to be 4-byte aligned to

src/hotspot/cpu/x86/x86_32.ad

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,11 @@ int MachCallRuntimeNode::ret_addr_offset() {
315315
return 5 + pre_call_resets_size() + (_leaf_no_fp ? 0 : sizeof_FFree_Float_Stack_All);
316316
}
317317

318+
int MachSafePointNode::ret_addr_offset() {
319+
Unimplemented();
320+
return 0;
321+
}
322+
318323
//
319324
// Compute padding required for nodes which need alignment
320325
//

src/hotspot/cpu/x86/x86_64.ad

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,12 @@ int MachCallRuntimeNode::ret_addr_offset() {
609609
}
610610
return offset;
611611
}
612+
613+
int MachSafePointNode::ret_addr_offset() {
614+
// Size of mov rax, [thread, #polling_page_offset]
615+
return 4;
616+
}
617+
612618
//
613619
// Compute padding required for nodes which need alignment
614620
//
@@ -12385,18 +12391,21 @@ instruct cmpFastUnlockLightweight(rFlagsReg cr, rRegP object, rax_RegP rax_reg,
1238512391

1238612392
// ============================================================================
1238712393
// Safepoint Instructions
12388-
instruct safePoint_poll_tls(rFlagsReg cr, rRegP poll)
12394+
// Note: MachSafePointNode::ret_addr_offset() should match this encoding.
12395+
// The return would happen to safepoint poll itself, not to polling page load.
12396+
instruct safePoint_poll_tls(rax_RegP rax_reg, rFlagsReg cr)
1238912397
%{
12390-
match(SafePoint poll);
12391-
effect(KILL cr, USE poll);
12398+
match(SafePoint);
12399+
effect(KILL cr, KILL rax_reg);
1239212400

12393-
format %{ "testl rax, [$poll]\t"
12394-
"# Safepoint: poll for GC" %}
12401+
format %{ "mov rax, [thread, #polling_page_offset]\n\t"
12402+
"testl rax, [rax]\t# Safepoint: poll for GC" %}
1239512403
ins_cost(125);
1239612404
ins_encode %{
12405+
__ movptr(rax, Address(r15_thread, JavaThread::polling_page_offset()));
1239712406
__ relocate(relocInfo::poll_type);
1239812407
address pre_pc = __ pc();
12399-
__ testl(rax, Address($poll$$Register, 0));
12408+
__ testl(rax, Address(rax, 0));
1240012409
assert(nativeInstruction_at(pre_pc)->is_safepoint_poll(), "must emit test %%eax [reg]");
1240112410
%}
1240212411
ins_pipe(ialu_reg_mem);

0 commit comments

Comments
 (0)