src/share/vm/opto/compile.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/compile.cpp Thu Jul 23 09:33:24 2009
--- new/src/share/vm/opto/compile.cpp Thu Jul 23 09:33:23 2009
*** 439,448 ****
--- 439,450 ----
_code_buffer("Compile::Fill_buffer"),
_orig_pc_slot(0),
_orig_pc_slot_offset_in_bytes(0),
_node_bundling_limit(0),
_node_bundling_base(NULL),
+ _java_calls(0),
+ _inner_loops(0),
#ifndef PRODUCT
_trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")),
_printer(IdealGraphPrinter::printer()),
#endif
_congraph(NULL) {
*** 709,718 ****
--- 711,722 ----
_do_escape_analysis(false),
_failure_reason(NULL),
_code_buffer("Compile::Fill_buffer"),
_node_bundling_limit(0),
_node_bundling_base(NULL),
+ _java_calls(0),
+ _inner_loops(0),
#ifndef PRODUCT
_trace_opto_output(TraceOptoOutput),
_printer(NULL),
#endif
_congraph(NULL) {
*** 1849,1874 ****
--- 1853,1882 ----
struct Final_Reshape_Counts : public StackObj {
int _call_count; // count non-inlined 'common' calls
int _float_count; // count float ops requiring 24-bit precision
int _double_count; // count double ops requiring more precision
int _java_call_count; // count non-inlined 'java' calls
+ int _inner_loop_count; // count loops which need alignment
VectorSet _visited; // Visitation flags
Node_List _tests; // Set of IfNodes & PCTableNodes
Final_Reshape_Counts() :
- _call_count(0), _float_count(0), _double_count(0), _java_call_count(0),
+ _java_call_count(0), _inner_loop_count(0),
_visited( Thread::current()->resource_area() ) { }
void inc_call_count () { _call_count ++; }
void inc_float_count () { _float_count ++; }
void inc_double_count() { _double_count++; }
void inc_java_call_count() { _java_call_count++; }
+ void inc_inner_loop_count() { _inner_loop_count++; }
int get_call_count () const { return _call_count ; }
int get_float_count () const { return _float_count ; }
int get_double_count() const { return _double_count; }
int get_java_call_count() const { return _java_call_count; }
+ int get_inner_loop_count() const { return _inner_loop_count; }
};
static bool oop_offset_is_sane(const TypeInstPtr* tp) {
ciInstanceKlass *k = tp->klass()->as_instance_klass();
// Make sure the offset goes inside the instance layout.
*** 1876,1886 ****
--- 1884,1894 ----
// Note that OffsetBot and OffsetTop are very negative.
}
//------------------------------final_graph_reshaping_impl----------------------
// Implement items 1-5 from final_graph_reshaping below.
! static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &fpu ) {
! static void final_graph_reshaping_impl( Node *n, Final_Reshape_Counts &frc ) {
if ( n->outcnt() == 0 ) return; // dead node
uint nop = n->Opcode();
// Check for 2-input instruction with "last use" on right input.
*** 1918,1934 ****
--- 1926,1942 ----
case Op_ConvI2F:
case Op_ConF:
case Op_CmpF:
case Op_CmpF3:
// case Op_ConvL2F: // longs are split into 32-bit halves
! fpu.inc_float_count();
! frc.inc_float_count();
break;
case Op_ConvF2D:
case Op_ConvD2F:
! fpu.inc_float_count();
! fpu.inc_double_count();
! frc.inc_float_count();
! frc.inc_double_count();
break;
// Count all double operations that may use FPU
case Op_AddD:
case Op_SubD:
*** 1941,1960 ****
--- 1949,1968 ----
// case Op_ConvL2D: // handled by leaf call
// case Op_ConvD2L: // handled by leaf call
case Op_ConD:
case Op_CmpD:
case Op_CmpD3:
! fpu.inc_double_count();
! frc.inc_double_count();
break;
case Op_Opaque1: // Remove Opaque Nodes before matching
case Op_Opaque2: // Remove Opaque Nodes before matching
n->subsume_by(n->in(1));
break;
case Op_CallStaticJava:
case Op_CallJava:
case Op_CallDynamicJava:
! fpu.inc_java_call_count(); // Count java call site;
! frc.inc_java_call_count(); // Count java call site;
case Op_CallRuntime:
case Op_CallLeaf:
case Op_CallLeafNoFP: {
assert( n->is_Call(), "" );
CallNode *call = n->as_Call();
*** 1961,1971 ****
--- 1969,1979 ----
// Count call sites where the FP mode bit would have to be flipped.
// Do not count uncommon runtime calls:
// uncommon_trap, _complete_monitor_locking, _complete_monitor_unlocking,
// _new_Java, _new_typeArray, _new_objArray, _rethrow_Java, ...
if( !call->is_CallStaticJava() || !call->as_CallStaticJava()->_name ) {
! fpu.inc_call_count(); // Count the call site
! frc.inc_call_count(); // Count the call site
} else { // See if uncommon argument is shared
Node *n = call->in(TypeFunc::Parms);
int nop = n->Opcode();
// Clone shared simple arguments to uncommon calls, item (1).
if( n->outcnt() > 1 &&
*** 1982,1996 ****
--- 1990,2004 ----
}
case Op_StoreD:
case Op_LoadD:
case Op_LoadD_unaligned:
! fpu.inc_double_count();
! frc.inc_double_count();
goto handle_mem;
case Op_StoreF:
case Op_LoadF:
! fpu.inc_float_count();
! frc.inc_float_count();
goto handle_mem;
case Op_StoreB:
case Op_StoreC:
case Op_StoreCM:
*** 2323,2370 ****
--- 2331,2384 ----
PackNode* p = (PackNode*) n;
Node* btp = p->binaryTreePack(Compile::current(), 1, n->req());
n->subsume_by(btp);
}
break;
+ case Op_Loop:
+ case Op_CountedLoop:
+ if (n->as_Loop()->is_inner_loop()) {
+ frc.inc_inner_loop_count();
+ }
+ break;
default:
assert( !n->is_Call(), "" );
assert( !n->is_Mem(), "" );
break;
}
// Collect CFG split points
if (n->is_MultiBranch())
! fpu._tests.push(n);
! frc._tests.push(n);
}
//------------------------------final_graph_reshaping_walk---------------------
// Replacing Opaque nodes with their input in final_graph_reshaping_impl(),
// requires that the walk visits a node's inputs before visiting the node.
! static void final_graph_reshaping_walk( Node_Stack &nstack, Node *root, Final_Reshape_Counts &fpu ) {
! static void final_graph_reshaping_walk( Node_Stack &nstack, Node *root, Final_Reshape_Counts &frc ) {
ResourceArea *area = Thread::current()->resource_area();
Unique_Node_List sfpt(area);
! fpu._visited.set(root->_idx); // first, mark node as visited
! frc._visited.set(root->_idx); // first, mark node as visited
uint cnt = root->req();
Node *n = root;
uint i = 0;
while (true) {
if (i < cnt) {
// Place all non-visited non-null inputs onto stack
Node* m = n->in(i);
++i;
! if (m != NULL && !fpu._visited.test_set(m->_idx)) {
! if (m != NULL && !frc._visited.test_set(m->_idx)) {
if (m->is_SafePoint() && m->as_SafePoint()->jvms() != NULL)
sfpt.push(m);
cnt = m->req();
nstack.push(n, i); // put on stack parent and next input's index
n = m;
i = 0;
}
} else {
// Now do post-visit work
! final_graph_reshaping_impl( n, fpu );
! final_graph_reshaping_impl( n, frc );
if (nstack.is_empty())
break; // finished
n = nstack.node(); // Get node from stack
cnt = n->req();
i = nstack.index();
*** 2441,2460 ****
--- 2455,2474 ----
if (root()->req() == 1) {
record_method_not_compilable("trivial infinite loop");
return true;
}
! Final_Reshape_Counts fpu;
! Final_Reshape_Counts frc;
// Visit everybody reachable!
// Allocate stack of size C->unique()/2 to avoid frequent realloc
Node_Stack nstack(unique() >> 1);
! final_graph_reshaping_walk(nstack, root(), fpu);
! final_graph_reshaping_walk(nstack, root(), frc);
// Check for unreachable (from below) code (i.e., infinite loops).
! for( uint i = 0; i < fpu._tests.size(); i++ ) {
! MultiBranchNode *n = fpu._tests[i]->as_MultiBranch();
! for( uint i = 0; i < frc._tests.size(); i++ ) {
! MultiBranchNode *n = frc._tests[i]->as_MultiBranch();
// Get number of CFG targets.
// Note that PCTables include exception targets after calls.
uint required_outcnt = n->required_outcnt();
if (n->outcnt() != required_outcnt) {
// Check for a few special cases. Rethrow Nodes never take the
*** 2496,2521 ****
--- 2510,2536 ----
}
}
// Check that I actually visited all kids. Unreached kids
// must be infinite loops.
for (DUIterator_Fast jmax, j = n->fast_outs(jmax); j < jmax; j++)
! if (!fpu._visited.test(n->fast_out(j)->_idx)) {
! if (!frc._visited.test(n->fast_out(j)->_idx)) {
record_method_not_compilable("infinite loop");
return true; // Found unvisited kid; must be unreach
}
}
// If original bytecodes contained a mixture of floats and doubles
// check if the optimizer has made it homogenous, item (3).
if( Use24BitFPMode && Use24BitFP &&
! fpu.get_float_count() > 32 &&
! fpu.get_double_count() == 0 &&
! (10 * fpu.get_call_count() < fpu.get_float_count()) ) {
! frc.get_float_count() > 32 &&
! frc.get_double_count() == 0 &&
! (10 * frc.get_call_count() < frc.get_float_count()) ) {
set_24_bit_selection_and_mode( false, true );
}
! set_has_java_calls(fpu.get_java_call_count() > 0);
! set_java_calls(frc.get_java_call_count());
+ set_inner_loops(frc.get_inner_loop_count());
// No infinite loops, no reason to bail out.
return false;
}
src/share/vm/opto/compile.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File