Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1/c1_Instruction.hpp @ 1783:d5d065957597
6953144: Tiered compilation
Summary: Infrastructure for tiered compilation support (interpreter + c1 + c2) for 32 and 64 bit. Simple tiered policy implementation.
Reviewed-by: kvn, never, phh, twisti
author | iveresov |
---|---|
date | Fri, 03 Sep 2010 17:51:07 -0700 |
parents | b812ff5abc73 |
children | 3a294e483abc |
comparison
equal
deleted
inserted
replaced
1782:f353275af40e | 1783:d5d065957597 |
---|---|
96 class UnsafePutObject; | 96 class UnsafePutObject; |
97 class UnsafePrefetch; | 97 class UnsafePrefetch; |
98 class UnsafePrefetchRead; | 98 class UnsafePrefetchRead; |
99 class UnsafePrefetchWrite; | 99 class UnsafePrefetchWrite; |
100 class ProfileCall; | 100 class ProfileCall; |
101 class ProfileCounter; | 101 class ProfileInvoke; |
102 | 102 |
103 // A Value is a reference to the instruction creating the value | 103 // A Value is a reference to the instruction creating the value |
104 typedef Instruction* Value; | 104 typedef Instruction* Value; |
105 define_array(ValueArray, Value) | 105 define_array(ValueArray, Value) |
106 define_stack(Values, ValueArray) | 106 define_stack(Values, ValueArray) |
193 virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0; | 193 virtual void do_UnsafeGetObject(UnsafeGetObject* x) = 0; |
194 virtual void do_UnsafePutObject(UnsafePutObject* x) = 0; | 194 virtual void do_UnsafePutObject(UnsafePutObject* x) = 0; |
195 virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x) = 0; | 195 virtual void do_UnsafePrefetchRead (UnsafePrefetchRead* x) = 0; |
196 virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0; | 196 virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0; |
197 virtual void do_ProfileCall (ProfileCall* x) = 0; | 197 virtual void do_ProfileCall (ProfileCall* x) = 0; |
198 virtual void do_ProfileCounter (ProfileCounter* x) = 0; | 198 virtual void do_ProfileInvoke (ProfileInvoke* x) = 0; |
199 }; | 199 }; |
200 | 200 |
201 | 201 |
202 // Hashing support | 202 // Hashing support |
203 // | 203 // |
1732 }; | 1732 }; |
1733 | 1733 |
1734 | 1734 |
1735 LEAF(Goto, BlockEnd) | 1735 LEAF(Goto, BlockEnd) |
1736 public: | 1736 public: |
1737 // creation | 1737 enum Direction { |
1738 Goto(BlockBegin* sux, ValueStack* state_before, bool is_safepoint = false) : BlockEnd(illegalType, state_before, is_safepoint) { | 1738 none, // Just a regular goto |
1739 taken, not_taken // Goto produced from If | |
1740 }; | |
1741 private: | |
1742 ciMethod* _profiled_method; | |
1743 int _profiled_bci; | |
1744 Direction _direction; | |
1745 public: | |
1746 // creation | |
1747 Goto(BlockBegin* sux, ValueStack* state_before, bool is_safepoint = false) | |
1748 : BlockEnd(illegalType, state_before, is_safepoint) | |
1749 , _direction(none) | |
1750 , _profiled_method(NULL) | |
1751 , _profiled_bci(0) { | |
1739 BlockList* s = new BlockList(1); | 1752 BlockList* s = new BlockList(1); |
1740 s->append(sux); | 1753 s->append(sux); |
1741 set_sux(s); | 1754 set_sux(s); |
1742 } | 1755 } |
1743 | 1756 |
1744 Goto(BlockBegin* sux, bool is_safepoint) : BlockEnd(illegalType, NULL, is_safepoint) { | 1757 Goto(BlockBegin* sux, bool is_safepoint) : BlockEnd(illegalType, NULL, is_safepoint) |
1758 , _direction(none) | |
1759 , _profiled_method(NULL) | |
1760 , _profiled_bci(0) { | |
1745 BlockList* s = new BlockList(1); | 1761 BlockList* s = new BlockList(1); |
1746 s->append(sux); | 1762 s->append(sux); |
1747 set_sux(s); | 1763 set_sux(s); |
1748 } | 1764 } |
1749 | 1765 |
1766 bool should_profile() const { return check_flag(ProfileMDOFlag); } | |
1767 ciMethod* profiled_method() const { return _profiled_method; } // set only for profiled branches | |
1768 int profiled_bci() const { return _profiled_bci; } | |
1769 Direction direction() const { return _direction; } | |
1770 | |
1771 void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); } | |
1772 void set_profiled_method(ciMethod* method) { _profiled_method = method; } | |
1773 void set_profiled_bci(int bci) { _profiled_bci = bci; } | |
1774 void set_direction(Direction d) { _direction = d; } | |
1750 }; | 1775 }; |
1751 | 1776 |
1752 | 1777 |
1753 LEAF(If, BlockEnd) | 1778 LEAF(If, BlockEnd) |
1754 private: | 1779 private: |
1755 Value _x; | 1780 Value _x; |
1756 Condition _cond; | 1781 Condition _cond; |
1757 Value _y; | 1782 Value _y; |
1758 ciMethod* _profiled_method; | 1783 ciMethod* _profiled_method; |
1759 int _profiled_bci; // Canonicalizer may alter bci of If node | 1784 int _profiled_bci; // Canonicalizer may alter bci of If node |
1785 bool _swapped; // Is the order reversed with respect to the original If in the | |
1786 // bytecode stream? | |
1760 public: | 1787 public: |
1761 // creation | 1788 // creation |
1762 // unordered_is_true is valid for float/double compares only | 1789 // unordered_is_true is valid for float/double compares only |
1763 If(Value x, Condition cond, bool unordered_is_true, Value y, BlockBegin* tsux, BlockBegin* fsux, ValueStack* state_before, bool is_safepoint) | 1790 If(Value x, Condition cond, bool unordered_is_true, Value y, BlockBegin* tsux, BlockBegin* fsux, ValueStack* state_before, bool is_safepoint) |
1764 : BlockEnd(illegalType, state_before, is_safepoint) | 1791 : BlockEnd(illegalType, state_before, is_safepoint) |
1765 , _x(x) | 1792 , _x(x) |
1766 , _cond(cond) | 1793 , _cond(cond) |
1767 , _y(y) | 1794 , _y(y) |
1768 , _profiled_method(NULL) | 1795 , _profiled_method(NULL) |
1769 , _profiled_bci(0) | 1796 , _profiled_bci(0) |
1797 , _swapped(false) | |
1770 { | 1798 { |
1771 ASSERT_VALUES | 1799 ASSERT_VALUES |
1772 set_flag(UnorderedIsTrueFlag, unordered_is_true); | 1800 set_flag(UnorderedIsTrueFlag, unordered_is_true); |
1773 assert(x->type()->tag() == y->type()->tag(), "types must match"); | 1801 assert(x->type()->tag() == y->type()->tag(), "types must match"); |
1774 BlockList* s = new BlockList(2); | 1802 BlockList* s = new BlockList(2); |
1786 BlockBegin* tsux() const { return sux_for(true); } | 1814 BlockBegin* tsux() const { return sux_for(true); } |
1787 BlockBegin* fsux() const { return sux_for(false); } | 1815 BlockBegin* fsux() const { return sux_for(false); } |
1788 BlockBegin* usux() const { return sux_for(unordered_is_true()); } | 1816 BlockBegin* usux() const { return sux_for(unordered_is_true()); } |
1789 bool should_profile() const { return check_flag(ProfileMDOFlag); } | 1817 bool should_profile() const { return check_flag(ProfileMDOFlag); } |
1790 ciMethod* profiled_method() const { return _profiled_method; } // set only for profiled branches | 1818 ciMethod* profiled_method() const { return _profiled_method; } // set only for profiled branches |
1791 int profiled_bci() const { return _profiled_bci; } // set only for profiled branches | 1819 int profiled_bci() const { return _profiled_bci; } // set for profiled branches and tiered |
1820 bool is_swapped() const { return _swapped; } | |
1792 | 1821 |
1793 // manipulation | 1822 // manipulation |
1794 void swap_operands() { | 1823 void swap_operands() { |
1795 Value t = _x; _x = _y; _y = t; | 1824 Value t = _x; _x = _y; _y = t; |
1796 _cond = mirror(_cond); | 1825 _cond = mirror(_cond); |
1805 } | 1834 } |
1806 | 1835 |
1807 void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); } | 1836 void set_should_profile(bool value) { set_flag(ProfileMDOFlag, value); } |
1808 void set_profiled_method(ciMethod* method) { _profiled_method = method; } | 1837 void set_profiled_method(ciMethod* method) { _profiled_method = method; } |
1809 void set_profiled_bci(int bci) { _profiled_bci = bci; } | 1838 void set_profiled_bci(int bci) { _profiled_bci = bci; } |
1810 | 1839 void set_swapped(bool value) { _swapped = value; } |
1811 // generic | 1840 // generic |
1812 virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_x); f->visit(&_y); } | 1841 virtual void input_values_do(ValueVisitor* f) { BlockEnd::input_values_do(f); f->visit(&_x); f->visit(&_y); } |
1813 }; | 1842 }; |
1814 | 1843 |
1815 | 1844 |
2233 { | 2262 { |
2234 ASSERT_VALUES | 2263 ASSERT_VALUES |
2235 } | 2264 } |
2236 }; | 2265 }; |
2237 | 2266 |
2238 | |
2239 LEAF(ProfileCall, Instruction) | 2267 LEAF(ProfileCall, Instruction) |
2240 private: | 2268 private: |
2241 ciMethod* _method; | 2269 ciMethod* _method; |
2242 int _bci_of_invoke; | 2270 int _bci_of_invoke; |
2243 Value _recv; | 2271 Value _recv; |
2261 ciKlass* known_holder() { return _known_holder; } | 2289 ciKlass* known_holder() { return _known_holder; } |
2262 | 2290 |
2263 virtual void input_values_do(ValueVisitor* f) { if (_recv != NULL) f->visit(&_recv); } | 2291 virtual void input_values_do(ValueVisitor* f) { if (_recv != NULL) f->visit(&_recv); } |
2264 }; | 2292 }; |
2265 | 2293 |
2266 | 2294 // Use to trip invocation counter of an inlined method |
2267 // | 2295 |
2268 // Simple node representing a counter update generally used for updating MDOs | 2296 LEAF(ProfileInvoke, Instruction) |
2269 // | 2297 private: |
2270 LEAF(ProfileCounter, Instruction) | 2298 ciMethod* _inlinee; |
2271 private: | 2299 ValueStack* _state; |
2272 Value _mdo; | 2300 int _bci_of_invoke; |
2273 int _offset; | 2301 |
2274 int _increment; | 2302 public: |
2275 | 2303 ProfileInvoke(ciMethod* inlinee, ValueStack* state, int bci) |
2276 public: | |
2277 ProfileCounter(Value mdo, int offset, int increment = 1) | |
2278 : Instruction(voidType) | 2304 : Instruction(voidType) |
2279 , _mdo(mdo) | 2305 , _inlinee(inlinee) |
2280 , _offset(offset) | 2306 , _bci_of_invoke(bci) |
2281 , _increment(increment) | 2307 , _state(state) |
2282 { | 2308 { |
2283 // The ProfileCounter has side-effects and must occur precisely where located | 2309 // The ProfileInvoke has side-effects and must occur precisely where located QQQ??? |
2284 pin(); | 2310 pin(); |
2285 } | 2311 } |
2286 | 2312 |
2287 Value mdo() { return _mdo; } | 2313 ciMethod* inlinee() { return _inlinee; } |
2288 int offset() { return _offset; } | 2314 ValueStack* state() { return _state; } |
2289 int increment() { return _increment; } | 2315 int bci_of_invoke() { return _bci_of_invoke; } |
2290 | 2316 virtual void input_values_do(ValueVisitor*) {} |
2291 virtual void input_values_do(ValueVisitor* f) { f->visit(&_mdo); } | 2317 virtual void state_values_do(ValueVisitor*); |
2292 }; | 2318 }; |
2293 | |
2294 | 2319 |
2295 class BlockPair: public CompilationResourceObj { | 2320 class BlockPair: public CompilationResourceObj { |
2296 private: | 2321 private: |
2297 BlockBegin* _from; | 2322 BlockBegin* _from; |
2298 BlockBegin* _to; | 2323 BlockBegin* _to; |