RFR: 8361892: AArch64: Incorrect matching rule leading to improper oop instruction encoding

Yadong Wang yadongwang at openjdk.org
Fri Jul 11 01:34:38 UTC 2025


On Thu, 10 Jul 2025 21:43:31 GMT, Andrew Haley <aph at openjdk.org> wrote:

> > @theRealAph @adinn Could you help review it?
> 
> Can't you just delete the special handling of byte_map_base?
It's fine to just delete immByteMapBase, and then ConP for byte_map_base will match immP in aarch64_enc_mov_p, and using adrp+add if valid address and using mov if unvalid.

    enc_class aarch64_enc_mov_p(iRegP dst, immP src) %{
    Register dst_reg = as_Register($dst$$reg);
    address con = (address)$src$$constant;
    if (con == nullptr || con == (address)1) {
      ShouldNotReachHere();
    } else {
      relocInfo::relocType rtype = $src->constant_reloc();
      if (rtype == relocInfo::oop_type) {
        __ movoop(dst_reg, (jobject)con);
      } else if (rtype == relocInfo::metadata_type) {
        __ mov_metadata(dst_reg, (Metadata*)con);
      } else {
        assert(rtype == relocInfo::none, "unexpected reloc type");
        if (! __ is_valid_AArch64_address(con) ||
            con < (address)(uintptr_t)os::vm_page_size()) {
          __ mov(dst_reg, con);
        } else {
          uint64_t offset;
          __ adrp(dst_reg, con, offset);
          __ add(dst_reg, dst_reg, offset);
        }
      }
    }
  %}

I can choose to delete it directly, but do you think the current changes in pr are safe?

-------------

PR Comment: https://git.openjdk.org/jdk/pull/26249#issuecomment-3059891654


More information about the hotspot-compiler-dev mailing list