commit 9b2a50eb19ade8ffdb177a77c186df10c0c3a1d5
parent 12a98dd5cbfc14b4ec0b065d56a1e3bd75b49a84
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sat, 12 Nov 2022 15:34:00 -0500
cc: code consolidation
Diffstat:
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/cc/vm/commonlo.fs b/fs/cc/vm/commonlo.fs
@@ -65,9 +65,8 @@ struct[ VMOp
: :push ( self -- 'copy ) dup >r :keep VM_NONE to r> loc ;
: :pop ( 'copy self -- ) dup :noop# 12 move ;
: :swap ( 'copy self -- 'copy ) dup :push rot> :pop ;
- : :&op
- dup :pointer? _assert
- dup :loclo over to loc dup type type*lvl+ swap to type ;
+ : :&loc dup :pointer? _assert dup :loclo swap to loc ;
+ : :&op dup :&loc dup type type*lvl+ swap to type ;
: :*op dup loc case
VM_CONSTANT of = endof
VM_STACKFRAME of = endof
diff --git a/fs/cc/vm/forth.fs b/fs/cc/vm/forth.fs
@@ -140,7 +140,7 @@ UNOPMUTCNT wordtbl _tbl8
: unopmut, ( opid -- )
vmop type typesize
case 1 of = _tbl8 endof 2 of = _tbl16 endof _tbl32 endcase ( opid tbl )
- vmop :&op vmop :compile swap wexec, ;
+ vmop :&loc vmop :compile swap wexec, ;
: vm+n, ( n -- ) vmop :compile litn compile + ?tos>reg ;
@@ -171,14 +171,14 @@ ARIOPCNT wordtbl _tbl
vmop^ :hasop# vmop^ loc VM_CONSTARRAY = if _movarray, else
vmop^ :compile \ op2 is TOS
vmop :TOS? if compile over PS+ then
- vmop :keep vmop :&op vmop :compile vmop :forgetTOS vmop :popNoChk
+ vmop :keep vmop :&loc vmop :compile vmop :forgetTOS vmop :popNoChk
vmop :typesz! vmop^ :forgetTOS compile ! PS- PS- then ;
\ an assignop, is like a unop in the sense that it operates directly on op1, but
\ with the participation of op2.
: assignop, ( opid -- )
dup 10 = if drop _=, exit then \ "=" is special
- vmop type typesize vmop :compile& vmop :&op ( opid sz ) \ op1 is TOS
+ vmop type typesize vmop :compile& vmop :&loc ( opid sz ) \ op1 is TOS
compile dup PS+ dup sz! compile @ vmop^ :compile ( opid sz ) \ op2 is TOS
swap _tbl swap wexec, PS- vmop^ :forgetTOS ( sz ) \ result on TOS
compile swap sz! compile ! vmop :forgetTOS PS- PS- ;