Mercurial > hg > truffle
comparison src/share/vm/opto/idealKit.cpp @ 851:fc4be448891f
6851742: (EA) allocation elimination doesn't work with UseG1GC
Summary: Fix eliminate_card_mark() to eliminate G1 pre/post barriers.
Reviewed-by: never
author | kvn |
---|---|
date | Thu, 16 Jul 2009 14:10:42 -0700 |
parents | d1605aabd0a1 |
children | 89e0543e1737 685e959d09ea |
comparison
equal
deleted
inserted
replaced
850:fd50a67f97d1 | 851:fc4be448891f |
---|---|
32 // soak up spots in the inputs even though we only use early Control | 32 // soak up spots in the inputs even though we only use early Control |
33 // and Memory slots. (So far.) | 33 // and Memory slots. (So far.) |
34 const uint IdealKit::first_var = TypeFunc::Parms + 1; | 34 const uint IdealKit::first_var = TypeFunc::Parms + 1; |
35 | 35 |
36 //----------------------------IdealKit----------------------------------------- | 36 //----------------------------IdealKit----------------------------------------- |
37 IdealKit::IdealKit(PhaseGVN &gvn, Node* control, Node* mem, bool delay_all_transforms) : | 37 IdealKit::IdealKit(PhaseGVN &gvn, Node* control, Node* mem, bool delay_all_transforms, bool has_declarations) : |
38 _gvn(gvn), C(gvn.C) { | 38 _gvn(gvn), C(gvn.C) { |
39 _initial_ctrl = control; | 39 _initial_ctrl = control; |
40 _initial_memory = mem; | 40 _initial_memory = mem; |
41 _delay_all_transforms = delay_all_transforms; | 41 _delay_all_transforms = delay_all_transforms; |
42 _var_ct = 0; | 42 _var_ct = 0; |
45 assert(mem == NULL || mem->Opcode() == Op_MergeMem, "memory must be pre-split"); | 45 assert(mem == NULL || mem->Opcode() == Op_MergeMem, "memory must be pre-split"); |
46 int init_size = 5; | 46 int init_size = 5; |
47 _pending_cvstates = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0); | 47 _pending_cvstates = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0); |
48 _delay_transform = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0); | 48 _delay_transform = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0); |
49 DEBUG_ONLY(_state = new (C->node_arena()) GrowableArray<int>(C->node_arena(), init_size, 0, 0)); | 49 DEBUG_ONLY(_state = new (C->node_arena()) GrowableArray<int>(C->node_arena(), init_size, 0, 0)); |
50 if (!has_declarations) { | |
51 declarations_done(); | |
52 } | |
50 } | 53 } |
51 | 54 |
52 //-------------------------------if_then------------------------------------- | 55 //-------------------------------if_then------------------------------------- |
53 // Create: if(left relop right) | 56 // Create: if(left relop right) |
54 // / \ | 57 // / \ |
95 } | 98 } |
96 | 99 |
97 //-------------------------------end_if------------------------------------- | 100 //-------------------------------end_if------------------------------------- |
98 // Merge the "then" and "else" cvstates. | 101 // Merge the "then" and "else" cvstates. |
99 // | 102 // |
100 // The if_then() pushed the current state for later use | 103 // The if_then() pushed a copy of the current state for later use |
101 // as the initial state for a future "else" clause. The | 104 // as the initial state for a future "else" clause. The |
102 // current state then became the initial state for the | 105 // current state then became the initial state for the |
103 // then clause. If an "else" clause was encountered, it will | 106 // then clause. If an "else" clause was encountered, it will |
104 // pop the top state and use it for it's initial state. | 107 // pop the top state and use it for it's initial state. |
105 // It will also push the current state (the state at the end of | 108 // It will also push the current state (the state at the end of |
256 const BasicType bt = n->bottom_type()->basic_type(); | 259 const BasicType bt = n->bottom_type()->basic_type(); |
257 const Type* ct = Type::get_const_basic_type(bt); | 260 const Type* ct = Type::get_const_basic_type(bt); |
258 return delay_transform(PhiNode::make(reg, n, ct)); | 261 return delay_transform(PhiNode::make(reg, n, ct)); |
259 } | 262 } |
260 | 263 |
261 //-----------------------------declares_done----------------------------------- | 264 //-----------------------------declarations_done------------------------------- |
262 void IdealKit::declares_done() { | 265 void IdealKit::declarations_done() { |
263 _cvstate = new_cvstate(); // initialize current cvstate | 266 _cvstate = new_cvstate(); // initialize current cvstate |
264 set_ctrl(_initial_ctrl); // initialize control in current cvstate | 267 set_ctrl(_initial_ctrl); // initialize control in current cvstate |
265 set_all_memory(_initial_memory);// initialize memory in current cvstate | 268 set_all_memory(_initial_memory);// initialize memory in current cvstate |
266 DEBUG_ONLY(_state->push(BlockS)); | 269 DEBUG_ONLY(_state->push(BlockS)); |
267 } | 270 } |
275 } | 278 } |
276 } | 279 } |
277 | 280 |
278 //-----------------------------delay_transform----------------------------------- | 281 //-----------------------------delay_transform----------------------------------- |
279 Node* IdealKit::delay_transform(Node* n) { | 282 Node* IdealKit::delay_transform(Node* n) { |
280 gvn().set_type(n, n->bottom_type()); | 283 if (!gvn().is_IterGVN() || !gvn().is_IterGVN()->delay_transform()) { |
284 gvn().set_type(n, n->bottom_type()); | |
285 } | |
281 _delay_transform->push(n); | 286 _delay_transform->push(n); |
282 return n; | 287 return n; |
283 } | 288 } |
284 | 289 |
285 //-----------------------------new_cvstate----------------------------------- | 290 //-----------------------------new_cvstate----------------------------------- |
319 } | 324 } |
320 | 325 |
321 Node* IdealKit::memory(uint alias_idx) { | 326 Node* IdealKit::memory(uint alias_idx) { |
322 MergeMemNode* mem = merged_memory(); | 327 MergeMemNode* mem = merged_memory(); |
323 Node* p = mem->memory_at(alias_idx); | 328 Node* p = mem->memory_at(alias_idx); |
324 _gvn.set_type(p, Type::MEMORY); // must be mapped | 329 if (!gvn().is_IterGVN() || !gvn().is_IterGVN()->delay_transform()) { |
330 _gvn.set_type(p, Type::MEMORY); // must be mapped | |
331 } | |
325 return p; | 332 return p; |
326 } | 333 } |
327 | 334 |
328 void IdealKit::set_memory(Node* mem, uint alias_idx) { | 335 void IdealKit::set_memory(Node* mem, uint alias_idx) { |
329 merged_memory()->set_memory_at(alias_idx, mem); | 336 merged_memory()->set_memory_at(alias_idx, mem); |
460 | 467 |
461 // We only handle taking in RawMem and modifying RawMem | 468 // We only handle taking in RawMem and modifying RawMem |
462 const TypePtr* adr_type = TypeRawPtr::BOTTOM; | 469 const TypePtr* adr_type = TypeRawPtr::BOTTOM; |
463 uint adr_idx = C->get_alias_index(adr_type); | 470 uint adr_idx = C->get_alias_index(adr_type); |
464 | 471 |
465 // Clone initial memory | |
466 MergeMemNode* cloned_mem = MergeMemNode::make(C, merged_memory()); | |
467 | |
468 // Slow-path leaf call | 472 // Slow-path leaf call |
469 int size = slow_call_type->domain()->cnt(); | 473 int size = slow_call_type->domain()->cnt(); |
470 CallNode *call = (CallNode*)new (C, size) CallLeafNode( slow_call_type, slow_call, leaf_name, adr_type); | 474 CallNode *call = (CallNode*)new (C, size) CallLeafNode( slow_call_type, slow_call, leaf_name, adr_type); |
471 | 475 |
472 // Set fixed predefined input arguments | 476 // Set fixed predefined input arguments |
487 | 491 |
488 // Slow leaf call has no side-effects, sets few values | 492 // Slow leaf call has no side-effects, sets few values |
489 | 493 |
490 set_ctrl(transform( new (C, 1) ProjNode(call,TypeFunc::Control) )); | 494 set_ctrl(transform( new (C, 1) ProjNode(call,TypeFunc::Control) )); |
491 | 495 |
492 // Set the incoming clone of memory as current memory | |
493 set_all_memory(cloned_mem); | |
494 | |
495 // Make memory for the call | 496 // Make memory for the call |
496 Node* mem = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory) ); | 497 Node* mem = _gvn.transform( new (C, 1) ProjNode(call, TypeFunc::Memory) ); |
497 | 498 |
498 // Set the RawPtr memory state only. | 499 // Set the RawPtr memory state only. |
499 set_memory(mem, adr_idx); | 500 set_memory(mem, adr_idx); |