Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8309405

RISC-V: is_deopt may produce unaligned memory read

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • None
    • 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

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

              Created:
              Updated:
              Resolved: