On Wed, 10 Jun 2026 12:39:07 GMT, Dingli Zhang <[email protected]> wrote:
>> This small change enables support for the with-hsdis=capstone option for the >> RISC-V target. >> It could be done because libcapstone is available in apt repositories. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > make/Hsdis.gmk line 52: > >> 50: else ifeq ($(call isTargetCpuArch, riscv), true) >> 51: CAPSTONE_ARCH := CS_ARCH_RISCV >> 52: CAPSTONE_MODE := CS_MODE_RISCV64 > > Thanks for this patch! > I also tested both cross-compilation and a native build, and both worked fine > with this change. > > Suggestion: > > CAPSTONE_MODE := 'CS_MODE_RISCV64|CS_MODE_RISCVC' > > > I have one small question: would it make sense to enable `CS_MODE_RISCVC` > here as well? > On rv64gc boards, this can be observed easily with `-XX:+PrintAssembly`: many > compressed instructions are not decoded and are shown as `.byte` instead. > > Although the RISC-V port wiki describes RV64G as the supported base > configuration and lists RVC as an explicitly enabled feature, RVC is widely > assumed in Linux-capable riscv64 environments today. I've tried @DingliZhang's suggested changed and that works: [Instructions begin] ;; block B1 [0, 0] 0x0000003f783fe100: c.nop 0x0000003f783fe102: c.nop 0x0000003f783fe104: c.nop 0x0000003f783fe106: c.nop 0x0000003f783fe108: c.nop 0x0000003f783fe10a: c.nop 0x0000003f783fe10c: c.nop 0x0000003f783fe10e: c.nop 0x0000003f783fe110: c.nop 0x0000003f783fe112: c.nop 0x0000003f783fe114: c.nop 0x0000003f783fe116: c.nop 0x0000003f783fe118: c.nop 0x0000003f783fe11a: c.nop 0x0000003f783fe11c: c.nop 0x0000003f783fe11e: c.nop 0x0000003f783fe120: c.nop 0x0000003f783fe122: c.nop 0x0000003f783fe124: c.nop 0x0000003f783fe126: c.nop [Entry Point] # {method} {0x0000003f1b0005f8} '''<init>''' '''()V''' in '''java/lang/Object''' # [sp+0x30] (sp of caller) 0x0000003f783fe128: ld t1, 0(a1) 0x0000003f783fe12c: srli t1, t1, 0x2a 0x0000003f783fe130: lwu t2, 8(t0) 0x0000003f783fe134: beq t1, t2, 0xc 0x0000003f783fe138: auipc t1, 0x7642 ; {runtime_call ic_miss_blob (shared runtime)} 0x0000003f783fe13c: jalr zero, t1, 0x2c8 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31424#discussion_r3403316210
