JDK-8159150 : Constant folding final field accesses does not take class redefinition into account
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9,10
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • CPU: generic
  • Submitted: 2016-06-09
  • Updated: 2020-05-07
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.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Since JDK-8157181, the VM is disallowed to fold final field accesses if the final field is modified outside of initializers. However, as pointed out by Vladimir Ivanov, the changes by JDK-8157181 do not take account for class redefinition. That is supposed to be addressed by the current issue.

Here is the relevant part of the discussion during the review of JDK-8157181:

"Unfortunately, it doesn't (and, moreover, can't) cover class 
redefinition: if a new version of a method contains final field update, 
all the generated code which embed previous value should be invalidated.

The only way to handle such case now is to add nmethod dependencies when 
static final field loads are constant folded.

Please, file a separate bug (P4) for that and let's decide how to 
proceed with it later."

For more details see the email thread on hotspot-compiler-dev about JDK-8157181:

http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/2016-June/023313.html

Comments
ILW = Constant folding of final fields may be invalid after class re-definition, with class re-definition, no workaround = MLH = P4
20-02-2017

9-defer-SQE-ok: agreed on deferral reason
31-08-2016

Sorry, that was the wrong link. I've updated the link above.
31-08-2016

I don't see any comments relative to class redefinition in the link above and since the detection is in the rewriter, and rewriting is done for redefined methods, I don't see what the problem would be.
31-08-2016

9-defer-request: Problem that has not occurred yet in practice.
31-08-2016