Skip to content

Commit

Permalink
8290780: AArch64: Crash in c2 nmethod running RunThese30M.java
Browse files Browse the repository at this point in the history
Reviewed-by: dlong
  • Loading branch information
Andrew Haley committed Jul 25, 2022
1 parent b17269a commit 1e270ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
16 changes: 8 additions & 8 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,12 @@ class Patcher : public RelocActions {
ptrdiff_t offset = target - insn_addr;
instructions = 2;
precond(inner != nullptr);
uintptr_t dest = (uintptr_t)target;
// Give the inner reloc a chance to modify the target.
address adjusted_target = target;
instructions = (*inner)(insn_addr, adjusted_target);
uintptr_t pc_page = (uintptr_t)insn_addr >> 12;
uintptr_t adr_page = (uintptr_t)target >> 12;
uintptr_t adr_page = (uintptr_t)adjusted_target >> 12;
offset = adr_page - pc_page;
instructions = (*inner)(insn_addr, target);
// Now we extract the lower 21 bits of the signed offset field for
// the ADRP.
offset = offset << (64-21) >> (64-21);
int offset_lo = offset & 3;
offset >>= 2;
Instruction_aarch64::spatch(insn_addr, 23, 5, offset);
Expand All @@ -340,8 +338,10 @@ class Patcher : public RelocActions {
return 2;
}
static int adrpMovk_impl(address insn_addr, address &target) {
uintptr_t dest = (uintptr_t)target;
uintptr_t dest = uintptr_t(target);
Instruction_aarch64::patch(insn_addr + sizeof (uint32_t), 20, 5, (uintptr_t)target >> 32);
dest = (dest & 0xffffffffULL) | (uintptr_t(insn_addr) & 0xffff00000000ULL);
target = address(dest);
return 2;
}
virtual int immediate(address insn_addr, address &target) {
Expand Down Expand Up @@ -457,7 +457,7 @@ class Decoder : public RelocActions {
static int adrpMovk_impl(address insn_addr, address &target) {
uint32_t insn2 = insn_at(insn_addr, 1);
uint64_t dest = uint64_t(target);
dest = (dest & 0xffffffff) |
dest = (dest & 0xffff0000ffffffff) |
((uint64_t)Instruction_aarch64::extract(insn2, 20, 5) << 32);
target = address(dest);

Expand Down
16 changes: 0 additions & 16 deletions src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6949,22 +6949,6 @@ class StubGenerator: public StubCodeGenerator {

__ leave();

#ifdef ASSERT
{
// Stress relocs for adrp() by trying to reach a page beyond
// the range of a simple ADRP instruction.
ExternalAddress longWayAway(__ pc() - (1ll << 34));
if (! __ is_valid_AArch64_address(longWayAway.target())) {
longWayAway = ExternalAddress(__ pc() + (1ll << 34));
}
if (__ is_valid_AArch64_address(longWayAway.target())) {
uint64_t offset;
__ adrp(rscratch1, longWayAway, offset);
__ add(rscratch1, rscratch1, offset);
}
}
#endif // ASSERT

// check for pending exceptions
#ifdef ASSERT
Label L;
Expand Down

1 comment on commit 1e270ea

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.