1.1 --- a/src/share/vm/c1/c1_Instruction.hpp Sat Mar 05 11:02:04 2011 -0800 1.2 +++ b/src/share/vm/c1/c1_Instruction.hpp Sun Mar 06 22:09:23 2011 -0800 1.3 @@ -323,8 +323,6 @@ 1.4 CanTrapFlag, 1.5 DirectCompareFlag, 1.6 IsEliminatedFlag, 1.7 - IsInitializedFlag, 1.8 - IsLoadedFlag, 1.9 IsSafepointFlag, 1.10 IsStaticFlag, 1.11 IsStrictfpFlag, 1.12 @@ -693,7 +691,7 @@ 1.13 public: 1.14 // creation 1.15 AccessField(Value obj, int offset, ciField* field, bool is_static, 1.16 - ValueStack* state_before, bool is_loaded, bool is_initialized) 1.17 + ValueStack* state_before, bool needs_patching) 1.18 : Instruction(as_ValueType(field->type()->basic_type()), state_before) 1.19 , _obj(obj) 1.20 , _offset(offset) 1.21 @@ -701,16 +699,9 @@ 1.22 , _explicit_null_check(NULL) 1.23 { 1.24 set_needs_null_check(!is_static); 1.25 - set_flag(IsLoadedFlag, is_loaded); 1.26 - set_flag(IsInitializedFlag, is_initialized); 1.27 set_flag(IsStaticFlag, is_static); 1.28 + set_flag(NeedsPatchingFlag, needs_patching); 1.29 ASSERT_VALUES 1.30 - if (!is_loaded || (PatchALot && !field->is_volatile())) { 1.31 - // need to patch if the holder wasn't loaded or we're testing 1.32 - // using PatchALot. Don't allow PatchALot for fields which are 1.33 - // known to be volatile they aren't patchable. 1.34 - set_flag(NeedsPatchingFlag, true); 1.35 - } 1.36 // pin of all instructions with memory access 1.37 pin(); 1.38 } 1.39 @@ -721,11 +712,14 @@ 1.40 ciField* field() const { return _field; } 1.41 BasicType field_type() const { return _field->type()->basic_type(); } 1.42 bool is_static() const { return check_flag(IsStaticFlag); } 1.43 - bool is_loaded() const { return check_flag(IsLoadedFlag); } 1.44 - bool is_initialized() const { return check_flag(IsInitializedFlag); } 1.45 NullCheck* explicit_null_check() const { return _explicit_null_check; } 1.46 bool needs_patching() const { return check_flag(NeedsPatchingFlag); } 1.47 1.48 + // Unresolved getstatic and putstatic can cause initialization. 1.49 + // Technically it occurs at the Constant that materializes the base 1.50 + // of the static fields but it's simpler to model it here. 1.51 + bool is_init_point() const { return is_static() && (needs_patching() || !_field->holder()->is_initialized()); } 1.52 + 1.53 // manipulation 1.54 1.55 // Under certain circumstances, if a previous NullCheck instruction 1.56 @@ -745,15 +739,15 @@ 1.57 public: 1.58 // creation 1.59 LoadField(Value obj, int offset, ciField* field, bool is_static, 1.60 - ValueStack* state_before, bool is_loaded, bool is_initialized) 1.61 - : AccessField(obj, offset, field, is_static, state_before, is_loaded, is_initialized) 1.62 + ValueStack* state_before, bool needs_patching) 1.63 + : AccessField(obj, offset, field, is_static, state_before, needs_patching) 1.64 {} 1.65 1.66 ciType* declared_type() const; 1.67 ciType* exact_type() const; 1.68 1.69 // generic 1.70 - HASHING2(LoadField, is_loaded() && !field()->is_volatile(), obj()->subst(), offset()) // cannot be eliminated if not yet loaded or if volatile 1.71 + HASHING2(LoadField, !needs_patching() && !field()->is_volatile(), obj()->subst(), offset()) // cannot be eliminated if needs patching or if volatile 1.72 }; 1.73 1.74 1.75 @@ -764,8 +758,8 @@ 1.76 public: 1.77 // creation 1.78 StoreField(Value obj, int offset, ciField* field, Value value, bool is_static, 1.79 - ValueStack* state_before, bool is_loaded, bool is_initialized) 1.80 - : AccessField(obj, offset, field, is_static, state_before, is_loaded, is_initialized) 1.81 + ValueStack* state_before, bool needs_patching) 1.82 + : AccessField(obj, offset, field, is_static, state_before, needs_patching) 1.83 , _value(value) 1.84 { 1.85 set_flag(NeedsWriteBarrierFlag, as_ValueType(field_type())->is_object());