Review request for JDK-8057148
attila.szegedi at oracle.com
Mon Sep 8 10:04:12 UTC 2014
Please review JDK-8057148 at <http://cr.openjdk.java.net/~attila/8057148/webrev.00> for <https://bugs.openjdk.java.net/browse/JDK-8057148>
It's the now (hopefully) final version of the code to skip nested functions in the parser when doing on-demand compilation. Notable changes to the surroundings include:
- FunctionNode no longer has an id field, but rather uses its Node.position() as its ID (also unique within a source file - :program always has 0, and functions typically have the position of their closing parameter list parenthesis for some reason, so even if the program starts with a function declaration, the function won't have 0). This had to be done otherwise an ID assignment algorithm on recompilations would've renumbered functions now that we're skipping nesteds. I tried exporting the IDs from RecompilableScriptFunctionData.nestedFunctions.keySet() but it turns out those were missing nested functions that are visible to the parser, but removed later in the pipeline as they're function expressions declared in dead code… I know, right?
- RecompilableScriptFunctionData now has a copy of FunctionNode.flags, instead of decomposing it into various booleans. This is needed to reconstruct correct flags on reparse.
More information about the nashorn-dev