src/share/vm/c1/c1_GraphBuilder.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
8073191-work Cdiff src/share/vm/c1/c1_GraphBuilder.cpp
src/share/vm/c1/c1_GraphBuilder.cpp
Print this page
*** 1652,1661 ****
--- 1652,1669 ----
state_before, needs_patching)));
}
break;
}
case Bytecodes::_putstatic: {
+ // Check if modification of a static final field is attempted outside of
+ // the class/interface initializer method.
+ if (field->is_constant() &&
+ strcmp(method()->name()->as_quoted_ascii(), "<clinit>") != 0) {
+ bailout("The current method sets a static final field but "
+ "it is not the class or interface initializer method <clinit>.");
+ return;
+ }
Value val = pop(type);
if (state_before == NULL) {
state_before = copy_state_for_exception();
}
if (field->type()->basic_type() == T_BOOLEAN) {
*** 1703,1712 ****
--- 1711,1728 ----
}
}
break;
}
case Bytecodes::_putfield: {
+ // Check if modification of a static final field is attempted outside of
+ // the instance initializer method.
+ if (field->is_final() &&
+ strcmp(method()->name()->as_quoted_ascii(), "<init>") != 0) {
+ bailout("The current method sets a final field but "
+ "it is not the instance initializer method <init>.");
+ return;
+ }
Value val = pop(type);
obj = apop();
if (state_before == NULL) {
state_before = copy_state_for_exception();
}
src/share/vm/c1/c1_GraphBuilder.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File