Rationale
The Clojure compiler is currently a large Java class. Writing it in Clojure will produce many benefits.
Plan
- Provide discrete analysis phase yielding Clojure data structures capturing semantics of code.
- Split out type reflection into API
- needs protocols to hide actual reflection classes
- since we would like to fabricate class and method descriptors for classes-being-compiled
- needs protocols to hide actual reflection classes
- Split out code gen into API
- Split off ASM into separate jar
- allow for full use of ASM
- e.g. show assembly output mode for compiler
- this split could happen pre-CinC
- Should we still re-root package to avoid conflicts?
- allow for full use of ASM
- Multiple back ends
- Java source
- Java bytecode
- CLR
- JS
- ?
- Remove warts from current design
- e.g. use of vars and binding
- explicitly pass environment
- current code modifies environment to e.g. tag things as closed-over
- could turn into query against child tree
- in any case, will need to take and return environment (in addition to returning expression object)
- current code modifies environment to e.g. tag things as closed-over
- some rewriting is done during analysis in order to facilitate generation
- e.g. wrapping things in lambdas to get around expression restrictions
- should/could this be done later, during gen?
- since different targets might have different approaches
- Some impacts on current infrastructure
- e.g. namespaces map to vars or classes
- need to map to class descriptors in order to be able to resolve to things-being-compiled
- e.g. namespaces map to vars or classes
Issues
Labels:
1 Comment
Hide/Show CommentsJul 08, 2011
Pedro Teixeira
PyPy may be good reference: https://bitbucket.org/pypy/extradoc/raw/tip/talk/icooolps2009-dotnet/cli-jit.pdf