[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Optimizing AKCL Compilations



I recently investigated how to build AKCL 1.189 on Sun-3's and Sun-4's (running
SunOS 4.0.1) in such a way as to make the executable smaller and faster.  In
short, I used the Sun compiler at its maximum optimization level (-O4), and I
tried using version 1.35 of the GNU compiler.  As long as the UNIX process had
sufficient stack space in which to grow (8MB was enough), the Sun compiler was
able to compile all but two files using -O4.  The two "difficult" files --
lsp/setf.c and lsp/sloop.c -- were compiled manually using -O2 when the build
procedure halted.  Also, I made the following changes to cmpnew/cmpmain.lsp so
that the result of Lisp compilation would always be compiled using -O2 (-O is
equivalent to -O1 on the Sun-3, but to -O2 on the Sun-4):

      *** cmpmain.lsp.orig    Thu Aug 17 15:10:59 1989
      --- cmpmain.lsp         Wed Aug 23 13:09:11 1989
      ***************
      *** 451 ****
      !          "~a ~@[~*-O ~]-S -I. -w ~a ; as -J -o ~A ~A")
      --- 451 ----
      !          "~a ~@[~*-O2 ~]-S -I. -w ~a ; as -J -o ~A ~A")
      ***************
      *** 453 ****
      !          (format nil "(cd ~a ;~a ~a ~@[~*-O ~]-c -I. ~a ~a)"
      --- 453 ----
      !          (format nil "(cd ~a ;~a ~a ~@[~*-O2 ~]-c -I. ~a ~a)"
      ***************
      *** 497 ****
      !               #-buggy-cc "~a ~@[~*-O ~]-c -I. -w ~a"
      --- 497 ----
      !               #-buggy-cc "~a ~@[~*-O2 ~]-c -I. -w ~a"

The GNU compiler did produce slightly better code on the Sun-3, but I was not
able to build AKCL with it on the Sun-4.

During this investigation, I rewrote the machine-dependent files h/sun3.defs
and h/sun4.defs so that they would be more clear and correct (especially the
comments).  I have enclosed copies of the new files, and Prof. Schelter is
encouraged to use them in future releases of AKCL.


================================== sun3.defs ===================================

# Machine-dependent makefile definitions for sun3

MAINDIR = /net/maverick/d2/local/src/kcl
LBINDIR = /usr/local/bin
CFLAGS  = -c $(DEFS) -I../h

# Before starting the build, issue the csh command "limit stacksize 8m" to make
# sure the process will have sufficient stack space.  Using SUN's C compiler,
# the result of Lisp compilation cannot always be compiled using -O4, but all
# other files can be.  Under SunOS 4.0.1, the only files in AKCL Version 1.189
# that would not compile with -O4 were lsp/setf.c and lsp/sloop.c.  Whenever
# the build halts with an iropt compiler error, go to the lsp directory and
# compile the file manually using -O2, "cat setf.data >> setf.o" (for example),
# and then restart the build procedure in the top-level directory.  Version
# 1.35 of gcc (see below) produces slightly better code on the Sun-3, but it
# does not produce a working AKCL on the Sun-4.

OFLAG = -O4
LIBS  = -lm
ODIR_DEBUG =

# In order to turn on debugging in the ../o directory, change ODIR_DEBUG
# to -g, add -lg to LIBS, and change OFLAG appropriately (nothing for cc,
# possibly -O for gcc).

# The CC string will be used for compilation of the system and also in the
# compiler::*cc* variable for later compilation of Lisp files.

CC = cc -DMCC -DKEEPFASL -DVOL= -temp=. -I$(AKCLDIR)/o -Bstatic -f68881 -Qoption as -O

# "-DMCC -DKEEPFASL" is used only with MCC CAD's modifications.
# "-Bstatic" is for SunOS 4.0 and is not needed for SunOS 3.5 or lower.
# "-f68881" is good if all your Sun-3's have MC68881 chips.
# "-Qoption as -O" is needed on Sun-3's under SunOS 4.0 because of a Sun bug.

# "-I$(AKCLDIR)/o" is so that the C preprocessor will be able to find a
# cmpinclude.h file even if it is not in /usr/include.  We do not use the
# ../h directory because there are so many .h files there, and one of their
# names might conflict with a user's name (e.g. if he has a file vs.lisp).

# To use gcc, change OFLAG to -O above, and then use:

# CC = /usr/local/gnu/bin/gcc -DMCC -DKEEPFASL -DVOL=volatile -I$(AKCLDIR)/o -Bstatic -fwritable-strings -m68020 -m68881
# LDCC = $(CC) -g

# LDCC is used in unixport/makefile and in unixport/make_kcn.  It is
# needed when using gcc with SunOS 4.0 because gcc does not pass the
# -Bstatic option to ld unless the -g option is also specified.

# Enable the fastloading mechanism which does not use ld -A
# (requires c/rel_.. machine-dependent code).

RSYM  = rsym
SFASL = $(ODIR)/sfasl.o

# The INITFORM function will be run before dumping.
# When using SFASL, it is good to have (si::build-symbol-table).
# If you desire to have the KCL documentation files available on-line
# within the Lisp environment, rather than using an external documentation
# tool such as find-doc.el, add (load "../lsp/setdoc.lsp").

INITFORM = (si::build-symbol-table)

# Use symbolic links

SYMB = -s

================================================================================

================================== sun4.defs ===================================

# Machine-dependent makefile definitions for sun4

MAINDIR = /net/maverick/d2/local/src/kcl
LBINDIR = /usr/local/bin
CFLAGS  = -c $(DEFS) -I../h

CHTAB = sun4_chtab.s
EMUL  = $(ODIR)/sun4_emul.o

# Before starting the build, issue the csh command "limit stacksize 8m" to make
# sure the process will have sufficient stack space.  Using SUN's C compiler,
# the result of Lisp compilation cannot always be compiled using -O4, but all
# other files can be.  Under SunOS 4.0.1, the only files in AKCL Version 1.189
# that would not compile with -O4 were lsp/setf.c and lsp/sloop.c.  Whenever
# the build halts with an iropt compiler error, go to the lsp directory and
# compile the file manually using -O2, "cat setf.data >> setf.o" (for example),
# and then restart the build procedure in the top-level directory.  Version
# 1.35 of gcc (see below) produces slightly better code on the Sun-3, but it
# does not produce a working AKCL on the Sun-4.

OFLAG = -O4
LIBS  = -lm
ODIR_DEBUG =

# In order to turn on debugging in the ../o directory, change ODIR_DEBUG
# to -g, add -lg to LIBS, and change OFLAG appropriately (nothing for cc,
# possibly -O for gcc).

# The CC string will be used for compilation of the system and also in the
# compiler::*cc* variable for later compilation of Lisp files.

CC = cc -DMCC -DKEEPFASL -DVOL= -temp=. -I$(AKCLDIR)/o -Bstatic

# "-DMCC -DKEEPFASL" is used only with MCC CAD's modifications.
# "-Bstatic" is for SunOS 4.0 and is not needed for SunOS 3.5 or lower.

# "-I$(AKCLDIR)/o" is so that the C preprocessor will be able to find a
# cmpinclude.h file even if it is not in /usr/include.  We do not use the
# ../h directory because there are so many .h files there, and one of their
# names might conflict with a user's name (e.g. if he has a file vs.lisp).

# To use gcc, change OFLAG to -O above, and then use:

# CC = /usr/local/gnu/bin/gcc -DMCC -DKEEPFASL -DVOL=volatile -I$(AKCLDIR)/o -Bstatic -fwritable-strings -mfpu
# LDCC = $(CC) -g

# LDCC is used in unixport/makefile and in unixport/make_kcn.  It is
# needed when using gcc with SunOS 4.0 because gcc does not pass the
# -Bstatic option to ld unless the -g option is also specified.

# Enable the fastloading mechanism which does not use ld -A
# (requires c/rel_.. machine-dependent code).

RSYM  = rsym
SFASL = $(ODIR)/sfasl.o

# The INITFORM function will be run before dumping.
# When using SFASL, it is good to have (si::build-symbol-table).
# If you desire to have the KCL documentation files available on-line
# within the Lisp environment, rather than using an external documentation
# tool such as find-doc.el, add (load "../lsp/setdoc.lsp").

INITFORM = (si::build-symbol-table)

# Use symbolic links

SYMB = -s

================================================================================

 -----------------------------------------------------------------------
   Gregory R. Siebers  | MAIL: P.O. Box 200195, Austin, TX 78720
    MCC CAD Program    | ARPA: siebers@mcc.com
     (512) 338-3656    | UUCP: ...!cs.utexas.edu!milano!cadillac!siebers
 -----------------------------------------------------------------------