Changeset 12184 in project


Ignore:
Timestamp:
10/16/08 23:57:42 (12 years ago)
Author:
felix winkelmann
Message:

option -emit-inline-file; fixed breakage in optimizer

Location:
chicken/branches/cmi
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • chicken/branches/cmi/NEWS

    r12183 r12184  
    3636- "local" mode, in which locally defined exported toplevel variables can
    3737  be inlined
    38 - new options and declarations "[-]local" and "[-]inline-global"
     38- new options and declarations "[-]local", "[-]inline-global" and "-emit-inline-file"
    3939- optimization levels changed to use inlining:
    4040  -optimize-level 3: enables -inline -local (but *not* -unsafe)
  • chicken/branches/cmi/TODO

    r12183 r12184  
    1414*** dirty-macros.scm loops when using `defile'
    1515    possibly due to unrenamed special forms
     16*** curried define performs expansion in empty se - problem?
     17    (as comment in expand.scm indicated (##sys#register-export))
    1618** modules
    1719*** chicken.import.scm refers to ##sys#chicken-macro-environment
    1820    ... which is only set, if chicken-more-macros.scm is loaded, which
    1921    is of course not the case inside a compiled executable (current
    20     workaround is to set them to nil by default)
     22    workaround is to set them to '() by default)
    2123*** same for ##sys#chicken-ffi-macro-environment
    2224*** re-exports of syntax doesn't work
     
    2931    load is performed after the import (at runtime). A possibly fix
    3032    would be to load the extension immediately (at
    31     compile-/expansion-time), when import is #t and o import lib
     33    compile-/expansion-time), when import is #t and the import lib
    3234    exists.
     35*** code-duplication in compiler and evaluator for ##core#module
     36*** "scheme" module does not include some special forms ("define-syntax", etc.)
     37*** import-for-syntax imports value bindings into import-env
     38    should actually be a distinct meta-import-env.
     39    (does it work at all?)
    3340
    3441* compiler
     
    3744*** needs declaration or option, >= -O2
    3845*** local mode is probably half of it
    39 ** cross-module inlining
    40 *** emit <sourcefile>.inline file with "-inline-global"
    41 *** "-inline-global" slurps *.inline files include-path
    4246** remove "custom-declare" + stuff?
    4347** when inlining, consing arg-list with "list" may make get-keyword possibly foldable
     48** -emit-inline-file makes only sense with -inline-global and -local
     49   what should imply what?
    4450** test global inlining (using .inline files)
    45 *** add dependency lines to rules.make
    46     this is to ensure compiler- and library-units are built in correct order
    47 ** we possibly need an option to generate .inline files
    48    currently -inline-global both emits such a file and enables use of them
    4951
    5052* runtime
    5153** pre-hashed symbols (extra symbol slot)
     54   The memory usage should be acceptable, performance gain is hard to guess.
     55   Some experiments indicate that hashing the string is cheaper than it appears,
     56   but low-level hashtables should get the most of this (and thus speed up
     57   the compiler)
    5258
    5359* benchmarks
    5460** add more realistic benchmarks
     61*** check shootout
    5562** run benchmarks with current trunk to have something to compare
    5663
     
    6168
    6269* modules
    63 ** code-duplication in compiler and evaluator for ##core#module
    64 ** "scheme" module does not include some special forms ("define-syntax", etc.)
    65 ** import-for-syntax imports value bindings into import-env
    66    should actually be a distinct meta-import-env.
    67    (does it work at all?)
    68 ** curried define performs expansion in empty se - problem?
    69    (as comment in expand.scm indicated (##sys#register-export))
    7070** checks
    7171*** reimport of imported id
     
    9494** if ##sys#current-module is set, add name to error message?
    9595** fluidly keep track of expanded forms (extend meaning of culprit)
    96    to pprint pruned expr on error
     96   pprint pruned expr on error
     97   (too expensive?)
  • chicken/branches/cmi/batch-driver.scm

    r12169 r12184  
    3737  non-foldable-standard-bindings foldable-standard-bindings non-foldable-extended-bindings foldable-extended-bindings
    3838  standard-bindings-that-never-return-false side-effect-free-standard-bindings-that-never-return-false
    39   compiler-cleanup-hook disabled-warnings local-definitions
     39  compiler-cleanup-hook disabled-warnings local-definitions emit-inline-file
    4040  file-io-only undefine-shadowed-macros profiled-procedures
    4141  unit-name insert-timer-checks used-units inline-max-size inline-locally
     
    251251    (when (memq 'fixnum-arithmetic options) (set! number-type 'fixnum))
    252252    (when (memq 'block options) (set! block-compilation #t))
    253     (when (memq 'emit-external-prototypes-first options) (set! external-protos-first #t))
     253    (when (memq 'emit-external-prototypes-first options)
     254      (set! external-protos-first #t))
    254255    (when (memq 'inline options) (set! inline-locally #t))
     256    (and-let* ((ifile (memq 'emit-inline-file options)))
     257      (set! emit-inline-file (option-arg ifile)))
    255258    (and-let* ([inlimit (memq 'inline-limit options)])
    256259      (set! inline-max-size
     
    593596                            (print-node "optimized" '|7| node2)
    594597
    595                             (when inline-globally
    596                               (let ((f (pathname-replace-extension source-filename "inline")))
     598                            (when (and inline-globally emit-inline-file)
     599                              (let ((f emit-inline-file))
    597600                                (when verbose
    598601                                  (printf "Generating global inline file `~a' ...~%" f))
  • chicken/branches/cmi/c-platform.scm

    r12148 r12184  
    128128          inline-limit profile-name disable-warning
    129129    prelude postlude prologue epilogue nursery extend feature
    130     emit-import-library
     130    emit-import-library emit-inline-file
    131131    heap-growth heap-shrinkage heap-initial-size ffi-define ffi-include-path) )
    132132
  • chicken/branches/cmi/compiler.scm

    r12169 r12184  
    8989;   ##compiler#inline-global -> 'yes | 'no | <node>
    9090;   ##compiler#profile -> BOOL
     91;   ##compiler#unused -> BOOL
    9192
    9293; - Source language:
     
    303304  pprint-expressions-to-file foreign-type-check estimate-foreign-result-size scan-used-variables scan-free-variables
    304305  topological-sort print-version print-usage initialize-analysis-database csc-control-file
    305   estimate-foreign-result-location-size unused-variables
     306  estimate-foreign-result-location-size emit-inline-file
    306307  expand-foreign-callback-lambda default-optimization-passes default-optimization-passes-when-trying-harder
    307308  units-used-by-default words-per-flonum disable-stack-overflow-checking
     
    382383(define inline-globally #f)
    383384(define inline-locally #f)
     385(define emit-inline-file #f)
    384386
    385387
     
    429431(define file-requirements #f)
    430432(define postponed-initforms '())
    431 (define unused-variables '())
    432433(define literal-rewrite-hook #f)
    433434
     
    13431344       ((keep-shadowed-macros) (set! undefine-shadowed-macros #f))
    13441345       ((unused)
    1345         (set! unused-variables (append (cdr spec) unused-variables)))
     1346        (for-each (cut mark-variable <> '##compiler#unused) (stripa (cdr spec))))
    13461347       ((not)
    13471348        (check-decl spec 1)
     
    19291930                    global
    19301931                    (null? references)
    1931                     (not (memq sym unused-variables)))
     1932                    (not (variable-mark sym '##compiler#unused)))
    19321933           (when assigned-locally
    19331934             (compiler-warning 'var "local assignment to unused variable `~S' may be unintended" sym) )
  • chicken/branches/cmi/csc.scm

    r12148 r12184  
    175175    -block -disable-interrupts -fixnum-arithmetic -to-stdout -profile -raw -accumulate-profile
    176176    -check-syntax -case-insensitive -benchmark-mode -shared -compile-syntax -no-lambda-info
    177     -lambda-lift -dynamic -disable-stack-overflow-checks -emit-debug-info -local
     177    -lambda-lift -dynamic -disable-stack-overflow-checks -local
    178178    -emit-external-prototypes-first -inline -extension -release -static-extensions
    179179    -analyze-only -keep-shadowed-macros -inline-global))
     
    183183    -optimize-level -include-path -database-size -extend -prelude -postlude -prologue -epilogue
    184184    -inline-limit -profile-name -disable-warning
    185     -require-static-extension
     185    -require-static-extension -emit-inline-file
    186186    -feature -debug-level -heap-growth -heap-shrinkage -heap-initial-size
    187187    -emit-import-library))
     
    203203    (-u "-unsafe")
    204204    (-j "-emit-import-library")
     205    (-n "-emit-inline-file")
    205206    (-b "-block") ) )
    206207
     
    367368    -accumulate-profile         executable emits profiling information in append mode
    368369    -profile-name FILENAME      name of the generated profile information file
    369     -emit-debug-info            emit additional debug-information
    370370
    371371  Optimization options:
     
    389389    -inline-limit               set inlining threshold
    390390    -inline-global              enable cross-module inlining
     391    -n -emit-inline-file FILENAME 
     392                                generate file with globally inlinable procedures
    391393
    392394  Configuration options:
  • chicken/branches/cmi/manual/Using the compiler

    r12151 r12184  
    5555     0          show database before lambda-lifting pass
    5656     L          show expressions after lambda-lifting
    57      M          show unit-information and syntax-/runtime-requirements
     57     M          show syntax-/runtime-requirements
    5858     1          show source expressions
    5959     2          show canonicalized expressions
     
    9696; -emit-import-library MODULE : Specifies that an import library named {{MODULE.import.scm}} for the named module should be generated (equivalent to using the {{emit-import-library}} declaration).
    9797
     98; -emit-inline-file FILENAME : Write procedures that can be globally inlined in internal form to {{FILENAME}}, if global inlining is enabled.
     99
    98100; -explicit-use : Disables automatic use of the units {{library, eval}} and {{extras}}. Use this option if compiling a library unit instead of an application unit.
    99101
  • chicken/branches/cmi/optimizer.scm

    r12169 r12184  
    313313                             (walk-generic n class params subs)) ]
    314314                        [(and lval
    315                               inline-locally
    316315                              (eq? '##core#lambda (node-class lval)))
    317316                         (let* ([lparams (node-parameters lval)]
     
    321320                            (lambda (vars argc rest)
    322321                              (let ([fid (first lparams)])
    323                                 (cond [(and (test fid 'simple)
     322                                (cond [(and inline-locally
     323                                            (test fid 'simple)
    324324                                            (test var 'inlinable)
    325325                                            (case (variable-mark var '##compiler#inline)
  • chicken/branches/cmi/support.scm

    r12182 r12184  
    6868  generate-code make-variable-list make-argument-list generate-foreign-stubs foreign-type-declaration
    6969  foreign-argument-conversion foreign-result-conversion final-foreign-type debugging block-globals
    70   constant-declarations process-lambda-documentation big-fixnum?
     70  constant-declarations process-lambda-documentation big-fixnum? sort-symbols
    7171  export-dump-hook intrinsic? node->sexpr emit-global-inline-file inline-max-size
    7272  make-random-name foreign-type-convert-result foreign-type-convert-argument process-custom-declaration)
     
    230230        (abort)
    231231        (proc x (lambda (x2) (loop x2 (cons x done)))) ) ) )
     232
     233(define (sort-symbols lst)
     234  (sort lst (lambda (s1 s2) (string<? (symbol->string s1) (symbol->string s2)))))
    232235
    233236
     
    702705    (when (and (pair? lst)
    703706               (debugging 'i "the following procedures can be globally inlined:"))
    704       (for-each (cut print "  " <>) lst))))
     707      (for-each (cut print "  " <>) (sort-symbols lst)))))
    705708
    706709(define (load-inline-file fname)
     
    12771280    -inline-limit               set inlining threshold
    12781281    -inline-global              enable cross-module inlining
     1282    -emit-inline-file FILENAME  generate file with globally inlinable procedures
    12791283
    12801284  Configuration options:
Note: See TracChangeset for help on using the changeset viewer.