50
51 const TypePtr *MemNode::adr_type() const {
52 Node* adr = in(Address);
53 const TypePtr* cross_check = NULL;
54 DEBUG_ONLY(cross_check = _adr_type);
55 return calculate_adr_type(adr->bottom_type(), cross_check);
56 }
57
58 #ifndef PRODUCT
59 void MemNode::dump_spec(outputStream *st) const {
60 if (in(Address) == NULL) return; // node is dead
61 #ifndef ASSERT
62 // fake the missing field
63 const TypePtr* _adr_type = NULL;
64 if (in(Address) != NULL)
65 _adr_type = in(Address)->bottom_type()->isa_ptr();
66 #endif
67 dump_adr_type(this, _adr_type, st);
68
69 Compile* C = Compile::current();
70 if( C->alias_type(_adr_type)->is_volatile() )
71 st->print(" Volatile!");
72 }
73
74 void MemNode::dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st) {
75 st->print(" @");
76 if (adr_type == NULL) {
77 st->print("NULL");
78 } else {
79 adr_type->dump_on(st);
80 Compile* C = Compile::current();
81 Compile::AliasType* atp = NULL;
82 if (C->have_alias_type(adr_type)) atp = C->alias_type(adr_type);
83 if (atp == NULL)
84 st->print(", idx=?\?;");
85 else if (atp->index() == Compile::AliasIdxBot)
86 st->print(", idx=Bot;");
87 else if (atp->index() == Compile::AliasIdxTop)
88 st->print(", idx=Top;");
89 else if (atp->index() == Compile::AliasIdxRaw)
90 st->print(", idx=Raw;");
91 else {
3305 if ((count += 1) > 20) return false; // complexity limit
3306 for (uint i = 1; i < n->req(); i++) {
3307 Node* m = n->in(i);
3308 if (m == NULL || m == n || m->is_top()) continue;
3309 uint first_i = n->find_edge(m);
3310 if (i != first_i) continue; // process duplicate edge just once
3311 if (!detect_init_independence(m, count)) {
3312 return false;
3313 }
3314 }
3315
3316 return true;
3317 }
3318
3319 // Here are all the checks a Store must pass before it can be moved into
3320 // an initialization. Returns zero if a check fails.
3321 // On success, returns the (constant) offset to which the store applies,
3322 // within the initialized memory.
3323 intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape) {
3324 const int FAIL = 0;
3325 if (st->req() != MemNode::ValueIn + 1)
3326 return FAIL; // an inscrutable StoreNode (card mark?)
3327 Node* ctl = st->in(MemNode::Control);
3328 if (!(ctl != NULL && ctl->is_Proj() && ctl->in(0) == this))
3329 return FAIL; // must be unconditional after the initialization
3330 Node* mem = st->in(MemNode::Memory);
3331 if (!(mem->is_Proj() && mem->in(0) == this))
3332 return FAIL; // must not be preceded by other stores
3333 Node* adr = st->in(MemNode::Address);
3334 intptr_t offset;
3335 AllocateNode* alloc = AllocateNode::Ideal_allocation(adr, phase, offset);
3336 if (alloc == NULL)
3337 return FAIL; // inscrutable address
3338 if (alloc != allocation())
3339 return FAIL; // wrong allocation! (store needs to float up)
3340 Node* val = st->in(MemNode::ValueIn);
3341 int complexity_count = 0;
3342 if (!detect_init_independence(val, complexity_count))
3343 return FAIL; // stored value must be 'simple enough'
3344
|
50
51 const TypePtr *MemNode::adr_type() const {
52 Node* adr = in(Address);
53 const TypePtr* cross_check = NULL;
54 DEBUG_ONLY(cross_check = _adr_type);
55 return calculate_adr_type(adr->bottom_type(), cross_check);
56 }
57
58 #ifndef PRODUCT
59 void MemNode::dump_spec(outputStream *st) const {
60 if (in(Address) == NULL) return; // node is dead
61 #ifndef ASSERT
62 // fake the missing field
63 const TypePtr* _adr_type = NULL;
64 if (in(Address) != NULL)
65 _adr_type = in(Address)->bottom_type()->isa_ptr();
66 #endif
67 dump_adr_type(this, _adr_type, st);
68
69 Compile* C = Compile::current();
70 if (C->alias_type(_adr_type)->is_volatile()) {
71 st->print(" Volatile!");
72 }
73 if (_unaligned_access) {
74 st->print(" unaligned");
75 }
76 if (_mismatched_access) {
77 st->print(" mismatched");
78 }
79 }
80
81 void MemNode::dump_adr_type(const Node* mem, const TypePtr* adr_type, outputStream *st) {
82 st->print(" @");
83 if (adr_type == NULL) {
84 st->print("NULL");
85 } else {
86 adr_type->dump_on(st);
87 Compile* C = Compile::current();
88 Compile::AliasType* atp = NULL;
89 if (C->have_alias_type(adr_type)) atp = C->alias_type(adr_type);
90 if (atp == NULL)
91 st->print(", idx=?\?;");
92 else if (atp->index() == Compile::AliasIdxBot)
93 st->print(", idx=Bot;");
94 else if (atp->index() == Compile::AliasIdxTop)
95 st->print(", idx=Top;");
96 else if (atp->index() == Compile::AliasIdxRaw)
97 st->print(", idx=Raw;");
98 else {
3312 if ((count += 1) > 20) return false; // complexity limit
3313 for (uint i = 1; i < n->req(); i++) {
3314 Node* m = n->in(i);
3315 if (m == NULL || m == n || m->is_top()) continue;
3316 uint first_i = n->find_edge(m);
3317 if (i != first_i) continue; // process duplicate edge just once
3318 if (!detect_init_independence(m, count)) {
3319 return false;
3320 }
3321 }
3322
3323 return true;
3324 }
3325
3326 // Here are all the checks a Store must pass before it can be moved into
3327 // an initialization. Returns zero if a check fails.
3328 // On success, returns the (constant) offset to which the store applies,
3329 // within the initialized memory.
3330 intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape) {
3331 const int FAIL = 0;
3332 if (st->is_unaligned_access()) {
3333 return FAIL;
3334 }
3335 if (st->req() != MemNode::ValueIn + 1)
3336 return FAIL; // an inscrutable StoreNode (card mark?)
3337 Node* ctl = st->in(MemNode::Control);
3338 if (!(ctl != NULL && ctl->is_Proj() && ctl->in(0) == this))
3339 return FAIL; // must be unconditional after the initialization
3340 Node* mem = st->in(MemNode::Memory);
3341 if (!(mem->is_Proj() && mem->in(0) == this))
3342 return FAIL; // must not be preceded by other stores
3343 Node* adr = st->in(MemNode::Address);
3344 intptr_t offset;
3345 AllocateNode* alloc = AllocateNode::Ideal_allocation(adr, phase, offset);
3346 if (alloc == NULL)
3347 return FAIL; // inscrutable address
3348 if (alloc != allocation())
3349 return FAIL; // wrong allocation! (store needs to float up)
3350 Node* val = st->in(MemNode::ValueIn);
3351 int complexity_count = 0;
3352 if (!detect_init_independence(val, complexity_count))
3353 return FAIL; // stored value must be 'simple enough'
3354
|