JDK-8055042 : Compile-time expression evaluator was missing variables
  • Type: Bug
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2014-08-13
  • Updated: 2015-01-21
  • Resolved: 2014-08-14
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 b28Fixed
Description
With optimistic typing, we try to evaluate lots of side-effect free expressions when we do on-demand compilation to gain insight into the types of those expressions. Unfortunately, some scoped variables were mistakenly marked as being in local slots and not in scope, and thus compilation didn't benefit from compile-time type evaluation for them. While this does not affect correctness, it resulted in unnecessarily increasing the number of deoptimizing recompilations as the compiler couldn't detect early that a program point doing a dyn:getProp on such variables will deoptimize later.

The solution is to postpone communicating the information about a symbol being local to the Compiler until AssignSymbols has processed the whole Block that defines the symbol, instead of doing it as soon as the symbol is defined (as circumstances following the definition can promote the symbol into scope, e.g. it being accessed from a nested function etc.)
Comments
This might be the cause of JDK-8040894 too. After implementing this fix, typescript octane test now actually completes, albeit still slowly (4 ops/minute after 20 iteration), so there might be other things at play there too.
13-08-2014