# HG changeset patch # User phh # Date 1286550434 14400 # Node ID be2b508a60cbf27d3319c63919aec86087ff46f6 # Parent 22339bb3b2fdb551891375d1ab91ae2be1816d27 6981431: IdealKit should support I_O projections Summary: add I_O projections support into IdealKit Reviewed-by: never diff -r 22339bb3b2fd -r be2b508a60cb src/share/vm/includeDB_compiler2 --- a/src/share/vm/includeDB_compiler2 Mon Aug 30 11:02:53 2010 -0700 +++ b/src/share/vm/includeDB_compiler2 Fri Oct 08 11:07:14 2010 -0400 @@ -522,6 +522,7 @@ idealKit.hpp cfgnode.hpp idealKit.hpp connode.hpp idealKit.hpp divnode.hpp +idealKit.hpp graphKit.hpp idealKit.hpp mulnode.hpp idealKit.hpp phaseX.hpp idealKit.hpp subnode.hpp diff -r 22339bb3b2fd -r be2b508a60cb src/share/vm/opto/graphKit.cpp --- a/src/share/vm/opto/graphKit.cpp Mon Aug 30 11:02:53 2010 -0700 +++ b/src/share/vm/opto/graphKit.cpp Fri Oct 08 11:07:14 2010 -0400 @@ -3254,6 +3254,7 @@ // Final sync IdealKit and graphKit. __ drain_delay_transform(); set_all_memory(__ merged_memory()); + set_i_o(__ i_o()); set_control(__ ctrl()); } @@ -3301,7 +3302,7 @@ // (Else it's an array (or unknown), and we want more precise card marks.) assert(adr != NULL, ""); - IdealKit ideal(gvn(), control(), merged_memory(), true); + IdealKit ideal(this, true); // Convert the pointer to an int prior to doing math on it Node* cast = __ CastPX(__ ctrl(), adr); @@ -3337,7 +3338,7 @@ Node* val, const TypeOopPtr* val_type, BasicType bt) { - IdealKit ideal(gvn(), control(), merged_memory(), true); + IdealKit ideal(this, true); Node* tls = __ thread(); // ThreadLocalStorage @@ -3480,7 +3481,7 @@ // (Else it's an array (or unknown), and we want more precise card marks.) assert(adr != NULL, ""); - IdealKit ideal(gvn(), control(), merged_memory(), true); + IdealKit ideal(this, true); Node* tls = __ thread(); // ThreadLocalStorage diff -r 22339bb3b2fd -r be2b508a60cb src/share/vm/opto/idealKit.cpp --- a/src/share/vm/opto/idealKit.cpp Mon Aug 30 11:02:53 2010 -0700 +++ b/src/share/vm/opto/idealKit.cpp Fri Oct 08 11:07:14 2010 -0400 @@ -34,15 +34,16 @@ const uint IdealKit::first_var = TypeFunc::Parms + 1; //----------------------------IdealKit----------------------------------------- -IdealKit::IdealKit(PhaseGVN &gvn, Node* control, Node* mem, bool delay_all_transforms, bool has_declarations) : - _gvn(gvn), C(gvn.C) { - _initial_ctrl = control; - _initial_memory = mem; +IdealKit::IdealKit(GraphKit* gkit, bool delay_all_transforms, bool has_declarations) : + _gvn(gkit->gvn()), C(gkit->C) { + _initial_ctrl = gkit->control(); + _initial_memory = gkit->merged_memory(); + _initial_i_o = gkit->i_o(); _delay_all_transforms = delay_all_transforms; _var_ct = 0; _cvstate = NULL; // We can go memory state free or else we need the entire memory state - assert(mem == NULL || mem->Opcode() == Op_MergeMem, "memory must be pre-split"); + assert(_initial_memory == NULL || _initial_memory->Opcode() == Op_MergeMem, "memory must be pre-split"); int init_size = 5; _pending_cvstates = new (C->node_arena()) GrowableArray(C->node_arena(), init_size, 0, 0); _delay_transform = new (C->node_arena()) GrowableArray(C->node_arena(), init_size, 0, 0); @@ -266,6 +267,7 @@ _cvstate = new_cvstate(); // initialize current cvstate set_ctrl(_initial_ctrl); // initialize control in current cvstate set_all_memory(_initial_memory);// initialize memory in current cvstate + set_i_o(_initial_i_o); // initialize i_o in current cvstate DEBUG_ONLY(_state->push(BlockS)); } @@ -407,6 +409,9 @@ // Get the region for the join state Node* join_region = join->in(TypeFunc::Control); assert(join_region != NULL, "join region must exist"); + if (join->in(TypeFunc::I_O) == NULL ) { + join->set_req(TypeFunc::I_O, merging->in(TypeFunc::I_O)); + } if (join->in(TypeFunc::Memory) == NULL ) { join->set_req(TypeFunc::Memory, merging->in(TypeFunc::Memory)); return; @@ -453,6 +458,20 @@ mms.set_memory(phi); } } + + Node* join_io = join->in(TypeFunc::I_O); + Node* merging_io = merging->in(TypeFunc::I_O); + if (join_io != merging_io) { + PhiNode* phi; + if (join_io->is_Phi() && join_io->as_Phi()->region() == join_region) { + phi = join_io->as_Phi(); + } else { + phi = PhiNode::make(join_region, join_io, Type::ABIO); + phi = (PhiNode*) delay_transform(phi); + join->set_req(TypeFunc::I_O, phi); + } + phi->set_req(slot, merging_io); + } } diff -r 22339bb3b2fd -r be2b508a60cb src/share/vm/opto/idealKit.hpp --- a/src/share/vm/opto/idealKit.hpp Mon Aug 30 11:02:53 2010 -0700 +++ b/src/share/vm/opto/idealKit.hpp Fri Oct 08 11:07:14 2010 -0400 @@ -95,6 +95,7 @@ bool _delay_all_transforms; // flag forcing all transforms to be delayed Node* _initial_ctrl; // saves initial control until variables declared Node* _initial_memory; // saves initial memory until variables declared + Node* _initial_i_o; // saves initial i_o until variables declared PhaseGVN& gvn() const { return _gvn; } // Create a new cvstate filled with nulls @@ -129,7 +130,7 @@ Node* memory(uint alias_idx); public: - IdealKit(PhaseGVN &gvn, Node* control, Node* memory, bool delay_all_transforms = false, bool has_declarations = false); + IdealKit(GraphKit* gkit, bool delay_all_transforms = false, bool has_declarations = false); ~IdealKit() { stop(); drain_delay_transform(); @@ -140,6 +141,8 @@ Node* top() { return C->top(); } MergeMemNode* merged_memory() { return _cvstate->in(TypeFunc::Memory)->as_MergeMem(); } void set_all_memory(Node* mem) { _cvstate->set_req(TypeFunc::Memory, mem); } + Node* i_o() { return _cvstate->in(TypeFunc::I_O); } + void set_i_o(Node* c) { _cvstate->set_req(TypeFunc::I_O, c); } void set(IdealVariable& v, Node* rhs) { _cvstate->set_req(first_var + v.id(), rhs); } Node* value(IdealVariable& v) { return _cvstate->in(first_var + v.id()); } void dead(IdealVariable& v) { set(v, (Node*)NULL); } diff -r 22339bb3b2fd -r be2b508a60cb src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp Mon Aug 30 11:02:53 2010 -0700 +++ b/src/share/vm/opto/library_call.cpp Fri Oct 08 11:07:14 2010 -0400 @@ -1105,7 +1105,7 @@ const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin)); const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot); - IdealKit kit(gvn(), control(), merged_memory(), false, true); + IdealKit kit(this, false, true); #define __ kit. Node* zero = __ ConI(0); Node* one = __ ConI(1); @@ -2292,7 +2292,7 @@ // of it. So we need to emit code to conditionally do the proper type of // store. - IdealKit ideal(gvn(), control(), merged_memory()); + IdealKit ideal(this); #define __ ideal. // QQQ who knows what probability is here?? __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {