version 1.167, 2007/07/10 21:23:24
|
version 1.175, 2011/12/31 15:29:25
|
Line 1
|
Line 1
|
\ converts primitives to, e.g., C code |
\ converts primitives to, e.g., C code |
|
|
\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006 Free Software Foundation, Inc. |
\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006,2007,2009,2010,2011 Free Software Foundation, Inc. |
|
|
\ This file is part of Gforth. |
\ This file is part of Gforth. |
|
|
\ Gforth is free software; you can redistribute it and/or |
\ Gforth is free software; you can redistribute it and/or |
\ modify it under the terms of the GNU General Public License |
\ modify it under the terms of the GNU General Public License |
\ as published by the Free Software Foundation; either version 2 |
\ as published by the Free Software Foundation, either version 3 |
\ of the License, or (at your option) any later version. |
\ of the License, or (at your option) any later version. |
|
|
\ This program is distributed in the hope that it will be useful, |
\ This program is distributed in the hope that it will be useful, |
Line 15
|
Line 15
|
\ GNU General Public License for more details. |
\ GNU General Public License for more details. |
|
|
\ You should have received a copy of the GNU General Public License |
\ You should have received a copy of the GNU General Public License |
\ along with this program; if not, write to the Free Software |
\ along with this program. If not, see http://www.gnu.org/licenses/. |
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. |
|
|
|
|
|
\ This is not very nice (hard limits, no checking, assumes 1 chars = 1). |
\ This is not very nice (hard limits, no checking, assumes 1 chars = 1). |
Line 922 stack inst-stream IP Cell
|
Line 921 stack inst-stream IP Cell
|
: stack-pointer-update { stack -- } |
: stack-pointer-update { stack -- } |
\ and moves |
\ and moves |
\ stacks grow downwards |
\ stacks grow downwards |
|
\ ." /* stack pointer update " stack stack-pointer 2@ type ." */" cr |
stack stack-prim-stacks-sync @ if |
stack stack-prim-stacks-sync @ if |
|
\ ." /* synced " stack stack-in ? stack stack-out ? stack state-in stack-offset . ." */" cr |
stack stack-in @ |
stack stack-in @ |
stack state-in stack-offset - |
stack state-in stack-offset - |
stack swap update-stack-pointer |
stack swap update-stack-pointer |
else |
else |
|
\ ." /* unsynced " stack stack-in ? stack stack-out ? ." */" cr |
stack stack-diff ( in-out ) |
stack stack-diff ( in-out ) |
stack state-in stack-offset - |
stack state-in stack-offset - |
stack state-out stack-offset + ( [in-in_offset]-[out-out_offset] ) |
stack state-out stack-offset + ( [in-in_offset]-[out-out_offset] ) |
Line 938 stack inst-stream IP Cell
|
Line 940 stack inst-stream IP Cell
|
['] stack-pointer-update map-stacks ; |
['] stack-pointer-update map-stacks ; |
|
|
: stack-pointer-update2 { stack -- } |
: stack-pointer-update2 { stack -- } |
|
\ ." /* stack pointer update2 " stack stack-pointer 2@ type ." */" cr |
stack stack-prim-stacks-sync @ if |
stack stack-prim-stacks-sync @ if |
stack state-out stack-offset |
stack state-out stack-offset |
stack stack-out @ - |
stack stack-out @ - |
Line 1054 variable tail-nextp2 \ xt to execute for
|
Line 1057 variable tail-nextp2 \ xt to execute for
|
tail-nextp2 @ output-c-tail1-no-stores ; |
tail-nextp2 @ output-c-tail1-no-stores ; |
|
|
: output-c-tail2-no-stores ( -- ) |
: output-c-tail2-no-stores ( -- ) |
|
prim prim-c-code 2@ s" VM_JUMP(" search nip nip abort" Currently VM_JUMP is not supported in static superinstructions" |
['] output-label2 output-c-tail1-no-stores ; |
['] output-label2 output-c-tail1-no-stores ; |
|
|
: type-c-code ( c-addr u xt -- ) |
: type-c-code ( c-addr u xt -- ) |
Line 1349 is output-c-prim-num
|
Line 1353 is output-c-prim-num
|
\ NEXT_P2; |
\ NEXT_P2; |
|
|
: init-combined ( -- ) |
: init-combined ( -- ) |
|
['] clear-prim-stacks-sync map-stacks |
prim to combined |
prim to combined |
0 num-combined ! |
0 num-combined ! |
current-depth max-stacks cells erase |
current-depth max-stacks cells erase |
Line 1556 variable reprocessed-num 0 reprocessed-n
|
Line 1561 variable reprocessed-num 0 reprocessed-n
|
stores ; |
stores ; |
|
|
: output-combined-tail ( -- ) |
: output-combined-tail ( -- ) |
part-output-c-tail |
|
in-part @ >r in-part off |
in-part @ >r in-part off |
|
part-output-c-tail |
combined ['] output-c-tail-no-stores prim-context |
combined ['] output-c-tail-no-stores prim-context |
r> in-part ! ; |
r> in-part ! ; |
|
|