From 0bcfd0f9eab14c6dfd708a237afa06258088d096 Mon Sep 17 00:00:00 2001 From: Mike <45243121+tankf33der@users.noreply.github.com> Date: Fri, 25 Apr 2025 15:24:52 +0300 Subject: [PATCH] cgen: fix riscv64 closure thunk (use floating point register) (#24315) --- vlib/v/gen/c/cheaders.v | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/v/gen/c/cheaders.v b/vlib/v/gen/c/cheaders.v index 775e4c179f..235e763f0d 100644 --- a/vlib/v/gen/c/cheaders.v +++ b/vlib/v/gen/c/cheaders.v @@ -127,11 +127,12 @@ static char __CLOSURE_GET_DATA_BYTES[] = { static char __closure_thunk[] = { 0x97, 0xCF, 0xFF, 0xFF, // auipc t6, 0xffffc 0x03, 0xBF, 0x8F, 0x00, // ld t5, 8(t6) - 0x67, 0x00, 0x0F, 0x00 // jr t5 + 0x07, 0xB3, 0x0F, 0x00, // fld ft6, 0(t6) + 0x67, 0x00, 0x0F, 0x00, // jr t5 }; static char __CLOSURE_GET_DATA_BYTES[] = { - 0x03, 0xb5, 0x0f, 0x00, // ld a0, 0(t6) - 0x67, 0x80, 0x00, 0x00 // ret + 0x53, 0x05, 0x03, 0xE2, // fmv.x.d a0, ft6 + 0x67, 0x80, 0x00, 0x00, // ret }; #elif defined (__V_rv32) static char __closure_thunk[] = {