3 # Time-stamp: <2010-01-19 17:56:00 feeley>
5 # Utility to change the number of registers in the virtual machine.
7 # Usage: misc/set-regs [ <NB_GVM_REGS> [ <NB_ARG_REGS> ]]
12 if [ "$NB_GVM_REGS" = "" ] ; then
16 if [ "$NB_ARG_REGS" = "" ] ; then
20 if [ "$NB_GVM_REGS" -lt 3 ] ; then
21 echo "NB_GVM_REGS=$NB_ARG_REGS but it must be >= 3"
25 if [ "$NB_GVM_REGS" -gt 25 ] ; then
26 echo "NB_GVM_REGS=$NB_ARG_REGS but it must be <= 25"
30 if [ "$NB_ARG_REGS" -lt 1 ] ; then
31 echo "NB_ARG_REGS=$NB_ARG_REGS but it must be >= 1"
35 if [ "$NB_ARG_REGS" -gt 12 ] ; then
36 echo "NB_ARG_REGS=$NB_ARG_REGS but it must be <= 12"
40 if [ "$NB_ARG_REGS" -gt `expr $NB_GVM_REGS - 2` ] ; then
41 echo "NB_ARG_REGS=$NB_ARG_REGS but it must be <= `expr $NB_GVM_REGS - 2`"
45 # Make sure the bootstrap compiler is built.
49 # Save the current bootstrap compiler just in case something goes wrong.
51 cp gsc-comp gsc-comp-old
53 # Set the number of registers in the gsc/_t-c-1.scm file.
55 sed -e "s/(set! targ-nb-gvm-regs [0-9]*)/(set! targ-nb-gvm-regs $NB_GVM_REGS)/" -e "s/(set! targ-nb-arg-regs [0-9]*)/(set! targ-nb-arg-regs $NB_ARG_REGS)/" gsc
/_t-c-1.scm
> gsc
/_t-c-1.scm-new
57 mv gsc
/_t-c-1.scm-new gsc
/_t-c-1.scm
59 # Build the new bootstrap compiler.
65 # Set the number of registers in the include/gambit.h file.
67 sed -e "s/#define ___NB_GVM_REGS [0-9]*/#define ___NB_GVM_REGS $NB_GVM_REGS/" -e "s/#define ___NB_ARG_REGS [0-9]*/#define ___NB_ARG_REGS $NB_ARG_REGS/" include
/gambit.h.
in > include
/gambit.h.in-new
69 mv include
/gambit.h.in-new include
/gambit.h.
in
71 # All the .c files previously generated by gsc are now invalid.
75 # Build the system using the new compiler.