RISC-V: is_deopt may produce unaligned memory read

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: None
    • Component/s: hotspot
    • b26
    • riscv
    • linux

      After compressed opcodes were enabled by default, we may have a 4-byte opcode located at 2-byte aligned address, but not 4-byte aligned address ( e.g. ending with 2/6/a/e in hex form)

      This code then may produce misaligned read, and on some hardware (e.g. hifive) may result in misaligned load emulation thru m-mode

        static bool is_deopt_at(address instr) {
          assert(instr != nullptr, "");
          uint32_t value = *(uint32_t *) instr;
          // 0xc0201073 encodes CSRRW x0, instret, x0
          return value == 0xc0201073;
        }

      direct pointer dereference should be replaced with a proper method

            Assignee:
            Vladimir Kempik
            Reporter:
            Vladimir Kempik
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: