comparison src/share/vm/opto/compile.cpp @ 17810:62c54fcc0a35

Merge
author kvn
date Tue, 25 Mar 2014 17:07:36 -0700
parents 752ba2e5f6d0 606acabe7b5c
children 31e28ee4c9b4
comparison
equal deleted inserted replaced
17809:a433eb716ce1 17810:62c54fcc0a35
692 } 692 }
693 #endif 693 #endif
694 set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining)); 694 set_print_inlining(PrintInlining || method()->has_option("PrintInlining") NOT_PRODUCT( || PrintOptoInlining));
695 set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics")); 695 set_print_intrinsics(PrintIntrinsics || method()->has_option("PrintIntrinsics"));
696 696
697 if (ProfileTraps) { 697 if (ProfileTraps RTM_OPT_ONLY( || UseRTMLocking )) {
698 // Make sure the method being compiled gets its own MDO, 698 // Make sure the method being compiled gets its own MDO,
699 // so we can at least track the decompile_count(). 699 // so we can at least track the decompile_count().
700 // Need MDO to record RTM code generation state.
700 method()->ensure_method_data(); 701 method()->ensure_method_data();
701 } 702 }
702 703
703 Init(::AliasLevel); 704 Init(::AliasLevel);
704 705
905 frame_size_in_words(), _oop_map_set, 906 frame_size_in_words(), _oop_map_set,
906 &_handler_table, &_inc_table, 907 &_handler_table, &_inc_table,
907 compiler, 908 compiler,
908 env()->comp_level(), 909 env()->comp_level(),
909 has_unsafe_access(), 910 has_unsafe_access(),
910 SharedRuntime::is_wide_vector(max_vector_size()) 911 SharedRuntime::is_wide_vector(max_vector_size()),
912 rtm_state()
911 ); 913 );
912 914
913 if (log() != NULL) // Print code cache state into compiler log 915 if (log() != NULL) // Print code cache state into compiler log
914 log()->code_cache_state(); 916 log()->code_cache_state();
915 } 917 }
1071 set_max_inline_size(MaxInlineSize); 1073 set_max_inline_size(MaxInlineSize);
1072 set_freq_inline_size(FreqInlineSize); 1074 set_freq_inline_size(FreqInlineSize);
1073 set_do_scheduling(OptoScheduling); 1075 set_do_scheduling(OptoScheduling);
1074 set_do_count_invocations(false); 1076 set_do_count_invocations(false);
1075 set_do_method_data_update(false); 1077 set_do_method_data_update(false);
1076 1078 set_rtm_state(NoRTM); // No RTM lock eliding by default
1079 #if INCLUDE_RTM_OPT
1080 if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) {
1081 int rtm_state = method()->method_data()->rtm_state();
1082 if (method_has_option("NoRTMLockEliding") || ((rtm_state & NoRTM) != 0)) {
1083 // Don't generate RTM lock eliding code.
1084 set_rtm_state(NoRTM);
1085 } else if (method_has_option("UseRTMLockEliding") || ((rtm_state & UseRTM) != 0) || !UseRTMDeopt) {
1086 // Generate RTM lock eliding code without abort ratio calculation code.
1087 set_rtm_state(UseRTM);
1088 } else if (UseRTMDeopt) {
1089 // Generate RTM lock eliding code and include abort ratio calculation
1090 // code if UseRTMDeopt is on.
1091 set_rtm_state(ProfileRTM);
1092 }
1093 }
1094 #endif
1077 if (debug_info()->recording_non_safepoints()) { 1095 if (debug_info()->recording_non_safepoints()) {
1078 set_node_note_array(new(comp_arena()) GrowableArray<Node_Notes*> 1096 set_node_note_array(new(comp_arena()) GrowableArray<Node_Notes*>
1079 (comp_arena(), 8, 0, NULL)); 1097 (comp_arena(), 8, 0, NULL));
1080 set_default_node_notes(Node_Notes::make(this)); 1098 set_default_node_notes(Node_Notes::make(this));
1081 } 1099 }
2579 case Op_CmpD3: 2597 case Op_CmpD3:
2580 frc.inc_double_count(); 2598 frc.inc_double_count();
2581 break; 2599 break;
2582 case Op_Opaque1: // Remove Opaque Nodes before matching 2600 case Op_Opaque1: // Remove Opaque Nodes before matching
2583 case Op_Opaque2: // Remove Opaque Nodes before matching 2601 case Op_Opaque2: // Remove Opaque Nodes before matching
2602 case Op_Opaque3:
2584 n->subsume_by(n->in(1), this); 2603 n->subsume_by(n->in(1), this);
2585 break; 2604 break;
2586 case Op_CallStaticJava: 2605 case Op_CallStaticJava:
2587 case Op_CallJava: 2606 case Op_CallJava:
2588 case Op_CallDynamicJava: 2607 case Op_CallDynamicJava:
3026 // confuses register allocation. 3045 // confuses register allocation.
3027 if (n->req() > MemBarNode::Precedent) { 3046 if (n->req() > MemBarNode::Precedent) {
3028 n->set_req(MemBarNode::Precedent, top()); 3047 n->set_req(MemBarNode::Precedent, top());
3029 } 3048 }
3030 break; 3049 break;
3031 // Must set a control edge on all nodes that produce a FlagsProj
3032 // so they can't escape the block that consumes the flags.
3033 // Must also set the non throwing branch as the control
3034 // for all nodes that depends on the result. Unless the node
3035 // already have a control that isn't the control of the
3036 // flag producer
3037 case Op_FlagsProj:
3038 {
3039 MathExactNode* math = (MathExactNode*) n->in(0);
3040 Node* ctrl = math->control_node();
3041 Node* non_throwing = math->non_throwing_branch();
3042 math->set_req(0, ctrl);
3043
3044 Node* result = math->result_node();
3045 if (result != NULL) {
3046 for (DUIterator_Fast jmax, j = result->fast_outs(jmax); j < jmax; j++) {
3047 Node* out = result->fast_out(j);
3048 // Phi nodes shouldn't be moved. They would only match below if they
3049 // had the same control as the MathExactNode. The only time that
3050 // would happen is if the Phi is also an input to the MathExact
3051 //
3052 // Cmp nodes shouldn't have control set at all.
3053 if (out->is_Phi() ||
3054 out->is_Cmp()) {
3055 continue;
3056 }
3057
3058 if (out->in(0) == NULL) {
3059 out->set_req(0, non_throwing);
3060 } else if (out->in(0) == ctrl) {
3061 out->set_req(0, non_throwing);
3062 }
3063 }
3064 }
3065 }
3066 break;
3067 default: 3050 default:
3068 assert( !n->is_Call(), "" ); 3051 assert( !n->is_Call(), "" );
3069 assert( !n->is_Mem(), "" ); 3052 assert( !n->is_Mem(), "" );
3070 break; 3053 break;
3071 } 3054 }
3283 if (md->is_empty()) { 3266 if (md->is_empty()) {
3284 // Assume the trap has not occurred, or that it occurred only 3267 // Assume the trap has not occurred, or that it occurred only
3285 // because of a transient condition during start-up in the interpreter. 3268 // because of a transient condition during start-up in the interpreter.
3286 return false; 3269 return false;
3287 } 3270 }
3288 if (md->has_trap_at(bci, reason) != 0) { 3271 ciMethod* m = Deoptimization::reason_is_speculate(reason) ? this->method() : NULL;
3272 if (md->has_trap_at(bci, m, reason) != 0) {
3289 // Assume PerBytecodeTrapLimit==0, for a more conservative heuristic. 3273 // Assume PerBytecodeTrapLimit==0, for a more conservative heuristic.
3290 // Also, if there are multiple reasons, or if there is no per-BCI record, 3274 // Also, if there are multiple reasons, or if there is no per-BCI record,
3291 // assume the worst. 3275 // assume the worst.
3292 if (log()) 3276 if (log())
3293 log()->elem("observe trap='%s' count='%d'", 3277 log()->elem("observe trap='%s' count='%d'",
3301 } 3285 }
3302 3286
3303 // Less-accurate variant which does not require a method and bci. 3287 // Less-accurate variant which does not require a method and bci.
3304 bool Compile::too_many_traps(Deoptimization::DeoptReason reason, 3288 bool Compile::too_many_traps(Deoptimization::DeoptReason reason,
3305 ciMethodData* logmd) { 3289 ciMethodData* logmd) {
3306 if (trap_count(reason) >= (uint)PerMethodTrapLimit) { 3290 if (trap_count(reason) >= Deoptimization::per_method_trap_limit(reason)) {
3307 // Too many traps globally. 3291 // Too many traps globally.
3308 // Note that we use cumulative trap_count, not just md->trap_count. 3292 // Note that we use cumulative trap_count, not just md->trap_count.
3309 if (log()) { 3293 if (log()) {
3310 int mcount = (logmd == NULL)? -1: (int)logmd->trap_count(reason); 3294 int mcount = (logmd == NULL)? -1: (int)logmd->trap_count(reason);
3311 log()->elem("observe trap='%s' count='0' mcount='%d' ccount='%d'", 3295 log()->elem("observe trap='%s' count='0' mcount='%d' ccount='%d'",
3336 // Pick a cutoff point well within PerBytecodeRecompilationCutoff. 3320 // Pick a cutoff point well within PerBytecodeRecompilationCutoff.
3337 uint bc_cutoff = (uint) PerBytecodeRecompilationCutoff / 8; 3321 uint bc_cutoff = (uint) PerBytecodeRecompilationCutoff / 8;
3338 uint m_cutoff = (uint) PerMethodRecompilationCutoff / 2 + 1; // not zero 3322 uint m_cutoff = (uint) PerMethodRecompilationCutoff / 2 + 1; // not zero
3339 Deoptimization::DeoptReason per_bc_reason 3323 Deoptimization::DeoptReason per_bc_reason
3340 = Deoptimization::reason_recorded_per_bytecode_if_any(reason); 3324 = Deoptimization::reason_recorded_per_bytecode_if_any(reason);
3325 ciMethod* m = Deoptimization::reason_is_speculate(reason) ? this->method() : NULL;
3341 if ((per_bc_reason == Deoptimization::Reason_none 3326 if ((per_bc_reason == Deoptimization::Reason_none
3342 || md->has_trap_at(bci, reason) != 0) 3327 || md->has_trap_at(bci, m, reason) != 0)
3343 // The trap frequency measure we care about is the recompile count: 3328 // The trap frequency measure we care about is the recompile count:
3344 && md->trap_recompiled_at(bci) 3329 && md->trap_recompiled_at(bci, m)
3345 && md->overflow_recompile_count() >= bc_cutoff) { 3330 && md->overflow_recompile_count() >= bc_cutoff) {
3346 // Do not emit a trap here if it has already caused recompilations. 3331 // Do not emit a trap here if it has already caused recompilations.
3347 // Also, if there are multiple reasons, or if there is no per-BCI record, 3332 // Also, if there are multiple reasons, or if there is no per-BCI record,
3348 // assume the worst. 3333 // assume the worst.
3349 if (log()) 3334 if (log())