Mercurial > hg > truffle
comparison src/share/vm/c1/c1_ValueMap.hpp @ 8860:46f6f063b272
7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by: never, kvn, twisti
Contributed-by: thomaswue <thomas.wuerthinger@oracle.com>
author | roland |
---|---|
date | Thu, 21 Mar 2013 09:27:54 +0100 |
parents | b9a9ed0f8eeb |
children | acadb114c818 |
comparison
equal
deleted
inserted
replaced
8780:98f3af397705 | 8860:46f6f063b272 |
---|---|
204 void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ } | 204 void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ } |
205 void do_ProfileCall (ProfileCall* x) { /* nothing to do */ } | 205 void do_ProfileCall (ProfileCall* x) { /* nothing to do */ } |
206 void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ }; | 206 void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ }; |
207 void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ }; | 207 void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ }; |
208 void do_MemBar (MemBar* x) { /* nothing to do */ }; | 208 void do_MemBar (MemBar* x) { /* nothing to do */ }; |
209 void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ }; | |
210 void do_Assert (Assert* x) { /* nothing to do */ }; | |
209 }; | 211 }; |
210 | 212 |
211 | 213 |
212 class ValueNumberingEffects: public ValueNumberingVisitor { | 214 class ValueNumberingEffects: public ValueNumberingVisitor { |
213 private: | 215 private: |
223 }; | 225 }; |
224 | 226 |
225 | 227 |
226 class GlobalValueNumbering: public ValueNumberingVisitor { | 228 class GlobalValueNumbering: public ValueNumberingVisitor { |
227 private: | 229 private: |
230 Compilation* _compilation; // compilation data | |
228 ValueMap* _current_map; // value map of current block | 231 ValueMap* _current_map; // value map of current block |
229 ValueMapArray _value_maps; // list of value maps for all blocks | 232 ValueMapArray _value_maps; // list of value maps for all blocks |
233 ValueSet _processed_values; // marker for instructions that were already processed | |
234 bool _has_substitutions; // set to true when substitutions must be resolved | |
230 | 235 |
231 public: | 236 public: |
232 // accessors | 237 // accessors |
238 Compilation* compilation() const { return _compilation; } | |
233 ValueMap* current_map() { return _current_map; } | 239 ValueMap* current_map() { return _current_map; } |
234 ValueMap* value_map_of(BlockBegin* block) { return _value_maps.at(block->linear_scan_number()); } | 240 ValueMap* value_map_of(BlockBegin* block) { return _value_maps.at(block->linear_scan_number()); } |
235 void set_value_map_of(BlockBegin* block, ValueMap* map) { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); } | 241 void set_value_map_of(BlockBegin* block, ValueMap* map) { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); } |
242 | |
243 bool is_processed(Value v) { return _processed_values.contains(v); } | |
244 void set_processed(Value v) { _processed_values.put(v); } | |
236 | 245 |
237 // implementation for abstract methods of ValueNumberingVisitor | 246 // implementation for abstract methods of ValueNumberingVisitor |
238 void kill_memory() { current_map()->kill_memory(); } | 247 void kill_memory() { current_map()->kill_memory(); } |
239 void kill_field(ciField* field, bool all_offsets) { current_map()->kill_field(field, all_offsets); } | 248 void kill_field(ciField* field, bool all_offsets) { current_map()->kill_field(field, all_offsets); } |
240 void kill_array(ValueType* type) { current_map()->kill_array(type); } | 249 void kill_array(ValueType* type) { current_map()->kill_array(type); } |
241 | 250 |
242 // main entry point that performs global value numbering | 251 // main entry point that performs global value numbering |
243 GlobalValueNumbering(IR* ir); | 252 GlobalValueNumbering(IR* ir); |
253 void substitute(Instruction* instr); // substitute instruction if it is contained in current value map | |
244 }; | 254 }; |
245 | 255 |
246 #endif // SHARE_VM_C1_C1_VALUEMAP_HPP | 256 #endif // SHARE_VM_C1_C1_VALUEMAP_HPP |