chicken-janitors
[Top][All Lists]
Advanced

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

Re: [Chicken-janitors] #986: (define ++ string-append) defeats constant-


From: Chicken Trac
Subject: Re: [Chicken-janitors] #986: (define ++ string-append) defeats constant-folding
Date: Sat, 09 Aug 2014 04:56:52 -0000

#986: (define ++ string-append) defeats constant-folding
--------------------------------+-------------------------------------------
  Reporter:  zbigniew           |       Owner:  evhan   
      Type:  enhancement        |      Status:  assigned
  Priority:  not urgent at all  |   Milestone:  4.10.0  
 Component:  compiler           |     Version:  4.8.x   
Resolution:                     |    Keywords:          
--------------------------------+-------------------------------------------
Changes (by evhan):

  * owner:  => evhan
  * status:  new => assigned


Comment:

 This isn't actually due to the use of {{{define}}}, but because the
 scrutinizer rewrites {{{(string-append string string)}}} to use {{{##sys
 #string-append}}} before the high-level optimization pass and {{{##sys
 #string-append}}} isn't marked as {{{##compiler#foldable}}}, the
 opportunity is missed.

 {{{
 ;; Folds "quxquuxquuux" as expected:
 (define ++ string-append)
 (print (string-append "foo" "bar" "baz"))
 (print (++ "qux" "quux" "quuux")) ; Three arguments, so no specialization.

 ;; Doesn't fold "quxquux" due to specialization:
 (print (string-append "foo" "bar" "baz"))
 (print (string-append "qux" "quux")) ; Two arguments, specialized.
 }}}

 I think {{{##sys#string-append}}} should be included in {{{foldable-
 bindings}}}, but there are lots of other internal ({{{##sys#}}})
 procedures that should be folded as well, so the fix should probably be
 more general than just adding {{{##sys#string-append}}}.

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/986#comment:3>
CHICKEN Scheme <http://www.call-with-current-continuation.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]