Skip to content

Commit

Permalink
Added configure variable STACK_CACHE_REGS and set useful defaults
Browse files Browse the repository at this point in the history
  currently supported: 0-4 regs, default reg 0-4.
  • Loading branch information
anton committed Jan 2, 2008
1 parent 2cd15cb commit dcdb45e
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 16 deletions.
5 changes: 3 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ XLDFLAGS = @LDFLAGS@
LDFLAGS = $(DEBUGFLAG) $(XLDFLAGS)
LDLIBS = @LIBS@

STACK_CACHE_REGS = @STACK_CACHE_REGS@
STACK_CACHE_DEFAULT_FAST = @STACK_CACHE_DEFAULT_FAST@

# ------------ Install Directories
Expand Down Expand Up @@ -763,8 +764,8 @@ prim.b: prim cache0.vmg
$(M4) -Dcondbranch_opt=0 $(srcdir)/prim >$@
sleep 1 #should make hpux-workaround unnecessary

prim-fast.b: prim cache-fast$(STACK_CACHE_DEFAULT_FAST).vmg peeprules.vmg Makefile.in
$(M4) -Dcondbranch_opt=@condbranch_opt@ -DSTACK_CACHE_FILE=cache-fast$(STACK_CACHE_DEFAULT_FAST).vmg $(srcdir)/prim >$@
prim-fast.b: prim cache-fast$(STACK_CACHE_DEFAULT_FAST).vmg cache-regs$(STACK_CACHE_REGS).vmg peeprules.vmg Makefile
$(M4) -Dcondbranch_opt=@condbranch_opt@ -DSTACK_CACHE_FILE=cache-fast$(STACK_CACHE_DEFAULT_FAST).vmg -DSTACK_CACHE_REGS=cache-regs$(STACK_CACHE_REGS).vmg $(srcdir)/prim >$@
sleep 1 #should make hpux-workaround unnecessary

$(FORTH_GEN_ENGINE_FAST): prim-fast.b prims2x.fs
Expand Down
7 changes: 1 addition & 6 deletions cache-fast0.vmg
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,7 @@
\E state S7
\E state S8

\E S3 state-disable
\E S4 state-disable
\E S5 state-disable
\E S6 state-disable
\E S7 state-disable
\E S8 state-disable
include(STACK_CACHE_REGS)

\E ss0 data-stack S0 set-ss
\E ss1 data-stack S1 set-ss
Expand Down
9 changes: 2 additions & 7 deletions cache-fast1.vmg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
\ stack cache setup
\ stack cache setup: default state S1

\ Copyright (C) 2003,2004,2005,2006,2007 Free Software Foundation, Inc.

Expand Down Expand Up @@ -59,12 +59,7 @@
\E state S7
\E state S8

\E S3 state-disable
\E S4 state-disable
\E S5 state-disable
\E S6 state-disable
\E S7 state-disable
\E S8 state-disable
include(STACK_CACHE_REGS)

\E ss0 data-stack S0 set-ss
\E ss1 data-stack S1 set-ss
Expand Down
2 changes: 2 additions & 0 deletions cache-fast2.vmg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
\E state S7
\E state S8

include(STACK_CACHE_REGS)

\E ss0 data-stack S0 set-ss
\E ss1 data-stack S1 set-ss
\E ss2 data-stack S2 set-ss
Expand Down
2 changes: 2 additions & 0 deletions cache-fast3.vmg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
\E state S7
\E state S8

include(STACK_CACHE_REGS)

\E ss0 data-stack S0 set-ss
\E ss1 data-stack S1 set-ss
\E ss2 data-stack S2 set-ss
Expand Down
2 changes: 2 additions & 0 deletions cache-fast4.vmg
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
\E state S7
\E state S8

include(STACK_CACHE_REGS)

\E ss0 data-stack S0 set-ss
\E ss1 data-stack S1 set-ss
\E ss2 data-stack S2 set-ss
Expand Down
26 changes: 26 additions & 0 deletions cache-regs1.vmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
\ stack cache diablers: maximun state S1

\ Copyright (C) 2008 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/.

\E S2 state-disable
\E S3 state-disable
\E S4 state-disable
\E S5 state-disable
\E S6 state-disable
\E S7 state-disable
\E S8 state-disable
25 changes: 25 additions & 0 deletions cache-regs2.vmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
\ stack cache diablers: maximun state S2

\ Copyright (C) 2008 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/.

\E S3 state-disable
\E S4 state-disable
\E S5 state-disable
\E S6 state-disable
\E S7 state-disable
\E S8 state-disable
24 changes: 24 additions & 0 deletions cache-regs3.vmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
\ stack cache diablers: maximun state S3

\ Copyright (C) 2008 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/.

\E S4 state-disable
\E S5 state-disable
\E S6 state-disable
\E S7 state-disable
\E S8 state-disable
23 changes: 23 additions & 0 deletions cache-regs4.vmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
\ stack cache diablers: maximun state S4

\ Copyright (C) 2008 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/.

\E S5 state-disable
\E S6 state-disable
\E S7 state-disable
\E S8 state-disable
11 changes: 10 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ else
fi])

#variables mentioned in INSTALL
AC_ARG_VAR(CC, [The C compiler (must support GNU C 2.x); gcc-2.95 recommended.])
AC_ARG_VAR(CC, [The C compiler (must support GNU C 2.x).])
AC_ARG_VAR(FORTHSIZES, [Gforth command line options for the default stack and dictionary sizes (see INSTALL).])
AC_ARG_VAR(STACK_CACHE_REGS, [number of registers in the maximum stack cache state for gforth-fast and gforth-native (default platform-dependent).])
AC_ARG_VAR(STACK_CACHE_DEFAULT_FAST, [number of registers in the default stack cache state for gforth-fast and gforth-native (default 1).])
AC_ARG_VAR(GCC_PR15242_WORKAROUND, [Force the enabling (1) or disabling (0) of a workaround for a gcc-3.x performance bug (default unset: use workaround for gcc-3.x)])

Expand Down Expand Up @@ -314,6 +315,9 @@ case "$host_cpu" in
test x$ac_cv_sizeof_long_long = x &&
($CC -v 2>&1 |grep -q 'gcc version 2.95') &&
ac_cv_sizeof_long_long=0
#The only architecture with enough callee-saved registers
test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=3
#or use 2, hardly slower at run-time and starts up faster
;;
*)
AC_MSG_WARN([Using a generic machine description])
Expand Down Expand Up @@ -348,6 +352,11 @@ then
fi
AC_SUBST(MAKEINC)

AC_ARG_VAR(STACK_CACHE_REGS, [number of registers in the maximum stack cache state for gforth-fast and gforth-native (default platform-dependent).])

test x$STACK_CACHE_REGS = x && STACK_CACHE_REGS=1
AC_DEFINE_UNQUOTED(STACK_CACHE_REGS, $STACK_CACHE_REGS,
[number of registers in the maximum stack cache state for gforth-fast and gforth-native])
test x$STACK_CACHE_DEFAULT_FAST = x && STACK_CACHE_DEFAULT_FAST=1
AC_DEFINE_UNQUOTED(STACK_CACHE_DEFAULT_FAST, $STACK_CACHE_DEFAULT_FAST,
[number of registers in the default stack cache state for gforth-fast and gforth-native])
Expand Down

0 comments on commit dcdb45e

Please sign in to comment.