-
Bug
-
Resolution: Fixed
-
P2
-
7
-
b08
-
generic
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2187607 | 7 | John Rose | P2 | Closed | Fixed | b81 |
JDK-2189855 | 6u21 | John Rose | P2 | Resolved | Fixed | b01 |
A value in an object field cannot be constant-folded even when the field is marked 'final' and the enclosing object itself can be determined at compile time. This is because 'final' fields are not enforced by the JVM.
The long term fix for this is to properly optimize the common case of any field which is set in an object constructor and then never changed, not even by reflection or JNI.
This is a performance issue for method handle combinators like MethodHandles.guardWithTest. They are a hybrid of data structure and function pointer. As function pointers they need to be inlined and optimized. As data structures, they are tied together via final fields, which must be foldable at compile time in order to complete the inlining process.
As a stopgap measure, we will instruct the JVM to "trust" final fields in selected (trusted!) packages, notably java.dyn and sun.dyn. This trust directive will be configurable, so that dynamic language runtimes can be included as necessary.
The long term fix for this is to properly optimize the common case of any field which is set in an object constructor and then never changed, not even by reflection or JNI.
This is a performance issue for method handle combinators like MethodHandles.guardWithTest. They are a hybrid of data structure and function pointer. As function pointers they need to be inlined and optimized. As data structures, they are tied together via final fields, which must be foldable at compile time in order to complete the inlining process.
As a stopgap measure, we will instruct the JVM to "trust" final fields in selected (trusted!) packages, notably java.dyn and sun.dyn. This trust directive will be configurable, so that dynamic language runtimes can be included as necessary.
- backported by
-
JDK-2189855 final fields in objects need to support inlining optimizations for JSR 292
- Resolved
-
JDK-2187607 final fields in objects need to support inlining optimizations for JSR 292
- Closed
- relates to
-
JDK-8058164 final fields in objects need to support inlining optimizations
- Open
-
JDK-8233873 final field values should be trusted as constant
- Open