Mercurial > hg > truffle
diff src/share/vm/opto/compile.cpp @ 14909:4ca6dc0799b6
Backout jdk9 merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 01 Apr 2014 13:57:07 +0200 |
parents | fdad2932c73f |
children | 52b4284cb496 |
line wrap: on
line diff
--- a/src/share/vm/opto/compile.cpp Tue Apr 01 14:09:03 2014 +0200 +++ b/src/share/vm/opto/compile.cpp Tue Apr 01 13:57:07 2014 +0200 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "asm/macroAssembler.inline.hpp" -#include "ci/ciReplay.hpp" #include "classfile/systemDictionary.hpp" #include "code/exceptionHandlerTable.hpp" #include "code/nmethod.hpp" @@ -82,11 +81,8 @@ #ifdef TARGET_ARCH_MODEL_arm # include "adfiles/ad_arm.hpp" #endif -#ifdef TARGET_ARCH_MODEL_ppc_32 -# include "adfiles/ad_ppc_32.hpp" -#endif -#ifdef TARGET_ARCH_MODEL_ppc_64 -# include "adfiles/ad_ppc_64.hpp" +#ifdef TARGET_ARCH_MODEL_ppc +# include "adfiles/ad_ppc.hpp" #endif @@ -648,11 +644,9 @@ _dead_node_count(0), #ifndef PRODUCT _trace_opto_output(TraceOptoOutput || method()->has_option("TraceOptoOutput")), - _in_dump_cnt(0), _printer(IdealGraphPrinter::printer()), #endif _congraph(NULL), - _replay_inline_data(NULL), _late_inlines(comp_arena(), 2, 0, NULL), _string_late_inlines(comp_arena(), 2, 0, NULL), _boxing_late_inlines(comp_arena(), 2, 0, NULL), @@ -686,10 +680,6 @@ } set_print_assembly(print_opto_assembly); set_parsed_irreducible_loop(false); - - if (method()->has_option("ReplayInline")) { - _replay_inline_data = ciReplay::load_inline_data(method(), entry_bci(), ci_env->comp_level()); - } #endif set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); @@ -705,7 +695,10 @@ print_compile_messages(); - _ilt = InlineTree::build_inline_tree_root(); + if (UseOldInlining || PrintCompilation NOT_PRODUCT( || PrintOpto) ) + _ilt = InlineTree::build_inline_tree_root(); + else + _ilt = NULL; // Even if NO memory addresses are used, MergeMem nodes must have at least 1 slice assert(num_alias_types() >= AliasIdxRaw, ""); @@ -856,15 +849,6 @@ #endif NOT_PRODUCT( verify_barriers(); ) - - // Dump compilation data to replay it. - if (method()->has_option("DumpReplay")) { - env()->dump_replay_data(_compile_id); - } - if (method()->has_option("DumpInline") && (ilt() != NULL)) { - env()->dump_inline_data(_compile_id); - } - // Now that we know the size of all the monitors we can add a fixed slot // for the original deopt pc. @@ -872,10 +856,6 @@ int next_slot = _orig_pc_slot + (sizeof(address) / VMRegImpl::stack_slot_size); set_fixed_slots(next_slot); - // Compute when to use implicit null checks. Used by matching trap based - // nodes and NullCheck optimization. - set_allowed_deopt_reasons(); - // Now generate code Code_Gen(); if (failing()) return; @@ -953,20 +933,17 @@ _inner_loops(0), #ifndef PRODUCT _trace_opto_output(TraceOptoOutput), - _in_dump_cnt(0), _printer(NULL), #endif _dead_node_list(comp_arena()), _dead_node_count(0), _congraph(NULL), - _replay_inline_data(NULL), _number_of_mh_late_inlines(0), _inlining_progress(false), _inlining_incrementally(false), _print_inlining_list(NULL), _print_inlining_idx(0), - _preserve_jvm_state(0), - _allowed_reasons(0) { + _preserve_jvm_state(0) { C = this; #ifndef PRODUCT @@ -2271,12 +2248,6 @@ peep.do_transform(); } - // Do late expand if CPU requires this. - if (Matcher::require_postalloc_expand) { - NOT_PRODUCT(TracePhase t2c("postalloc_expand", &_t_postalloc_expand, true)); - cfg.postalloc_expand(_regalloc); - } - // Convert Nodes to instruction bits in a buffer { // %%%% workspace merge brought two timers together for one job @@ -3028,6 +2999,42 @@ n->set_req(MemBarNode::Precedent, top()); } break; + // Must set a control edge on all nodes that produce a FlagsProj + // so they can't escape the block that consumes the flags. + // Must also set the non throwing branch as the control + // for all nodes that depends on the result. Unless the node + // already have a control that isn't the control of the + // flag producer + case Op_FlagsProj: + { + MathExactNode* math = (MathExactNode*) n->in(0); + Node* ctrl = math->control_node(); + Node* non_throwing = math->non_throwing_branch(); + math->set_req(0, ctrl); + + Node* result = math->result_node(); + if (result != NULL) { + for (DUIterator_Fast jmax, j = result->fast_outs(jmax); j < jmax; j++) { + Node* out = result->fast_out(j); + // Phi nodes shouldn't be moved. They would only match below if they + // had the same control as the MathExactNode. The only time that + // would happen is if the Phi is also an input to the MathExact + // + // Cmp nodes shouldn't have control set at all. + if (out->is_Phi() || + out->is_Cmp()) { + continue; + } + + if (out->in(0) == NULL) { + out->set_req(0, non_throwing); + } else if (out->in(0) == ctrl) { + out->set_req(0, non_throwing); + } + } + } + } + break; default: assert( !n->is_Call(), "" ); assert( !n->is_Mem(), "" ); @@ -3249,8 +3256,7 @@ // because of a transient condition during start-up in the interpreter. return false; } - ciMethod* m = Deoptimization::reason_is_speculate(reason) ? this->method() : NULL; - if (md->has_trap_at(bci, m, reason) != 0) { + if (md->has_trap_at(bci, reason) != 0) { // Assume PerBytecodeTrapLimit==0, for a more conservative heuristic. // Also, if there are multiple reasons, or if there is no per-BCI record, // assume the worst. @@ -3268,7 +3274,7 @@ // Less-accurate variant which does not require a method and bci. bool Compile::too_many_traps(Deoptimization::DeoptReason reason, ciMethodData* logmd) { - if (trap_count(reason) >= Deoptimization::per_method_trap_limit(reason)) { + if (trap_count(reason) >= (uint)PerMethodTrapLimit) { // Too many traps globally. // Note that we use cumulative trap_count, not just md->trap_count. if (log()) { @@ -3303,11 +3309,10 @@ uint m_cutoff = (uint) PerMethodRecompilationCutoff / 2 + 1; // not zero Deoptimization::DeoptReason per_bc_reason = Deoptimization::reason_recorded_per_bytecode_if_any(reason); - ciMethod* m = Deoptimization::reason_is_speculate(reason) ? this->method() : NULL; if ((per_bc_reason == Deoptimization::Reason_none - || md->has_trap_at(bci, m, reason) != 0) + || md->has_trap_at(bci, reason) != 0) // The trap frequency measure we care about is the recompile count: - && md->trap_recompiled_at(bci, m) + && md->trap_recompiled_at(bci) && md->overflow_recompile_count() >= bc_cutoff) { // Do not emit a trap here if it has already caused recompilations. // Also, if there are multiple reasons, or if there is no per-BCI record, @@ -3334,19 +3339,6 @@ } } -// Compute when not to trap. Used by matching trap based nodes and -// NullCheck optimization. -void Compile::set_allowed_deopt_reasons() { - _allowed_reasons = 0; - if (is_method_compilation()) { - for (int rs = (int)Deoptimization::Reason_none+1; rs < Compile::trapHistLength; rs++) { - assert(rs < BitsPerInt, "recode bit map"); - if (!too_many_traps((Deoptimization::DeoptReason) rs)) { - _allowed_reasons |= nth_bit(rs); - } - } - } -} #ifndef PRODUCT //------------------------------verify_graph_edges--------------------------- @@ -3765,16 +3757,6 @@ } } -// Dump inlining replay data to the stream. -// Don't change thread state and acquire any locks. -void Compile::dump_inline_data(outputStream* out) { - InlineTree* inl_tree = ilt(); - if (inl_tree != NULL) { - out->print(" inline %d", inl_tree->count()); - inl_tree->dump_replay_data(out); - } -} - int Compile::cmp_expensive_nodes(Node* n1, Node* n2) { if (n1->Opcode() < n2->Opcode()) return -1; else if (n1->Opcode() > n2->Opcode()) return 1; @@ -3911,18 +3893,16 @@ // which may optimize it out. for (uint next = 0; next < worklist.size(); ++next) { Node *n = worklist.at(next); - if (n->is_Type()) { + if (n->is_Type() && n->as_Type()->type()->isa_oopptr() != NULL && + n->as_Type()->type()->is_oopptr()->speculative() != NULL) { TypeNode* tn = n->as_Type(); - const Type* t = tn->type(); - const Type* t_no_spec = t->remove_speculative(); - if (t_no_spec != t) { - bool in_hash = igvn.hash_delete(n); - assert(in_hash, "node should be in igvn hash table"); - tn->set_type(t_no_spec); - igvn.hash_insert(n); - igvn._worklist.push(n); // give it a chance to go away - modified++; - } + const TypeOopPtr* t = tn->type()->is_oopptr(); + bool in_hash = igvn.hash_delete(n); + assert(in_hash, "node should be in igvn hash table"); + tn->set_type(t->remove_speculative()); + igvn.hash_insert(n); + igvn._worklist.push(n); // give it a chance to go away + modified++; } uint max = n->len(); for( uint i = 0; i < max; ++i ) { @@ -3936,27 +3916,6 @@ if (modified > 0) { igvn.optimize(); } -#ifdef ASSERT - // Verify that after the IGVN is over no speculative type has resurfaced - worklist.clear(); - worklist.push(root()); - for (uint next = 0; next < worklist.size(); ++next) { - Node *n = worklist.at(next); - const Type* t = igvn.type(n); - assert(t == t->remove_speculative(), "no more speculative types"); - if (n->is_Type()) { - t = n->as_Type()->type(); - assert(t == t->remove_speculative(), "no more speculative types"); - } - uint max = n->len(); - for( uint i = 0; i < max; ++i ) { - Node *m = n->in(i); - if (not_a_node(m)) continue; - worklist.push(m); - } - } - igvn.check_no_speculative_types(); -#endif } }