Verified Commit defa6697 authored by Camil Staps's avatar Camil Staps 🙂

Fix copy_from_string for thunks (incorrect computation of arity)

parent 88ff3ad7
Pipeline #22074 passed with stages
in 13 minutes and 32 seconds
......@@ -1098,28 +1098,31 @@
(br $loop)
)
(else
;; thunk
(local.set $arity (i32.load (i32.sub (local.get $desc) (i32.const 4))))
(local.set $a-arity (local.get $arity))
;; "arity"
;;(call $debug (i32.const 3) (local.get $arity) (i32.const 0) (i32.const 0))
(if
(i32.lt_s (local.get $arity) (i32.const 0))
(then
(local.set $arity (i32.const 1))
(local.set $a-arity (i32.const 1))
)
(else
(if
(i32.gt_u (local.get $arity) (i32.const 256))
(then
(local.set $a-arity (i32.shr_u (local.get $arity) (i32.const 8)))
(local.set $b-arity (i32.shr_u (local.get $arity) (i32.const 8)))
(local.set $arity (i32.and (local.get $arity) (i32.const 0xff)))
(local.set $a-arity (i32.sub (local.get $arity) (local.get $b-arity)))
)
)
)
)
;; "arity"
;;(call $debug (i32.const 3) (local.get $arity) (local.get $a-arity) (local.get $b-arity))
(i64.store (i32.load (local.get $ptr-stack)) (i64.extend_i32_u (local.get $hp)))
(local.set $ptr-stack (i32.sub (local.get $ptr-stack) (i32.const 4)))
......
......@@ -286,8 +286,9 @@ BC_WORD *string_to_interpreter(uint64_t *clean_string, struct interpretation_env
if (arity<0) {
arity=1;
} else if (arity>256) {
a_arity=arity>>8;
int16_t b_arity=arity>>8;
arity&=0xff;
a_arity=arity-b_arity;
}
**ptr_stack--=(BC_WORD)ie->hp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment