commit e8f9fe208ac1a4c54ee14499e9067f6b869ad4b0
parent afa6c6a9c39b33adc7112f14b2e40e11ca5b9b63
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sun, 3 Jul 2022 13:18:43 -0400
cc: make vmcall>op1, use selected op as an argument
Diffstat:
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/fs/cc/gen.fs b/fs/cc/gen.fs
@@ -227,7 +227,7 @@ ASTIDCNT wordtbl gentbl ( node -- )
dup ast.unit.find ?dup if ( name fnode )
nip dup nodeid AST_FUNCTION = _assert ast.func.address else ( name )
find ?dup _assert then ( address )
- vmcall>op1, ;
+ const>op vmcall>op1, ;
: _ ( node -- ) gentbl over nodeid wexec ;
current to gennode
diff --git a/fs/cc/vm.fs b/fs/cc/vm.fs
@@ -201,13 +201,16 @@ operands value 'curop
ret, ;
: callargallot, ( bytes -- ) dup to callsz ebp i32 sub, ;
+
+\ Call the address in current op and put the result of that call in op1.
+\ we assume that it left a 4b area in the SF with its result in it.
+\ move this data in op1.
\ TODO: call function with no return value.
-\ call addr and assume that it left a 4b area in the SF with its result in it.
-\ move this data in Result.
-: vmcall>op1, ( addr -- )
+: vmcall>op1, ( -- )
+ VM_CONSTANT optype = _assert
+ oparg call, VM_NONE optype!
selop1 noop#
- call,
- VM_REGISTER optype! regallot r! [ebp] mov,
+ VM_REGISTER optype! regallot dup oparg! r! [ebp] mov,
ebp 4 i32 add, 0 to callsz ;