src/share/vm/interpreter/interpreterRuntime.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
8160527 Cdiff src/share/vm/interpreter/interpreterRuntime.cpp
src/share/vm/interpreter/interpreterRuntime.cpp
Print this page
*** 590,602 ****
InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
!klass->is_initialized());
Bytecodes::Code get_code = (Bytecodes::Code)0;
if (!uninitialized_static) {
get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield);
! if (is_put || !info.access_flags().is_final()) {
put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield);
}
}
cp_cache_entry->set_field(
--- 590,617 ----
InstanceKlass* klass = InstanceKlass::cast(info.field_holder());
bool uninitialized_static = ((bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic) &&
!klass->is_initialized());
Bytecodes::Code get_code = (Bytecodes::Code)0;
+ /* Do not cache the result of the resolution for putfield instructions
+ * to instance final fields.
+ *
+ * A putfield instruction targeting an instance final field must throw
+ * an IllegalAccessError if the instruction is not in an instance
+ * initializer method <init>. Without the check below, a putfield
+ * in an initializer method is resolved; subsequent putfield instructions
+ * to the same field then use cached information and thus do not pass
+ * through the VM (i.e., checks will not be executed for those instructions).
+ */
+ bool final_instance_update = info.field_holder()->major_version() >= 53 &&
+ info.has_initialized_final_update() &&
+ (bytecode == Bytecodes::_putfield || bytecode == Bytecodes::_nofast_putfield);
+
+
if (!uninitialized_static) {
get_code = ((is_static) ? Bytecodes::_getstatic : Bytecodes::_getfield);
! if ((is_put && !final_instance_update) || !info.access_flags().is_final()) {
put_code = ((is_static) ? Bytecodes::_putstatic : Bytecodes::_putfield);
}
}
cp_cache_entry->set_field(
src/share/vm/interpreter/interpreterRuntime.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File