8034812: remove IDX_INIT macro hack in Node class

The IDX_INIT macro used by Node::Node(...) to retrieve the Compile object is removed and replaced by a call to Compile::current(). The Node constructor, new operator and all calls to it are adapted accordingly.

Reviewed-by: kvn, jrose, iveresov, goetz
This commit is contained in:
Tobias Hartmann 2014-06-02 08:07:29 +02:00
parent b053fa4c48
commit 2a0815a55e
51 changed files with 1659 additions and 1686 deletions

View file

@ -70,7 +70,7 @@ class StringConcat : public ResourceObj {
_multiple(false),
_string_alloc(NULL),
_stringopts(stringopts) {
_arguments = new (_stringopts->C) Node(1);
_arguments = new Node(1);
_arguments->del_req(0);
}
@ -228,8 +228,8 @@ class StringConcat : public ResourceObj {
const TypeFunc* call_type = OptoRuntime::uncommon_trap_Type();
const TypePtr* no_memory_effects = NULL;
Compile* C = _stringopts->C;
CallStaticJavaNode* call = new (C) CallStaticJavaNode(call_type, call_addr, "uncommon_trap",
jvms->bci(), no_memory_effects);
CallStaticJavaNode* call = new CallStaticJavaNode(call_type, call_addr, "uncommon_trap",
jvms->bci(), no_memory_effects);
for (int e = 0; e < TypeFunc::Parms; e++) {
call->init_req(e, uct->in(e));
}
@ -1127,9 +1127,9 @@ Node* PhaseStringOpts::fetch_static_field(GraphKit& kit, ciField* field) {
}
Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {
RegionNode *final_merge = new (C) RegionNode(3);
RegionNode *final_merge = new RegionNode(3);
kit.gvn().set_type(final_merge, Type::CONTROL);
Node* final_size = new (C) PhiNode(final_merge, TypeInt::INT);
Node* final_size = new PhiNode(final_merge, TypeInt::INT);
kit.gvn().set_type(final_size, TypeInt::INT);
IfNode* iff = kit.create_and_map_if(kit.control(),
@ -1146,11 +1146,11 @@ Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {
} else {
// int size = (i < 0) ? stringSize(-i) + 1 : stringSize(i);
RegionNode *r = new (C) RegionNode(3);
RegionNode *r = new RegionNode(3);
kit.gvn().set_type(r, Type::CONTROL);
Node *phi = new (C) PhiNode(r, TypeInt::INT);
Node *phi = new PhiNode(r, TypeInt::INT);
kit.gvn().set_type(phi, TypeInt::INT);
Node *size = new (C) PhiNode(r, TypeInt::INT);
Node *size = new PhiNode(r, TypeInt::INT);
kit.gvn().set_type(size, TypeInt::INT);
Node* chk = __ CmpI(arg, __ intcon(0));
Node* p = __ Bool(chk, BoolTest::lt);
@ -1175,11 +1175,11 @@ Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {
// Add loop predicate first.
kit.add_predicate();
RegionNode *loop = new (C) RegionNode(3);
RegionNode *loop = new RegionNode(3);
loop->init_req(1, kit.control());
kit.gvn().set_type(loop, Type::CONTROL);
Node *index = new (C) PhiNode(loop, TypeInt::INT);
Node *index = new PhiNode(loop, TypeInt::INT);
index->init_req(1, __ intcon(0));
kit.gvn().set_type(index, TypeInt::INT);
kit.set_control(loop);
@ -1212,7 +1212,7 @@ Node* PhaseStringOpts::int_stringSize(GraphKit& kit, Node* arg) {
}
void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, Node* start, Node* end) {
RegionNode *final_merge = new (C) RegionNode(4);
RegionNode *final_merge = new RegionNode(4);
kit.gvn().set_type(final_merge, Type::CONTROL);
Node *final_mem = PhiNode::make(final_merge, kit.memory(char_adr_idx), Type::MEMORY, TypeAryPtr::CHARS);
kit.gvn().set_type(final_mem, Type::MEMORY);
@ -1262,11 +1262,11 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N
__ Bool(__ CmpI(arg, __ intcon(0)), BoolTest::lt),
PROB_FAIR, COUNT_UNKNOWN);
RegionNode *merge = new (C) RegionNode(3);
RegionNode *merge = new RegionNode(3);
kit.gvn().set_type(merge, Type::CONTROL);
i = new (C) PhiNode(merge, TypeInt::INT);
i = new PhiNode(merge, TypeInt::INT);
kit.gvn().set_type(i, TypeInt::INT);
sign = new (C) PhiNode(merge, TypeInt::INT);
sign = new PhiNode(merge, TypeInt::INT);
kit.gvn().set_type(sign, TypeInt::INT);
merge->init_req(1, __ IfTrue(iff));
@ -1295,10 +1295,10 @@ void PhaseStringOpts::int_getChars(GraphKit& kit, Node* arg, Node* char_array, N
// Add loop predicate first.
kit.add_predicate();
RegionNode *head = new (C) RegionNode(3);
RegionNode *head = new RegionNode(3);
head->init_req(1, kit.control());
kit.gvn().set_type(head, Type::CONTROL);
Node *i_phi = new (C) PhiNode(head, TypeInt::INT);
Node *i_phi = new PhiNode(head, TypeInt::INT);
i_phi->init_req(1, i);
kit.gvn().set_type(i_phi, TypeInt::INT);
charPos = PhiNode::make(head, charPos);
@ -1420,7 +1420,7 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
// as a shim for the insertion of the new code.
JVMState* jvms = sc->begin()->jvms()->clone_shallow(C);
uint size = sc->begin()->req();
SafePointNode* map = new (C) SafePointNode(size, jvms);
SafePointNode* map = new SafePointNode(size, jvms);
// copy the control and memory state from the final call into our
// new starting state. This allows any preceeding tests to feed
@ -1465,12 +1465,12 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
// Create a region for the overflow checks to merge into.
int args = MAX2(sc->num_arguments(), 1);
RegionNode* overflow = new (C) RegionNode(args);
RegionNode* overflow = new RegionNode(args);
kit.gvn().set_type(overflow, Type::CONTROL);
// Create a hook node to hold onto the individual sizes since they
// are need for the copying phase.
Node* string_sizes = new (C) Node(args);
Node* string_sizes = new Node(args);
Node* length = __ intcon(0);
for (int argi = 0; argi < sc->num_arguments(); argi++) {
@ -1514,9 +1514,9 @@ void PhaseStringOpts::replace_string_concat(StringConcat* sc) {
} else if (!type->higher_equal(TypeInstPtr::NOTNULL)) {
// s = s != null ? s : "null";
// length = length + (s.count - s.offset);
RegionNode *r = new (C) RegionNode(3);
RegionNode *r = new RegionNode(3);
kit.gvn().set_type(r, Type::CONTROL);
Node *phi = new (C) PhiNode(r, type);
Node *phi = new PhiNode(r, type);
kit.gvn().set_type(phi, phi->bottom_type());
Node* p = __ Bool(__ CmpP(arg, kit.null()), BoolTest::ne);
IfNode* iff = kit.create_and_map_if(kit.control(), p, PROB_MIN, COUNT_UNKNOWN);