commit 9adb658c18d9303016809691bddf27158095f41e
parent 7a67b8734a2bda995991f22be8a33482d2dbb25f
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Wed, 5 Jul 2023 07:05:54 -0400
comp/c: add pushret, popret, to function prelude/postlude
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/comp/c/fgen.fs b/fs/comp/c/fgen.fs
@@ -9,7 +9,8 @@
: _postlude
_curfunc CDecl :argssize ?dup if ps+, then
- _locvars CDecl :size ?dup if rs+, then ;
+ _locvars CDecl :size ?dup if rs+, then
+ popret, ;
$40 const MAXSWITCHCASES
\ breaks are a list of forward jumps addr that need to be resolved at the end
@@ -182,7 +183,7 @@ MAXSWITCHCASES << Stack :new structbind Stack _cases
here _curfunc to CDecl offset ( )
_curfunc ?updateFunctionPrototype _curfunc addSymbol
\ prelude: space for stack frame. "dup," is wiggle room for W
- dup, _locvars CDecl :size ?dup if neg rs+, then
+ pushret, dup, _locvars CDecl :size ?dup if neg rs+, then
_initcode ?dup if [compile] again r> [compile] then then
0 to _laststmtid parseStatements
_laststmtid 1 <> if emitNullRet then \ emit implicit return if needed