src/share/vm/c1/c1_ValueMap.hpp
Print this page
rev 4136 : 7153771: array bound check elimination for c1
Summary: when possible optimize out array bound checks, inserting predicates when needed.
Reviewed-by:
@@ -204,10 +204,12 @@
void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
void do_ProfileCall (ProfileCall* x) { /* nothing to do */ }
void do_ProfileInvoke (ProfileInvoke* x) { /* nothing to do */ };
void do_RuntimeCall (RuntimeCall* x) { /* nothing to do */ };
void do_MemBar (MemBar* x) { /* nothing to do */ };
+ void do_RangeCheckPredicate(RangeCheckPredicate* x) { /* nothing to do */ };
+ void do_Assert (Assert* x) { /* nothing to do */ };
};
class ValueNumberingEffects: public ValueNumberingVisitor {
private:
@@ -223,24 +225,32 @@
};
class GlobalValueNumbering: public ValueNumberingVisitor {
private:
+ Compilation* _compilation; // compilation data
ValueMap* _current_map; // value map of current block
ValueMapArray _value_maps; // list of value maps for all blocks
+ ValueSet _processed_values; // marker for instructions that were already processed
+ bool _has_substitutions; // set to true when substitutions must be resolved
public:
// accessors
+ Compilation* compilation() const { return _compilation; }
ValueMap* current_map() { return _current_map; }
ValueMap* value_map_of(BlockBegin* block) { return _value_maps.at(block->linear_scan_number()); }
void set_value_map_of(BlockBegin* block, ValueMap* map) { assert(value_map_of(block) == NULL, ""); _value_maps.at_put(block->linear_scan_number(), map); }
+ bool is_processed(Value v) { return _processed_values.contains(v); }
+ void set_processed(Value v) { _processed_values.put(v); }
+
// implementation for abstract methods of ValueNumberingVisitor
void kill_memory() { current_map()->kill_memory(); }
void kill_field(ciField* field, bool all_offsets) { current_map()->kill_field(field, all_offsets); }
void kill_array(ValueType* type) { current_map()->kill_array(type); }
// main entry point that performs global value numbering
GlobalValueNumbering(IR* ir);
+ void substitute(Instruction* instr); // substitute instruction if it is contained in current value map
};
#endif // SHARE_VM_C1_C1_VALUEMAP_HPP