Update of /cvsroot/win32forth/win32forth-stc/src/kernel
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5713
Modified Files:
gkernel.f
Log Message:
arm: further support for type system; cleaner optimisation
Index: gkernel.f
===================================================================
RCS file: /cvsroot/win32forth/win32forth-stc/src/kernel/gkernel.f,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** gkernel.f 13 Nov 2006 00:49:28 -0000 1.25
--- gkernel.f 22 Nov 2006 00:07:14 -0000 1.26
***************
*** 545,550 ****
next;
- \ -------------------- stack operators -------------------------------
-
code sp@ ( -- addr ) \ get addr of the stack
0 1 in/out
--- 545,548 ----
***************
*** 799,802 ****
--- 797,801 ----
next;
+ ((
code 3reverse ( n1 n2 n3 -- n3 n2 n1 )
\ *G exchange first and third items on data stack
***************
*** 818,821 ****
--- 817,844 ----
mov 0 [ebp], ecx
next;
+ ))
+
+ code s-reverse ( n[k]..2 1 0 k -- 0 1 2..n[k] ) \ w32f
+ \ *g reverse n items on stack \n
+ \ ** usage: 1 2 3 4 5 5 s-reverse ==> 5 4 3 2 1
+ -1 -1 in/out
+ lea ecx, -4 [ebp] \ ecx points 4 under top of stack
+ lea eax, 4 [ecx] [eax*4] \ eax points 4 over stack
+ \ bump pointers, if they overlap, stop
+ @@1: sub eax, # 4 \ adjust top
+ add ecx, # 4 \ adjust bottom
+ cmp ecx, eax \ compare
+ jae short @@2 \ ecx passing ebx, so exit
+ \ rotate a pair
+ mov edx, 0 [eax] \ bottom to edx
+ xor 0 [ecx], edx \ exchange top and edx
+ xor edx, 0 [ecx]
+ xor 0 [ecx], edx
+ mov 0 [eax], edx \ eax to bottom
+ jmp short @@1 \ next pair
+
+ @@2: mov eax, [ebp]
+ lea ebp, 4 [ebp]
+ next c;
\ -------------------- Memory operators -------------------------------
|