Details
-
Bug
-
Resolution: Fixed
-
P2
-
None
-
None
-
b82
Description
Currently lower phase combines
1) Attributions - fill Types, Symbols for AST nodes. Enforce semantic correctness (not much here for JS. We can think of adding in certain mode perhaps)
2) Lower higher level constructs into the ones implemented by codegen
3) Some optimizations like folding
Perhaps we need to separate Lower into 2 phases - Attr followed by Lower. "Attr" will perform just attribution and do semantic checks. When we add more constructs like "let", "deconstruction of arrays/objects" etc. it is better to have the separation. The words "Attr" and "Lower" will also make nashorn code familiar to javac code based compiler programmers in open source community.
So for example
CallNode does transformation for 'eval'
[10/29/12 10:05:49 AM] Sundararajan: basically any method that changes shape of code..
[10/29/12 10:06:00 AM] Sundararajan: rather than setting symbol and type alone
[10/29/12 10:06:20 AM] Sundararajan: Attr-> only assign type and symbols. infer types etc
[10/29/12 10:06:31 AM] Sundararajan: Lower-> code transformations
And as AccessSpecializer no longer depends on scope, it can be folded into the Lower passes
This will also help facilitate stuff like lazy jitting and method specialisation with a clear cut
tier and type level for the IR.
1) Attributions - fill Types, Symbols for AST nodes. Enforce semantic correctness (not much here for JS. We can think of adding in certain mode perhaps)
2) Lower higher level constructs into the ones implemented by codegen
3) Some optimizations like folding
Perhaps we need to separate Lower into 2 phases - Attr followed by Lower. "Attr" will perform just attribution and do semantic checks. When we add more constructs like "let", "deconstruction of arrays/objects" etc. it is better to have the separation. The words "Attr" and "Lower" will also make nashorn code familiar to javac code based compiler programmers in open source community.
So for example
CallNode does transformation for 'eval'
[10/29/12 10:05:49 AM] Sundararajan: basically any method that changes shape of code..
[10/29/12 10:06:00 AM] Sundararajan: rather than setting symbol and type alone
[10/29/12 10:06:20 AM] Sundararajan: Attr-> only assign type and symbols. infer types etc
[10/29/12 10:06:31 AM] Sundararajan: Lower-> code transformations
And as AccessSpecializer no longer depends on scope, it can be folded into the Lower passes
This will also help facilitate stuff like lazy jitting and method specialisation with a clear cut
tier and type level for the IR.