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 /config/trunk/_run-sml
ViewVC logotype

Diff of /config/trunk/_run-sml

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

revision 212, Fri Jan 15 16:19:21 1999 UTC revision 1261, Tue Jul 23 15:45:45 2002 UTC
# Line 21  Line 21 
21  #  #
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    if [ x${SMLNJ_HOME} = x ] ; then
25  BIN_DIR=@BINDIR@  BIN_DIR=@BINDIR@
26        if [ ! -d "$BIN_DIR" ]; then
27            cmddir=`dirname $0`
28            case "$cmddir" in
29                /* ) BIN_DIR="$cmddir";;
30                * ) BIN_DIR=`cd $cmddir; pwd` ;;
31            esac
32        fi
33    else
34        if [ x${CM_PATHCONFIG} = x ] ; then
35            CM_PATHCONFIG=${SMLNJ_HOME}/lib/pathconfig
36            export CM_PATHCONFIG
37        fi
38        BIN_DIR=${SMLNJ_HOME}/bin
39    fi
40    
41  # 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.
42  RUN_DIR=$BIN_DIR/.run  RUN_DIR=$BIN_DIR/.run
# Line 45  Line 60 
60  #  #
61  #############################################################################  #############################################################################
62    
63    # special shortcut for frequent use (and for Linux' binfmt)
64    if [ `basename $0` = sml ] ; then
65        case "$1" in
66            /* | ./* | ../* )
67                case "$1" in
68                    *.cm | *.sml | *.sig | *.fun )
69                        ;;
70                    * )
71                        HEAP="@SMLload=$1"
72                        shift
73                        ;;
74                esac
75                ;;
76        esac
77    fi
78    
79    ALLOC=""
80    
81  #  #
82  # Process command line arguments  # Process command line arguments
83  #  #
 ARGS=""  
84  while [ "$#" != "0" ]; do  while [ "$#" != "0" ]; do
85    arg=$1; shift    arg=$1
86    case $arg in    case $arg in
87      @SMLrun=*)      @SMLrun=*)
88          shift
89        RUN=`echo $arg | sed 's/@SMLrun=//'`        RUN=`echo $arg | sed 's/@SMLrun=//'`
90        ;;        ;;
91      @SMLload=*)      @SMLload=*)
92        HEAP=$arg;        shift
93          HEAP=$arg
94        ;;        ;;
95      @SMLappl)      @SMLappl)
96          shift
97        if [ "$#" = "0" ]; then        if [ "$#" = "0" ]; then
98          echo "$CMD: missing argument for @SMLappl option"          echo "$CMD: missing argument for @SMLappl option"
99          exit 1          exit 1
100        fi        fi
101        APPL=$1; shift        APPL=$1
102          shift
103        ;;        ;;
104      @SMLversion)      @SMLversion)
105        echo "$CMD @VERSION@"        echo "$CMD @VERSION@"
106        exit 0        exit 0
107        ;;        ;;
108        @SMLalloc=*)
109          shift
110          ALLOC=$arg
111          ;;
112      *)      *)
113        ARGS="$ARGS $arg"        break
114        ;;        ;;
115    esac    esac
116  done  done
117    
118    #
119    # Try to figure out the CPU's cache size and set the allocation area
120    # size accordingly.  This is majorly important for Celeron systems
121    # which suffer badly when the allocation area is too big.
122    #
123    if [ "$ALLOC" = "" ] ; then
124        if [ -f /proc/cpuinfo ] ; then
125            # "head" is called to make sure we consider only one matching line.
126            # (On linux SMP systems there is more than one such line.)
127            cache=`fgrep 'cache size' </proc/cpuinfo | head -1`
128            if [ "x$cache" = "x" ] ; then
129                # No cache info in /proc/cputype.  No we are checking the CPU
130                # type....
131                cpu=`fgrep 'cpu     ' </proc/cpuinfo | head -1`
132                cputype=`echo $cpu | sed -e 's/^.*:[ \t]*\(.*\)$/\1/'`
133                case $cputype in
134                    586)
135                        # An old Pentium.  Seems to work best with 64k.
136                        # Some extreme cases run best with even less
137                        #  (32k, 16k, or even just 8k).
138                        ALLOC="@SMLalloc=64k"
139                        ;;
140                    *)
141                        ;;
142                esac
143            else
144                kb=`echo $cache | sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'`
145                case $kb in
146                    128)
147                        # This is the Celeron case.
148                        ALLOC="@SMLalloc=32k"
149                        ;;
150                    256)
151                        # Do CPUs like this exist?
152                        ALLOC="@SMLalloc=128k"
153                        ;;
154                    512)
155                        # The Pentium II case...
156                        ALLOC="@SMLalloc=256k"
157                        ;;
158                    *)
159                        ;;
160                esac
161            fi
162        fi
163    fi
164    
165  if [ "$RUN" = "" ]; then  if [ "$RUN" = "" ]; then
166    #    #
167    # Construct the runtime system path from the ARCH and OS    # Construct the runtime system path from the ARCH and OS
# Line 107  Line 194 
194  #  #
195  # run the sucker!  # run the sucker!
196  #  #
197  exec $RUN @SMLcmdname=$0 $HEAP $ARGS  exec $RUN @SMLcmdname=$0 $HEAP $ALLOC "$@"

Legend:
Removed from v.212  
changed lines
  Added in v.1261

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