diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:29 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:29 -0800 |
commit | 302e3218b7d487539ec305bf23881a6ee7d5be99 (patch) | |
tree | bf1adafe552a17b3b78522048bb7c24787696dd3 /hobbit.info | |
parent | c7d035ae1a729232579a0fe41ed5affa131d3623 (diff) | |
download | scm-upstream/5e1.tar.gz scm-upstream/5e1.zip |
Import Upstream version 5e1upstream/5e1
Diffstat (limited to 'hobbit.info')
-rw-r--r-- | hobbit.info | 306 |
1 files changed, 155 insertions, 151 deletions
diff --git a/hobbit.info b/hobbit.info index a9d8b9f..d775565 100644 --- a/hobbit.info +++ b/hobbit.info @@ -1,4 +1,4 @@ -This is hobbit.info, produced by makeinfo version 4.0 from hobbit.texi. +This is hobbit.info, produced by makeinfo version 4.7 from hobbit.texi. INFO-DIR-SECTION The Algorithmic Language Scheme START-INFO-DIR-ENTRY @@ -40,8 +40,8 @@ approved by the author. File: hobbit.info, Node: Introduction, Next: Compiling with Hobbit, Prev: Top, Up: Top -Introduction -************ +1 Introduction +************** Hobbit is a small optimizing scheme-to-C compiler written in Report 4 scheme and intended for use together with the SCM scheme interpreter of @@ -67,17 +67,17 @@ Hobbit (derived from hobbit5x) is now part of the SCM Scheme implementation. The most recent information about SCM can be found on SCM's "WWW" home page: - <http://swissnet.ai.mit.edu/~jaffer/SCM> + `http://swiss.csail.mit.edu/~jaffer/SCM' Hobbit4d has also been ported to the Guile Scheme implementation: - <http://www.gnu.org/software/guile/anon-cvs.html> + `http://www.gnu.org/software/guile/anon-cvs.html' File: hobbit.info, Node: Compiling with Hobbit, Next: The Language Compiled, Prev: Introduction, Up: Top -Compiling with Hobbit -********************* +2 Compiling with Hobbit +*********************** * Menu: @@ -89,16 +89,16 @@ Compiling with Hobbit File: hobbit.info, Node: Compiling And Linking, Next: Error Detection, Prev: Compiling with Hobbit, Up: Compiling with Hobbit -Compiling And Linking -===================== +2.1 Compiling And Linking +========================= `(require 'compile)' - - Function: hobbit name1.scm name2.scm ... + -- Function: hobbit name1.scm name2.scm ... Invokes the HOBBIT compiler to translate Scheme files `NAME1.scm', `NAME2.scm', ... to C files `NAME1.c' and `NAME1.h'. - - Function: compile-file name1.scm name2.scm ... + -- Function: compile-file name1.scm name2.scm ... Compiles the HOBBIT translation of NAME1.scm, NAME2.scm, ... to a dynamically linkable object file NAME1<object-suffix>, where <object-suffix> is the object file suffix for your computer (for @@ -110,26 +110,26 @@ Compiling And Linking cd ~/scm/ scm -rcompile -e'(compile-file "example.scm")' - + Starting to read example.scm - + Generic (slow) arithmetic assumed: 1.0e-3 found. - + ** Pass 1 completed ** ** Pass 2 completed ** ** Pass 3 completed ** ** Pass 4 completed ** ** Pass 5 completed ** ** Pass 6 completed ** - + C source file example.c is built. C header file example.h is built. - + These top level higher order procedures are not clonable (slow): (nonkeyword_make-promise map-streams generate-vector runge-kutta-4) These top level procedures create non-liftable closures (slow): (nonkeyword_make-promise damped-oscillator map-streams scale-vector elementwise runge-kutta-4 integrate-system) - + ; Scheme (linux) script created by SLIB/batch Sun Apr 7 22:49:49 2002 ; ================ Write file with C defines (delete-file "scmflags.h") @@ -138,7 +138,7 @@ Compiling And Linking (lambda (fp) (for-each (lambda (string) (write-line string fp)) - '("#define IMPLINIT \"Init5d9.scm\"" + '("#define IMPLINIT \"Init5e1.scm\"" "#define BIGNUMS" "#define FLOATS" "#define ARRAYS" @@ -149,10 +149,10 @@ Compiling And Linking (delete-file "example.o") ; ================ Link C object files (delete-file "slibcat") - + Compilation finished at Sun Apr 7 22:49:50 - - Function: compile->executable exename name1.scm name2.scm ... + -- Function: compile->executable exename name1.scm name2.scm ... Compiles and links the HOBBIT translation of NAME1.scm, NAME2.scm, ... to a SCM executable named EXENAME. NAME1.scm must be in the current directory; NAME2.scm, ... may be in other directories. @@ -162,26 +162,26 @@ Compiling And Linking cd ~/scm/ scm -rcompile -e'(compile->executable "exscm" "example.scm")' - + Starting to read example.scm - + Generic (slow) arithmetic assumed: 1.0e-3 found. - + ** Pass 1 completed ** ** Pass 2 completed ** ** Pass 3 completed ** ** Pass 4 completed ** ** Pass 5 completed ** ** Pass 6 completed ** - + C source file example.c is built. C header file example.h is built. - + These top level higher order procedures are not clonable (slow): (nonkeyword_make-promise map-streams generate-vector runge-kutta-4) These top level procedures create non-liftable closures (slow): (nonkeyword_make-promise damped-oscillator map-streams scale-vector elementwise runge-kutta-4 integrate-system) - + ; Scheme (linux) script created by SLIB/batch Sun Apr 7 22:46:31 2002 ; ================ Write file with C defines (delete-file "scmflags.h") @@ -190,7 +190,7 @@ Compiling And Linking (lambda (fp) (for-each (lambda (string) (write-line string fp)) - '("#define IMPLINIT \"Init5d9.scm\"" + '("#define IMPLINIT \"Init5e1.scm\"" "#define COMPILED_INITS init_example();" "#define CCLO" "#define FLOATS")))) @@ -198,7 +198,7 @@ Compiling And Linking (system "gcc -O2 -c continue.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c example.c scm.c") ; ================ Link C object files (system "gcc -rdynamic -o exscm continue.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o example.o scm.o -L/usr/local/lib/scm/ -lm -lc") - + Compilation finished at Sun Apr 7 22:46:44 _Note Bene:_ `#define CCLO' must be present in `scmfig.h'. @@ -212,8 +212,8 @@ before calling these functions. File: hobbit.info, Node: Error Detection, Next: Hobbit Options, Prev: Compiling And Linking, Up: Compiling with Hobbit -Error Detection -=============== +2.2 Error Detection +=================== Error detection during compilation is minimal. In case your scheme code is syntactically incorrect, hobbit may crash with no sensible error @@ -252,8 +252,8 @@ and hobbit will immediately halt compilation. File: hobbit.info, Node: Hobbit Options, Next: CC Optimizations, Prev: Error Detection, Up: Compiling with Hobbit -Hobbit Options -============== +2.3 Hobbit Options +================== 1. Selecting the type of arithmetics. @@ -440,8 +440,8 @@ Hobbit Options File: hobbit.info, Node: CC Optimizations, Prev: Hobbit Options, Up: Compiling with Hobbit -CC Optimizations -================ +2.4 CC Optimizations +==================== When using the C compiler to compile the C code output by hobbit, always use strong optimizations (eg. `cc -xO3' for cc on Sun, `gcc -O2' or @@ -461,8 +461,8 @@ checking into the code it produces. File: hobbit.info, Node: The Language Compiled, Next: Performance of Compiled Code, Prev: Compiling with Hobbit, Up: Top -The Language Compiled -********************* +3 The Language Compiled +*********************** Calls to `load' or `require' occurring at the top level of a file being compiled are ignored. Calls to `load' or `require' within a procedure @@ -483,8 +483,8 @@ hobbit as Scheme primitives. File: hobbit.info, Node: Macros, Next: SCM Primitive Procedures, Prev: The Language Compiled, Up: The Language Compiled -Macros -====== +3.1 Macros +========== The Common-lisp style defmacro implemented in SCM is recognized and procedures defined by defmacro are expanded during compilation. @@ -500,8 +500,8 @@ file. File: hobbit.info, Node: SCM Primitive Procedures, Next: SLIB Logical Procedures, Prev: Macros, Up: The Language Compiled -SCM Primitive Procedures -======================== +3.2 SCM Primitive Procedures +============================ Real-only versions of transcedental procedures (warning: these procedures are not compiled directly into the corresponding C library @@ -522,8 +522,8 @@ delete-file, rename-file. File: hobbit.info, Node: SLIB Logical Procedures, Next: Fast Integer Calculations, Prev: SCM Primitive Procedures, Up: The Language Compiled -SLIB Logical Procedures -======================= +3.3 SLIB Logical Procedures +=========================== The following bitwise procedures in the scheme library file `logical.scm' are compiled directly to fast C operations on immediate @@ -534,8 +534,8 @@ C ops below): & | ^ ~ << >> The following alternative names logical:logand, logical:logior, -logical:logxor, logical:lognot, ash, logical:ash are compiled for the -generic case, not immediate-integers-only and are thus much slower. +logical:logxor, logical:lognot, and ash are compiled for the generic +case, not immediate-integers-only and are thus much slower. Notice that the procedures logsleft, logsright are NOT in the the library file `logical.scm:' the universal procedure ash is instead. @@ -549,8 +549,8 @@ logsleft and logsright are defined for non-compiled use in the file File: hobbit.info, Node: Fast Integer Calculations, Next: Force and Delay, Prev: SLIB Logical Procedures, Up: The Language Compiled -Fast Integer Calculations -========================= +3.4 Fast Integer Calculations +============================= The following primitives are for immediate (30-bit) integer-only arithmetics. The are compiled directly into the corresponding C @@ -573,8 +573,8 @@ in the SCM distribution. File: hobbit.info, Node: Force and Delay, Next: Suggestions for writing fast code, Prev: Fast Integer Calculations, Up: The Language Compiled -Force and Delay -=============== +3.5 Force and Delay +=================== The nonessential procedure `force' and syntax `delay' are implemented exactly as suggested in the report 4. This implementation deviates @@ -586,8 +586,8 @@ for the promises created by the interpreter. File: hobbit.info, Node: Suggestions for writing fast code, Prev: Force and Delay, Up: The Language Compiled -Suggestions for writing fast code -================================= +3.6 Suggestions for writing fast code +===================================== The following suggestions may help you to write well-optimizable and fast code for the hobbit-scm combination. Roughly speaking, the main @@ -844,8 +844,8 @@ Here come the details. File: hobbit.info, Node: Performance of Compiled Code, Next: Principles of Compilation, Prev: The Language Compiled, Up: Top -Performance of Compiled Code -**************************** +4 Performance of Compiled Code +****************************** * Menu: @@ -856,8 +856,8 @@ Performance of Compiled Code File: hobbit.info, Node: Gain in Speed, Next: Benchmarks, Prev: Performance of Compiled Code, Up: Performance of Compiled Code -Gain in Speed -============= +4.1 Gain in Speed +================= The author has so far compiled and tested a number of large programs (theorem provers for various logics and hobbit itself). @@ -895,8 +895,8 @@ benchmark CPSTAK in the following table. File: hobbit.info, Node: Benchmarks, Next: Benchmark Sources, Prev: Gain in Speed, Up: Performance of Compiled Code -Benchmarks -========== +4.2 Benchmarks +============== We will present a table with the performance of three scheme systems on a number of benchmarks: interpreted SCM, byte-compiled VSCM and @@ -956,8 +956,8 @@ before each test. File: hobbit.info, Node: Benchmark Sources, Prev: Benchmarks, Up: Performance of Compiled Code -Benchmark Sources -================= +4.3 Benchmark Sources +===================== A selection of (smaller) benchmark sources ------------------------------------------ @@ -977,8 +977,8 @@ A selection of (smaller) benchmark sources File: hobbit.info, Node: Destruct, Next: Recfib, Prev: Benchmark Sources, Up: Benchmark Sources -Destruct --------- +4.3.1 Destruct +-------------- ;;;; Destructive operation benchmark (define (destructive n m) @@ -1014,8 +1014,8 @@ Destruct File: hobbit.info, Node: Recfib, Next: div-iter and div-rec, Prev: Destruct, Up: Benchmark Sources -Recfib ------- +4.3.2 Recfib +------------ (define (recfib x) (if (< x 2) @@ -1026,8 +1026,8 @@ Recfib File: hobbit.info, Node: div-iter and div-rec, Next: Hanoi, Prev: Recfib, Up: Benchmark Sources -div-iter and div-rec --------------------- +4.3.3 div-iter and div-rec +-------------------------- ;;;; Recursive and iterative benchmark divides by 2 using lists of ()'s. (define (create-n n) @@ -1060,8 +1060,8 @@ div-iter and div-rec File: hobbit.info, Node: Hanoi, Next: Tak, Prev: div-iter and div-rec, Up: Benchmark Sources -Hanoi ------ +4.3.4 Hanoi +----------- ;;; C optimiser should be able to remove the first recursive call to ;;; move-them. But Solaris 2.4 cc, gcc 2.5.8, and hobbit don't. @@ -1077,8 +1077,8 @@ Hanoi File: hobbit.info, Node: Tak, Next: Ctak, Prev: Hanoi, Up: Benchmark Sources -Tak ---- +4.3.5 Tak +--------- ;;;; A vanilla version of the TAKeuchi function (define (tak x y z) @@ -1092,15 +1092,15 @@ Tak File: hobbit.info, Node: Ctak, Next: Takl, Prev: Tak, Up: Benchmark Sources -Ctak ----- +4.3.6 Ctak +---------- ;;;; A version of the TAK function that uses continuations (define (ctak x y z) (call-with-current-continuation (lambda (k) (ctak-aux k x y z)))) - + (define (ctak-aux k x y z) (cond ((not (< y x)) (k z)) (else (call-with-current-continuation @@ -1112,9 +1112,9 @@ Ctak (lambda (k) (ctak-aux k (- y 1) z x))) (call-with-current-continuation (lambda (k) (ctak-aux k (- z 1) x y)))))))) - + (define (id x) x) - + (define (mb-test r x y z) (if (zero? r) (ctak x y z) @@ -1124,26 +1124,26 @@ Ctak File: hobbit.info, Node: Takl, Next: Cpstak, Prev: Ctak, Up: Benchmark Sources -Takl ----- +4.3.7 Takl +---------- ;;;; The TAKeuchi function using lists as counters. (define (listn n) (if (not (= 0 n)) (cons n (listn (- n 1))) '())) - + (define l18 (listn 18)) (define l12 (listn 12)) (define l6 (listn 6)) - + (define (mas x y z) (if (not (shorterp y x)) z (mas (mas (cdr x) y z) (mas (cdr y) z x) (mas (cdr z) x y)))) - + (define (shorterp x y) (and (pair? y) (or (null? x) (shorterp (cdr x) (cdr y))))) ;; call: (mas l18 l12 l6) @@ -1151,8 +1151,8 @@ Takl File: hobbit.info, Node: Cpstak, Next: Pi, Prev: Takl, Up: Benchmark Sources -Cpstak ------- +4.3.8 Cpstak +------------ ;;;; A continuation-passing version of the TAK benchmark. (define (cpstak x y z) @@ -1178,8 +1178,8 @@ Cpstak File: hobbit.info, Node: Pi, Prev: Cpstak, Up: Benchmark Sources -Pi --- +4.3.9 Pi +-------- (define (pi n . args) (let* ((d (car args)) @@ -1210,8 +1210,8 @@ Pi File: hobbit.info, Node: Principles of Compilation, Next: About Hobbit, Prev: Performance of Compiled Code, Up: Top -Principles of Compilation -************************* +5 Principles of Compilation +*************************** * Menu: @@ -1225,8 +1225,8 @@ Principles of Compilation File: hobbit.info, Node: Macro-Expansion and Analysis, Next: Building Closures, Prev: Principles of Compilation, Up: Principles of Compilation -Expansion and Analysis -====================== +5.1 Expansion and Analysis +========================== 1. Macros defined by defmacro and all the quasiquotes are expanded and compiled into equivalent form without macros and quasiquotes. @@ -1320,8 +1320,8 @@ Expansion and Analysis File: hobbit.info, Node: Building Closures, Next: Lambda-lifting, Prev: Macro-Expansion and Analysis, Up: Principles of Compilation -Building Closures -================= +5.2 Building Closures +===================== Here Hobbit produces code for creating real closures for all the lambda-terms which are not marked as being liftable by the previous @@ -1388,8 +1388,8 @@ called using an internal apply. File: hobbit.info, Node: Lambda-lifting, Next: Statement-lifting, Prev: Building Closures, Up: Principles of Compilation -Lambda-lifting -============== +5.3 Lambda-lifting +================== When this pass starts, all the real (nonliftable) closures have been translated to closure-creating code. The remaining lambda-terms are @@ -1415,7 +1415,7 @@ is converted to (define foo (lambda (x y) (foo-fn1 x y) )) - + (define foo-fn1 (lambda (x u) (+ u x) )) @@ -1435,10 +1435,10 @@ of these variables: (define (foo x y z i) (foo-fn2 x z i) ) - + (define foo-fn1 (lambda (x z u) (if x (+ (foo-fn2 x z u) 1))) ) - + (define foo-fn2 (lambda (x z v) (if (zero? v) 1 (foo-fn1 x z z))) ) @@ -1462,7 +1462,7 @@ is converted to incorrect scheme: (lambda (x y z) (foo-fn1 x (**c-adr** z) y) z)) - + (define foo-fn1 (lambda (x (**c-adr** z) u) (set! (**c-fetch** z) (+ u x (**c-fetch** z))) )) @@ -1475,7 +1475,7 @@ The last two will finally be compiled into correct C as: foo_fn1(x, &z, y); return z; } - + SCM foo_fn1(x, z, u) SCM x, u; SCM *z; @@ -1486,8 +1486,8 @@ The last two will finally be compiled into correct C as: File: hobbit.info, Node: Statement-lifting, Next: Higher-order Arglists, Prev: Lambda-lifting, Up: Principles of Compilation -Statement-lifting -================= +5.4 Statement-lifting +===================== As the scheme do-construction is compiled into C for, but for cannot occur in all places in C (it is a statement), then if the do in a @@ -1517,8 +1517,8 @@ the beginning of the procedure body. File: hobbit.info, Node: Higher-order Arglists, Next: Typing and Constants, Prev: Statement-lifting, Up: Principles of Compilation -Higher-order Arglists -===================== +5.5 Higher-order Arglists +========================= All procedures taking a list argument are converted into ordinary non-list taking procedures and they are called with the list-making @@ -1583,8 +1583,8 @@ FUN is the name of the original procedure. File: hobbit.info, Node: Typing and Constants, Prev: Higher-order Arglists, Up: Principles of Compilation -Typing and Constants -==================== +5.6 Typing and Constants +======================== All C<->Scheme conversions for immediate objects like numbers, booleans and characters are introduced. Internal apply is used for undefined @@ -1623,8 +1623,8 @@ instead of the default: File: hobbit.info, Node: About Hobbit, Next: Index, Prev: Principles of Compilation, Up: Top -About Hobbit -************ +6 About Hobbit +************** * Menu: @@ -1637,8 +1637,8 @@ About Hobbit File: hobbit.info, Node: The Aims of Developing Hobbit, Next: Manifest, Prev: About Hobbit, Up: About Hobbit -The Aims of Developing Hobbit -============================= +6.1 The Aims of Developing Hobbit +================================= 1. Producing maximally fast C code from simple scheme code. @@ -1657,8 +1657,8 @@ The Aims of Developing Hobbit File: hobbit.info, Node: Manifest, Next: Author and Contributors, Prev: The Aims of Developing Hobbit, Up: About Hobbit -Manifest -======== +6.2 Manifest +============ `hobbit.scm' the hobbit compiler. `scmhob.scm' the file defining some additional procedures recognized @@ -1670,8 +1670,8 @@ Manifest File: hobbit.info, Node: Author and Contributors, Next: Future Improvements, Prev: Manifest, Up: About Hobbit -Author and Contributors -======================= +6.3 Author and Contributors +=========================== Tanel Tammet Department of Computing Science @@ -1696,8 +1696,8 @@ NMICHAEL@us.oracle.com, Lee Iverson (leei@ai.sri.com), Burt Leavenworth File: hobbit.info, Node: Future Improvements, Next: Release History, Prev: Author and Contributors, Up: About Hobbit -Future Improvements -=================== +6.4 Future Improvements +======================= 1. Optimisations: @@ -1727,8 +1727,8 @@ Future Improvements File: hobbit.info, Node: Release History, Prev: Future Improvements, Up: About Hobbit -Release History -=============== +6.5 Release History +=================== [In February 2002, hobbit5x was integrated into the SCM distribution. Changes since then are recorded in `scm/ChangeLog'.] @@ -1916,55 +1916,59 @@ File: hobbit.info, Node: Index, Prev: About Hobbit, Up: Top Index ***** + * Menu: * compile->executable: Compiling And Linking. + (line 67) * compile-file: Compiling And Linking. + (line 13) * hobbit: Compiling And Linking. + (line 9) Tag Table: Node: Top199 Node: Introduction1227 -Node: Compiling with Hobbit2540 -Node: Compiling And Linking2793 -Node: Error Detection7538 -Node: Hobbit Options8836 -Node: CC Optimizations15557 -Node: The Language Compiled16505 -Node: Macros17160 -Node: SCM Primitive Procedures17756 -Node: SLIB Logical Procedures18607 -Node: Fast Integer Calculations19763 +Node: Compiling with Hobbit2543 +Node: Compiling And Linking2801 +Node: Error Detection7487 +Node: Hobbit Options8793 +Node: CC Optimizations15522 +Node: The Language Compiled16478 +Node: Macros17137 +Node: SCM Primitive Procedures17741 +Node: SLIB Logical Procedures18600 +Node: Fast Integer Calculations19755 Node: Force and Delay20889 -Node: Suggestions for writing fast code21466 -Node: Performance of Compiled Code31657 -Node: Gain in Speed31913 -Node: Benchmarks33490 -Node: Benchmark Sources36582 -Node: Destruct36920 -Node: Recfib38495 -Node: div-iter and div-rec38738 -Node: Hanoi39812 -Node: Tak40381 -Node: Ctak40724 -Node: Takl41707 -Node: Cpstak42366 -Node: Pi43133 -Node: Principles of Compilation44250 -Node: Macro-Expansion and Analysis44672 -Node: Building Closures48469 -Node: Lambda-lifting51352 -Node: Statement-lifting54100 -Node: Higher-order Arglists55200 -Node: Typing and Constants56998 -Node: About Hobbit58254 -Node: The Aims of Developing Hobbit58510 -Node: Manifest59393 -Node: Author and Contributors59844 -Node: Future Improvements60891 -Node: Release History61648 -Node: Index68429 +Node: Suggestions for writing fast code21474 +Node: Performance of Compiled Code31673 +Node: Gain in Speed31933 +Node: Benchmarks33518 +Node: Benchmark Sources36618 +Node: Destruct36964 +Node: Recfib38551 +Node: div-iter and div-rec38806 +Node: Hanoi39892 +Node: Tak40473 +Node: Ctak40828 +Node: Takl41808 +Node: Cpstak42464 +Node: Pi43243 +Node: Principles of Compilation44372 +Node: Macro-Expansion and Analysis44798 +Node: Building Closures48603 +Node: Lambda-lifting51494 +Node: Statement-lifting54225 +Node: Higher-order Arglists55333 +Node: Typing and Constants57139 +Node: About Hobbit58403 +Node: The Aims of Developing Hobbit58663 +Node: Manifest59554 +Node: Author and Contributors60013 +Node: Future Improvements61068 +Node: Release History61833 +Node: Index68622 End Tag Table |