home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d7xx
/
d765
/
gambit_comp.lha
/
Gambit_Comp
/
compiler.doc
< prev
next >
Wrap
Text File
|
1992-11-21
|
8KB
|
223 lines
FILE: "compiler.doc"
IMPLEMENTS: Description of how to use the compiler.
AUTHOR: Ken Dickey
DATE: 1992 August 1
LAST UPDATED: 1992 August 2
NOTES:
To save space, the compiler has not been built as a stand-alone
program. Use GSI (the Gambit Scheme Interpreter):
>> gsi -- -h4000 -c1000
Gambit v1.8
: (load "SCM:loadcompiler") ;; assumes you have assigned SCM:
: (compile "foo" 'verbose 'pvm 'report) ;; compiles "foo.scm" to "foo.O"
Compile files as shown below.
There are 2 major memory areas: the heap and the constant space. The
constant space is where code is loaded--it is not garbage collected at
this time. The heap holds all live data. In this release (1.8), a
stop-and-copy or hemispherical collector is used. This means that the
live data can fill up to 1/2 of the heap. To use the compiler, you
must tell gsi to save extra space for the compiled code (see
"gsi.man"). Use as large a heap as you can afford. I use "gsi --
-h4000 -c1000" which allocates 2 2MB semi-spaces for the heap and 1MB
for the interpreter & compiler code. If you don't allocate enough
space, the system will tell you when, e.g. you run out of constant
space when trying to load the compiler.
USAGE SYNOPSIS: (compile <filename-string> . <optional-options>)
; (compile "tak") -- compile 'tak.scm' for M68000 target
; (compile "tak" 'VERBOSE) -- produce compiler trace
; (compile "tak" 'REPORT) -- show usage of global variables
; (compile "tak" 'PVM) -- write PVM code on 'tak.pvm'
; (compile "tak" 'DEBUG) -- generate code with debugging info
; (compile "tak" 'EXPANSION) -- show code after source-to-source transform
; (compile "tak" 'ASM) -- write asm code to file 'tak.asm'
SAMPLE USAGE:
: (compile "sets" 'asm 'pvm 'report)
;; report output to stdout as follows
Global variable usage:
STANDARD
[ C] car
[ C] cdr
[ C] cons
[ C] eq?
[ R ] for-each
[ C] list
[ C] memq
[ C] null?
OTHERS
[D ] list->set
[D C] n-ary
[D ] set->list
[D ] set-adjoin
[D ] set-choose
[D ] set-difference
[D ] set-empty
[D ] set-empty?
[D C] set-equal?
[D C] set-every?
[D ] set-foreach
[D ] set-intersection
[D C] set-keep
[D C] set-map
[D ] set-member?
[D C] set-remove
[D ] set-singleton
[D ] set-union
[DARC] =>
Defined
Assigned to
Referenced
Called
SAMPLE SIZES
; sets.scm 2745 -- source
; sets.O 4898 -- loadfile
; sets.pvm 55119 -- symbolic instructions for PVM
; sets.asm 118447 -- assembly listing
COMPILER OPTIONS:
There are a number of options you can add to your code to enhance
speed and space performance. From Marc's man page:
NON-STANDARD SPECIAL FORMS
In addition to the standard Scheme special forms, the
compiler accepts the following forms which can appear
anywhere a define special form can appear:
(##declare decl...)
See below for the list of accepted
declarations. The scope of the
declaration extends to the end of the body
it is in or to the end of the program if
it is at toplevel.
(##include "prog.scm")
Read the expressions contained in the
given file and splice them into the
program.
(##define-macro (name parm...) body)
Define the name as a macro special form
which expands into body. The scope of the
declaration extends to the end of the body
it is in or to the end of the program if
it is at toplevel (unless it is redefined
before).
DECLARATIONS
The following declarations are accepted by the compiler:
(dialect) Use the given dialect's semantics.
Dialect can be: ieee-scheme, r4rs-scheme
or multilisp.
([not] lambda-lift)
Lambda-lift (or don't lambda-lift)
procedures.
(strategy) Select block compilation or separate
compilation. In block compilation, the
compiler can assume that all references to
the global variables defined in the
current program are located in the program
itself. Strategy can be: block or
separate.
([not] standard-bindings var...)
The given global variables are known (or
not known) to be equal to the value
defined for them in the dialect (all
variables defined in the standard if none
specified).
([not] extended-bindings var...)
The given global variables are known (or
not known) to be equal to the value
defined for them in the runtime system
(all variables defined in the runtime if
none specified).
([not] safe) Generate (or don't generate) code that
will prevent fatal runtime errors. Note
that in `safe' mode certain semantic
errors will not be checked as long as they
can't crash the system. For example the
primitive `char=?' could disregard the
type of its arguments in `safe' (as well
as `not safe') mode.
([not] intr-checks)
Generate (or don't generate) interrupt
checks. Interrupt checks are used to
signal the need for a garbage collection
on a multiprocessor system, to catch user
interrupts and also to check for stack
overflows. Interrupt checking should not
be turned off casually.
(futures method) Use the given method to implement futures.
Method can be: off (future = identity),
delay (future = delay), eager (create a
task for the body of every future), lazy
(create a task for a future's continuation
only when it must be moved to another
processor), and eager-inline (like eager
when there are no tasks waiting on the
processor, otherwise like identity).
(number-type prim...)
Numeric arguments and result of specified
primitives are known to be of the given
type (all primitives if none specified).
Number-type can be: generic or fixnum.
DEFAULT DECLARATION
The default declarations used by the compiler are:
(ieee-scheme)
(lambda-lift)
(separate)
(not standard-bindings)
(not extended-bindings)
(not safe)
(intr-checks)
(futures lazy)
(generic)
These declarations are compatible with the ieee-scheme
standard. Typically used declarations that enhance
performance (at the cost of violating the ieee-scheme
standard) are: (standard-bindings) and (fixnum).
DIAGNOSTICS
The diagnostic messages produced by gsc are printed on the
standard output file.
;; --- E O F ---