JDK-8057931 : Instead of not skipping small functions in parser, make lexer avoid them instead
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-09-09
  • Updated: 2015-06-04
  • Resolved: 2014-09-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u40Fixed 9 b31Fixed
Related Reports
Relates :  
Description
In JDK-8057148 we introduced a feature where the Nashorn's parser will skip nested functions when it's reparsing an outer function as the first step of recompiling it (as nested functions aren't necessary for recompilation of outer function). We also introduced a feature where functions under a certain size (those that don't exhaust the lexer's read-ahead buffer) will not be skipped (as we already lexed their source).

This enhancement instead informs the lexer to pause read-ahead lexing when it encounters a function body's left brace when it's used in recompilation context. Care is also taken in parser's functionBody() to not accidentally nudge the lexer past the pause point when it'd otherwise skip the function body.