Skip to content

Commit

Permalink
Fix issue with user defined input stack effects (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbirddog authored Jul 20, 2024
1 parent 8e90abc commit 38ed21d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
26 changes: 10 additions & 16 deletions dictionary.inc
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ macro _ose e {
_core_words:
.prev_word = 0

_wi 'ecx', 3, se_reg_ecx, 0, 0
_wi 'eax', 3, se_reg_eax, 0, 0
_wi 'ecx', 3, se_reg.ecx, 0, 0
_wi 'eax', 3, se_reg.eax, 0, 0

.se_reg_latest = .prev_word
.prev_word = 0
Expand Down Expand Up @@ -415,10 +415,13 @@ seX_parse_end:

ret

se_reg_eax:
mov rax, _EAX
se_reg:
macro _se_reg reg, _REG {
.##reg:
mov rax, _REG
mov rdi, [_dictionary.here]
stosq
mov [_dictionary.here], rdi

mov rdi, [_dictionary.latest]
add rdi, 2
Expand All @@ -427,16 +430,7 @@ se_reg_eax:
stosb
ret

se_reg_ecx:
mov rax, _ECX
mov rdi, [_dictionary.here]
stosq

mov rdi, [_dictionary.latest]
add rdi, 2
mov al, byte [rdi]
inc al
stosb
}
ret
_se_reg eax, _EAX
_se_reg ecx, _ECX
4 changes: 2 additions & 2 deletions dictionary_test.inc
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ dictionary_test:
tc3 seX_o_parse, _core_words.se_parse_latest
tc3 seX_parse_end, _core_words.se_parse_latest

tc3 se_reg_eax, _core_words.se_reg_latest
tc3 se_reg_ecx, _core_words.se_reg_latest
tc3 se_reg.eax, _core_words.se_reg_latest
tc3 se_reg.ecx, _core_words.se_reg_latest
call dictionary_deinit
Expand Down
7 changes: 7 additions & 0 deletions flow.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ flow_in:

lea rbx, [rdi + (rcx * 8)]
mov rbx, [rbx]

cmp bl, _REGISTER
jne .bad_se
and rbx, REG_MASK
shr rbx, REG_OFFSET

Expand Down Expand Up @@ -51,6 +55,9 @@ flow_in:
.done:
ret

.bad_se:
die ERR_BAD_SE

;
; expects
; - word in rax
Expand Down

0 comments on commit 38ed21d

Please sign in to comment.