File:  [gforth] / gforth / cache1.vmg
Revision 1.5: download - view: text, annotated - select for diffs
Sun Jan 25 12:35:58 2004 UTC (19 years, 4 months ago) by anton
Branches: MAIN
CVS tags: HEAD
minore bugfixes (
enabled 3-state stack caching for gforth-fast and gforth-native
   bugfixes (EXECUTE and PERFORM; spbREG use)
   explicit register allocation to spb for gforth-native, but not gforth-fast
   Due to the shortest-path algorithm this means that gforth-fast uses only
     S0 and S1, not S2, so we could keep that.
     However, we probably want to use more states etc. for other
     architectures, so we may want to have a way to select different
       cache.vmg and different peeprules.vmg files for different
       archs, builds, and binaries.

\ stack cache setup

\ Copyright (C) 2003 Free Software Foundation, Inc.

\ This file is part of Gforth.

\ Gforth is free software; you can redistribute it and/or
\ modify it under the terms of the GNU General Public License
\ as published by the Free Software Foundation; either version 2
\ of the License, or (at your option) any later version.

\ This program is distributed in the hope that it will be useful,
\ but WITHOUT ANY WARRANTY; without even the implied warranty of
\ GNU General Public License for more details.

\ You should have received a copy of the GNU General Public License
\ along with this program; if not, write to the Free Software
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.

\E register IPTOS Cell
\E register spTOS Cell
\E register spb Cell
\E register spc Cell
\  \E register spd Cell

\E create IPregs IPTOS ,
\E create regs spc , spb , spTOS ,
\ \E create regs spTOS ,

\E IPregs 1 0 stack-state IPss1
\E regs 3 cells + 0  -1 stack-state ss0
\E regs 2 cells + 1  0 stack-state ss1
\E regs 1 cells + 2  1 stack-state ss2
\ \E regs 0 cells + 3  2 stack-state ss3
\ \E regs 1 cells + 0 -1 stack-state ss0
\ \E regs           1  0 stack-state ss1

\ the first of these is the default state (for now)
\E state S1
\E state S0
\E state S2
\ \E state S3

\E ss0 data-stack S0 set-ss
\E ss1 data-stack S1 set-ss
\E ss2 data-stack S2 set-ss
\  \E ss3 data-stack S3 set-ss

\E IPss1 inst-stream S0 set-ss
\E IPss1 inst-stream S1 set-ss
\E IPss1 inst-stream S2 set-ss
\  \E IPss1 inst-stream S3 set-ss

\E data-stack to cache-stack
\E here 3 cache-states 2! s0 , s1 , s2 ,
\ \E here 2 cache-states 2! s0 , s1 ,

\ !! the following should be automatic
\E S1 to state-default
\E state-default to state-in
\E state-default to state-out

FreeBSD-CVSweb <>