< prev index next >

src/share/vm/opto/valuetypenode.cpp

Print this page
rev 10493 : keep
rev 10496 : more
rev 10497 : embedded vt
rev 10498 : C2: add SafePointScalarObjectNodes from ValueTypeNodes to SafePointNodes without an allocation + propagate materialized value type in the graph

*** 23,32 **** --- 23,33 ---- */ #include "ci/ciValueKlass.hpp" #include "opto/addnode.hpp" #include "opto/graphKit.hpp" + #include "opto/rootnode.hpp" #include "opto/valuetypenode.hpp" #include "opto/phaseX.hpp" Node* ValueTypeNode::make(PhaseGVN& gvn, ciValueKlass* klass) { // Create a new ValueTypeNode with uninitialized values and NULL oop
*** 103,113 **** kit->record_for_igvn(region); kit->record_for_igvn(oop); kit->record_for_igvn(io); kit->record_for_igvn(mem); ! return kit->gvn().transform(oop); } Node* ValueTypeNode::get_field_value(uint index) const { assert(index < field_count(), "index out of bounds"); return in(Values + index); --- 104,118 ---- kit->record_for_igvn(region); kit->record_for_igvn(oop); kit->record_for_igvn(io); kit->record_for_igvn(mem); ! Node* res_oop = kit->gvn().transform(oop); ! ValueTypeNode* vt = clone()->as_ValueType(); ! vt->set_oop(res_oop); ! kit->replace_in_map(this, kit->gvn().transform(vt)); ! return res_oop; } Node* ValueTypeNode::get_field_value(uint index) const { assert(index < field_count(), "index out of bounds"); return in(Values + index);
*** 131,140 **** --- 136,192 ---- BasicType ValueTypeNode::get_field_type(uint index) const { assert(index < field_count(), "index out of bounds"); return get_value_klass()->get_field_type_by_index(index); } + void ValueTypeNode::make_scalar_in_safepoints(Compile* C) { + const TypeValueTypePtr* res_type = TypeValueTypePtr::make(bottom_type()->isa_valuetype(), TypePtr::NotNull); + uint nfields = field_count(); + for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) { + Node* u = fast_out(i); + if (u->is_SafePoint() && (!u->is_Call() || u->as_Call()->has_debug_use(this))) { + Node* in_oop = get_oop(); + const Type* oop_type = in_oop->bottom_type(); + SafePointNode* sfpt = u->as_SafePoint(); + JVMState* jvms = sfpt->jvms(); + int start = jvms->debug_start(); + int end = jvms->debug_end(); + if (oop_type->meet(TypePtr::NULL_PTR) != oop_type) { + int nb = sfpt->replace_edges_in_range(this, in_oop, start, end); + --i; imax -= nb; + } else { + assert(jvms != NULL, "missing JVMS"); + uint first_ind = (sfpt->req() - jvms->scloff()); + SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type, + #ifdef ASSERT + NULL, + #endif + first_ind, nfields); + sobj->init_req(0, C->root()); + // fields must be added to the safepoint in order of increasing offset + int min = 0; + for (uint j = 0; j < nfields; j++) { + int off = INT_MAX; + uint next = 0; + for (uint k = 0; k < nfields; k++) { + int offset = get_field_offset(k); + if (offset > min && offset < off) { + off = offset; + next = k; + } + } + min = get_field_offset(next); + sfpt->add_req(in(Values + next)); + } + jvms->set_endoff(sfpt->req()); + int nb = sfpt->replace_edges_in_range(this, sobj, start, end); + --i; imax -= nb; + } + } + } + } + Node* ValueTypeNode::Ideal(PhaseGVN* phase, bool can_reshape) { // No optimizations for now return NULL; }
< prev index next >