src/share/vm/c1/c1_GraphBuilder.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Mar  1 10:30:31 2011
--- new/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Mar  1 10:30:31 2011

*** 1454,1490 **** --- 1454,1486 ---- ciField* field = stream()->get_field(will_link); ciInstanceKlass* holder = field->holder(); BasicType field_type = field->type()->basic_type(); ValueType* type = as_ValueType(field_type); // call will_link again to determine if the field is valid. ! const bool is_loaded = holder->is_loaded() && field->will_link(method()->holder(), code); ! const bool is_initialized = is_loaded && holder->is_initialized(); ! const bool needs_patching = !holder->is_loaded() || + !field->will_link(method()->holder(), code) || ! PatchALot; ValueStack* state_before = NULL; ! if (!is_initialized || PatchALot) { ! if (!holder->is_initialized() || needs_patching) { // save state before instruction for debug info when // deoptimization happens during patching state_before = copy_state_before(); } Value obj = NULL; if (code == Bytecodes::_getstatic || code == Bytecodes::_putstatic) { // commoning of class constants should only occur if the class is // fully initialized and resolved in this constant pool. The will_link test // above essentially checks if this class is resolved in this constant pool // so, the is_initialized flag should be suffiect. if (state_before != NULL) { // build a patching constant obj = new Constant(new ClassConstant(holder), state_before); } else { obj = new Constant(new ClassConstant(holder)); } } ! const int offset = is_loaded ? field->offset() : -1; ! const int offset = !needs_patching ? field->offset() : -1; switch (code) { case Bytecodes::_getstatic: { // check for compile-time constants, i.e., initialized static final fields Instruction* constant = NULL; if (field->is_constant() && !PatchALot) {
*** 1507,1535 **** --- 1503,1531 ---- } else { if (state_before == NULL) { state_before = copy_state_for_exception(); } push(type, append(new LoadField(append(obj), offset, field, true, ! state_before, is_loaded, is_initialized))); ! state_before, needs_patching))); } break; } case Bytecodes::_putstatic: { Value val = pop(type); if (state_before == NULL) { state_before = copy_state_for_exception(); } ! append(new StoreField(append(obj), offset, field, val, true, state_before, is_loaded, is_initialized)); ! append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching)); } break; case Bytecodes::_getfield : { if (state_before == NULL) { state_before = copy_state_for_exception(); } ! LoadField* load = new LoadField(apop(), offset, field, false, state_before, is_loaded, true); ! Value replacement = is_loaded ? _memory->load(load) : load; ! LoadField* load = new LoadField(apop(), offset, field, false, state_before, needs_patching); ! Value replacement = !needs_patching ? _memory->load(load) : load; if (replacement != load) { assert(replacement->is_linked() || !replacement->can_be_linked(), "should already by linked"); push(type, replacement); } else { push(type, append(load));
*** 1540,1551 **** --- 1536,1547 ---- case Bytecodes::_putfield : { Value val = pop(type); if (state_before == NULL) { state_before = copy_state_for_exception(); } ! StoreField* store = new StoreField(apop(), offset, field, val, false, state_before, is_loaded, true); ! if (is_loaded) store = _memory->store(store); ! StoreField* store = new StoreField(apop(), offset, field, val, false, state_before, needs_patching); ! if (!needs_patching) store = _memory->store(store); if (store != NULL) { append(store); } } break;

src/share/vm/c1/c1_GraphBuilder.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File