[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CPS Update
From: |
William ML Leslie |
Subject: |
Re: CPS Update |
Date: |
Fri, 22 Feb 2013 19:25:43 +1100 |
On 20 February 2013 03:21, Mark H Weaver <address@hidden> wrote:
> (define (func x)
> (let ((r (my-special-function x)))
> (+ x 2 r)))
>
> Here, (my-special-function x) must be evaluated before evaluating '+'.
> Evaluating '+' means to fetch the value stored in the location denoted
> by '+'. Therefore, if '+' is rebound during the call to
> 'my-special-function', then the new binding for '+' must be used.
>
> This is a case where on-stack-replacement is needed to implement the
> correct semantics.
>
> To summarize, when you rebind a function 'foo', it is not the existing
> activation records for 'foo' that you need to worry about. Instead, you
> need to worry about existing activation records for all compiled
> procedures 'bar' that incorporated assumptions about 'foo'.
Recompiling every procedure that uses + when somebody binds it means
compiling a lot of code that probably isn't going to be used. More
likely, if + has been inlined here, the compiler will have to emit a
guard that checks inlining assumptions as the start of the let body.
This is how those sort of semantics are preserved where OSR is not
implemented.
Regarding rebinding (+): A few people have expressed opinions about
scheme becoming less fluid, and I think most would probably agree that
even if certain bindings are assumed constant or types are declared in
module APIs and specialised code generated, the most-general code
still wants to be available, and ideally from within the .so .
--
William Leslie
- CPS Update, Noah Lavine, 2013/02/15
- Re: CPS Update, Stefan Israelsson Tampe, 2013/02/16
- Re: CPS Update, Noah Lavine, 2013/02/16
- Re: CPS Update, Mark H Weaver, 2013/02/16
- Re: CPS Update, Noah Lavine, 2013/02/16
- Re: CPS Update, Mark H Weaver, 2013/02/16
- Re: CPS Update, Noah Lavine, 2013/02/19
- Re: CPS Update, Mark H Weaver, 2013/02/19
- Re: CPS Update,
William ML Leslie <=
- Re: CPS Update, Mark H Weaver, 2013/02/23
- Re: CPS Update, William ML Leslie, 2013/02/24
- Re: CPS Update, Mark H Weaver, 2013/02/26
- Re: CPS Update, Stefan Israelsson Tampe, 2013/02/19