Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with user defined input stack effects #81

Merged
merged 3 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading