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]

Re: procedure optimization


Keisuke Nishida <kxn30@po.cwru.edu> writes:

> 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?

We'll allow for efficient code by letting most top-level bindings
imported from other modules be read-only.  In the module system, there
also is hooks for reverting things to "uncompiled state" when bindings
change.

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