--- 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
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
--- 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 @@ void GraphKit::sync_kit(IdealKit& ideal)
// 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 @@ void GraphKit::write_barrier_post(Node*
// (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 @@ void GraphKit::g1_write_barrier_pre(Node
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 @@ void GraphKit::g1_write_barrier_post(Nod
// (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
--- 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 = TypeFun
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<Node*>(C->node_arena(), init_size, 0, 0);
_delay_transform = new (C->node_arena()) GrowableArray<Node*>(C->node_arena(), init_size, 0, 0);
@@ -266,6 +267,7 @@ void IdealKit::declarations_done() {
_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 @@ void IdealKit::do_memory_merge(Node* mer
// 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 @@ void IdealKit::do_memory_merge(Node* mer
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);
+ }
}
--- 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 @@ class IdealKit: public StackObj {
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 @@ class IdealKit: public StackObj {
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 @@ class IdealKit: public StackObj {
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); }
--- 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 @@ Node* LibraryCallKit::string_indexOf(Nod
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 @@ bool LibraryCallKit::inline_unsafe_acces
// 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)); {