From: Alex M. <ale...@us...> - 2007-07-06 09:06:42
|
Update of /cvsroot/win32forth/win32forth-stc/src/kernel In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv12810/src/kernel Modified Files: gkernel.f Log Message: arm: tidy up localalloc, remove uses of internal words _localalloc _localfree Index: gkernel.f =================================================================== RCS file: /cvsroot/win32forth/win32forth-stc/src/kernel/gkernel.f,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** gkernel.f 1 Jul 2007 17:26:31 -0000 1.40 --- gkernel.f 6 Jul 2007 09:06:39 -0000 1.41 *************** *** 1157,1194 **** next c; - \ -------------------- Locals Allocation on rstack -------------------- - - \ These are internal words for use during meta-compilation. See - \ localalloc and locals words for user words. - - gcode __localsave \ save previous local ptr - push lp [up] \ push local ptr - mov lp [up] , esp \ new local ptr - ;g - - gcode __localalloc \ allocate local on rstack - sub esp, eax \ subtract n1 from return stack - and esp, # -4 \ cell align return stack - mov eax, esp \ move to top of stack - ;g - - gcode __localfree \ free local on rstack - mov esp, lp [up] \ restore rstack ptr - pop lp [up] \ restore old local ptr - ;g - - : _localallocp ( len -- addr ) \ allocate local on rstack - (comp-only) compilation> drop __localalloc (copy-code) ; - 1 1 in/out - - : _localalloc ( len -- addr ) \ allocate local on rstack - (comp-only) compilation> drop - __localsave (copy-code) __localalloc (copy-code) ; - 1 1 in/out - - : _localfree ( -- ) \ allocate local on rstack - (comp-only) compilation> drop __localfree (copy-code) ; - 0 0 in/out - \ -------------------- Double memory Operators ------------------------ --- 1157,1160 ---- *************** *** 1516,1520 **** next; ! code / ( n1 n2 -- quot ) \ equiv of >r s>d r> sm/rem swap drop 2 1 in/out mov ecx, eax \ >r --- 1482,1486 ---- next; ! code / ( n1 n2 -- quot ) \ equiv of >r s>d r> sm/rem nip 2 1 in/out mov ecx, eax \ >r *************** *** 4601,4608 **** \ See the locals wordset for details on localstk usage. ! 0 value localstk \ support for locals (including localalloc) ! \ EXIT compiles _LOCALFREE, but leaves LOCALSTK alone so that ; can ! \ also compile _LOCALFREE : exit ( -- ) \ exit current word --- 4567,4590 ---- \ See the locals wordset for details on localstk usage. ! 0 value localstk \ support for locals (including localalloc) ! gcode __localsave \ save previous local ptr ! push lp [up] \ push local ptr ! mov lp [up] , esp \ new local ptr ! ;g ! ! gcode __localalloc \ allocate local on rstack ! sub esp, eax \ subtract n1 from return stack ! and esp, # -4 \ cell align return stack ! mov eax, esp \ move to top of stack ! ;g ! ! gcode __localfree \ free local on rstack ! mov esp, lp [up] \ restore rstack ptr ! pop lp [up] \ restore old local ptr ! ;g ! ! \ EXIT compiles __LOCALFREE, but leaves LOCALSTK alone so that ; can ! \ also compile __LOCALFREE : exit ( -- ) \ exit current word *************** *** 4610,4614 **** compilation> ( -- xt ) drop localstk if ! postpone _localfree \ to unwind the stack then sync-code \ ensure everyting generated --- 4592,4596 ---- compilation> ( -- xt ) drop localstk if ! __localfree (copy-code) \ to unwind the stack then sync-code \ ensure everyting generated *************** *** 4749,4753 **** compilation> ( -- xt ) drop localstk if ! postpone _localfree \ to unwind the stack then 0 to localstk \ can have its own locals --- 4731,4735 ---- compilation> ( -- xt ) drop localstk if ! __localfree (copy-code) \ to unwind the stack then 0 to localstk \ can have its own locals *************** *** 5026,5030 **** : loading? ( -- flag ) \ are we loading? ! source-id -1 0 between 0= ; : (message) ( n addr len -- ) --- 5008,5013 ---- : loading? ( -- flag ) \ are we loading? ! \ source-id -1 0 between 0= ; ! source-id 0<> ; : (message) ( n addr len -- ) *************** *** 5587,5596 **** : localalloc ( n1 -- a1 ) \ allocate n1 bytes of return stack (comp-only) compilation> drop ! localstk if \ if not zero, already using locals ! postpone _localallocp \ so use the p form ! else ! postpone _localalloc -1 to localstk \ mark as localalloc ! then ; : localbuff ( -- addr ) \ maxbuffer alloc (260 bytes currently) --- 5570,5578 ---- : localalloc ( n1 -- a1 ) \ allocate n1 bytes of return stack (comp-only) compilation> drop ! localstk 0= if \ if zero, not using locals ! __localsave (copy-code) -1 to localstk \ mark as localalloc ! then ! __localalloc (copy-code) ; : localbuff ( -- addr ) \ maxbuffer alloc (260 bytes currently) |