Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/config/_run-sml
ViewVC logotype

Diff of /sml/trunk/config/_run-sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

sml/branches/SMLNJ/config/_run-sml revision 211, Fri Jan 15 16:19:21 1999 UTC sml/trunk/config/_run-sml revision 756, Thu Dec 14 16:01:33 2000 UTC
# Line 22  Line 22 
22    
23  # the path of the directory in which executables (like this file) are kept.  # the path of the directory in which executables (like this file) are kept.
24  BIN_DIR=@BINDIR@  BIN_DIR=@BINDIR@
25    if [ ! -d "$BIN_DIR" ]; then
26        cmddir=`dirname $0`
27        case "$cmddir" in
28            /* ) BIN_DIR="$cmddir";;
29            * ) BIN_DIR=`cd $cmddir; pwd` ;;
30        esac
31    fi
32    
33  # the path of the directory in which the runtime system executables are kept.  # the path of the directory in which the runtime system executables are kept.
34  RUN_DIR=$BIN_DIR/.run  RUN_DIR=$BIN_DIR/.run
# Line 45  Line 52 
52  #  #
53  #############################################################################  #############################################################################
54    
55    # special shortcut for frequent use (and for Linux' binfmt)
56    case "$1" in
57        /* | ./* | ../* )
58            case "$1" in
59                *.cm | *.sml | *.sig | *.fun )
60                    ;;
61                * )
62                    HEAP="@SMLload=$1"
63                    shift
64                    ;;
65            esac
66            ;;
67    esac
68    
69    ALLOC=""
70    
71  #  #
72  # Process command line arguments  # Process command line arguments
73  #  #
# Line 69  Line 92 
92        echo "$CMD @VERSION@"        echo "$CMD @VERSION@"
93        exit 0        exit 0
94        ;;        ;;
95        @SMLalloc=*)
96          ALLOC=$arg
97          ;;
98      *)      *)
99        ARGS="$ARGS $arg"        ARGS="$ARGS $arg"
100        ;;        ;;
101    esac    esac
102  done  done
103    
104    #
105    # Try to figure out the CPU's cache size and set the allocation area
106    # size accordingly.  This is majorly important for Celeron systems
107    # which suffer badly when the allocation area is too big.
108    #
109    if [ "$ALLOC" = "" ] ; then
110        if [ -f /proc/cpuinfo ] ; then
111            # "head" is called to make sure we consider only one matching line.
112            # (On linux SMP systems there is more than one such line.)
113            cache=`fgrep 'cache size' </proc/cpuinfo | head -1`
114            if [ "x$cache" = "x" ] ; then
115                # No cache info in /proc/cputype.  No we are checking the CPU
116                # type....
117                cpu=`fgrep 'cpu     ' </proc/cpuinfo | head -1`
118                cputype=`echo $cpu | sed -e 's/^.*:[ \t]*\(.*\)$/\1/'`
119                case $cputype in
120                    586)
121                        # An old Pentium.  Seems to work best with 64k.
122                        # Some extreme cases run best with even less
123                        #  (32k, 16k, or even just 8k).
124                        ALLOC="@SMLalloc=64k"
125                        ;;
126                    *)
127                        ;;
128                esac
129            else
130                kb=`echo $cache | sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'`
131                case $kb in
132                    128)
133                        # This is the Celeron case.
134                        ALLOC="@SMLalloc=32k"
135                        ;;
136                    256)
137                        # Do CPUs like this exist?
138                        ALLOC="@SMLalloc=128k"
139                        ;;
140                    512)
141                        # The Pentium II case...
142                        ALLOC="@SMLalloc=256k"
143                        ;;
144                    *)
145                        ;;
146                esac
147            fi
148        fi
149    fi
150    
151  if [ "$RUN" = "" ]; then  if [ "$RUN" = "" ]; then
152    #    #
153    # Construct the runtime system path from the ARCH and OS    # Construct the runtime system path from the ARCH and OS
# Line 107  Line 180 
180  #  #
181  # run the sucker!  # run the sucker!
182  #  #
183  exec $RUN @SMLcmdname=$0 $HEAP $ARGS  exec $RUN @SMLcmdname=$0 $HEAP $ALLOC $ARGS

Legend:
Removed from v.211  
changed lines
  Added in v.756

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0