This is the mail archive of the guile@sources.redhat.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

procedure optimization


Hello,

My current compiler optimizes some procedures by using VM builtin
functions:

  (define (foo x) (1+ x)) ->

  %make-program .prog2
  %savet foo
  %load-unspecified
  %return

.prog2
  %loadl:0
  inc             ;; 1+ is replaced by a builtin function
  %return

However, if the binding of `1+' is changed after the above program is
created, the program is no longer correct; I need to rebuild it.

One way to avoid this problem is to always use top level variables:

.prog2
  %pushl:0
  %loadt 1+       ;; 1+ is a top level variable
  %tail-call 1    ;; use procedure call

This approach will slow down the program significantly.

How should I solve this?  Maybe I need to add a compiler option that
allows this optimization.  In that case, rebinding top level variables
should be probably prohibited...

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]