[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] primitive resolution for public refs
From: |
Noah Lavine |
Subject: |
Re: [PATCH] primitive resolution for public refs |
Date: |
Mon, 12 Mar 2012 13:17:34 -0400 |
Hello,
Are you sure this is correct? What if someone calls the module-set!
function on that module between the definition and use of whatever
function you're compiling?
I agree very strongly that we need to be able to do this sort of
optimization, but I think we might need some sort of caching mechanism
to do it right, where the cache of compiled function bodies is
invalidated by module-set!.
Noah
On Mon, Mar 12, 2012 at 12:42 PM, BT Templeton <address@hidden> wrote:
> * module/language/tree-il/primitives.scm (resolve-primitives!): Resolve
> public module-refs to primitives.
> ---
> module/language/tree-il/primitives.scm | 16 +++++++++-------
> 1 files changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/module/language/tree-il/primitives.scm
> b/module/language/tree-il/primitives.scm
> index 3c6769d..1dcab20 100644
> --- a/module/language/tree-il/primitives.scm
> +++ b/module/language/tree-il/primitives.scm
> @@ -265,13 +265,15 @@
> (module-variable mod name)))
> (lambda (name) (make-primitive-ref src name))))
> ((<module-ref> src mod name public?)
> - ;; for the moment, we're disabling primitive resolution for
> - ;; public refs because resolve-interface can raise errors.
> - (let ((m (and (not public?) (resolve-module mod))))
> - (and m
> - (and=> (hashq-ref *interesting-primitive-vars*
> - (module-variable m name))
> - (lambda (name) (make-primitive-ref src name))))))
> + (and=> (and=> (resolve-module mod)
> + (if public?
> + module-public-interface
> + identity))
> + (lambda (m)
> + (and=> (hashq-ref *interesting-primitive-vars*
> + (module-variable m name))
> + (lambda (name)
> + (make-primitive-ref src name))))))
> ((<call> src proc args)
> (and (primitive-ref? proc)
> (make-primcall src (primitive-ref-name proc) args)))
> --
> 1.7.9.1
>
>