--- gforth/peeprules.vmg 2003/10/09 20:25:59 1.9 +++ gforth/peeprules.vmg 2007/12/31 19:02:24 1.21 @@ -1,28 +1,54 @@ +\ Gforth superinstructions and stack caching replicas + +\ Copyright (C) 2003,2004,2005,2007 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 3 +\ 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 +\ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +\ 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, see http://www.gnu.org/licenses/. + \ taken from David Gregg's EuroForth 2001 paper; omitted some sequences +\ eliminated for gforth-native: +\ 1) sequences containing call +\ 2) sequences with immediate arguments not in the first position + +\ no new prim-nums for supers and state-replicas +\E ' noop is output-c-prim-num + super1 = lit + -super2 = lit call +\ super2 = lit call super3 = lit @ -super4 = lit @ call -super5 = @ call +\ super4 = lit @ call +\ super5 = @ call super6 = lit ! -super7 = lit lit -super8 = dup lit -super9 = ! lit -super10 = lit ! lit +\ super7 = lit lit +\ super8 = dup lit +\ super9 = ! lit +\ super10 = lit ! lit super11 = ! ;s super12 = lit + @ -super13 = 0= ?branch -super14 = dup call +\ super13 = 0= ?branch +\ super14 = dup call super15 = useraddr @ super16 = + @ -super17 = lit @ ?branch +\ super17 = lit @ ?branch super18 = lit ! ;s super19 = lit @ and -super20 = = ?branch -super21 = lit lit ! -super22 = @ ?branch +\ super20 = = ?branch +\ super21 = lit lit ! +\ super22 = @ ?branch super23 = useraddr ! -super24 = dup ?branch +\ super24 = dup ?branch super25 = @ ;s super26 = lit @ + super27 = dup @ @@ -45,6 +71,7 @@ super27 = dup @ \E prim-states 0= \ 584487 \E prim-states dup \ 566855 \E S0 S1 state-prim dup +\E S1 S1 state-prim dup \E prim-states + \ 566003 \E prim-states i \ 502908 \E prim-states +! \ 448925 @@ -65,12 +92,17 @@ super27 = dup @ \E S2 S3 state-prim rot \E S1 S3 state-prim rot \E S0 S3 state-prim rot +\E S4 S2 state-prim rot +\E S5 S3 state-prim rot \E prim-states ! \ 218672 \E prim-states 2dup \ 211315 +\E S0 S1 state-prim 2dup \E S0 S2 state-prim 2dup \E S1 S3 state-prim 2dup \E S2 S2 state-prim 2dup \E S3 S1 state-prim 2dup +\E S4 S4 state-prim 2dup +\E S4 S2 state-prim 2dup \ \E branch-states lit-perform \ 188331 \E prim-states <> \ 179502 \E prim-states c! \ 179332 @@ -90,9 +122,10 @@ super27 = dup @ \E prim-states >= \ 80994 \E prim-states tuck \ 78696 \E S2 S2 state-prim tuck +\E S3 S3 state-prim tuck \E prim-states /string \ 78595 \E prim-states char+ \ 77542 -\ \E prim-states ?dup \ 76850 +\E prim-states ?dup \ 76850 \E prim-states @local0 \ 75322 \E prim-states min \ 75264 \ \E prim-states compare \ 65603 @@ -105,6 +138,7 @@ super27 = dup @ \E prim-states nip \ 54961 \E S1 S1 state-prim nip \E S0 S1 state-prim nip +\E S2 S2 state-prim nip \E prim-states within \ 51075 \E prim-states 1- \ 47441 \E branch-states execute \ 46674 @@ -117,6 +151,9 @@ super27 = dup @ \E prim-states -rot \ 26211 \E S3 S2 state-prim -rot \E S1 S3 state-prim -rot +\E S4 S3 state-prim -rot +\E S2 S4 state-prim -rot +\E S3 S5 state-prim -rot \E prim-states 2drop \ 25418 \E S0 S0 state-prim 2drop \E S1 S0 state-prim 2drop @@ -151,7 +188,7 @@ super27 = dup @ \E branch-states (+do) \ 5863 \ \E prim-states va-return-double \ 5517 \E prim-states um* \ 5342 -\E prim-states toupper \ 3517 +\ \E prim-states toupper \ 3517 \ \E prim-states f@local1 \ 2907 \ \E prim-states rp! \ 2859 \ \E prim-states ?dup-?branch \ 2829 @@ -172,6 +209,8 @@ super27 = dup @ \E prim-states 2swap \ 336 \E S0 S3 state-prim 2swap \E S1 S3 state-prim 2swap +\E S2 S4 state-prim 2swap +\E S4 S2 state-prim 2swap \E prim-states laddr# \ 335 \ \E prim-states faxpy \ 286 \ \E prim-states (next) \ 272 @@ -182,6 +221,11 @@ super27 = dup @ \E prim-states 2over \ 165 \E S0 S2 state-prim 2over \E S1 S3 state-prim 2over +\E S2 S4 state-prim 2over +\E S3 S5 state-prim 2over +\E S4 S2 state-prim 2over +\E S5 S3 state-prim 2over +\E S6 S4 state-prim 2over \E prim-states under+ \ 154 \E prim-states dnegate \ 128 \E prim-states u<> \ 128