Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
abc-interpreter
Commits
defa6697
Verified
Commit
defa6697
authored
Apr 26, 2019
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix copy_from_string for thunks (incorrect computation of arity)
parent
88ff3ad7
Pipeline
#22074
passed with stages
in 13 minutes and 32 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
src-js/abc-interpreter-util.wat
src-js/abc-interpreter-util.wat
+7
-4
src/copy_interpreter_to_host.c
src/copy_interpreter_to_host.c
+2
-1
No files found.
src-js/abc-interpreter-util.wat
View file @
defa6697
...
...
@@ -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)))
...
...
src/copy_interpreter_to_host.c
View file @
defa6697
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment