130
131 typedef GrowableArray<ValueMap*> ValueMapArray;
132
133 class ValueNumberingVisitor: public InstructionVisitor {
134 protected:
135 // called by visitor functions for instructions that kill values
136 virtual void kill_memory() = 0;
137 virtual void kill_field(ciField* field, bool all_offsets) = 0;
138 virtual void kill_array(ValueType* type) = 0;
139
140 // visitor functions
141 void do_StoreField (StoreField* x) {
142 if (x->is_init_point() || // putstatic is an initialization point so treat it as a wide kill
143 // This is actually too strict and the JMM doesn't require
144 // this in all cases (e.g. load a; volatile store b; load a)
145 // but possible future optimizations might require this.
146 x->field()->is_volatile()) {
147 kill_memory();
148 } else {
149 kill_field(x->field(), x->needs_patching());
150 }
151 }
152 void do_StoreIndexed (StoreIndexed* x) { kill_array(x->type()); }
153 void do_MonitorEnter (MonitorEnter* x) { kill_memory(); }
154 void do_MonitorExit (MonitorExit* x) { kill_memory(); }
155 void do_Invoke (Invoke* x) { kill_memory(); }
156 void do_UnsafePut (UnsafePut* x) { kill_memory(); }
157 void do_UnsafeGetAndSet(UnsafeGetAndSet* x) { kill_memory(); }
158 void do_UnsafeGet (UnsafeGet* x) {
159 if (x->is_volatile()) { // the JMM requires this
160 kill_memory();
161 }
162 }
163 void do_Intrinsic (Intrinsic* x) { if (!x->preserves_state()) kill_memory(); }
164
165 void do_Phi (Phi* x) { /* nothing to do */ }
166 void do_Local (Local* x) { /* nothing to do */ }
167 void do_Constant (Constant* x) {
168 if (x->kills_memory()) {
169 assert(x->can_trap(), "already linked");
194 kill_memory();
195 }
196 }
197 void do_NewTypeArray (NewTypeArray* x) { /* nothing to do */ }
198 void do_NewObjectArray (NewObjectArray* x) { /* nothing to do */ }
199 void do_NewMultiArray (NewMultiArray* x) { /* nothing to do */ }
200 void do_CheckCast (CheckCast* x) { /* nothing to do */ }
201 void do_InstanceOf (InstanceOf* x) { /* nothing to do */ }
202 void do_BlockBegin (BlockBegin* x) { /* nothing to do */ }
203 void do_Goto (Goto* x) { /* nothing to do */ }
204 void do_If (If* x) { /* nothing to do */ }
205 void do_TableSwitch (TableSwitch* x) { /* nothing to do */ }
206 void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ }
207 void do_Return (Return* x) { /* nothing to do */ }
208 void do_Throw (Throw* x) { /* nothing to do */ }
209 void do_Base (Base* x) { /* nothing to do */ }
210 void do_OsrEntry (OsrEntry* x) { /* nothing to do */ }
211 void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
212 void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }
213 void do_ProfileReturnType (ProfileReturnType* x) { /* nothing to do */ }
214 void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
215 void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ };
216 void do_MemBar (MemBar* x) { /* nothing to do */ };
217 void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
218 #ifdef ASSERT
219 void do_Assert (Assert* x) { /* nothing to do */ };
220 #endif
221 };
222
223
224 class ValueNumberingEffects: public ValueNumberingVisitor {
225 private:
226 ValueMap* _map;
227
228 public:
229 // implementation for abstract methods of ValueNumberingVisitor
230 void kill_memory() { _map->kill_memory(); }
231 void kill_field(ciField* field, bool all_offsets) { _map->kill_field(field, all_offsets); }
232 void kill_array(ValueType* type) { _map->kill_array(type); }
233
|
130
131 typedef GrowableArray<ValueMap*> ValueMapArray;
132
133 class ValueNumberingVisitor: public InstructionVisitor {
134 protected:
135 // called by visitor functions for instructions that kill values
136 virtual void kill_memory() = 0;
137 virtual void kill_field(ciField* field, bool all_offsets) = 0;
138 virtual void kill_array(ValueType* type) = 0;
139
140 // visitor functions
141 void do_StoreField (StoreField* x) {
142 if (x->is_init_point() || // putstatic is an initialization point so treat it as a wide kill
143 // This is actually too strict and the JMM doesn't require
144 // this in all cases (e.g. load a; volatile store b; load a)
145 // but possible future optimizations might require this.
146 x->field()->is_volatile()) {
147 kill_memory();
148 } else {
149 kill_field(x->field(), x->needs_patching());
150 if (x->enclosing_field() != nullptr) {
151 kill_field(x->enclosing_field(), true);
152 }
153 }
154 }
155 void do_StoreIndexed (StoreIndexed* x) { kill_array(x->type()); }
156 void do_MonitorEnter (MonitorEnter* x) { kill_memory(); }
157 void do_MonitorExit (MonitorExit* x) { kill_memory(); }
158 void do_Invoke (Invoke* x) { kill_memory(); }
159 void do_UnsafePut (UnsafePut* x) { kill_memory(); }
160 void do_UnsafeGetAndSet(UnsafeGetAndSet* x) { kill_memory(); }
161 void do_UnsafeGet (UnsafeGet* x) {
162 if (x->is_volatile()) { // the JMM requires this
163 kill_memory();
164 }
165 }
166 void do_Intrinsic (Intrinsic* x) { if (!x->preserves_state()) kill_memory(); }
167
168 void do_Phi (Phi* x) { /* nothing to do */ }
169 void do_Local (Local* x) { /* nothing to do */ }
170 void do_Constant (Constant* x) {
171 if (x->kills_memory()) {
172 assert(x->can_trap(), "already linked");
197 kill_memory();
198 }
199 }
200 void do_NewTypeArray (NewTypeArray* x) { /* nothing to do */ }
201 void do_NewObjectArray (NewObjectArray* x) { /* nothing to do */ }
202 void do_NewMultiArray (NewMultiArray* x) { /* nothing to do */ }
203 void do_CheckCast (CheckCast* x) { /* nothing to do */ }
204 void do_InstanceOf (InstanceOf* x) { /* nothing to do */ }
205 void do_BlockBegin (BlockBegin* x) { /* nothing to do */ }
206 void do_Goto (Goto* x) { /* nothing to do */ }
207 void do_If (If* x) { /* nothing to do */ }
208 void do_TableSwitch (TableSwitch* x) { /* nothing to do */ }
209 void do_LookupSwitch (LookupSwitch* x) { /* nothing to do */ }
210 void do_Return (Return* x) { /* nothing to do */ }
211 void do_Throw (Throw* x) { /* nothing to do */ }
212 void do_Base (Base* x) { /* nothing to do */ }
213 void do_OsrEntry (OsrEntry* x) { /* nothing to do */ }
214 void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
215 void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }
216 void do_ProfileReturnType (ProfileReturnType* x) { /* nothing to do */ }
217 void do_ProfileACmpTypes(ProfileACmpTypes* x) { /* nothing to do */ }
218 void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
219 void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ };
220 void do_MemBar (MemBar* x) { /* nothing to do */ };
221 void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
222 #ifdef ASSERT
223 void do_Assert (Assert* x) { /* nothing to do */ };
224 #endif
225 };
226
227
228 class ValueNumberingEffects: public ValueNumberingVisitor {
229 private:
230 ValueMap* _map;
231
232 public:
233 // implementation for abstract methods of ValueNumberingVisitor
234 void kill_memory() { _map->kill_memory(); }
235 void kill_field(ciField* field, bool all_offsets) { _map->kill_field(field, all_offsets); }
236 void kill_array(ValueType* type) { _map->kill_array(type); }
237
|