Changeset 12201 in project for chicken/trunk


Ignore:
Timestamp:
10/19/08 22:43:58 (12 years ago)
Author:
felix winkelmann
Message:

fixed another let-location bug detected by Joerg Wittenberger

Location:
chicken/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • chicken/trunk/TODO

    r12195 r12201  
    99* bugs
    1010** compiler
     11***! another "let-location" bug (see tests/compiler-tests.scm)
    1112*** lambda-lifting breaks in ##sys#read (r-spaces), reported by Joerg Wittenberger
    1213    in rev. 12103
     
    3738
    3839* compiler
     40** remove "custom-declare" + stuff?
     41
     42* optimizations
    3943** self-recursion optimization
    4044   what MacScheme called "benchmark-mode" (assume self-calls are recursion)
    4145*** needs declaration or option, >= -O2
    42 ** cross-module inlining
    43 *** emit <sourcefile>.inline file with "-inline-global" (?)
    44 *** "-inline-global" slurps *.inline files include-path (?)
    45 *** would inline in other compilation units, but not in current (sort of confusing)
    46 ** remove "custom-declare" + stuff?
    47 ** "assume-no-redefinitions" mode?
    48    like Gambit's block-mode (?): single toplevel assignment makes assigned
    49    variable known (and allows inlining/contraction)
    5046** when inlining, consing arg-list with "list" may make get-keyword possible foldable
    51 ** using plists instead of symbol lists (block-globals, etc.) might speed up things
     47** local flow analysis
     48** lambda-fusion
     49** handle optional ags primitively
     50   for example, set to distinguished val (checking argc) on C level, core
     51   primitive for checking this - should be quite simple, but llist processing
     52   (decompose-lambda-list) will be more expensive and cumbersome.
    5253
    5354* tests
  • chicken/trunk/compiler.scm

    r12114 r12201  
    862862                                [var (lookup var0 se)]
    863863                                [ln (get-line x)]
    864                                 [val (walk (caddr x) se var0)] )
     864                                [val (caddr x)] )
    865865                           (when (memq var unlikely-variables)
    866866                             (compiler-warning
     
    868868                              "assignment to variable `~s' possibly unintended"
    869869                              var))
    870                            (when (eq? var var0) ; global?
    871                              (set! var (##sys#alias-global-hook var #t))
    872                              (when safe-globals-flag
    873                                (set! always-bound-to-procedure
    874                                  (lset-adjoin eq? always-bound-to-procedure var))
    875                                (set! always-bound (lset-adjoin eq? always-bound var)) )
    876                              (when (macro? var)
    877                                (compiler-warning
    878                                 'var "assigned global variable `~S' is a macro ~A"
    879                                 var
    880                                 (if ln (sprintf "in line ~S" ln) "") )
    881                                (when undefine-shadowed-macros (undefine-macro! var) ) ) )
    882                            (when (keyword? var)
    883                              (compiler-warning 'syntax "assignment to keyword `~S'" var) )
    884                            (when (pair? var) ; macro
    885                              (syntax-error
    886                               'set! "assignment to syntactic identifier" var))
    887870                           (cond ((assq var foreign-variables)
    888871                                   => (lambda (fv)
     
    906889                                              ,(foreign-type-check tmp type) ) )
    907890                                          se #f))))
    908                                  (else `(set! ,var ,val)))))
     891                                 (else
     892                                  (when (eq? var var0) ; global?
     893                                    (set! var (##sys#alias-global-hook var #t))
     894                                    (when safe-globals-flag
     895                                      (set! always-bound-to-procedure
     896                                        (lset-adjoin eq? always-bound-to-procedure var))
     897                                      (set! always-bound (lset-adjoin eq? always-bound var)) )
     898                                    (when (macro? var)
     899                                      (compiler-warning
     900                                       'var "assigned global variable `~S' is a macro ~A"
     901                                       var
     902                                       (if ln (sprintf "in line ~S" ln) "") )
     903                                      (when undefine-shadowed-macros (undefine-macro! var) ) ) )
     904                                  (when (keyword? var)
     905                                    (compiler-warning 'syntax "assignment to keyword `~S'" var) )
     906                                  (when (pair? var) ; macro
     907                                    (syntax-error
     908                                     'set! "assignment to syntactic identifier" var))
     909                                  `(set! ,var ,(walk val se var0))))))
    909910
    910911                        ((##core#inline)
  • chicken/trunk/tests/compiler-tests.scm

    r12114 r12201  
    2626
    2727(print (test-location))
     28
     29
     30;;; rev. 12188 (reported by Jörg Wittenberger)
     31;
     32; - generated init-assignment refers to alias, but alias isn't seen later)
     33
     34(module
     35 x
     36 (bar)
     37 (import scheme chicken foreign)
     38
     39 (define (bar n)
     40  (let-location
     41   ((off integer 0))
     42   (lambda () ((foreign-lambda*
     43                void
     44                (((c-pointer integer) i))
     45                "(*i)++;")
     46               (location off)) off)))
     47)
     48
     49(import x)
     50(bar 42)
Note: See TracChangeset for help on using the changeset viewer.