35 #include "opto/loopnode.hpp"
36 #include "opto/machnode.hpp"
37 #include "opto/matcher.hpp"
38 #include "opto/memnode.hpp"
39 #include "opto/mulnode.hpp"
40 #include "opto/narrowptrnode.hpp"
41 #include "opto/phaseX.hpp"
42 #include "opto/regmask.hpp"
43
44 // Portions of code courtesy of Clifford Click
45
46 // Optimization - Graph Style
47
48 static Node *step_through_mergemem(PhaseGVN *phase, MergeMemNode *mmem, const TypePtr *tp, const TypePtr *adr_check, outputStream *st);
49
50 //=============================================================================
51 uint MemNode::size_of() const { return sizeof(*this); }
52
53 const TypePtr *MemNode::adr_type() const {
54 Node* adr = in(Address);
55 const TypePtr* cross_check = NULL;
56 DEBUG_ONLY(cross_check = _adr_type);
57 return calculate_adr_type(adr->bottom_type(), cross_check);
58 }
59
60 #ifndef PRODUCT
61 void MemNode::dump_spec(outputStream *st) const {
62 if (in(Address) == NULL) return; // node is dead
63 #ifndef ASSERT
64 // fake the missing field
65 const TypePtr* _adr_type = NULL;
66 if (in(Address) != NULL)
67 _adr_type = in(Address)->bottom_type()->isa_ptr();
68 #endif
69 dump_adr_type(this, _adr_type, st);
70
71 Compile* C = Compile::current();
72 if( C->alias_type(_adr_type)->is_volatile() )
73 st->print(" Volatile!");
74 }
2704 Node *x = fast_out(i);
2705 if (x->Opcode() == Op_SCMemProj) continue;
2706 return false;
2707 }
2708 return true;
2709 }
2710
2711 uint LoadStoreNode::size_of() const { return sizeof(*this); }
2712
2713 //=============================================================================
2714 //----------------------------------LoadStoreConditionalNode--------------------
2715 LoadStoreConditionalNode::LoadStoreConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex ) : LoadStoreNode(c, mem, adr, val, NULL, TypeInt::BOOL, 5) {
2716 init_req(ExpectedIn, ex );
2717 }
2718
2719 //=============================================================================
2720 //-------------------------------adr_type--------------------------------------
2721 // Do we Match on this edge index or not? Do not match memory
2722 const TypePtr* ClearArrayNode::adr_type() const {
2723 Node *adr = in(3);
2724 return MemNode::calculate_adr_type(adr->bottom_type());
2725 }
2726
2727 //------------------------------match_edge-------------------------------------
2728 // Do we Match on this edge index or not? Do not match memory
2729 uint ClearArrayNode::match_edge(uint idx) const {
2730 return idx > 1;
2731 }
2732
2733 //------------------------------Identity---------------------------------------
2734 // Clearing a zero length array does nothing
2735 Node *ClearArrayNode::Identity( PhaseTransform *phase ) {
2736 return phase->type(in(2))->higher_equal(TypeX::ZERO) ? in(1) : this;
2737 }
2738
2739 //------------------------------Idealize---------------------------------------
2740 // Clearing a short array is faster with stores
2741 Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape){
2742 const int unit = BytesPerLong;
2743 const TypeX* t = phase->type(in(2))->isa_intptr_t();
|
35 #include "opto/loopnode.hpp"
36 #include "opto/machnode.hpp"
37 #include "opto/matcher.hpp"
38 #include "opto/memnode.hpp"
39 #include "opto/mulnode.hpp"
40 #include "opto/narrowptrnode.hpp"
41 #include "opto/phaseX.hpp"
42 #include "opto/regmask.hpp"
43
44 // Portions of code courtesy of Clifford Click
45
46 // Optimization - Graph Style
47
48 static Node *step_through_mergemem(PhaseGVN *phase, MergeMemNode *mmem, const TypePtr *tp, const TypePtr *adr_check, outputStream *st);
49
50 //=============================================================================
51 uint MemNode::size_of() const { return sizeof(*this); }
52
53 const TypePtr *MemNode::adr_type() const {
54 Node* adr = in(Address);
55 if (adr == NULL) return NULL; // node is dead
56 const TypePtr* cross_check = NULL;
57 DEBUG_ONLY(cross_check = _adr_type);
58 return calculate_adr_type(adr->bottom_type(), cross_check);
59 }
60
61 #ifndef PRODUCT
62 void MemNode::dump_spec(outputStream *st) const {
63 if (in(Address) == NULL) return; // node is dead
64 #ifndef ASSERT
65 // fake the missing field
66 const TypePtr* _adr_type = NULL;
67 if (in(Address) != NULL)
68 _adr_type = in(Address)->bottom_type()->isa_ptr();
69 #endif
70 dump_adr_type(this, _adr_type, st);
71
72 Compile* C = Compile::current();
73 if( C->alias_type(_adr_type)->is_volatile() )
74 st->print(" Volatile!");
75 }
2705 Node *x = fast_out(i);
2706 if (x->Opcode() == Op_SCMemProj) continue;
2707 return false;
2708 }
2709 return true;
2710 }
2711
2712 uint LoadStoreNode::size_of() const { return sizeof(*this); }
2713
2714 //=============================================================================
2715 //----------------------------------LoadStoreConditionalNode--------------------
2716 LoadStoreConditionalNode::LoadStoreConditionalNode( Node *c, Node *mem, Node *adr, Node *val, Node *ex ) : LoadStoreNode(c, mem, adr, val, NULL, TypeInt::BOOL, 5) {
2717 init_req(ExpectedIn, ex );
2718 }
2719
2720 //=============================================================================
2721 //-------------------------------adr_type--------------------------------------
2722 // Do we Match on this edge index or not? Do not match memory
2723 const TypePtr* ClearArrayNode::adr_type() const {
2724 Node *adr = in(3);
2725 if (adr == NULL) return NULL; // node is dead
2726 return MemNode::calculate_adr_type(adr->bottom_type());
2727 }
2728
2729 //------------------------------match_edge-------------------------------------
2730 // Do we Match on this edge index or not? Do not match memory
2731 uint ClearArrayNode::match_edge(uint idx) const {
2732 return idx > 1;
2733 }
2734
2735 //------------------------------Identity---------------------------------------
2736 // Clearing a zero length array does nothing
2737 Node *ClearArrayNode::Identity( PhaseTransform *phase ) {
2738 return phase->type(in(2))->higher_equal(TypeX::ZERO) ? in(1) : this;
2739 }
2740
2741 //------------------------------Idealize---------------------------------------
2742 // Clearing a short array is faster with stores
2743 Node *ClearArrayNode::Ideal(PhaseGVN *phase, bool can_reshape){
2744 const int unit = BytesPerLong;
2745 const TypeX* t = phase->type(in(2))->isa_intptr_t();
|