Skip to content
This repository has been archived by the owner on Feb 3, 2019. It is now read-only.

Inline def'd constants #10

Open
arrdem opened this issue Jun 8, 2014 · 1 comment
Open

Inline def'd constants #10

arrdem opened this issue Jun 8, 2014 · 1 comment
Assignees

Comments

@arrdem
Copy link
Owner

arrdem commented Jun 8, 2014

Constants wrapped in a var are still behind a volatile Object and thus cause a pointer chase on all accesses. For constant defs, we can simply syntactically inline the constant. That or some Oxcart emitter could provide a module level constant pool which would allow for JIT optimization of large def'd constants.

@arrdem
Copy link
Owner Author

arrdem commented Jun 16, 2014

@halgari is of the oppinion that constant inlining is not likely to be a valuable transformation. If constant inlining is to take place, it's probably worth doing it right and annotating the clojure core library as well as special forms with function purity metadata. This would allow a trivial is-expr-pure or is-form-idempotent analysis which could then be used to prove inlining of forms sound.

I contend that inlining is potentially valuable not because it offers an opportunity to precompute expressions but because for some forms such as (partial) and (comp) being able to reduce cases like ((comp f) x y) to (f x y) would allow Oxcart to escape emitting f as a Var wrapped IFn and instead emit a method call.

@arrdem arrdem self-assigned this Jun 16, 2014
@arrdem arrdem mentioned this issue Jun 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant