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

revision 212, Fri Jan 15 16:19:21 1999 UTC revision 902, Wed Aug 15 21:17:05 2001 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    if [ `basename $0` = sml ] ; then
57        case "$1" in
58            /* | ./* | ../* )
59                case "$1" in
60                    *.cm | *.sml | *.sig | *.fun )
61                        ;;
62                    * )
63                        HEAP="@SMLload=$1"
64                        shift
65                        ;;
66                esac
67                ;;
68        esac
69    fi
70    
71    ALLOC=""
72    
73  #  #
74  # Process command line arguments  # Process command line arguments
75  #  #
# Line 69  Line 94 
94        echo "$CMD @VERSION@"        echo "$CMD @VERSION@"
95        exit 0        exit 0
96        ;;        ;;
97        @SMLalloc=*)
98          ALLOC=$arg
99          ;;
100      *)      *)
101        ARGS="$ARGS $arg"        ARGS="$ARGS $arg"
102        ;;        ;;
103    esac    esac
104  done  done
105    
106    #
107    # Try to figure out the CPU's cache size and set the allocation area
108    # size accordingly.  This is majorly important for Celeron systems
109    # which suffer badly when the allocation area is too big.
110    #
111    if [ "$ALLOC" = "" ] ; then
112        if [ -f /proc/cpuinfo ] ; then
113            # "head" is called to make sure we consider only one matching line.
114            # (On linux SMP systems there is more than one such line.)
115            cache=`fgrep 'cache size' </proc/cpuinfo | head -1`
116            if [ "x$cache" = "x" ] ; then
117                # No cache info in /proc/cputype.  No we are checking the CPU
118                # type....
119                cpu=`fgrep 'cpu     ' </proc/cpuinfo | head -1`
120                cputype=`echo $cpu | sed -e 's/^.*:[ \t]*\(.*\)$/\1/'`
121                case $cputype in
122                    586)
123                        # An old Pentium.  Seems to work best with 64k.
124                        # Some extreme cases run best with even less
125                        #  (32k, 16k, or even just 8k).
126                        ALLOC="@SMLalloc=64k"
127                        ;;
128                    *)
129                        ;;
130                esac
131            else
132                kb=`echo $cache | sed -e 's/^[^0-9]*\([0-9]*\).*$/\1/'`
133                case $kb in
134                    128)
135                        # This is the Celeron case.
136                        ALLOC="@SMLalloc=32k"
137                        ;;
138                    256)
139                        # Do CPUs like this exist?
140                        ALLOC="@SMLalloc=128k"
141                        ;;
142                    512)
143                        # The Pentium II case...
144                        ALLOC="@SMLalloc=256k"
145                        ;;
146                    *)
147                        ;;
148                esac
149            fi
150        fi
151    fi
152    
153  if [ "$RUN" = "" ]; then  if [ "$RUN" = "" ]; then
154    #    #
155    # Construct the runtime system path from the ARCH and OS    # Construct the runtime system path from the ARCH and OS
# Line 107  Line 182 
182  #  #
183  # run the sucker!  # run the sucker!
184  #  #
185  exec $RUN @SMLcmdname=$0 $HEAP $ARGS  exec $RUN @SMLcmdname=$0 $HEAP $ALLOC $ARGS

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

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