Wed, 04 May 2011 13:12:42 -0700
5091921: Sign flip issues in loop optimizer
Summary: Fix integer overflow problem in the code generated by loop optimizer.
Reviewed-by: never
1.1 --- a/src/cpu/x86/vm/x86_32.ad Wed May 04 03:42:58 2011 -0700 1.2 +++ b/src/cpu/x86/vm/x86_32.ad Wed May 04 13:12:42 2011 -0700 1.3 @@ -12989,6 +12989,53 @@ 1.4 %} 1.5 1.6 // ============================================================================ 1.7 +// Counted Loop limit node which represents exact final iterator value. 1.8 +// Note: the resulting value should fit into integer range since 1.9 +// counted loops have limit check on overflow. 1.10 +instruct loopLimit_eReg(eAXRegI limit, nadxRegI init, immI stride, eDXRegI limit_hi, nadxRegI tmp, eFlagsReg flags) %{ 1.11 + match(Set limit (LoopLimit (Binary init limit) stride)); 1.12 + effect(TEMP limit_hi, TEMP tmp, KILL flags); 1.13 + ins_cost(300); 1.14 + 1.15 + format %{ "loopLimit $init,$limit,$stride # $limit = $init + $stride *( $limit - $init + $stride -1)/ $stride, kills $limit_hi" %} 1.16 + ins_encode %{ 1.17 + int strd = (int)$stride$$constant; 1.18 + assert(strd != 1 && strd != -1, "sanity"); 1.19 + int m1 = (strd > 0) ? 1 : -1; 1.20 + // Convert limit to long (EAX:EDX) 1.21 + __ cdql(); 1.22 + // Convert init to long (init:tmp) 1.23 + __ movl($tmp$$Register, $init$$Register); 1.24 + __ sarl($tmp$$Register, 31); 1.25 + // $limit - $init 1.26 + __ subl($limit$$Register, $init$$Register); 1.27 + __ sbbl($limit_hi$$Register, $tmp$$Register); 1.28 + // + ($stride - 1) 1.29 + if (strd > 0) { 1.30 + __ addl($limit$$Register, (strd - 1)); 1.31 + __ adcl($limit_hi$$Register, 0); 1.32 + __ movl($tmp$$Register, strd); 1.33 + } else { 1.34 + __ addl($limit$$Register, (strd + 1)); 1.35 + __ adcl($limit_hi$$Register, -1); 1.36 + __ lneg($limit_hi$$Register, $limit$$Register); 1.37 + __ movl($tmp$$Register, -strd); 1.38 + } 1.39 + // signed devision: (EAX:EDX) / pos_stride 1.40 + __ idivl($tmp$$Register); 1.41 + if (strd < 0) { 1.42 + // restore sign 1.43 + __ negl($tmp$$Register); 1.44 + } 1.45 + // (EAX) * stride 1.46 + __ mull($tmp$$Register); 1.47 + // + init (ignore upper bits) 1.48 + __ addl($limit$$Register, $init$$Register); 1.49 + %} 1.50 + ins_pipe( pipe_slow ); 1.51 +%} 1.52 + 1.53 +// ============================================================================ 1.54 // Branch Instructions 1.55 // Jump Table 1.56 instruct jumpXtnd(eRegI switch_val) %{
2.1 --- a/src/share/vm/oops/methodDataOop.hpp Wed May 04 03:42:58 2011 -0700 2.2 +++ b/src/share/vm/oops/methodDataOop.hpp Wed May 04 13:12:42 2011 -0700 2.3 @@ -1194,7 +1194,7 @@ 2.4 // Whole-method sticky bits and flags 2.5 public: 2.6 enum { 2.7 - _trap_hist_limit = 16, // decoupled from Deoptimization::Reason_LIMIT 2.8 + _trap_hist_limit = 17, // decoupled from Deoptimization::Reason_LIMIT 2.9 _trap_hist_mask = max_jubyte, 2.10 _extra_data_count = 4 // extra DataLayout headers, for trap history 2.11 }; // Public flag values
3.1 --- a/src/share/vm/opto/bytecodeInfo.cpp Wed May 04 03:42:58 2011 -0700 3.2 +++ b/src/share/vm/opto/bytecodeInfo.cpp Wed May 04 13:12:42 2011 -0700 3.3 @@ -373,7 +373,6 @@ 3.4 return true; 3.5 } 3.6 3.7 -#ifndef PRODUCT 3.8 //------------------------------print_inlining--------------------------------- 3.9 // Really, the failure_msg can be a success message also. 3.10 void InlineTree::print_inlining(ciMethod* callee_method, int caller_bci, const char* failure_msg) const { 3.11 @@ -385,7 +384,6 @@ 3.12 tty->print(" bcs: %d+%d invoked: %d", top->count_inline_bcs(), callee_method->code_size(), callee_method->interpreter_invocation_count()); 3.13 } 3.14 } 3.15 -#endif 3.16 3.17 //------------------------------ok_to_inline----------------------------------- 3.18 WarmCallInfo* InlineTree::ok_to_inline(ciMethod* callee_method, JVMState* jvms, ciCallProfile& profile, WarmCallInfo* initial_wci) {
4.1 --- a/src/share/vm/opto/c2_globals.hpp Wed May 04 03:42:58 2011 -0700 4.2 +++ b/src/share/vm/opto/c2_globals.hpp Wed May 04 13:12:42 2011 -0700 4.3 @@ -183,6 +183,21 @@ 4.4 develop(bool, TraceLoopOpts, false, \ 4.5 "Trace executed loop optimizations") \ 4.6 \ 4.7 + diagnostic(bool, LoopLimitCheck, true, \ 4.8 + "Generate a loop limits check for overflow") \ 4.9 + \ 4.10 + develop(bool, TraceLoopLimitCheck, false, \ 4.11 + "Trace generation of loop limits checks") \ 4.12 + \ 4.13 + diagnostic(bool, RangeLimitCheck, true, \ 4.14 + "Additional overflow checks during range check elimination") \ 4.15 + \ 4.16 + develop(bool, TraceRangeLimitCheck, false, \ 4.17 + "Trace additional overflow checks in RCE") \ 4.18 + \ 4.19 + diagnostic(bool, UnrollLimitCheck, true, \ 4.20 + "Additional overflow checks during loop unroll") \ 4.21 + \ 4.22 product(bool, OptimizeFill, false, \ 4.23 "convert fill/copy loops into intrinsic") \ 4.24 \
5.1 --- a/src/share/vm/opto/cfgnode.cpp Wed May 04 03:42:58 2011 -0700 5.2 +++ b/src/share/vm/opto/cfgnode.cpp Wed May 04 13:12:42 2011 -0700 5.3 @@ -1373,7 +1373,7 @@ 5.4 5.5 // Clone loop predicates 5.6 if (predicate_proj != NULL) { 5.7 - newn = igvn->clone_loop_predicates(predicate_proj, newn); 5.8 + newn = igvn->clone_loop_predicates(predicate_proj, newn, !n->is_CountedLoop()); 5.9 } 5.10 5.11 // Now I can point to the new node.
6.1 --- a/src/share/vm/opto/classes.hpp Wed May 04 03:42:58 2011 -0700 6.2 +++ b/src/share/vm/opto/classes.hpp Wed May 04 13:12:42 2011 -0700 6.3 @@ -156,6 +156,7 @@ 6.4 macro(LogD) 6.5 macro(Log10D) 6.6 macro(Loop) 6.7 +macro(LoopLimit) 6.8 macro(Mach) 6.9 macro(MachProj) 6.10 macro(MaxI)
7.1 --- a/src/share/vm/opto/graphKit.cpp Wed May 04 03:42:58 2011 -0700 7.2 +++ b/src/share/vm/opto/graphKit.cpp Wed May 04 13:12:42 2011 -0700 7.3 @@ -3378,6 +3378,10 @@ 7.4 if (UseLoopPredicate) { 7.5 add_predicate_impl(Deoptimization::Reason_predicate, nargs); 7.6 } 7.7 + // loop's limit check predicate should be near the loop. 7.8 + if (LoopLimitCheck) { 7.9 + add_predicate_impl(Deoptimization::Reason_loop_limit_check, nargs); 7.10 + } 7.11 } 7.12 7.13 //----------------------------- store barriers ----------------------------
8.1 --- a/src/share/vm/opto/ifnode.cpp Wed May 04 03:42:58 2011 -0700 8.2 +++ b/src/share/vm/opto/ifnode.cpp Wed May 04 13:12:42 2011 -0700 8.3 @@ -236,6 +236,7 @@ 8.4 } 8.5 Node* predicate_c = NULL; 8.6 Node* predicate_x = NULL; 8.7 + bool counted_loop = r->is_CountedLoop(); 8.8 8.9 Node *region_c = new (igvn->C, req_c + 1) RegionNode(req_c + 1); 8.10 Node *phi_c = con1; 8.11 @@ -294,16 +295,16 @@ 8.12 if (predicate_c != NULL) { 8.13 assert(predicate_x == NULL, "only one predicate entry expected"); 8.14 // Clone loop predicates to each path 8.15 - iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t); 8.16 - iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f); 8.17 + iff_c_t = igvn->clone_loop_predicates(predicate_c, iff_c_t, !counted_loop); 8.18 + iff_c_f = igvn->clone_loop_predicates(predicate_c, iff_c_f, !counted_loop); 8.19 } 8.20 Node *iff_x_t = phase->transform(new (igvn->C, 1) IfTrueNode (iff_x)); 8.21 Node *iff_x_f = phase->transform(new (igvn->C, 1) IfFalseNode(iff_x)); 8.22 if (predicate_x != NULL) { 8.23 assert(predicate_c == NULL, "only one predicate entry expected"); 8.24 // Clone loop predicates to each path 8.25 - iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t); 8.26 - iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f); 8.27 + iff_x_t = igvn->clone_loop_predicates(predicate_x, iff_x_t, !counted_loop); 8.28 + iff_x_f = igvn->clone_loop_predicates(predicate_x, iff_x_f, !counted_loop); 8.29 } 8.30 8.31 // Merge the TRUE paths
9.1 --- a/src/share/vm/opto/loopPredicate.cpp Wed May 04 03:42:58 2011 -0700 9.2 +++ b/src/share/vm/opto/loopPredicate.cpp Wed May 04 13:12:42 2011 -0700 9.3 @@ -341,7 +341,7 @@ 9.4 // Cut predicate from old place. 9.5 Node* old = predicate_proj; 9.6 igvn->_worklist.push(old); 9.7 - for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin; ) { 9.8 + for (DUIterator_Last imin, i = old->last_outs(imin); i >= imin;) { 9.9 Node* use = old->last_out(i); // for each use... 9.10 igvn->hash_delete(use); 9.11 igvn->_worklist.push(use); 9.12 @@ -384,24 +384,25 @@ 9.13 9.14 //--------------------------clone_loop_predicates----------------------- 9.15 // Interface from IGVN 9.16 -Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry) { 9.17 - return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, NULL, this); 9.18 +Node* PhaseIterGVN::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 9.19 + return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, NULL, this); 9.20 } 9.21 -Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry) { 9.22 - return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, NULL, this); 9.23 +Node* PhaseIterGVN::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 9.24 + return PhaseIdealLoop::clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, NULL, this); 9.25 } 9.26 9.27 // Interface from PhaseIdealLoop 9.28 -Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry) { 9.29 - return clone_loop_predicates(old_entry, new_entry, false, this, &this->_igvn); 9.30 +Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 9.31 + return clone_loop_predicates(old_entry, new_entry, false, clone_limit_check, this, &this->_igvn); 9.32 } 9.33 -Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry) { 9.34 - return clone_loop_predicates(old_entry, new_entry, true, this, &this->_igvn); 9.35 +Node* PhaseIdealLoop::move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check) { 9.36 + return clone_loop_predicates(old_entry, new_entry, true, clone_limit_check, this, &this->_igvn); 9.37 } 9.38 9.39 // Clone loop predicates to cloned loops (peeled, unswitched, split_if). 9.40 Node* PhaseIdealLoop::clone_loop_predicates(Node* old_entry, Node* new_entry, 9.41 bool move_predicates, 9.42 + bool clone_limit_check, 9.43 PhaseIdealLoop* loop_phase, 9.44 PhaseIterGVN* igvn) { 9.45 #ifdef ASSERT 9.46 @@ -413,10 +414,16 @@ 9.47 #endif 9.48 // Search original predicates 9.49 Node* entry = old_entry; 9.50 + ProjNode* limit_check_proj = NULL; 9.51 + if (LoopLimitCheck) { 9.52 + limit_check_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 9.53 + if (limit_check_proj != NULL) { 9.54 + entry = entry->in(0)->in(0); 9.55 + } 9.56 + } 9.57 if (UseLoopPredicate) { 9.58 ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 9.59 if (predicate_proj != NULL) { // right pattern that can be used by loop predication 9.60 - assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 9.61 if (move_predicates) { 9.62 new_entry = move_predicate(predicate_proj, new_entry, 9.63 Deoptimization::Reason_predicate, 9.64 @@ -435,11 +442,37 @@ 9.65 } 9.66 } 9.67 } 9.68 + if (limit_check_proj != NULL && clone_limit_check) { 9.69 + // Clone loop limit check last to insert it before loop. 9.70 + // Don't clone a limit check which was already finalized 9.71 + // for this counted loop (only one limit check is needed). 9.72 + if (move_predicates) { 9.73 + new_entry = move_predicate(limit_check_proj, new_entry, 9.74 + Deoptimization::Reason_loop_limit_check, 9.75 + loop_phase, igvn); 9.76 + assert(new_entry == limit_check_proj, "old limit check fall through projection"); 9.77 + } else { 9.78 + new_entry = clone_predicate(limit_check_proj, new_entry, 9.79 + Deoptimization::Reason_loop_limit_check, 9.80 + loop_phase, igvn); 9.81 + assert(new_entry != NULL && new_entry->is_Proj(), "IfTrue or IfFalse after clone limit check"); 9.82 + } 9.83 + if (TraceLoopLimitCheck) { 9.84 + tty->print_cr("Loop Limit Check %s: ", move_predicates ? "moved" : "cloned"); 9.85 + debug_only( new_entry->in(0)->dump(); ) 9.86 + } 9.87 + } 9.88 return new_entry; 9.89 } 9.90 9.91 //--------------------------eliminate_loop_predicates----------------------- 9.92 void PhaseIdealLoop::eliminate_loop_predicates(Node* entry) { 9.93 + if (LoopLimitCheck) { 9.94 + Node* predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 9.95 + if (predicate != NULL) { 9.96 + entry = entry->in(0)->in(0); 9.97 + } 9.98 + } 9.99 if (UseLoopPredicate) { 9.100 ProjNode* predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 9.101 if (predicate_proj != NULL) { // right pattern that can be used by loop predication 9.102 @@ -456,10 +489,15 @@ 9.103 // Skip related predicates. 9.104 Node* PhaseIdealLoop::skip_loop_predicates(Node* entry) { 9.105 Node* predicate = NULL; 9.106 + if (LoopLimitCheck) { 9.107 + predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 9.108 + if (predicate != NULL) { 9.109 + entry = entry->in(0)->in(0); 9.110 + } 9.111 + } 9.112 if (UseLoopPredicate) { 9.113 predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 9.114 if (predicate != NULL) { // right pattern that can be used by loop predication 9.115 - assert(entry->is_Proj() && entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 9.116 IfNode* iff = entry->in(0)->as_If(); 9.117 ProjNode* uncommon_proj = iff->proj_out(1 - entry->as_Proj()->_con); 9.118 Node* rgn = uncommon_proj->unique_ctrl_out(); 9.119 @@ -491,10 +529,15 @@ 9.120 // Find a predicate 9.121 Node* PhaseIdealLoop::find_predicate(Node* entry) { 9.122 Node* predicate = NULL; 9.123 + if (LoopLimitCheck) { 9.124 + predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 9.125 + if (predicate != NULL) { // right pattern that can be used by loop predication 9.126 + return entry; 9.127 + } 9.128 + } 9.129 if (UseLoopPredicate) { 9.130 predicate = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 9.131 if (predicate != NULL) { // right pattern that can be used by loop predication 9.132 - assert(entry->in(0)->in(1)->in(1)->Opcode()==Op_Opaque1, "must be"); 9.133 return entry; 9.134 } 9.135 } 9.136 @@ -658,7 +701,7 @@ 9.137 Node* range = cmp->in(2); 9.138 if (range->Opcode() != Op_LoadRange) { 9.139 const TypeInt* tint = phase->_igvn.type(range)->isa_int(); 9.140 - if (!OptimizeFill || tint == NULL || tint->empty() || tint->_lo < 0) { 9.141 + if (tint == NULL || tint->empty() || tint->_lo < 0) { 9.142 // Allow predication on positive values that aren't LoadRanges. 9.143 // This allows optimization of loops where the length of the 9.144 // array is a known value and doesn't need to be loaded back 9.145 @@ -696,7 +739,7 @@ 9.146 // max(scale*i + offset) = scale*(limit-stride) + offset 9.147 // (2) stride*scale < 0 9.148 // max(scale*i + offset) = scale*init + offset 9.149 -BoolNode* PhaseIdealLoop::rc_predicate(Node* ctrl, 9.150 +BoolNode* PhaseIdealLoop::rc_predicate(IdealLoopTree *loop, Node* ctrl, 9.151 int scale, Node* offset, 9.152 Node* init, Node* limit, Node* stride, 9.153 Node* range, bool upper) { 9.154 @@ -709,9 +752,19 @@ 9.155 Node* max_idx_expr = init; 9.156 int stride_con = stride->get_int(); 9.157 if ((stride_con > 0) == (scale > 0) == upper) { 9.158 - max_idx_expr = new (C, 3) SubINode(limit, stride); 9.159 - register_new_node(max_idx_expr, ctrl); 9.160 - if (TraceLoopPredicate) predString->print("(limit - stride) "); 9.161 + if (LoopLimitCheck) { 9.162 + // With LoopLimitCheck limit is not exact. 9.163 + // Calculate exact limit here. 9.164 + // Note, counted loop's test is '<' or '>'. 9.165 + limit = exact_limit(loop); 9.166 + max_idx_expr = new (C, 3) SubINode(limit, stride); 9.167 + register_new_node(max_idx_expr, ctrl); 9.168 + if (TraceLoopPredicate) predString->print("(limit - stride) "); 9.169 + } else { 9.170 + max_idx_expr = new (C, 3) SubINode(limit, stride); 9.171 + register_new_node(max_idx_expr, ctrl); 9.172 + if (TraceLoopPredicate) predString->print("(limit - stride) "); 9.173 + } 9.174 } else { 9.175 if (TraceLoopPredicate) predString->print("init "); 9.176 } 9.177 @@ -752,29 +805,36 @@ 9.178 // Could be a simple region when irreducible loops are present. 9.179 return false; 9.180 } 9.181 + LoopNode* head = loop->_head->as_Loop(); 9.182 9.183 - if (loop->_head->unique_ctrl_out()->Opcode() == Op_NeverBranch) { 9.184 + if (head->unique_ctrl_out()->Opcode() == Op_NeverBranch) { 9.185 // do nothing for infinite loops 9.186 return false; 9.187 } 9.188 9.189 CountedLoopNode *cl = NULL; 9.190 - if (loop->_head->is_CountedLoop()) { 9.191 - cl = loop->_head->as_CountedLoop(); 9.192 + if (head->is_CountedLoop()) { 9.193 + cl = head->as_CountedLoop(); 9.194 // do nothing for iteration-splitted loops 9.195 if (!cl->is_normal_loop()) return false; 9.196 } 9.197 9.198 - LoopNode *lpn = loop->_head->as_Loop(); 9.199 - Node* entry = lpn->in(LoopNode::EntryControl); 9.200 + Node* entry = head->in(LoopNode::EntryControl); 9.201 + ProjNode *predicate_proj = NULL; 9.202 + // Loop limit check predicate should be near the loop. 9.203 + if (LoopLimitCheck) { 9.204 + predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 9.205 + if (predicate_proj != NULL) 9.206 + entry = predicate_proj->in(0)->in(0); 9.207 + } 9.208 9.209 - ProjNode *predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 9.210 + predicate_proj = find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 9.211 if (!predicate_proj) { 9.212 #ifndef PRODUCT 9.213 if (TraceLoopPredicate) { 9.214 tty->print("missing predicate:"); 9.215 loop->dump_head(); 9.216 - lpn->dump(1); 9.217 + head->dump(1); 9.218 } 9.219 #endif 9.220 return false; 9.221 @@ -788,7 +848,6 @@ 9.222 // Create list of if-projs such that a newer proj dominates all older 9.223 // projs in the list, and they all dominate loop->tail() 9.224 Node_List if_proj_list(area); 9.225 - LoopNode *head = loop->_head->as_Loop(); 9.226 Node *current_proj = loop->tail(); //start from tail 9.227 while (current_proj != head) { 9.228 if (loop == get_loop(current_proj) && // still in the loop ? 9.229 @@ -862,8 +921,8 @@ 9.230 const Node* cmp = bol->in(1)->as_Cmp(); 9.231 Node* idx = cmp->in(1); 9.232 assert(!invar.is_invariant(idx), "index is variant"); 9.233 - assert(cmp->in(2)->Opcode() == Op_LoadRange || OptimizeFill, "must be"); 9.234 Node* rng = cmp->in(2); 9.235 + assert(rng->Opcode() == Op_LoadRange || _igvn.type(rng)->is_int() >= 0, "must be"); 9.236 assert(invar.is_invariant(rng), "range must be invariant"); 9.237 int scale = 1; 9.238 Node* offset = zero; 9.239 @@ -892,14 +951,14 @@ 9.240 } 9.241 9.242 // Test the lower bound 9.243 - Node* lower_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, false); 9.244 + Node* lower_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, false); 9.245 IfNode* lower_bound_iff = lower_bound_proj->in(0)->as_If(); 9.246 _igvn.hash_delete(lower_bound_iff); 9.247 lower_bound_iff->set_req(1, lower_bound_bol); 9.248 if (TraceLoopPredicate) tty->print_cr("lower bound check if: %d", lower_bound_iff->_idx); 9.249 9.250 // Test the upper bound 9.251 - Node* upper_bound_bol = rc_predicate(ctrl, scale, offset, init, limit, stride, rng, true); 9.252 + Node* upper_bound_bol = rc_predicate(loop, ctrl, scale, offset, init, limit, stride, rng, true); 9.253 IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If(); 9.254 _igvn.hash_delete(upper_bound_iff); 9.255 upper_bound_iff->set_req(1, upper_bound_bol);
10.1 --- a/src/share/vm/opto/loopTransform.cpp Wed May 04 03:42:58 2011 -0700 10.2 +++ b/src/share/vm/opto/loopTransform.cpp Wed May 04 13:12:42 2011 -0700 10.3 @@ -83,7 +83,7 @@ 10.4 #ifdef ASSERT 10.5 BoolTest::mask bt = cl->loopexit()->test_trip(); 10.6 assert(bt == BoolTest::lt || bt == BoolTest::gt || 10.7 - bt == BoolTest::ne, "canonical test is expected"); 10.8 + (bt == BoolTest::ne && !LoopLimitCheck), "canonical test is expected"); 10.9 #endif 10.10 10.11 Node* init_n = cl->init_trip(); 10.12 @@ -510,7 +510,7 @@ 10.13 // the pre-loop with only 1 user (the new peeled iteration), but the 10.14 // peeled-loop backedge has 2 users. 10.15 Node* new_exit_value = old_new[head->in(LoopNode::LoopBackControl)->_idx]; 10.16 - new_exit_value = move_loop_predicates(entry, new_exit_value); 10.17 + new_exit_value = move_loop_predicates(entry, new_exit_value, !counted_loop); 10.18 _igvn.hash_delete(head); 10.19 head->set_req(LoopNode::EntryControl, new_exit_value); 10.20 for (DUIterator_Fast jmax, j = head->fast_outs(jmax); j < jmax; j++) { 10.21 @@ -593,6 +593,12 @@ 10.22 return false; 10.23 } 10.24 10.25 + // Fully unroll a loop with few iterations regardless next 10.26 + // conditions since following loop optimizations will split 10.27 + // such loop anyway (pre-main-post). 10.28 + if (trip_count <= 3) 10.29 + return true; 10.30 + 10.31 // Take into account that after unroll conjoined heads and tails will fold, 10.32 // otherwise policy_unroll() may allow more unrolling than max unrolling. 10.33 uint new_body_size = EMPTY_LOOP_SIZE + (body_size - EMPTY_LOOP_SIZE) * trip_count; 10.34 @@ -605,15 +611,6 @@ 10.35 return false; 10.36 } 10.37 10.38 - // Currently we don't have policy to optimize one iteration loops. 10.39 - // Maximally unrolling transformation is used for that: 10.40 - // it is peeled and the original loop become non reachable (dead). 10.41 - // Also fully unroll a loop with few iterations regardless next 10.42 - // conditions since following loop optimizations will split 10.43 - // such loop anyway (pre-main-post). 10.44 - if (trip_count <= 3) 10.45 - return true; 10.46 - 10.47 // Do not unroll a loop with String intrinsics code. 10.48 // String intrinsics are large and have loops. 10.49 for (uint k = 0; k < _body.size(); k++) { 10.50 @@ -645,8 +642,9 @@ 10.51 if (!cl->is_valid_counted_loop()) 10.52 return false; // Malformed counted loop 10.53 10.54 - // protect against over-unrolling 10.55 - if (cl->trip_count() <= 1) return false; 10.56 + // Protect against over-unrolling. 10.57 + // After split at least one iteration will be executed in pre-loop. 10.58 + if (cl->trip_count() <= (uint)(cl->is_normal_loop() ? 2 : 1)) return false; 10.59 10.60 int future_unroll_ct = cl->unrolled_count() * 2; 10.61 if (future_unroll_ct > MAX_UNROLL) return false; 10.62 @@ -678,6 +676,7 @@ 10.63 10.64 Node *init_n = cl->init_trip(); 10.65 Node *limit_n = cl->limit(); 10.66 + int stride_con = cl->stride_con(); 10.67 // Non-constant bounds. 10.68 // Protect against over-unrolling when init or/and limit are not constant 10.69 // (so that trip_count's init value is maxint) but iv range is known. 10.70 @@ -687,7 +686,7 @@ 10.71 if (phi != NULL) { 10.72 assert(phi->is_Phi() && phi->in(0) == _head, "Counted loop should have iv phi."); 10.73 const TypeInt* iv_type = phase->_igvn.type(phi)->is_int(); 10.74 - int next_stride = cl->stride_con() * 2; // stride after this unroll 10.75 + int next_stride = stride_con * 2; // stride after this unroll 10.76 if (next_stride > 0) { 10.77 if (iv_type->_lo + next_stride <= iv_type->_lo || // overflow 10.78 iv_type->_lo + next_stride > iv_type->_hi) { 10.79 @@ -702,15 +701,19 @@ 10.80 } 10.81 } 10.82 10.83 + // After unroll limit will be adjusted: new_limit = limit-stride. 10.84 + // Bailout if adjustment overflow. 10.85 + const TypeInt* limit_type = phase->_igvn.type(limit_n)->is_int(); 10.86 + if (stride_con > 0 && ((limit_type->_hi - stride_con) >= limit_type->_hi) || 10.87 + stride_con < 0 && ((limit_type->_lo - stride_con) <= limit_type->_lo)) 10.88 + return false; // overflow 10.89 + 10.90 // Adjust body_size to determine if we unroll or not 10.91 uint body_size = _body.size(); 10.92 - // Key test to unroll CaffeineMark's Logic test 10.93 - int xors_in_loop = 0; 10.94 // Also count ModL, DivL and MulL which expand mightly 10.95 for (uint k = 0; k < _body.size(); k++) { 10.96 Node* n = _body.at(k); 10.97 switch (n->Opcode()) { 10.98 - case Op_XorI: xors_in_loop++; break; // CaffeineMark's Logic test 10.99 case Op_ModL: body_size += 30; break; 10.100 case Op_DivL: body_size += 30; break; 10.101 case Op_MulL: body_size += 10; break; 10.102 @@ -727,8 +730,7 @@ 10.103 10.104 // Check for being too big 10.105 if (body_size > (uint)LoopUnrollLimit) { 10.106 - if (xors_in_loop >= 4 && body_size < (uint)LoopUnrollLimit*4) return true; 10.107 - // Normal case: loop too big 10.108 + // Normal case: loop too big 10.109 return false; 10.110 } 10.111 10.112 @@ -750,28 +752,31 @@ 10.113 // Return TRUE or FALSE if the loop should be range-check-eliminated. 10.114 // Actually we do iteration-splitting, a more powerful form of RCE. 10.115 bool IdealLoopTree::policy_range_check( PhaseIdealLoop *phase ) const { 10.116 - if( !RangeCheckElimination ) return false; 10.117 + if (!RangeCheckElimination) return false; 10.118 10.119 CountedLoopNode *cl = _head->as_CountedLoop(); 10.120 // If we unrolled with no intention of doing RCE and we later 10.121 // changed our minds, we got no pre-loop. Either we need to 10.122 // make a new pre-loop, or we gotta disallow RCE. 10.123 - if( cl->is_main_no_pre_loop() ) return false; // Disallowed for now. 10.124 + if (cl->is_main_no_pre_loop()) return false; // Disallowed for now. 10.125 Node *trip_counter = cl->phi(); 10.126 10.127 // Check loop body for tests of trip-counter plus loop-invariant vs 10.128 // loop-invariant. 10.129 - for( uint i = 0; i < _body.size(); i++ ) { 10.130 + for (uint i = 0; i < _body.size(); i++) { 10.131 Node *iff = _body[i]; 10.132 - if( iff->Opcode() == Op_If ) { // Test? 10.133 + if (iff->Opcode() == Op_If) { // Test? 10.134 10.135 // Comparing trip+off vs limit 10.136 Node *bol = iff->in(1); 10.137 - if( bol->req() != 2 ) continue; // dead constant test 10.138 + if (bol->req() != 2) continue; // dead constant test 10.139 if (!bol->is_Bool()) { 10.140 assert(UseLoopPredicate && bol->Opcode() == Op_Conv2B, "predicate check only"); 10.141 continue; 10.142 } 10.143 + if (bol->as_Bool()->_test._test == BoolTest::ne) 10.144 + continue; // not RC 10.145 + 10.146 Node *cmp = bol->in(1); 10.147 10.148 Node *rc_exp = cmp->in(1); 10.149 @@ -1067,6 +1072,7 @@ 10.150 // negative stride use > 10.151 10.152 if (pre_end->in(CountedLoopEndNode::TestValue)->as_Bool()->_test._test == BoolTest::ne) { 10.153 + assert(!LoopLimitCheck, "only canonical tests (lt or gt) are expected"); 10.154 10.155 BoolTest::mask new_test = (main_end->stride_con() > 0) ? BoolTest::lt : BoolTest::gt; 10.156 // Modify pre loop end condition 10.157 @@ -1093,6 +1099,9 @@ 10.158 main_head->set_main_loop(); 10.159 if( peel_only ) main_head->set_main_no_pre_loop(); 10.160 10.161 + // Subtract a trip count for the pre-loop. 10.162 + main_head->set_trip_count(main_head->trip_count() - 1); 10.163 + 10.164 // It's difficult to be precise about the trip-counts 10.165 // for the pre/post loops. They are usually very short, 10.166 // so guess that 4 trips is a reasonable value. 10.167 @@ -1126,9 +1135,9 @@ 10.168 loop->dump_head(); 10.169 } else if (TraceLoopOpts) { 10.170 if (loop_head->trip_count() < (uint)LoopUnrollLimit) { 10.171 - tty->print("Unroll %d(%2d) ", loop_head->unrolled_count()*2, loop_head->trip_count()); 10.172 + tty->print("Unroll %d(%2d) ", loop_head->unrolled_count()*2, loop_head->trip_count()); 10.173 } else { 10.174 - tty->print("Unroll %d ", loop_head->unrolled_count()*2); 10.175 + tty->print("Unroll %d ", loop_head->unrolled_count()*2); 10.176 } 10.177 loop->dump_head(); 10.178 } 10.179 @@ -1144,7 +1153,8 @@ 10.180 Node *stride = loop_head->stride(); 10.181 10.182 Node *opaq = NULL; 10.183 - if( adjust_min_trip ) { // If not maximally unrolling, need adjustment 10.184 + if (adjust_min_trip) { // If not maximally unrolling, need adjustment 10.185 + // Search for zero-trip guard. 10.186 assert( loop_head->is_main_loop(), "" ); 10.187 assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" ); 10.188 Node *iff = ctrl->in(0); 10.189 @@ -1154,63 +1164,202 @@ 10.190 Node *cmp = bol->in(1); 10.191 assert( cmp->Opcode() == Op_CmpI, "" ); 10.192 opaq = cmp->in(2); 10.193 - // Occasionally it's possible for a pre-loop Opaque1 node to be 10.194 + // Occasionally it's possible for a zero-trip guard Opaque1 node to be 10.195 // optimized away and then another round of loop opts attempted. 10.196 // We can not optimize this particular loop in that case. 10.197 - if( opaq->Opcode() != Op_Opaque1 ) 10.198 - return; // Cannot find pre-loop! Bail out! 10.199 + if (opaq->Opcode() != Op_Opaque1) 10.200 + return; // Cannot find zero-trip guard! Bail out! 10.201 + // Zero-trip test uses an 'opaque' node which is not shared. 10.202 + assert(opaq->outcnt() == 1 && opaq->in(1) == limit, ""); 10.203 } 10.204 10.205 C->set_major_progress(); 10.206 10.207 - // Adjust max trip count. The trip count is intentionally rounded 10.208 - // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll, 10.209 - // the main, unrolled, part of the loop will never execute as it is protected 10.210 - // by the min-trip test. See bug 4834191 for a case where we over-unrolled 10.211 - // and later determined that part of the unrolled loop was dead. 10.212 - loop_head->set_trip_count(loop_head->trip_count() / 2); 10.213 + Node* new_limit = NULL; 10.214 + if (UnrollLimitCheck) { 10.215 + int stride_con = stride->get_int(); 10.216 + int stride_p = (stride_con > 0) ? stride_con : -stride_con; 10.217 + uint old_trip_count = loop_head->trip_count(); 10.218 + // Verify that unroll policy result is still valid. 10.219 + assert(old_trip_count > 1 && 10.220 + (!adjust_min_trip || stride_p <= (1<<3)*loop_head->unrolled_count()), "sanity"); 10.221 10.222 - // Double the count of original iterations in the unrolled loop body. 10.223 - loop_head->double_unrolled_count(); 10.224 + // Adjust loop limit to keep valid iterations number after unroll. 10.225 + // Use (limit - stride) instead of (((limit - init)/stride) & (-2))*stride 10.226 + // which may overflow. 10.227 + if (!adjust_min_trip) { 10.228 + assert(old_trip_count > 1 && (old_trip_count & 1) == 0, 10.229 + "odd trip count for maximally unroll"); 10.230 + // Don't need to adjust limit for maximally unroll since trip count is even. 10.231 + } else if (loop_head->has_exact_trip_count() && init->is_Con()) { 10.232 + // Loop's limit is constant. Loop's init could be constant when pre-loop 10.233 + // become peeled iteration. 10.234 + long init_con = init->get_int(); 10.235 + // We can keep old loop limit if iterations count stays the same: 10.236 + // old_trip_count == new_trip_count * 2 10.237 + // Note: since old_trip_count >= 2 then new_trip_count >= 1 10.238 + // so we also don't need to adjust zero trip test. 10.239 + long limit_con = limit->get_int(); 10.240 + // (stride_con*2) not overflow since stride_con <= 8. 10.241 + int new_stride_con = stride_con * 2; 10.242 + int stride_m = new_stride_con - (stride_con > 0 ? 1 : -1); 10.243 + long trip_count = (limit_con - init_con + stride_m)/new_stride_con; 10.244 + // New trip count should satisfy next conditions. 10.245 + assert(trip_count > 0 && (julong)trip_count < (julong)max_juint/2, "sanity"); 10.246 + uint new_trip_count = (uint)trip_count; 10.247 + adjust_min_trip = (old_trip_count != new_trip_count*2); 10.248 + } 10.249 10.250 - // ----------- 10.251 - // Step 2: Cut back the trip counter for an unroll amount of 2. 10.252 - // Loop will normally trip (limit - init)/stride_con. Since it's a 10.253 - // CountedLoop this is exact (stride divides limit-init exactly). 10.254 - // We are going to double the loop body, so we want to knock off any 10.255 - // odd iteration: (trip_cnt & ~1). Then back compute a new limit. 10.256 - Node *span = new (C, 3) SubINode( limit, init ); 10.257 - register_new_node( span, ctrl ); 10.258 - Node *trip = new (C, 3) DivINode( 0, span, stride ); 10.259 - register_new_node( trip, ctrl ); 10.260 - Node *mtwo = _igvn.intcon(-2); 10.261 - set_ctrl(mtwo, C->root()); 10.262 - Node *rond = new (C, 3) AndINode( trip, mtwo ); 10.263 - register_new_node( rond, ctrl ); 10.264 - Node *spn2 = new (C, 3) MulINode( rond, stride ); 10.265 - register_new_node( spn2, ctrl ); 10.266 - Node *lim2 = new (C, 3) AddINode( spn2, init ); 10.267 - register_new_node( lim2, ctrl ); 10.268 + if (adjust_min_trip) { 10.269 + // Step 2: Adjust the trip limit if it is called for. 10.270 + // The adjustment amount is -stride. Need to make sure if the 10.271 + // adjustment underflows or overflows, then the main loop is skipped. 10.272 + Node* cmp = loop_end->cmp_node(); 10.273 + assert(cmp->in(2) == limit, "sanity"); 10.274 + assert(opaq != NULL && opaq->in(1) == limit, "sanity"); 10.275 10.276 - // Hammer in the new limit 10.277 - Node *ctrl2 = loop_end->in(0); 10.278 - Node *cmp2 = new (C, 3) CmpINode( loop_head->incr(), lim2 ); 10.279 - register_new_node( cmp2, ctrl2 ); 10.280 - Node *bol2 = new (C, 2) BoolNode( cmp2, loop_end->test_trip() ); 10.281 - register_new_node( bol2, ctrl2 ); 10.282 - _igvn.hash_delete(loop_end); 10.283 - loop_end->set_req(CountedLoopEndNode::TestValue, bol2); 10.284 + // Verify that policy_unroll result is still valid. 10.285 + const TypeInt* limit_type = _igvn.type(limit)->is_int(); 10.286 + assert(stride_con > 0 && ((limit_type->_hi - stride_con) < limit_type->_hi) || 10.287 + stride_con < 0 && ((limit_type->_lo - stride_con) > limit_type->_lo), "sanity"); 10.288 10.289 - // Step 3: Find the min-trip test guaranteed before a 'main' loop. 10.290 - // Make it a 1-trip test (means at least 2 trips). 10.291 - if( adjust_min_trip ) { 10.292 - // Guard test uses an 'opaque' node which is not shared. Hence I 10.293 - // can edit it's inputs directly. Hammer in the new limit for the 10.294 - // minimum-trip guard. 10.295 - assert( opaq->outcnt() == 1, "" ); 10.296 - _igvn.hash_delete(opaq); 10.297 - opaq->set_req(1, lim2); 10.298 - } 10.299 + if (limit->is_Con()) { 10.300 + // The check in policy_unroll and the assert above guarantee 10.301 + // no underflow if limit is constant. 10.302 + new_limit = _igvn.intcon(limit->get_int() - stride_con); 10.303 + set_ctrl(new_limit, C->root()); 10.304 + } else { 10.305 + if (stride_con > 0 && ((limit_type->_lo - stride_con) < limit_type->_lo) || 10.306 + stride_con < 0 && ((limit_type->_hi - stride_con) > limit_type->_hi)) { 10.307 + // No underflow. 10.308 + new_limit = new (C, 3) SubINode(limit, stride); 10.309 + } else { 10.310 + // (limit - stride) may underflow. 10.311 + // Clamp the adjustment value with MININT or MAXINT: 10.312 + // 10.313 + // new_limit = limit-stride 10.314 + // if (stride > 0) 10.315 + // new_limit = (limit < new_limit) ? MININT : new_limit; 10.316 + // else 10.317 + // new_limit = (limit > new_limit) ? MAXINT : new_limit; 10.318 + // 10.319 + BoolTest::mask bt = loop_end->test_trip(); 10.320 + assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected"); 10.321 + Node* adj_max = _igvn.intcon((stride_con > 0) ? min_jint : max_jint); 10.322 + set_ctrl(adj_max, C->root()); 10.323 + Node* old_limit = NULL; 10.324 + Node* adj_limit = NULL; 10.325 + Node* bol = limit->is_CMove() ? limit->in(CMoveNode::Condition) : NULL; 10.326 + if (loop_head->unrolled_count() > 1 && 10.327 + limit->is_CMove() && limit->Opcode() == Op_CMoveI && 10.328 + limit->in(CMoveNode::IfTrue) == adj_max && 10.329 + bol->as_Bool()->_test._test == bt && 10.330 + bol->in(1)->Opcode() == Op_CmpI && 10.331 + bol->in(1)->in(2) == limit->in(CMoveNode::IfFalse)) { 10.332 + // Loop was unrolled before. 10.333 + // Optimize the limit to avoid nested CMove: 10.334 + // use original limit as old limit. 10.335 + old_limit = bol->in(1)->in(1); 10.336 + // Adjust previous adjusted limit. 10.337 + adj_limit = limit->in(CMoveNode::IfFalse); 10.338 + adj_limit = new (C, 3) SubINode(adj_limit, stride); 10.339 + } else { 10.340 + old_limit = limit; 10.341 + adj_limit = new (C, 3) SubINode(limit, stride); 10.342 + } 10.343 + assert(old_limit != NULL && adj_limit != NULL, ""); 10.344 + register_new_node( adj_limit, ctrl ); // adjust amount 10.345 + Node* adj_cmp = new (C, 3) CmpINode(old_limit, adj_limit); 10.346 + register_new_node( adj_cmp, ctrl ); 10.347 + Node* adj_bool = new (C, 2) BoolNode(adj_cmp, bt); 10.348 + register_new_node( adj_bool, ctrl ); 10.349 + new_limit = new (C, 4) CMoveINode(adj_bool, adj_limit, adj_max, TypeInt::INT); 10.350 + } 10.351 + register_new_node(new_limit, ctrl); 10.352 + } 10.353 + assert(new_limit != NULL, ""); 10.354 + if (limit->outcnt() == 2) { 10.355 + // Replace old limit if it is used only in loop tests. 10.356 + _igvn.replace_node(limit, new_limit); 10.357 + } else { 10.358 + // Replace in loop test. 10.359 + _igvn.hash_delete(cmp); 10.360 + cmp->set_req(2, new_limit); 10.361 + 10.362 + // Step 3: Find the min-trip test guaranteed before a 'main' loop. 10.363 + // Make it a 1-trip test (means at least 2 trips). 10.364 + 10.365 + // Guard test uses an 'opaque' node which is not shared. Hence I 10.366 + // can edit it's inputs directly. Hammer in the new limit for the 10.367 + // minimum-trip guard. 10.368 + assert(opaq->outcnt() == 1, ""); 10.369 + _igvn.hash_delete(opaq); 10.370 + opaq->set_req(1, new_limit); 10.371 + } 10.372 + } 10.373 + 10.374 + // Adjust max trip count. The trip count is intentionally rounded 10.375 + // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll, 10.376 + // the main, unrolled, part of the loop will never execute as it is protected 10.377 + // by the min-trip test. See bug 4834191 for a case where we over-unrolled 10.378 + // and later determined that part of the unrolled loop was dead. 10.379 + loop_head->set_trip_count(old_trip_count / 2); 10.380 + 10.381 + // Double the count of original iterations in the unrolled loop body. 10.382 + loop_head->double_unrolled_count(); 10.383 + 10.384 + } else { // LoopLimitCheck 10.385 + 10.386 + // Adjust max trip count. The trip count is intentionally rounded 10.387 + // down here (e.g. 15-> 7-> 3-> 1) because if we unwittingly over-unroll, 10.388 + // the main, unrolled, part of the loop will never execute as it is protected 10.389 + // by the min-trip test. See bug 4834191 for a case where we over-unrolled 10.390 + // and later determined that part of the unrolled loop was dead. 10.391 + loop_head->set_trip_count(loop_head->trip_count() / 2); 10.392 + 10.393 + // Double the count of original iterations in the unrolled loop body. 10.394 + loop_head->double_unrolled_count(); 10.395 + 10.396 + // ----------- 10.397 + // Step 2: Cut back the trip counter for an unroll amount of 2. 10.398 + // Loop will normally trip (limit - init)/stride_con. Since it's a 10.399 + // CountedLoop this is exact (stride divides limit-init exactly). 10.400 + // We are going to double the loop body, so we want to knock off any 10.401 + // odd iteration: (trip_cnt & ~1). Then back compute a new limit. 10.402 + Node *span = new (C, 3) SubINode( limit, init ); 10.403 + register_new_node( span, ctrl ); 10.404 + Node *trip = new (C, 3) DivINode( 0, span, stride ); 10.405 + register_new_node( trip, ctrl ); 10.406 + Node *mtwo = _igvn.intcon(-2); 10.407 + set_ctrl(mtwo, C->root()); 10.408 + Node *rond = new (C, 3) AndINode( trip, mtwo ); 10.409 + register_new_node( rond, ctrl ); 10.410 + Node *spn2 = new (C, 3) MulINode( rond, stride ); 10.411 + register_new_node( spn2, ctrl ); 10.412 + new_limit = new (C, 3) AddINode( spn2, init ); 10.413 + register_new_node( new_limit, ctrl ); 10.414 + 10.415 + // Hammer in the new limit 10.416 + Node *ctrl2 = loop_end->in(0); 10.417 + Node *cmp2 = new (C, 3) CmpINode( loop_head->incr(), new_limit ); 10.418 + register_new_node( cmp2, ctrl2 ); 10.419 + Node *bol2 = new (C, 2) BoolNode( cmp2, loop_end->test_trip() ); 10.420 + register_new_node( bol2, ctrl2 ); 10.421 + _igvn.hash_delete(loop_end); 10.422 + loop_end->set_req(CountedLoopEndNode::TestValue, bol2); 10.423 + 10.424 + // Step 3: Find the min-trip test guaranteed before a 'main' loop. 10.425 + // Make it a 1-trip test (means at least 2 trips). 10.426 + if( adjust_min_trip ) { 10.427 + assert( new_limit != NULL, "" ); 10.428 + // Guard test uses an 'opaque' node which is not shared. Hence I 10.429 + // can edit it's inputs directly. Hammer in the new limit for the 10.430 + // minimum-trip guard. 10.431 + assert( opaq->outcnt() == 1, "" ); 10.432 + _igvn.hash_delete(opaq); 10.433 + opaq->set_req(1, new_limit); 10.434 + } 10.435 + } // LoopLimitCheck 10.436 10.437 // --------- 10.438 // Step 4: Clone the loop body. Move it inside the loop. This loop body 10.439 @@ -1266,6 +1415,7 @@ 10.440 10.441 void PhaseIdealLoop::do_maximally_unroll( IdealLoopTree *loop, Node_List &old_new ) { 10.442 CountedLoopNode *cl = loop->_head->as_CountedLoop(); 10.443 + assert(cl->has_exact_trip_count(), "trip count is not exact"); 10.444 assert(cl->trip_count() > 0, ""); 10.445 #ifndef PRODUCT 10.446 if (TraceLoopOpts) { 10.447 @@ -1282,6 +1432,7 @@ 10.448 // Now its tripping an even number of times remaining. Double loop body. 10.449 // Do not adjust pre-guards; they are not needed and do not exist. 10.450 if (cl->trip_count() > 0) { 10.451 + assert((cl->trip_count() & 1) == 0, "missed peeling"); 10.452 do_unroll(loop, old_new, false); 10.453 } 10.454 } 10.455 @@ -1295,22 +1446,13 @@ 10.456 } 10.457 10.458 //------------------------------add_constraint--------------------------------- 10.459 -// Constrain the main loop iterations so the condition: 10.460 -// scale_con * I + offset < limit 10.461 +// Constrain the main loop iterations so the conditions: 10.462 +// low_limit <= scale_con * I + offset < upper_limit 10.463 // always holds true. That is, either increase the number of iterations in 10.464 // the pre-loop or the post-loop until the condition holds true in the main 10.465 // loop. Stride, scale, offset and limit are all loop invariant. Further, 10.466 // stride and scale are constants (offset and limit often are). 10.467 -void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset, Node *limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ) { 10.468 - 10.469 - // Compute "I :: (limit-offset)/scale_con" 10.470 - Node *con = new (C, 3) SubINode( limit, offset ); 10.471 - register_new_node( con, pre_ctrl ); 10.472 - Node *scale = _igvn.intcon(scale_con); 10.473 - set_ctrl(scale, C->root()); 10.474 - Node *X = new (C, 3) DivINode( 0, con, scale ); 10.475 - register_new_node( X, pre_ctrl ); 10.476 - 10.477 +void PhaseIdealLoop::add_constraint( int stride_con, int scale_con, Node *offset, Node *low_limit, Node *upper_limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ) { 10.478 // For positive stride, the pre-loop limit always uses a MAX function 10.479 // and the main loop a MIN function. For negative stride these are 10.480 // reversed. 10.481 @@ -1319,48 +1461,143 @@ 10.482 // pre-loop must check for underflow and the post-loop for overflow. 10.483 // Negative stride*scale reverses this; pre-loop checks for overflow and 10.484 // post-loop for underflow. 10.485 - if( stride_con*scale_con > 0 ) { 10.486 - // Compute I < (limit-offset)/scale_con 10.487 - // Adjust main-loop last iteration to be MIN/MAX(main_loop,X) 10.488 - *main_limit = (stride_con > 0) 10.489 - ? (Node*)(new (C, 3) MinINode( *main_limit, X )) 10.490 - : (Node*)(new (C, 3) MaxINode( *main_limit, X )); 10.491 - register_new_node( *main_limit, pre_ctrl ); 10.492 + if (stride_con*scale_con > 0) { 10.493 + // The overflow limit: scale*I+offset < upper_limit 10.494 + // For main-loop compute 10.495 + // ( if (scale > 0) /* and stride > 0 */ 10.496 + // I < (upper_limit-offset)/scale 10.497 + // else /* scale < 0 and stride < 0 */ 10.498 + // I > (upper_limit-offset)/scale 10.499 + // ) 10.500 + // 10.501 + // (upper_limit-offset) may overflow when offset < 0. 10.502 + // But it is fine since main loop will either have 10.503 + // less iterations or will be skipped in such case. 10.504 + Node *con = new (C, 3) SubINode(upper_limit, offset); 10.505 + register_new_node(con, pre_ctrl); 10.506 + Node *scale = _igvn.intcon(scale_con); 10.507 + set_ctrl(scale, C->root()); 10.508 + Node *X = new (C, 3) DivINode(0, con, scale); 10.509 + register_new_node(X, pre_ctrl); 10.510 10.511 - } else { 10.512 - // Compute (limit-offset)/scale_con + SGN(-scale_con) <= I 10.513 - // Add the negation of the main-loop constraint to the pre-loop. 10.514 - // See footnote [++] below for a derivation of the limit expression. 10.515 - Node *incr = _igvn.intcon(scale_con > 0 ? -1 : 1); 10.516 - set_ctrl(incr, C->root()); 10.517 - Node *adj = new (C, 3) AddINode( X, incr ); 10.518 - register_new_node( adj, pre_ctrl ); 10.519 - *pre_limit = (scale_con > 0) 10.520 - ? (Node*)new (C, 3) MinINode( *pre_limit, adj ) 10.521 - : (Node*)new (C, 3) MaxINode( *pre_limit, adj ); 10.522 - register_new_node( *pre_limit, pre_ctrl ); 10.523 + // Adjust main-loop last iteration 10.524 + Node *loop_limit = *main_limit; 10.525 + loop_limit = (stride_con > 0) // scale > 0 10.526 + ? (Node*)(new (C, 3) MinINode(loop_limit, X)) 10.527 + : (Node*)(new (C, 3) MaxINode(loop_limit, X)); 10.528 + register_new_node(loop_limit, pre_ctrl); 10.529 + *main_limit = loop_limit; 10.530 10.531 -// [++] Here's the algebra that justifies the pre-loop limit expression: 10.532 -// 10.533 -// NOT( scale_con * I + offset < limit ) 10.534 -// == 10.535 -// scale_con * I + offset >= limit 10.536 -// == 10.537 -// SGN(scale_con) * I >= (limit-offset)/|scale_con| 10.538 -// == 10.539 -// (limit-offset)/|scale_con| <= I * SGN(scale_con) 10.540 -// == 10.541 -// (limit-offset)/|scale_con|-1 < I * SGN(scale_con) 10.542 -// == 10.543 -// ( if (scale_con > 0) /*common case*/ 10.544 -// (limit-offset)/scale_con - 1 < I 10.545 -// else 10.546 -// (limit-offset)/scale_con + 1 > I 10.547 -// ) 10.548 -// ( if (scale_con > 0) /*common case*/ 10.549 -// (limit-offset)/scale_con + SGN(-scale_con) < I 10.550 -// else 10.551 -// (limit-offset)/scale_con + SGN(-scale_con) > I 10.552 + // The underflow limit: low_limit <= scale*I+offset. 10.553 + // For pre-loop compute 10.554 + // NOT(scale*I+offset >= low_limit) 10.555 + // scale*I+offset < low_limit 10.556 + // ( if (scale > 0) /* and stride > 0 */ 10.557 + // I < (low_limit-offset)/scale 10.558 + // else /* scale < 0 and stride < 0 */ 10.559 + // I > (low_limit-offset)/scale 10.560 + // ) 10.561 + 10.562 + if (low_limit->get_int() == -max_jint) { 10.563 + if (!RangeLimitCheck) return; 10.564 + // We need this guard when scale*pre_limit+offset >= limit 10.565 + // due to underflow so we need execute pre-loop until 10.566 + // scale*I+offset >= min_int. But (low_limit-offset) will 10.567 + // underflow when offset > 0 and X will be > original_limit. 10.568 + // To avoid it we replace offset = offset > 0 ? 0 : offset 10.569 + // and add min(pre_limit, original_limit). 10.570 + Node* shift = _igvn.intcon(31); 10.571 + set_ctrl(shift, C->root()); 10.572 + Node *neg_off = new (C, 3) RShiftINode(offset, shift); 10.573 + register_new_node(neg_off, pre_ctrl); 10.574 + offset = new (C, 3) AndINode(offset, neg_off); 10.575 + register_new_node(offset, pre_ctrl); 10.576 + } else { 10.577 + assert(low_limit->get_int() == 0, "wrong low limit for range check"); 10.578 + // The only problem we have here when offset == min_int 10.579 + // since (0-min_int) == min_int. It may be fine for scale > 0 10.580 + // but for scale < 0 X will be < original_limit. 10.581 + } 10.582 + con = new (C, 3) SubINode(low_limit, offset); 10.583 + register_new_node(con, pre_ctrl); 10.584 + scale = _igvn.intcon(scale_con); 10.585 + set_ctrl(scale, C->root()); 10.586 + X = new (C, 3) DivINode(0, con, scale); 10.587 + register_new_node(X, pre_ctrl); 10.588 + 10.589 + // Adjust pre-loop last iteration 10.590 + loop_limit = *pre_limit; 10.591 + loop_limit = (stride_con > 0) // scale > 0 10.592 + ? (Node*)(new (C, 3) MaxINode(loop_limit, X)) 10.593 + : (Node*)(new (C, 3) MinINode(loop_limit, X)); 10.594 + register_new_node( loop_limit, pre_ctrl ); 10.595 + *pre_limit = loop_limit; 10.596 + 10.597 + } else { // stride_con*scale_con < 0 10.598 + // For negative stride*scale pre-loop checks for overflow and 10.599 + // post-loop for underflow. 10.600 + // 10.601 + // The underflow limit: low_limit <= scale*I+offset. 10.602 + // For main-loop compute 10.603 + // scale*I+offset+1 > low_limit 10.604 + // ( if (scale < 0) /* and stride > 0 */ 10.605 + // I < (low_limit-(offset+1))/scale 10.606 + // else /* scale < 0 and stride < 0 */ 10.607 + // I > (low_limit-(offset+1))/scale 10.608 + // ) 10.609 + 10.610 + if (low_limit->get_int() == -max_jint) { 10.611 + if (!RangeLimitCheck) return; 10.612 + } else { 10.613 + assert(low_limit->get_int() == 0, "wrong low limit for range check"); 10.614 + } 10.615 + 10.616 + Node *one = _igvn.intcon(1); 10.617 + set_ctrl(one, C->root()); 10.618 + Node *plus_one = new (C, 3) AddINode(offset, one); 10.619 + register_new_node( plus_one, pre_ctrl ); 10.620 + Node *con = new (C, 3) SubINode(low_limit, plus_one); 10.621 + register_new_node(con, pre_ctrl); 10.622 + Node *scale = _igvn.intcon(scale_con); 10.623 + set_ctrl(scale, C->root()); 10.624 + Node *X = new (C, 3) DivINode(0, con, scale); 10.625 + register_new_node(X, pre_ctrl); 10.626 + 10.627 + // Adjust main-loop last iteration 10.628 + Node *loop_limit = *main_limit; 10.629 + loop_limit = (stride_con > 0) // scale < 0 10.630 + ? (Node*)(new (C, 3) MinINode(loop_limit, X)) 10.631 + : (Node*)(new (C, 3) MaxINode(loop_limit, X)); 10.632 + register_new_node(loop_limit, pre_ctrl); 10.633 + *main_limit = loop_limit; 10.634 + 10.635 + // The overflow limit: scale*I+offset < upper_limit 10.636 + // For pre-loop compute 10.637 + // NOT(scale*I+offset < upper_limit) 10.638 + // scale*I+offset >= upper_limit 10.639 + // scale*I+offset+1 > upper_limit 10.640 + // ( if (scale < 0) /* and stride > 0 */ 10.641 + // I < (upper_limit-(offset+1))/scale 10.642 + // else /* scale < 0 and stride < 0 */ 10.643 + // I > (upper_limit-(offset+1))/scale 10.644 + // ) 10.645 + plus_one = new (C, 3) AddINode(offset, one); 10.646 + register_new_node( plus_one, pre_ctrl ); 10.647 + con = new (C, 3) SubINode(upper_limit, plus_one); 10.648 + register_new_node(con, pre_ctrl); 10.649 + scale = _igvn.intcon(scale_con); 10.650 + set_ctrl(scale, C->root()); 10.651 + X = new (C, 3) DivINode(0, con, scale); 10.652 + register_new_node(X, pre_ctrl); 10.653 + 10.654 + // Adjust pre-loop last iteration 10.655 + loop_limit = *pre_limit; 10.656 + loop_limit = (stride_con > 0) // scale < 0 10.657 + ? (Node*)(new (C, 3) MaxINode(loop_limit, X)) 10.658 + : (Node*)(new (C, 3) MinINode(loop_limit, X)); 10.659 + register_new_node( loop_limit, pre_ctrl ); 10.660 + *pre_limit = loop_limit; 10.661 + 10.662 } 10.663 } 10.664 10.665 @@ -1491,7 +1728,7 @@ 10.666 Node *cmpzm = bolzm->in(1); 10.667 assert(cmpzm->is_Cmp(), ""); 10.668 Node *opqzm = cmpzm->in(2); 10.669 - // Can not optimize a loop if pre-loop Opaque1 node is optimized 10.670 + // Can not optimize a loop if zero-trip Opaque1 node is optimized 10.671 // away and then another round of loop opts attempted. 10.672 if (opqzm->Opcode() != Op_Opaque1) 10.673 return; 10.674 @@ -1526,8 +1763,11 @@ 10.675 int stride_con = cl->stride_con(); 10.676 Node *zero = _igvn.intcon(0); 10.677 Node *one = _igvn.intcon(1); 10.678 + // Use symmetrical int range [-max_jint,max_jint] 10.679 + Node *mini = _igvn.intcon(-max_jint); 10.680 set_ctrl(zero, C->root()); 10.681 set_ctrl(one, C->root()); 10.682 + set_ctrl(mini, C->root()); 10.683 10.684 // Range checks that do not dominate the loop backedge (ie. 10.685 // conditionally executed) can lengthen the pre loop limit beyond 10.686 @@ -1602,7 +1842,12 @@ 10.687 if( offset_c == ctrl ) { 10.688 continue; // Don't rce this check but continue looking for other candidates. 10.689 } 10.690 - 10.691 +#ifdef ASSERT 10.692 + if (TraceRangeLimitCheck) { 10.693 + tty->print_cr("RC bool node%s", flip ? " flipped:" : ":"); 10.694 + bol->dump(2); 10.695 + } 10.696 +#endif 10.697 // At this point we have the expression as: 10.698 // scale_con * trip_counter + offset :: limit 10.699 // where scale_con, offset and limit are loop invariant. Trip_counter 10.700 @@ -1613,17 +1858,16 @@ 10.701 // Adjust pre and main loop limits to guard the correct iteration set 10.702 if( cmp->Opcode() == Op_CmpU ) {// Unsigned compare is really 2 tests 10.703 if( b_test._test == BoolTest::lt ) { // Range checks always use lt 10.704 - // The overflow limit: scale*I+offset < limit 10.705 - add_constraint( stride_con, scale_con, offset, limit, pre_ctrl, &pre_limit, &main_limit ); 10.706 - // The underflow limit: 0 <= scale*I+offset. 10.707 - // Some math yields: -scale*I-(offset+1) < 0 10.708 - Node *plus_one = new (C, 3) AddINode( offset, one ); 10.709 - register_new_node( plus_one, pre_ctrl ); 10.710 - Node *neg_offset = new (C, 3) SubINode( zero, plus_one ); 10.711 - register_new_node( neg_offset, pre_ctrl ); 10.712 - add_constraint( stride_con, -scale_con, neg_offset, zero, pre_ctrl, &pre_limit, &main_limit ); 10.713 + // The underflow and overflow limits: 0 <= scale*I+offset < limit 10.714 + add_constraint( stride_con, scale_con, offset, zero, limit, pre_ctrl, &pre_limit, &main_limit ); 10.715 if (!conditional_rc) { 10.716 conditional_rc = !loop->dominates_backedge(iff); 10.717 + // It is also needed if offset->_lo == min_int since 10.718 + // (0-min_int) == min_int. It may be fine for stride > 0 10.719 + // but for stride < 0 pre_limit will be < original_limit. 10.720 + const TypeInt* offset_t = _igvn.type(offset)->is_int(); 10.721 + conditional_rc |= RangeLimitCheck && (offset_t->_lo == min_jint) && 10.722 + (scale_con<0) && (stride_con<0); 10.723 } 10.724 } else { 10.725 #ifndef PRODUCT 10.726 @@ -1634,21 +1878,35 @@ 10.727 } 10.728 } else { // Otherwise work on normal compares 10.729 switch( b_test._test ) { 10.730 - case BoolTest::ge: // Convert X >= Y to -X <= -Y 10.731 + case BoolTest::gt: 10.732 + // Fall into GE case 10.733 + case BoolTest::ge: 10.734 + // Convert (I*scale+offset) >= Limit to (I*(-scale)+(-offset)) <= -Limit 10.735 scale_con = -scale_con; 10.736 offset = new (C, 3) SubINode( zero, offset ); 10.737 register_new_node( offset, pre_ctrl ); 10.738 limit = new (C, 3) SubINode( zero, limit ); 10.739 register_new_node( limit, pre_ctrl ); 10.740 // Fall into LE case 10.741 - case BoolTest::le: // Convert X <= Y to X < Y+1 10.742 - limit = new (C, 3) AddINode( limit, one ); 10.743 - register_new_node( limit, pre_ctrl ); 10.744 + case BoolTest::le: 10.745 + if (b_test._test != BoolTest::gt) { 10.746 + // Convert X <= Y to X < Y+1 10.747 + limit = new (C, 3) AddINode( limit, one ); 10.748 + register_new_node( limit, pre_ctrl ); 10.749 + } 10.750 // Fall into LT case 10.751 case BoolTest::lt: 10.752 - add_constraint( stride_con, scale_con, offset, limit, pre_ctrl, &pre_limit, &main_limit ); 10.753 + // The underflow and overflow limits: MIN_INT <= scale*I+offset < limit 10.754 + add_constraint( stride_con, scale_con, offset, mini, limit, pre_ctrl, &pre_limit, &main_limit ); 10.755 if (!conditional_rc) { 10.756 conditional_rc = !loop->dominates_backedge(iff); 10.757 + // It is also needed if scale*pre_limit+offset >= limit 10.758 + // due to underflow so we need execute pre-loop until 10.759 + // scale*I+offset >= min_int. But (low_limit-offset) will 10.760 + // underflow when offset > 0 and X will be > original_limit. 10.761 + const TypeInt* offset_t = _igvn.type(offset)->is_int(); 10.762 + conditional_rc |= RangeLimitCheck && (offset_t->_hi > 0) && 10.763 + (scale_con>0) && (stride_con>0); 10.764 } 10.765 break; 10.766 default: 10.767 @@ -1699,7 +1957,8 @@ 10.768 10.769 // Note:: we are making the main loop limit no longer precise; 10.770 // need to round up based on stride. 10.771 - if( stride_con != 1 && stride_con != -1 ) { // Cutout for common case 10.772 + cl->set_nonexact_trip_count(); 10.773 + if (!LoopLimitCheck && stride_con != 1 && stride_con != -1) { // Cutout for common case 10.774 // "Standard" round-up logic: ([main_limit-init+(y-1)]/y)*y+init 10.775 // Hopefully, compiler will optimize for powers of 2. 10.776 Node *ctrl = get_ctrl(main_limit); 10.777 @@ -1879,7 +2138,19 @@ 10.778 // iteration. Then the CountedLoopEnd will collapse (backedge never 10.779 // taken) and all loop-invariant uses of the exit values will be correct. 10.780 Node *phi = cl->phi(); 10.781 - Node *final = new (phase->C, 3) SubINode( cl->limit(), cl->stride() ); 10.782 + Node *exact_limit = phase->exact_limit(this); 10.783 + if (exact_limit != cl->limit()) { 10.784 + // We also need to replace the original limit to collapse loop exit. 10.785 + Node* cmp = cl->loopexit()->cmp_node(); 10.786 + assert(cl->limit() == cmp->in(2), "sanity"); 10.787 + phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist 10.788 + phase->_igvn.hash_delete(cmp); 10.789 + cmp->set_req(2, exact_limit); 10.790 + phase->_igvn._worklist.push(cmp); // put cmp on worklist 10.791 + } 10.792 + // Note: the final value after increment should not overflow since 10.793 + // counted loop has limit check predicate. 10.794 + Node *final = new (phase->C, 3) SubINode( exact_limit, cl->stride() ); 10.795 phase->register_new_node(final,cl->in(LoopNode::EntryControl)); 10.796 phase->_igvn.replace_node(phi,final); 10.797 phase->C->set_major_progress();
11.1 --- a/src/share/vm/opto/loopUnswitch.cpp Wed May 04 03:42:58 2011 -0700 11.2 +++ b/src/share/vm/opto/loopUnswitch.cpp Wed May 04 13:12:42 2011 -0700 11.3 @@ -130,6 +130,11 @@ 11.4 Node* uniqc = proj_true->unique_ctrl_out(); 11.5 Node* entry = head->in(LoopNode::EntryControl); 11.6 Node* predicate = find_predicate(entry); 11.7 + if (predicate != NULL && LoopLimitCheck && UseLoopPredicate) { 11.8 + // We may have two predicates, find first. 11.9 + entry = find_predicate(entry->in(0)->in(0)); 11.10 + if (entry != NULL) predicate = entry; 11.11 + } 11.12 if (predicate != NULL) predicate = predicate->in(0); 11.13 assert(proj_true->is_IfTrue() && 11.14 (predicate == NULL && uniqc == head || 11.15 @@ -217,6 +222,7 @@ 11.16 ProjNode* PhaseIdealLoop::create_slow_version_of_loop(IdealLoopTree *loop, 11.17 Node_List &old_new) { 11.18 LoopNode* head = loop->_head->as_Loop(); 11.19 + bool counted_loop = head->is_CountedLoop(); 11.20 Node* entry = head->in(LoopNode::EntryControl); 11.21 _igvn.hash_delete(entry); 11.22 _igvn._worklist.push(entry); 11.23 @@ -242,14 +248,14 @@ 11.24 assert(old_new[head->_idx]->is_Loop(), "" ); 11.25 11.26 // Fast (true) control 11.27 - Node* iffast_pred = clone_loop_predicates(entry, iffast); 11.28 + Node* iffast_pred = clone_loop_predicates(entry, iffast, !counted_loop); 11.29 _igvn.hash_delete(head); 11.30 head->set_req(LoopNode::EntryControl, iffast_pred); 11.31 set_idom(head, iffast_pred, dom_depth(head)); 11.32 _igvn._worklist.push(head); 11.33 11.34 // Slow (false) control 11.35 - Node* ifslow_pred = move_loop_predicates(entry, ifslow); 11.36 + Node* ifslow_pred = move_loop_predicates(entry, ifslow, !counted_loop); 11.37 LoopNode* slow_head = old_new[head->_idx]->as_Loop(); 11.38 _igvn.hash_delete(slow_head); 11.39 slow_head->set_req(LoopNode::EntryControl, ifslow_pred);
12.1 --- a/src/share/vm/opto/loopnode.cpp Wed May 04 03:42:58 2011 -0700 12.2 +++ b/src/share/vm/opto/loopnode.cpp Wed May 04 13:12:42 2011 -0700 12.3 @@ -206,7 +206,7 @@ 12.4 // Get backedge compare 12.5 Node *cmp = test->in(1); 12.6 int cmp_op = cmp->Opcode(); 12.7 - if( cmp_op != Op_CmpI ) 12.8 + if (cmp_op != Op_CmpI) 12.9 return false; // Avoid pointer & float compares 12.10 12.11 // Find the trip-counter increment & limit. Limit must be loop invariant. 12.12 @@ -259,7 +259,8 @@ 12.13 } 12.14 // Stride must be constant 12.15 int stride_con = stride->get_int(); 12.16 - assert(stride_con != 0, "missed some peephole opt"); 12.17 + if (stride_con == 0) 12.18 + return false; // missed some peephole opt 12.19 12.20 if (!xphi->is_Phi()) 12.21 return false; // Too much math on the trip counter 12.22 @@ -319,7 +320,7 @@ 12.23 // Count down loop rolls through MAXINT 12.24 (bt == BoolTest::le || bt == BoolTest::lt) && stride_con < 0 || 12.25 // Count up loop rolls through MININT 12.26 - (bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0 ) { 12.27 + (bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0) { 12.28 return false; // Bail out 12.29 } 12.30 12.31 @@ -341,12 +342,137 @@ 12.32 // 12.33 assert(x->Opcode() == Op_Loop, "regular loops only"); 12.34 C->print_method("Before CountedLoop", 3); 12.35 + 12.36 + Node *hook = new (C, 6) Node(6); 12.37 + 12.38 + if (LoopLimitCheck) { 12.39 + 12.40 + // =================================================== 12.41 + // Generate loop limit check to avoid integer overflow 12.42 + // in cases like next (cyclic loops): 12.43 + // 12.44 + // for (i=0; i <= max_jint; i++) {} 12.45 + // for (i=0; i < max_jint; i+=2) {} 12.46 + // 12.47 + // 12.48 + // Limit check predicate depends on the loop test: 12.49 + // 12.50 + // for(;i != limit; i++) --> limit <= (max_jint) 12.51 + // for(;i < limit; i+=stride) --> limit <= (max_jint - stride + 1) 12.52 + // for(;i <= limit; i+=stride) --> limit <= (max_jint - stride ) 12.53 + // 12.54 + 12.55 + // Check if limit is excluded to do more precise int overflow check. 12.56 + bool incl_limit = (bt == BoolTest::le || bt == BoolTest::ge); 12.57 + int stride_m = stride_con - (incl_limit ? 0 : (stride_con > 0 ? 1 : -1)); 12.58 + 12.59 + // If compare points directly to the phi we need to adjust 12.60 + // the compare so that it points to the incr. Limit have 12.61 + // to be adjusted to keep trip count the same and the 12.62 + // adjusted limit should be checked for int overflow. 12.63 + if (phi_incr != NULL) { 12.64 + stride_m += stride_con; 12.65 + } 12.66 + 12.67 + if (limit->is_Con()) { 12.68 + int limit_con = limit->get_int(); 12.69 + if ((stride_con > 0 && limit_con > (max_jint - stride_m)) || 12.70 + (stride_con < 0 && limit_con < (min_jint - stride_m))) { 12.71 + // Bailout: it could be integer overflow. 12.72 + return false; 12.73 + } 12.74 + } else if ((stride_con > 0 && limit_t->_hi <= (max_jint - stride_m)) || 12.75 + (stride_con < 0 && limit_t->_lo >= (min_jint - stride_m))) { 12.76 + // Limit's type may satisfy the condition, for example, 12.77 + // when it is an array length. 12.78 + } else { 12.79 + // Generate loop's limit check. 12.80 + // Loop limit check predicate should be near the loop. 12.81 + ProjNode *limit_check_proj = find_predicate_insertion_point(init_control, Deoptimization::Reason_loop_limit_check); 12.82 + if (!limit_check_proj) { 12.83 + // The limit check predicate is not generated if this method trapped here before. 12.84 +#ifdef ASSERT 12.85 + if (TraceLoopLimitCheck) { 12.86 + tty->print("missing loop limit check:"); 12.87 + loop->dump_head(); 12.88 + x->dump(1); 12.89 + } 12.90 +#endif 12.91 + return false; 12.92 + } 12.93 + 12.94 + IfNode* check_iff = limit_check_proj->in(0)->as_If(); 12.95 + Node* cmp_limit; 12.96 + Node* bol; 12.97 + 12.98 + if (stride_con > 0) { 12.99 + cmp_limit = new (C, 3) CmpINode(limit, _igvn.intcon(max_jint - stride_m)); 12.100 + bol = new (C, 2) BoolNode(cmp_limit, BoolTest::le); 12.101 + } else { 12.102 + cmp_limit = new (C, 3) CmpINode(limit, _igvn.intcon(min_jint - stride_m)); 12.103 + bol = new (C, 2) BoolNode(cmp_limit, BoolTest::ge); 12.104 + } 12.105 + cmp_limit = _igvn.register_new_node_with_optimizer(cmp_limit); 12.106 + bol = _igvn.register_new_node_with_optimizer(bol); 12.107 + set_subtree_ctrl(bol); 12.108 + 12.109 + // Replace condition in original predicate but preserve Opaque node 12.110 + // so that previous predicates could be found. 12.111 + assert(check_iff->in(1)->Opcode() == Op_Conv2B && 12.112 + check_iff->in(1)->in(1)->Opcode() == Op_Opaque1, ""); 12.113 + Node* opq = check_iff->in(1)->in(1); 12.114 + _igvn.hash_delete(opq); 12.115 + opq->set_req(1, bol); 12.116 + // Update ctrl. 12.117 + set_ctrl(opq, check_iff->in(0)); 12.118 + set_ctrl(check_iff->in(1), check_iff->in(0)); 12.119 + 12.120 #ifndef PRODUCT 12.121 - if (TraceLoopOpts) { 12.122 - tty->print("Counted "); 12.123 - loop->dump_head(); 12.124 + // report that the loop predication has been actually performed 12.125 + // for this loop 12.126 + if (TraceLoopLimitCheck) { 12.127 + tty->print_cr("Counted Loop Limit Check generated:"); 12.128 + debug_only( bol->dump(2); ) 12.129 + } 12.130 +#endif 12.131 } 12.132 -#endif 12.133 + 12.134 + if (phi_incr != NULL) { 12.135 + // If compare points directly to the phi we need to adjust 12.136 + // the compare so that it points to the incr. Limit have 12.137 + // to be adjusted to keep trip count the same and we 12.138 + // should avoid int overflow. 12.139 + // 12.140 + // i = init; do {} while(i++ < limit); 12.141 + // is converted to 12.142 + // i = init; do {} while(++i < limit+1); 12.143 + // 12.144 + limit = gvn->transform(new (C, 3) AddINode(limit, stride)); 12.145 + } 12.146 + 12.147 + // Now we need to canonicalize loop condition. 12.148 + if (bt == BoolTest::ne) { 12.149 + assert(stride_con == 1 || stride_con == -1, "simple increment only"); 12.150 + bt = (stride_con > 0) ? BoolTest::lt : BoolTest::gt; 12.151 + } 12.152 + 12.153 + if (incl_limit) { 12.154 + // The limit check guaranties that 'limit <= (max_jint - stride)' so 12.155 + // we can convert 'i <= limit' to 'i < limit+1' since stride != 0. 12.156 + // 12.157 + Node* one = (stride_con > 0) ? gvn->intcon( 1) : gvn->intcon(-1); 12.158 + limit = gvn->transform(new (C, 3) AddINode(limit, one)); 12.159 + if (bt == BoolTest::le) 12.160 + bt = BoolTest::lt; 12.161 + else if (bt == BoolTest::ge) 12.162 + bt = BoolTest::gt; 12.163 + else 12.164 + ShouldNotReachHere(); 12.165 + } 12.166 + set_subtree_ctrl( limit ); 12.167 + 12.168 + } else { // LoopLimitCheck 12.169 + 12.170 // If compare points to incr, we are ok. Otherwise the compare 12.171 // can directly point to the phi; in this case adjust the compare so that 12.172 // it points to the incr by adjusting the limit. 12.173 @@ -359,7 +485,6 @@ 12.174 Node *one_m = gvn->intcon(-1); 12.175 12.176 Node *trip_count = NULL; 12.177 - Node *hook = new (C, 6) Node(6); 12.178 switch( bt ) { 12.179 case BoolTest::eq: 12.180 ShouldNotReachHere(); 12.181 @@ -441,6 +566,8 @@ 12.182 limit = gvn->transform(new (C, 3) AddINode(span,init_trip)); 12.183 set_subtree_ctrl( limit ); 12.184 12.185 + } // LoopLimitCheck 12.186 + 12.187 // Check for SafePoint on backedge and remove 12.188 Node *sfpt = x->in(LoopNode::LoopBackControl); 12.189 if (sfpt->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt)) { 12.190 @@ -531,7 +658,7 @@ 12.191 12.192 // Check for immediately preceding SafePoint and remove 12.193 Node *sfpt2 = le->in(0); 12.194 - if( sfpt2->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt2)) 12.195 + if (sfpt2->Opcode() == Op_SafePoint && is_deleteable_safept(sfpt2)) 12.196 lazy_replace( sfpt2, sfpt2->in(TypeFunc::Control)); 12.197 12.198 // Free up intermediate goo 12.199 @@ -541,12 +668,56 @@ 12.200 assert(l->is_valid_counted_loop(), "counted loop shape is messed up"); 12.201 assert(l == loop->_head && l->phi() == phi && l->loopexit() == lex, "" ); 12.202 #endif 12.203 +#ifndef PRODUCT 12.204 + if (TraceLoopOpts) { 12.205 + tty->print("Counted "); 12.206 + loop->dump_head(); 12.207 + } 12.208 +#endif 12.209 12.210 C->print_method("After CountedLoop", 3); 12.211 12.212 return true; 12.213 } 12.214 12.215 +//----------------------exact_limit------------------------------------------- 12.216 +Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { 12.217 + assert(loop->_head->is_CountedLoop(), ""); 12.218 + CountedLoopNode *cl = loop->_head->as_CountedLoop(); 12.219 + 12.220 + if (!LoopLimitCheck || ABS(cl->stride_con()) == 1 || 12.221 + cl->limit()->Opcode() == Op_LoopLimit) { 12.222 + // Old code has exact limit (it could be incorrect in case of int overflow). 12.223 + // Loop limit is exact with stride == 1. And loop may already have exact limit. 12.224 + return cl->limit(); 12.225 + } 12.226 + Node *limit = NULL; 12.227 +#ifdef ASSERT 12.228 + BoolTest::mask bt = cl->loopexit()->test_trip(); 12.229 + assert(bt == BoolTest::lt || bt == BoolTest::gt, "canonical test is expected"); 12.230 +#endif 12.231 + if (cl->has_exact_trip_count()) { 12.232 + // Simple case: loop has constant boundaries. 12.233 + // Use longs to avoid integer overflow. 12.234 + int stride_con = cl->stride_con(); 12.235 + long init_con = cl->init_trip()->get_int(); 12.236 + long limit_con = cl->limit()->get_int(); 12.237 + julong trip_cnt = cl->trip_count(); 12.238 + long final_con = init_con + trip_cnt*stride_con; 12.239 + final_con -= stride_con; 12.240 + int final_int = (int)final_con; 12.241 + // The final value should be in integer range since the loop 12.242 + // is counted and the limit was checked for overflow. 12.243 + assert(final_con == (long)final_int, "final value should be integer"); 12.244 + limit = _igvn.intcon(final_int); 12.245 + } else { 12.246 + // Create new LoopLimit node to get exact limit (final iv value). 12.247 + limit = new (C, 4) LoopLimitNode(C, cl->init_trip(), cl->limit(), cl->stride()); 12.248 + register_new_node(limit, cl->in(LoopNode::EntryControl)); 12.249 + } 12.250 + assert(limit != NULL, "sanity"); 12.251 + return limit; 12.252 +} 12.253 12.254 //------------------------------Ideal------------------------------------------ 12.255 // Return a node which is more "ideal" than the current node. 12.256 @@ -572,14 +743,12 @@ 12.257 #ifndef PRODUCT 12.258 void CountedLoopNode::dump_spec(outputStream *st) const { 12.259 LoopNode::dump_spec(st); 12.260 - if( stride_is_con() ) { 12.261 + if (stride_is_con()) { 12.262 st->print("stride: %d ",stride_con()); 12.263 - } else { 12.264 - st->print("stride: not constant "); 12.265 } 12.266 - if( is_pre_loop () ) st->print("pre of N%d" , _main_idx ); 12.267 - if( is_main_loop() ) st->print("main of N%d", _idx ); 12.268 - if( is_post_loop() ) st->print("post of N%d", _main_idx ); 12.269 + if (is_pre_loop ()) st->print("pre of N%d" , _main_idx); 12.270 + if (is_main_loop()) st->print("main of N%d", _idx); 12.271 + if (is_post_loop()) st->print("post of N%d", _main_idx); 12.272 } 12.273 #endif 12.274 12.275 @@ -588,7 +757,130 @@ 12.276 return stride()->bottom_type()->is_int()->get_con(); 12.277 } 12.278 12.279 - 12.280 +//============================================================================= 12.281 +//------------------------------Value----------------------------------------- 12.282 +const Type *LoopLimitNode::Value( PhaseTransform *phase ) const { 12.283 + const Type* init_t = phase->type(in(Init)); 12.284 + const Type* limit_t = phase->type(in(Limit)); 12.285 + const Type* stride_t = phase->type(in(Stride)); 12.286 + // Either input is TOP ==> the result is TOP 12.287 + if (init_t == Type::TOP) return Type::TOP; 12.288 + if (limit_t == Type::TOP) return Type::TOP; 12.289 + if (stride_t == Type::TOP) return Type::TOP; 12.290 + 12.291 + int stride_con = stride_t->is_int()->get_con(); 12.292 + if (stride_con == 1) 12.293 + return NULL; // Identity 12.294 + 12.295 + if (init_t->is_int()->is_con() && limit_t->is_int()->is_con()) { 12.296 + // Use longs to avoid integer overflow. 12.297 + long init_con = init_t->is_int()->get_con(); 12.298 + long limit_con = limit_t->is_int()->get_con(); 12.299 + int stride_m = stride_con - (stride_con > 0 ? 1 : -1); 12.300 + long trip_count = (limit_con - init_con + stride_m)/stride_con; 12.301 + long final_con = init_con + stride_con*trip_count; 12.302 + int final_int = (int)final_con; 12.303 + // The final value should be in integer range since the loop 12.304 + // is counted and the limit was checked for overflow. 12.305 + assert(final_con == (long)final_int, "final value should be integer"); 12.306 + return TypeInt::make(final_int); 12.307 + } 12.308 + 12.309 + return bottom_type(); // TypeInt::INT 12.310 +} 12.311 + 12.312 +//------------------------------Ideal------------------------------------------ 12.313 +// Return a node which is more "ideal" than the current node. 12.314 +Node *LoopLimitNode::Ideal(PhaseGVN *phase, bool can_reshape) { 12.315 + if (phase->type(in(Init)) == Type::TOP || 12.316 + phase->type(in(Limit)) == Type::TOP || 12.317 + phase->type(in(Stride)) == Type::TOP) 12.318 + return NULL; // Dead 12.319 + 12.320 + int stride_con = phase->type(in(Stride))->is_int()->get_con(); 12.321 + if (stride_con == 1) 12.322 + return NULL; // Identity 12.323 + 12.324 + if (in(Init)->is_Con() && in(Limit)->is_Con()) 12.325 + return NULL; // Value 12.326 + 12.327 + // Delay following optimizations until all loop optimizations 12.328 + // done to keep Ideal graph simple. 12.329 + if (!can_reshape || phase->C->major_progress()) 12.330 + return NULL; 12.331 + 12.332 + const TypeInt* init_t = phase->type(in(Init) )->is_int(); 12.333 + const TypeInt* limit_t = phase->type(in(Limit))->is_int(); 12.334 + int stride_p; 12.335 + long lim, ini; 12.336 + julong max; 12.337 + if (stride_con > 0) { 12.338 + stride_p = stride_con; 12.339 + lim = limit_t->_hi; 12.340 + ini = init_t->_lo; 12.341 + max = (julong)max_jint; 12.342 + } else { 12.343 + stride_p = -stride_con; 12.344 + lim = init_t->_hi; 12.345 + ini = limit_t->_lo; 12.346 + max = (julong)min_jint; 12.347 + } 12.348 + julong range = lim - ini + stride_p; 12.349 + if (range <= max) { 12.350 + // Convert to integer expression if it is not overflow. 12.351 + Node* stride_m = phase->intcon(stride_con - (stride_con > 0 ? 1 : -1)); 12.352 + Node *range = phase->transform(new (phase->C, 3) SubINode(in(Limit), in(Init))); 12.353 + Node *bias = phase->transform(new (phase->C, 3) AddINode(range, stride_m)); 12.354 + Node *trip = phase->transform(new (phase->C, 3) DivINode(0, bias, in(Stride))); 12.355 + Node *span = phase->transform(new (phase->C, 3) MulINode(trip, in(Stride))); 12.356 + return new (phase->C, 3) AddINode(span, in(Init)); // exact limit 12.357 + } 12.358 + 12.359 + if (is_power_of_2(stride_p) || // divisor is 2^n 12.360 + !Matcher::has_match_rule(Op_LoopLimit)) { // or no specialized Mach node? 12.361 + // Convert to long expression to avoid integer overflow 12.362 + // and let igvn optimizer convert this division. 12.363 + // 12.364 + Node* init = phase->transform( new (phase->C, 2) ConvI2LNode(in(Init))); 12.365 + Node* limit = phase->transform( new (phase->C, 2) ConvI2LNode(in(Limit))); 12.366 + Node* stride = phase->longcon(stride_con); 12.367 + Node* stride_m = phase->longcon(stride_con - (stride_con > 0 ? 1 : -1)); 12.368 + 12.369 + Node *range = phase->transform(new (phase->C, 3) SubLNode(limit, init)); 12.370 + Node *bias = phase->transform(new (phase->C, 3) AddLNode(range, stride_m)); 12.371 + Node *span; 12.372 + if (stride_con > 0 && is_power_of_2(stride_p)) { 12.373 + // bias >= 0 if stride >0, so if stride is 2^n we can use &(-stride) 12.374 + // and avoid generating rounding for division. Zero trip guard should 12.375 + // guarantee that init < limit but sometimes the guard is missing and 12.376 + // we can get situation when init > limit. Note, for the empty loop 12.377 + // optimization zero trip guard is generated explicitly which leaves 12.378 + // only RCE predicate where exact limit is used and the predicate 12.379 + // will simply fail forcing recompilation. 12.380 + Node* neg_stride = phase->longcon(-stride_con); 12.381 + span = phase->transform(new (phase->C, 3) AndLNode(bias, neg_stride)); 12.382 + } else { 12.383 + Node *trip = phase->transform(new (phase->C, 3) DivLNode(0, bias, stride)); 12.384 + span = phase->transform(new (phase->C, 3) MulLNode(trip, stride)); 12.385 + } 12.386 + // Convert back to int 12.387 + Node *span_int = phase->transform(new (phase->C, 2) ConvL2INode(span)); 12.388 + return new (phase->C, 3) AddINode(span_int, in(Init)); // exact limit 12.389 + } 12.390 + 12.391 + return NULL; // No progress 12.392 +} 12.393 + 12.394 +//------------------------------Identity--------------------------------------- 12.395 +// If stride == 1 return limit node. 12.396 +Node *LoopLimitNode::Identity( PhaseTransform *phase ) { 12.397 + int stride_con = phase->type(in(Stride))->is_int()->get_con(); 12.398 + if (stride_con == 1 || stride_con == -1) 12.399 + return in(Limit); 12.400 + return this; 12.401 +} 12.402 + 12.403 +//============================================================================= 12.404 //----------------------match_incr_with_optional_truncation-------------------- 12.405 // Match increment with optional truncation: 12.406 // CHAR: (i+1)&0x7fff, BYTE: ((i+1)<<8)>>8, or SHORT: ((i+1)<<16)>>16 12.407 @@ -870,7 +1162,7 @@ 12.408 outer = igvn.register_new_node_with_optimizer(outer, _head); 12.409 phase->set_created_loop_node(); 12.410 12.411 - Node* pred = phase->clone_loop_predicates(ctl, outer); 12.412 + Node* pred = phase->clone_loop_predicates(ctl, outer, true); 12.413 // Outermost loop falls into '_head' loop 12.414 _head->set_req(LoopNode::EntryControl, pred); 12.415 _head->del_req(outer_idx); 12.416 @@ -1440,9 +1732,16 @@ 12.417 tty->print(" "); 12.418 tty->print("Loop: N%d/N%d ",_head->_idx,_tail->_idx); 12.419 if (_irreducible) tty->print(" IRREDUCIBLE"); 12.420 + Node* entry = _head->in(LoopNode::EntryControl); 12.421 + if (LoopLimitCheck) { 12.422 + Node* predicate = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_loop_limit_check); 12.423 + if (predicate != NULL ) { 12.424 + tty->print(" limit_check"); 12.425 + entry = entry->in(0)->in(0); 12.426 + } 12.427 + } 12.428 if (UseLoopPredicate) { 12.429 - Node* entry = PhaseIdealLoop::find_predicate_insertion_point(_head->in(LoopNode::EntryControl), 12.430 - Deoptimization::Reason_predicate); 12.431 + entry = PhaseIdealLoop::find_predicate_insertion_point(entry, Deoptimization::Reason_predicate); 12.432 if (entry != NULL) { 12.433 tty->print(" predicated"); 12.434 } 12.435 @@ -1528,10 +1827,15 @@ 12.436 !loop->tail()->is_top()) { 12.437 LoopNode* lpn = loop->_head->as_Loop(); 12.438 Node* entry = lpn->in(LoopNode::EntryControl); 12.439 - Node* predicate_proj = find_predicate(entry); 12.440 + Node* predicate_proj = find_predicate(entry); // loop_limit_check first 12.441 if (predicate_proj != NULL ) { // right pattern that can be used by loop predication 12.442 assert(entry->in(0)->in(1)->in(1)->Opcode() == Op_Opaque1, "must be"); 12.443 useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one 12.444 + entry = entry->in(0)->in(0); 12.445 + } 12.446 + predicate_proj = find_predicate(entry); // Predicate 12.447 + if (predicate_proj != NULL ) { 12.448 + useful_predicates.push(entry->in(0)->in(1)->in(1)); // good one 12.449 } 12.450 } 12.451 12.452 @@ -1542,6 +1846,8 @@ 12.453 12.454 //------------------------eliminate_useless_predicates----------------------------- 12.455 // Eliminate all inserted predicates if they could not be used by loop predication. 12.456 +// Note: it will also eliminates loop limits check predicate since it also uses 12.457 +// Opaque1 node (see Parse::add_predicate()). 12.458 void PhaseIdealLoop::eliminate_useless_predicates() { 12.459 if (C->predicate_count() == 0) 12.460 return; // no predicate left 12.461 @@ -1731,7 +2037,7 @@ 12.462 // Some parser-inserted loop predicates could never be used by loop 12.463 // predication or they were moved away from loop during some optimizations. 12.464 // For example, peeling. Eliminate them before next loop optimizations. 12.465 - if (UseLoopPredicate) { 12.466 + if (UseLoopPredicate || LoopLimitCheck) { 12.467 eliminate_useless_predicates(); 12.468 } 12.469
13.1 --- a/src/share/vm/opto/loopnode.hpp Wed May 04 03:42:58 2011 -0700 13.2 +++ b/src/share/vm/opto/loopnode.hpp Wed May 04 13:12:42 2011 -0700 13.3 @@ -289,6 +289,28 @@ 13.4 inline Node *CountedLoopNode::incr() const { return loopexit() ? loopexit()->incr() : NULL; } 13.5 inline Node *CountedLoopNode::phi() const { return loopexit() ? loopexit()->phi() : NULL; } 13.6 13.7 +//------------------------------LoopLimitNode----------------------------- 13.8 +// Counted Loop limit node which represents exact final iterator value: 13.9 +// trip_count = (limit - init_trip + stride - 1)/stride 13.10 +// final_value= trip_count * stride + init_trip. 13.11 +// Use HW instructions to calculate it when it can overflow in integer. 13.12 +// Note, final_value should fit into integer since counted loop has 13.13 +// limit check: limit <= max_int-stride. 13.14 +class LoopLimitNode : public Node { 13.15 + enum { Init=1, Limit=2, Stride=3 }; 13.16 + public: 13.17 + LoopLimitNode( Compile* C, Node *init, Node *limit, Node *stride ) : Node(0,init,limit,stride) { 13.18 + // Put it on the Macro nodes list to optimize during macro nodes expansion. 13.19 + init_flags(Flag_is_macro); 13.20 + C->add_macro_node(this); 13.21 + } 13.22 + virtual int Opcode() const; 13.23 + virtual const Type *bottom_type() const { return TypeInt::INT; } 13.24 + virtual uint ideal_reg() const { return Op_RegI; } 13.25 + virtual const Type *Value( PhaseTransform *phase ) const; 13.26 + virtual Node *Ideal(PhaseGVN *phase, bool can_reshape); 13.27 + virtual Node *Identity( PhaseTransform *phase ); 13.28 +}; 13.29 13.30 // -----------------------------IdealLoopTree---------------------------------- 13.31 class IdealLoopTree : public ResourceObj { 13.32 @@ -775,6 +797,8 @@ 13.33 13.34 bool is_counted_loop( Node *x, IdealLoopTree *loop ); 13.35 13.36 + Node* exact_limit( IdealLoopTree *loop ); 13.37 + 13.38 // Return a post-walked LoopNode 13.39 IdealLoopTree *get_loop( Node *n ) const { 13.40 // Dead nodes have no loop, so return the top level loop instead 13.41 @@ -837,7 +861,6 @@ 13.42 bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0); 13.43 13.44 // Return true if proj is for "proj->[region->..]call_uct" 13.45 - // Return true if proj is for "proj->[region->..]call_uct" 13.46 static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason); 13.47 // Return true for "if(test)-> proj -> ... 13.48 // | 13.49 @@ -860,10 +883,11 @@ 13.50 PhaseIterGVN* igvn); 13.51 static Node* clone_loop_predicates(Node* old_entry, Node* new_entry, 13.52 bool move_predicates, 13.53 + bool clone_limit_check, 13.54 PhaseIdealLoop* loop_phase, 13.55 PhaseIterGVN* igvn); 13.56 - Node* clone_loop_predicates(Node* old_entry, Node* new_entry); 13.57 - Node* move_loop_predicates(Node* old_entry, Node* new_entry); 13.58 + Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 13.59 + Node* move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 13.60 13.61 void eliminate_loop_predicates(Node* entry); 13.62 static Node* skip_loop_predicates(Node* entry); 13.63 @@ -873,7 +897,7 @@ 13.64 // Find a predicate 13.65 static Node* find_predicate(Node* entry); 13.66 // Construct a range check for a predicate if 13.67 - BoolNode* rc_predicate(Node* ctrl, 13.68 + BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl, 13.69 int scale, Node* offset, 13.70 Node* init, Node* limit, Node* stride, 13.71 Node* range, bool upper); 13.72 @@ -903,11 +927,11 @@ 13.73 13.74 // Range Check Elimination uses this function! 13.75 // Constrain the main loop iterations so the affine function: 13.76 - // scale_con * I + offset < limit 13.77 + // low_limit <= scale_con * I + offset < upper_limit 13.78 // always holds true. That is, either increase the number of iterations in 13.79 // the pre-loop or the post-loop until the condition holds true in the main 13.80 // loop. Scale_con, offset and limit are all loop invariant. 13.81 - void add_constraint( int stride_con, int scale_con, Node *offset, Node *limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ); 13.82 + void add_constraint( int stride_con, int scale_con, Node *offset, Node *low_limit, Node *upper_limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit ); 13.83 13.84 // Partially peel loop up through last_peel node. 13.85 bool partial_peel( IdealLoopTree *loop, Node_List &old_new );
14.1 --- a/src/share/vm/opto/macro.cpp Wed May 04 03:42:58 2011 -0700 14.2 +++ b/src/share/vm/opto/macro.cpp Wed May 04 13:12:42 2011 -0700 14.3 @@ -2154,6 +2154,11 @@ 14.4 debug_only(int old_macro_count = C->macro_count();); 14.5 if (n->is_AbstractLock()) { 14.6 success = eliminate_locking_node(n->as_AbstractLock()); 14.7 + } else if (n->Opcode() == Op_LoopLimit) { 14.8 + // Remove it from macro list and put on IGVN worklist to optimize. 14.9 + C->remove_macro_node(n); 14.10 + _igvn._worklist.push(n); 14.11 + success = true; 14.12 } else if (n->Opcode() == Op_Opaque1 || n->Opcode() == Op_Opaque2) { 14.13 _igvn.replace_node(n, n->in(1)); 14.14 success = true;
15.1 --- a/src/share/vm/opto/matcher.cpp Wed May 04 03:42:58 2011 -0700 15.2 +++ b/src/share/vm/opto/matcher.cpp Wed May 04 13:12:42 2011 -0700 15.3 @@ -2086,6 +2086,13 @@ 15.4 n->del_req(3); 15.5 break; 15.6 } 15.7 + case Op_LoopLimit: { 15.8 + Node *pair1 = new (C, 3) BinaryNode(n->in(1),n->in(2)); 15.9 + n->set_req(1,pair1); 15.10 + n->set_req(2,n->in(3)); 15.11 + n->del_req(3); 15.12 + break; 15.13 + } 15.14 case Op_StrEquals: { 15.15 Node *pair1 = new (C, 3) BinaryNode(n->in(2),n->in(3)); 15.16 n->set_req(2,pair1);
16.1 --- a/src/share/vm/opto/parse.hpp Wed May 04 03:42:58 2011 -0700 16.2 +++ b/src/share/vm/opto/parse.hpp Wed May 04 13:12:42 2011 -0700 16.3 @@ -70,7 +70,7 @@ 16.4 const char* try_to_inline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result); 16.5 const char* shouldInline(ciMethod* callee_method, ciMethod* caller_method, int caller_bci, ciCallProfile& profile, WarmCallInfo* wci_result) const; 16.6 const char* shouldNotInline(ciMethod* callee_method, ciMethod* caller_method, WarmCallInfo* wci_result) const; 16.7 - void print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const PRODUCT_RETURN; 16.8 + void print_inlining(ciMethod *callee_method, int caller_bci, const char *failure_msg) const; 16.9 16.10 InlineTree *caller_tree() const { return _caller_tree; } 16.11 InlineTree* callee_at(int bci, ciMethod* m) const;
17.1 --- a/src/share/vm/opto/parse1.cpp Wed May 04 03:42:58 2011 -0700 17.2 +++ b/src/share/vm/opto/parse1.cpp Wed May 04 13:12:42 2011 -0700 17.3 @@ -638,7 +638,7 @@ 17.4 ensure_phis_everywhere(); 17.5 17.6 if (block->is_SEL_head() && 17.7 - UseLoopPredicate) { 17.8 + (UseLoopPredicate || LoopLimitCheck)) { 17.9 // Add predicate to single entry (not irreducible) loop head. 17.10 assert(!block->has_merged_backedge(), "only entry paths should be merged for now"); 17.11 // Need correct bci for predicate.
18.1 --- a/src/share/vm/opto/phaseX.hpp Wed May 04 03:42:58 2011 -0700 18.2 +++ b/src/share/vm/opto/phaseX.hpp Wed May 04 13:12:42 2011 -0700 18.3 @@ -472,8 +472,8 @@ 18.4 } 18.5 18.6 // Clone loop predicates. Defined in loopTransform.cpp. 18.7 - Node* clone_loop_predicates(Node* old_entry, Node* new_entry); 18.8 - Node* move_loop_predicates(Node* old_entry, Node* new_entry); 18.9 + Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 18.10 + Node* move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check); 18.11 // Create a new if below new_entry for the predicate to be cloned 18.12 ProjNode* create_new_if_for_predicate(ProjNode* cont_proj, Node* new_entry, 18.13 Deoptimization::DeoptReason reason);
19.1 --- a/src/share/vm/runtime/deoptimization.cpp Wed May 04 03:42:58 2011 -0700 19.2 +++ b/src/share/vm/runtime/deoptimization.cpp Wed May 04 13:12:42 2011 -0700 19.3 @@ -1773,7 +1773,8 @@ 19.4 "constraint", 19.5 "div0_check", 19.6 "age", 19.7 - "predicate" 19.8 + "predicate", 19.9 + "loop_limit_check" 19.10 }; 19.11 const char* Deoptimization::_trap_action_name[Action_LIMIT] = { 19.12 // Note: Keep this in sync. with enum DeoptAction.
20.1 --- a/src/share/vm/runtime/deoptimization.hpp Wed May 04 03:42:58 2011 -0700 20.2 +++ b/src/share/vm/runtime/deoptimization.hpp Wed May 04 13:12:42 2011 -0700 20.3 @@ -56,6 +56,7 @@ 20.4 Reason_div0_check, // a null_check due to division by zero 20.5 Reason_age, // nmethod too old; tier threshold reached 20.6 Reason_predicate, // compiler generated predicate failed 20.7 + Reason_loop_limit_check, // compiler generated loop limits check failed 20.8 Reason_LIMIT, 20.9 // Note: Keep this enum in sync. with _trap_reason_name. 20.10 Reason_RECORDED_LIMIT = Reason_bimorphic // some are not recorded per bc 20.11 @@ -78,7 +79,7 @@ 20.12 20.13 enum { 20.14 _action_bits = 3, 20.15 - _reason_bits = 4, 20.16 + _reason_bits = 5, 20.17 _action_shift = 0, 20.18 _reason_shift = _action_shift+_action_bits, 20.19 BC_CASE_LIMIT = PRODUCT_ONLY(1) NOT_PRODUCT(4) // for _deoptimization_hist
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/compiler/5091921/Test5091921.java Wed May 04 13:12:42 2011 -0700 21.3 @@ -0,0 +1,309 @@ 21.4 +/* 21.5 + * Copyright (c) 2011 Hewlett-Packard Company. All rights reserved. 21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 + * 21.8 + * This code is free software; you can redistribute it and/or modify it 21.9 + * under the terms of the GNU General Public License version 2 only, as 21.10 + * published by the Free Software Foundation. 21.11 + * 21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.15 + * version 2 for more details (a copy is included in the LICENSE file that 21.16 + * accompanied this code). 21.17 + * 21.18 + * You should have received a copy of the GNU General Public License version 21.19 + * 2 along with this work; if not, write to the Free Software Foundation, 21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.21 + * 21.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.23 + * or visit www.oracle.com if you need additional information or have any 21.24 + * questions. 21.25 + * 21.26 + */ 21.27 + 21.28 +/** 21.29 + * @test 21.30 + * @bug 5091921 21.31 + * @summary Sign flip issues in loop optimizer 21.32 + * 21.33 + * @run main/othervm -Xcomp -XX:CompileOnly=Test5091921 -XX:MaxInlineSize=1 Test5091921 21.34 + */ 21.35 + 21.36 +public class Test5091921 { 21.37 + private static int result = 0; 21.38 + 21.39 + 21.40 + /* Test for the bug of transforming indx >= MININT to indx > MININT-1 */ 21.41 + public static int test_ge1(int limit) { 21.42 + int indx; 21.43 + int sum = 0; 21.44 + for (indx = 500; indx >= limit; indx -= 2) { 21.45 + sum += 2000 / indx; 21.46 + result = sum; 21.47 + } 21.48 + return sum; 21.49 + } 21.50 + 21.51 + /* Test for the bug of transforming indx <= MAXINT to indx < MAXINT+1 */ 21.52 + public static int test_le1(int limit) { 21.53 + int indx; 21.54 + int sum = 0; 21.55 + for (indx = -500; indx <= limit; indx += 2) 21.56 + { 21.57 + sum += 3000 / indx; 21.58 + result = sum; 21.59 + } 21.60 + return sum; 21.61 + } 21.62 + 21.63 + /* Run with -Xcomp -XX:CompileOnly=wrap1.test1 -XX:MaxInlineSize=1 */ 21.64 + /* limit reset to ((limit-init+stride-1)/stride)*stride+init */ 21.65 + /* Calculation may overflow */ 21.66 + public static volatile int c = 1; 21.67 + public static int test_wrap1(int limit) 21.68 + { 21.69 + int indx; 21.70 + int sum = 0; 21.71 + for (indx = 0xffffffff; indx < limit; indx += 0x20000000) 21.72 + { 21.73 + sum += c; 21.74 + } 21.75 + return sum; 21.76 + } 21.77 + 21.78 + /* Test for range check elimination with bit flip issue for 21.79 + scale*i+offset<limit where offset is not 0 */ 21.80 + static int[] box5 = {1,2,3,4,5,6,7,8,9}; 21.81 + public static int test_rce5(int[] b, int limit) 21.82 + { 21.83 + int indx; 21.84 + int sum = b[1]; 21.85 + result = sum; 21.86 + for (indx = 0x80000000; indx < limit; ++indx) 21.87 + { 21.88 + if (indx > 0x80000000) 21.89 + { 21.90 + // this test is not issued in pre-loop but issued in main loop 21.91 + // trick rce into thinking expression is false when indx >= 0 21.92 + // in fact it is false when indx==0x80000001 21.93 + if (indx - 9 < -9) 21.94 + { 21.95 + sum += indx; 21.96 + result = sum; 21.97 + sum ^= b[indx & 7]; 21.98 + result = sum; 21.99 + } 21.100 + else 21.101 + break; 21.102 + } 21.103 + else 21.104 + { 21.105 + sum += b[indx & 3]; 21.106 + result = sum; 21.107 + } 21.108 + } 21.109 + return sum; 21.110 + } 21.111 + 21.112 + /* Test for range check elimination with bit flip issue for 21.113 + scale*i<limit where scale > 1 */ 21.114 + static int[] box6 = {1,2,3,4,5,6,7,8,9}; 21.115 + public static int test_rce6(int[] b, int limit) 21.116 + { 21.117 + int indx; 21.118 + int sum = b[1]; 21.119 + result = sum; 21.120 + for (indx = 0x80000000; indx < limit; ++indx) 21.121 + { 21.122 + if (indx > 0x80000000) 21.123 + { 21.124 + // harmless rce target 21.125 + if (indx < 0) 21.126 + { 21.127 + sum += result; 21.128 + result = sum; 21.129 + } 21.130 + else 21.131 + break; 21.132 + // this test is not issued in pre-loop but issued in main loop 21.133 + // trick rce into thinking expression is false when indx >= 0 21.134 + // in fact it is false when indx==0x80000001 21.135 + // In compilers that transform mulI to shiftI may mask this issue. 21.136 + if (indx * 28 + 1 < 0) 21.137 + { 21.138 + sum += indx; 21.139 + result = sum; 21.140 + sum ^= b[indx & 7]; 21.141 + result = sum; 21.142 + } 21.143 + else 21.144 + break; 21.145 + } 21.146 + else 21.147 + { 21.148 + sum += b[indx & 3]; 21.149 + result = sum; 21.150 + } 21.151 + } 21.152 + return sum; 21.153 + } 21.154 + 21.155 + /* Test for range check elimination with i <= limit */ 21.156 + static int[] box7 = {1,2,3,4,5,6,7,8,9,0x7fffffff}; 21.157 + public static int test_rce7(int[] b) 21.158 + { 21.159 + int indx; 21.160 + int max = b[9]; 21.161 + int sum = b[7]; 21.162 + result = sum; 21.163 + for (indx = 0; indx < b.length; ++indx) 21.164 + { 21.165 + if (indx <= max) 21.166 + { 21.167 + sum += (indx ^ 15) + ((result != 0) ? 0 : sum); 21.168 + result = sum; 21.169 + } 21.170 + else 21.171 + throw new RuntimeException(); 21.172 + } 21.173 + for (indx = -7; indx < b.length; ++indx) 21.174 + { 21.175 + if (indx <= 9) 21.176 + { 21.177 + sum += (sum ^ 15) + ((result != 0) ? 0 : sum); 21.178 + result = sum; 21.179 + } 21.180 + else 21.181 + throw new RuntimeException(); 21.182 + } 21.183 + return sum; 21.184 + } 21.185 + 21.186 + /* Test for range check elimination with i >= limit */ 21.187 + static int[] box8 = {-1,0,1,2,3,4,5,6,7,8,0x80000000}; 21.188 + public static int test_rce8(int[] b) 21.189 + { 21.190 + int indx; 21.191 + int sum = b[5]; 21.192 + int min = b[10]; 21.193 + result = sum; 21.194 + for (indx = b.length-1; indx >= 0; --indx) 21.195 + { 21.196 + if (indx >= min) 21.197 + { 21.198 + sum += (sum ^ 9) + ((result != 0) ? 0 :sum); 21.199 + result = sum; 21.200 + } 21.201 + else 21.202 + throw new RuntimeException(); 21.203 + } 21.204 + return sum; 21.205 + } 21.206 + 21.207 + public static void main(String[] args) 21.208 + { 21.209 + result=1; 21.210 + int r = 0; 21.211 + try { 21.212 + r = test_ge1(0x80000000); 21.213 + System.out.println(result); 21.214 + System.out.println("test_ge1 FAILED"); 21.215 + System.exit(1); 21.216 + } 21.217 + catch (ArithmeticException e1) { 21.218 + System.out.println("test_ge1: Expected exception caught"); 21.219 + if (result != 5986) { 21.220 + System.out.println(result); 21.221 + System.out.println("test_ge1 FAILED"); 21.222 + System.exit(97); 21.223 + } 21.224 + } 21.225 + System.out.println("test_ge1 WORKED"); 21.226 + 21.227 + result=0; 21.228 + try 21.229 + { 21.230 + r = test_le1(0x7fffffff); 21.231 + System.out.println(result); 21.232 + System.out.println("test_le1 FAILED"); 21.233 + System.exit(1); 21.234 + } 21.235 + catch (ArithmeticException e1) 21.236 + { 21.237 + System.out.println("test_le1: Expected exception caught"); 21.238 + if (result != -9039) 21.239 + { 21.240 + System.out.println(result); 21.241 + System.out.println("test_le1 FAILED"); 21.242 + System.exit(97); 21.243 + } 21.244 + } 21.245 + System.out.println("test_le1 WORKED"); 21.246 + 21.247 + result=0; 21.248 + r = test_wrap1(0x7fffffff); 21.249 + if (r != 4) 21.250 + { 21.251 + System.out.println(result); 21.252 + System.out.println("test_wrap1 FAILED"); 21.253 + System.exit(97); 21.254 + } 21.255 + else 21.256 + { 21.257 + System.out.println("test_wrap1 WORKED"); 21.258 + } 21.259 + 21.260 + result=0; 21.261 + r = test_rce5(box5,0x80000100); 21.262 + if (result != 3) 21.263 + { 21.264 + System.out.println(result); 21.265 + System.out.println("test_rce5 FAILED"); 21.266 + System.exit(97); 21.267 + } 21.268 + else 21.269 + { 21.270 + System.out.println("test_rce5 WORKED"); 21.271 + } 21.272 + 21.273 + result=0; 21.274 + r = test_rce6(box6,0x80000100); 21.275 + if (result != 6) 21.276 + { 21.277 + System.out.println(result); 21.278 + System.out.println("test_rce6 FAILED"); 21.279 + System.exit(97); 21.280 + } 21.281 + else 21.282 + { 21.283 + System.out.println("test_rce6 WORKED"); 21.284 + } 21.285 + 21.286 + result=0; 21.287 + r = test_rce7(box7); 21.288 + if (result != 14680079) 21.289 + { 21.290 + System.out.println(result); 21.291 + System.out.println("test_rce7 FAILED"); 21.292 + System.exit(97); 21.293 + } 21.294 + else 21.295 + { 21.296 + System.out.println("test_rce7 WORKED"); 21.297 + } 21.298 + 21.299 + result=0; 21.300 + r = test_rce8(box8); 21.301 + if (result != 16393) 21.302 + { 21.303 + System.out.println(result); 21.304 + System.out.println("test_rce8 FAILED"); 21.305 + System.exit(97); 21.306 + } 21.307 + else 21.308 + { 21.309 + System.out.println("test_rce8 WORKED"); 21.310 + } 21.311 + } 21.312 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/test/compiler/5091921/Test6186134.java Wed May 04 13:12:42 2011 -0700 22.3 @@ -0,0 +1,71 @@ 22.4 +/* 22.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.7 + * 22.8 + * This code is free software; you can redistribute it and/or modify it 22.9 + * under the terms of the GNU General Public License version 2 only, as 22.10 + * published by the Free Software Foundation. 22.11 + * 22.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 22.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22.15 + * version 2 for more details (a copy is included in the LICENSE file that 22.16 + * accompanied this code). 22.17 + * 22.18 + * You should have received a copy of the GNU General Public License version 22.19 + * 2 along with this work; if not, write to the Free Software Foundation, 22.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22.21 + * 22.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22.23 + * or visit www.oracle.com if you need additional information or have any 22.24 + * questions. 22.25 + * 22.26 + */ 22.27 + 22.28 +/** 22.29 + * @test 22.30 + * @bug 6186134 22.31 + * @summary Server virtual machine produces/exeutes incorrect code. 22.32 + * 22.33 + * @run main Test6186134 100000 22.34 + */ 22.35 +import java.util.ArrayList; 22.36 + 22.37 +public class Test6186134 { 22.38 + 22.39 + int num = 0; 22.40 + 22.41 + public Test6186134(int n) { 22.42 + num = n; 22.43 + } 22.44 + 22.45 + public boolean more() { 22.46 + return num-- > 0; 22.47 + } 22.48 + 22.49 + public ArrayList test1() { 22.50 + ArrayList res = new ArrayList(); 22.51 + int maxResults = Integer.MAX_VALUE; 22.52 + int n = 0; 22.53 + boolean more = more(); 22.54 + while ((n++ < maxResults) && more) { 22.55 + res.add(new Object()); 22.56 + more = more(); 22.57 + } 22.58 + return res; 22.59 + } 22.60 + 22.61 + public static void main(String[] pars) { 22.62 + int n = Integer.parseInt(pars[0]); 22.63 + for (int i=0; i<n; i++) { 22.64 + Test6186134 t = new Test6186134(10); 22.65 + int size = t.test1().size(); 22.66 + if (size != 10) { 22.67 + System.out.println("wrong size: " + size +", should be 10"); 22.68 + System.exit(97); 22.69 + } 22.70 + } 22.71 + System.out.println("Passed"); 22.72 + } 22.73 +} 22.74 +
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/compiler/5091921/Test6196102.java Wed May 04 13:12:42 2011 -0700 23.3 @@ -0,0 +1,47 @@ 23.4 +/* 23.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 + * or visit www.oracle.com if you need additional information or have any 23.24 + * questions. 23.25 + * 23.26 + */ 23.27 + 23.28 +/** 23.29 + * @test 23.30 + * @bug 6196102 23.31 + * @summary Integer seems to be greater than Integer.MAX_VALUE 23.32 + * 23.33 + * @run main Test6196102 23.34 + */ 23.35 + 23.36 +public class Test6196102 { 23.37 + static public void main(String[] args) { 23.38 + int i1 = 0; 23.39 + int i2 = Integer.MAX_VALUE; 23.40 + 23.41 + while (i1 >= 0) { 23.42 + i1++; 23.43 + if (i1 > i2) { 23.44 + System.out.println("E R R O R: " + i1); 23.45 + System.exit(97); 23.46 + } 23.47 + } 23.48 + } 23.49 +} 23.50 +
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/test/compiler/5091921/Test6357214.java Wed May 04 13:12:42 2011 -0700 24.3 @@ -0,0 +1,179 @@ 24.4 +/* 24.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 + * 24.8 + * This code is free software; you can redistribute it and/or modify it 24.9 + * under the terms of the GNU General Public License version 2 only, as 24.10 + * published by the Free Software Foundation. 24.11 + * 24.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 24.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.15 + * version 2 for more details (a copy is included in the LICENSE file that 24.16 + * accompanied this code). 24.17 + * 24.18 + * You should have received a copy of the GNU General Public License version 24.19 + * 2 along with this work; if not, write to the Free Software Foundation, 24.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.21 + * 24.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24.23 + * or visit www.oracle.com if you need additional information or have any 24.24 + * questions. 24.25 + * 24.26 + */ 24.27 + 24.28 +/** 24.29 + * @test 24.30 + * @bug 6357214 24.31 + * @summary Hotspot server compiler gets integer comparison wrong 24.32 + * 24.33 + * @run main/othervm/timeout=60 -DshowAll=ffo -DeventID=444 Test6357214 24.34 + */ 24.35 + 24.36 +// The test hangs after few iterations before the fix. So it fails if timeout. 24.37 +class MyResult { 24.38 + public boolean next() { 24.39 + return true; 24.40 + } 24.41 + 24.42 + public String getString(String in) { 24.43 + if (in.equals("id")) 24.44 + return "idFoo"; 24.45 + if (in.equals("contentKey")) 24.46 + return "ckFoo"; 24.47 + return "Foo"; 24.48 + } 24.49 + 24.50 + public int getInt(String in) { 24.51 + if (in.equals("processingComplete")) 24.52 + return 0; 24.53 + return 1; 24.54 + } 24.55 + 24.56 + public byte[] getBytes(String in) { 24.57 + byte[] arr = null; 24.58 + if (in.equals("content")) { 24.59 + arr = new byte[65536]; 24.60 + byte j = 32; 24.61 + for (int i=0; i<65536; i++) { 24.62 + arr[i] = j; 24.63 + if (++j == 127) 24.64 + j=32; 24.65 + } 24.66 + } 24.67 + return arr; 24.68 + } 24.69 +} 24.70 + 24.71 +public class Test6357214 { 24.72 + public static volatile boolean bollocks = true; 24.73 + public String create(String context) throws Exception { 24.74 + 24.75 + // 24.76 + // Extract HTTP parameters 24.77 + // 24.78 + 24.79 + boolean showAll = System.getProperty("showAll") != null; 24.80 + String eventID = System.getProperty("eventID"); 24.81 + String eventContentKey = System.getProperty("cKey"); 24.82 + // 24.83 + // Build ContentStaging query based on eventID or eventContentKey 24.84 + // 24.85 + 24.86 + String sql = "select id, processingComplete, contentKey, content " 24.87 + + "from ContentStaging cs, ContentStagingKey csk " 24.88 + + "where cs.eventContentKey = csk.eventContentKey "; 24.89 + 24.90 + if (eventID != null) { 24.91 + sql += "and id = " + eventID; 24.92 + } 24.93 + else if (eventContentKey != null) { 24.94 + sql += "and cs.eventContentKey = '" 24.95 + + eventContentKey 24.96 + + "' having id = max(id)"; 24.97 + } 24.98 + else { 24.99 + throw new Exception("Need eventID or eventContentKey"); 24.100 + } 24.101 + 24.102 + // 24.103 + // This factory builds a static panel, there is no JSP 24.104 + // 24.105 + 24.106 + StringBuffer html = new StringBuffer(); 24.107 + 24.108 + try { 24.109 + 24.110 + MyResult result = new MyResult(); 24.111 + if (result.next()) { 24.112 + 24.113 + eventID = result.getString("id"); 24.114 + int processingComplete = result.getInt("processingComplete"); 24.115 + String contentKey = result.getString("contentKey"); 24.116 + byte[] bytes = result.getBytes("content"); 24.117 + 24.118 + // 24.119 + // Print content status and associated controls 24.120 + // 24.121 + 24.122 + html.append("<br/><font class=\"small\">"); 24.123 + html.append("Status: "); 24.124 + switch (processingComplete) { 24.125 + case 0 : 24.126 + case 1 : html.append("PENDING"); break; 24.127 + case 2 : html.append(contentKey); break; 24.128 + case 3 : html.append(eventID); break; 24.129 + default : html.append("UNKNONW"); 24.130 + } 24.131 + html.append("</font><br/>"); 24.132 + 24.133 + // 24.134 + // Print at most 20Kb of content unless "showAll" is set 24.135 + // 24.136 + 24.137 + int limit = showAll ? Integer.MAX_VALUE : 1024 * 20; 24.138 + System.out.println(limit); 24.139 + html.append("<pre>"); 24.140 + for (int i = 0; bytes != null && i < bytes.length; i++) { 24.141 + char c = (char) bytes[i]; 24.142 + switch (c) { 24.143 + case '<' : html.append("<"); break; 24.144 + case '>' : html.append(">"); break; 24.145 + case '&' : html.append("&"); break; 24.146 + default : html.append(c); 24.147 + } 24.148 + 24.149 + if (i > limit) { 24.150 + while (bollocks); 24.151 + // System.out.println("i is " + i); 24.152 + // System.out.println("limit is " + limit); 24.153 + html.append("...\n</pre>"); 24.154 + html.append(eventID); 24.155 + html.append("<pre>"); 24.156 + break; 24.157 + } 24.158 + } 24.159 + html.append("</pre>"); 24.160 + } 24.161 + } 24.162 + catch (Exception exception) { 24.163 + throw exception; 24.164 + } 24.165 + finally { 24.166 + html.append("Oof!!"); 24.167 + } 24.168 + String ret = html.toString(); 24.169 + System.out.println("Returning string length = "+ ret.length()); 24.170 + return ret; 24.171 + } 24.172 + 24.173 + public static void main(String[] args) throws Exception { 24.174 + int length=0; 24.175 + 24.176 + for (int i = 0; i < 100; i++) { 24.177 + length = new Test6357214().create("boo").length(); 24.178 + System.out.println(length); 24.179 + } 24.180 + } 24.181 +} 24.182 +
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/test/compiler/5091921/Test6559156.java Wed May 04 13:12:42 2011 -0700 25.3 @@ -0,0 +1,81 @@ 25.4 +/* 25.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. 25.11 + * 25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.15 + * version 2 for more details (a copy is included in the LICENSE file that 25.16 + * accompanied this code). 25.17 + * 25.18 + * You should have received a copy of the GNU General Public License version 25.19 + * 2 along with this work; if not, write to the Free Software Foundation, 25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.21 + * 25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.23 + * or visit www.oracle.com if you need additional information or have any 25.24 + * questions. 25.25 + * 25.26 + */ 25.27 + 25.28 +/** 25.29 + * @test 25.30 + * @bug 6559156 25.31 + * @summary Server compiler generates bad code for "<= Integer.MAX_VALUE" expression 25.32 + * 25.33 + * @run main Test6559156 25.34 + */ 25.35 + 25.36 +public class Test6559156 { 25.37 + 25.38 + static final int N_TESTS = 1000000; 25.39 + 25.40 + public static void main(String[] args) throws Exception { 25.41 + 25.42 + /* 25.43 + * If MAX_VALUE is changed to MAX_VALUE - 1 below, the test passes 25.44 + * because (apparently) bad code is only generated when comparing 25.45 + * <= MAX_VALUE in the doTest method. 25.46 + */ 25.47 + Test6559156 test = new Test6559156(); 25.48 + for (int i = 0; i < N_TESTS; i += 1) { 25.49 + test.doTest1(10, Integer.MAX_VALUE, i); 25.50 + test.doTest2(10, Integer.MAX_VALUE, i); 25.51 + } 25.52 + System.out.println("No failure"); 25.53 + } 25.54 + 25.55 + void doTest1(int expected, int max, int i) { 25.56 + int counted; 25.57 + for (counted = 0; 25.58 + (counted <= max) && (counted < expected); 25.59 + counted += 1) { 25.60 + } 25.61 + if (counted != expected) { 25.62 + throw new RuntimeException("Failed test1 iteration=" + i + 25.63 + " max=" + max + 25.64 + " counted=" + counted + 25.65 + " expected=" + expected); 25.66 + } 25.67 + } 25.68 + 25.69 + void doTest2(int expected, int max, int i) { 25.70 + int counted; 25.71 + for (counted = 0; 25.72 + // change test sequence. 25.73 + (counted < expected) && (counted <= max); 25.74 + counted += 1) { 25.75 + } 25.76 + if (counted != expected) { 25.77 + throw new RuntimeException("Failed test1 iteration=" + i + 25.78 + " max=" + max + 25.79 + " counted=" + counted + 25.80 + " expected=" + expected); 25.81 + } 25.82 + } 25.83 +} 25.84 +
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/compiler/5091921/Test6753639.java Wed May 04 13:12:42 2011 -0700 26.3 @@ -0,0 +1,50 @@ 26.4 +/* 26.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 + * or visit www.oracle.com if you need additional information or have any 26.24 + * questions. 26.25 + * 26.26 + */ 26.27 + 26.28 +/** 26.29 + * @test 26.30 + * @bug 6753639 26.31 + * @summary Strange optimisation in for loop with cyclic integer condition 26.32 + * 26.33 + * @run main/othervm -Xbatch Test6753639 26.34 + */ 26.35 + 26.36 +public class Test6753639 { 26.37 + public static void main(String[] args) throws InterruptedException { 26.38 + int END = Integer.MAX_VALUE; 26.39 + int count = 0; 26.40 + for(int i = Integer.MAX_VALUE - 5; i <= END; i++) { 26.41 + count++; 26.42 + if (count > 100000) { 26.43 + System.out.println("Passed"); 26.44 + System.exit(95); 26.45 + } 26.46 + } 26.47 + System.out.println("broken " + count); 26.48 + System.out.println("FAILED"); 26.49 + System.exit(97); 26.50 + } 26.51 +} 26.52 + 26.53 +
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/compiler/5091921/Test6850611.java Wed May 04 13:12:42 2011 -0700 27.3 @@ -0,0 +1,53 @@ 27.4 +/* 27.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 + * 27.8 + * This code is free software; you can redistribute it and/or modify it 27.9 + * under the terms of the GNU General Public License version 2 only, as 27.10 + * published by the Free Software Foundation. 27.11 + * 27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 + * version 2 for more details (a copy is included in the LICENSE file that 27.16 + * accompanied this code). 27.17 + * 27.18 + * You should have received a copy of the GNU General Public License version 27.19 + * 2 along with this work; if not, write to the Free Software Foundation, 27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 + * 27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 27.23 + * or visit www.oracle.com if you need additional information or have any 27.24 + * questions. 27.25 + * 27.26 + */ 27.27 + 27.28 +/** 27.29 + * @test 27.30 + * @bug 6850611 27.31 + * @summary int / long arithmetic seems to be broken in 1.6.0_14 HotSpot Server VM (Win XP) 27.32 + * 27.33 + * @run main Test6850611 27.34 + */ 27.35 + 27.36 +public class Test6850611 { 27.37 + 27.38 + public static void main(String[] args) { 27.39 + test(); 27.40 + } 27.41 + 27.42 + private static void test() { 27.43 + for (int j = 0; j < 5; ++j) { 27.44 + long x = 0; 27.45 + for (int i = Integer.MIN_VALUE; i < Integer.MAX_VALUE; ++i) { 27.46 + x += i; 27.47 + } 27.48 + System.out.println("sum: " + x); 27.49 + if (x != -4294967295l) { 27.50 + System.out.println("FAILED"); 27.51 + System.exit(97); 27.52 + } 27.53 + } 27.54 + } 27.55 +} 27.56 +
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/test/compiler/5091921/Test6890943.java Wed May 04 13:12:42 2011 -0700 28.3 @@ -0,0 +1,189 @@ 28.4 +/* 28.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.7 + * 28.8 + * This code is free software; you can redistribute it and/or modify it 28.9 + * under the terms of the GNU General Public License version 2 only, as 28.10 + * published by the Free Software Foundation. 28.11 + * 28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.15 + * version 2 for more details (a copy is included in the LICENSE file that 28.16 + * accompanied this code). 28.17 + * 28.18 + * You should have received a copy of the GNU General Public License version 28.19 + * 2 along with this work; if not, write to the Free Software Foundation, 28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.21 + * 28.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 28.23 + * or visit www.oracle.com if you need additional information or have any 28.24 + * questions. 28.25 + * 28.26 + */ 28.27 + 28.28 +/** 28.29 + * @test 28.30 + * @bug 6890943 28.31 + * @summary JVM mysteriously gives wrong result on 64-bit 1.6 VMs in hotspot mode. 28.32 + * 28.33 + * @run shell Test6890943.sh 28.34 + */ 28.35 +import java.util.*; 28.36 +import java.io.*; 28.37 +import java.util.regex.*; 28.38 + 28.39 +public class Test6890943 { 28.40 + public static final boolean AIR = true, ROCK = false; 28.41 + public static void main(String[] args) { 28.42 + new Test6890943().go(); 28.43 + } 28.44 + 28.45 + int r, c, f, t; 28.46 + boolean[][] grid; 28.47 + 28.48 + public void go() { 28.49 + Scanner s = new Scanner(System.in); 28.50 + s.useDelimiter("\\s+"); 28.51 + int T = s.nextInt(); 28.52 + for (t = 0 ; t < T ; t++) { 28.53 + r = s.nextInt(); c = s.nextInt(); f = s.nextInt(); 28.54 + grid = new boolean[r][c]; 28.55 + for (int x = 0 ; x < r ; x++) { 28.56 + String line = s.next(); 28.57 + for (int y = 0 ; y < c ; y++) grid[x][y] = line.charAt(y) == '.'; 28.58 + } 28.59 + int digs = solve(); 28.60 + String res = digs == -1 ? "No" : "Yes " + digs; 28.61 + System.out.printf("Case #%d: %s\n", t+1, res); 28.62 + } 28.63 + } 28.64 + 28.65 + Map<Integer, Integer> M = new HashMap<Integer, Integer>(); 28.66 + 28.67 + private int solve() { 28.68 + M = new HashMap<Integer, Integer>(); 28.69 + M.put(calcWalkingRange(0, 0), 0); 28.70 + for (int digDown = 0 ; digDown < r ; digDown++) { 28.71 + Map<Integer, Integer> tries = new HashMap<Integer, Integer>(); 28.72 + for (Map.Entry<Integer, Integer> m : M.entrySet()) { 28.73 + int q = m.getKey(); 28.74 + if (depth(q) != (digDown)) continue; 28.75 + if (stuck(q)) continue; 28.76 + tries.put(q, m.getValue()); 28.77 + } 28.78 + 28.79 + for (Map.Entry<Integer, Integer> m : tries.entrySet()) { 28.80 + int q = m.getKey(); 28.81 + int fallLeftDelta = 0, fallRightDelta = 0; 28.82 + //fall left 28.83 + int fallLeft = fall(digDown, start(q)); 28.84 + if (fallLeft > 0) { 28.85 + fallLeftDelta = 1; 28.86 + if (fallLeft <= f) addToM(calcWalkingRange(digDown+fallLeft, start(q)), m.getValue()); 28.87 + } 28.88 + 28.89 + //fall right 28.90 + int fallRight = fall(digDown, end(q)); 28.91 + if (fallRight > 0) { 28.92 + fallRightDelta = 1; 28.93 + 28.94 + if (fallRight <= f) addToM(calcWalkingRange(digDown+fallRight, end(q)), m.getValue()); 28.95 + } 28.96 + 28.97 + for (int p = start(q) + fallLeftDelta ; p <= end(q) - fallRightDelta ; p++) { 28.98 + //goLeft 28.99 + for (int digSpot = p ; digSpot > start(q) +fallLeftDelta ; digSpot--) { 28.100 + int fallDown = 1+fall(digDown+1, digSpot); 28.101 + if (fallDown <= f) { 28.102 + if (fallDown == 1) { 28.103 + addToM(calcWalkingRange(digDown + 1, digSpot, digSpot, p), m.getValue() + Math.abs(digSpot-p)+1); 28.104 + } else { 28.105 + addToM(calcWalkingRange(digDown + fallDown, digSpot), m.getValue() + Math.abs(digSpot-p)+1); 28.106 + } 28.107 + } 28.108 + } 28.109 + 28.110 + //goRight 28.111 + for (int digSpot = p ; digSpot < end(q)-fallRightDelta ;digSpot++) { 28.112 + int fallDown = 1+fall(digDown+1, digSpot); 28.113 + if (fallDown <= f) { 28.114 + if (fallDown == 1) { 28.115 + addToM(calcWalkingRange(digDown + 1, digSpot, p, digSpot), m.getValue() + Math.abs(digSpot-p)+1); 28.116 + } else { 28.117 + addToM(calcWalkingRange(digDown + fallDown, digSpot), m.getValue() + Math.abs(digSpot-p)+1); 28.118 + } 28.119 + } 28.120 + } 28.121 + } 28.122 + } 28.123 + } 28.124 + 28.125 + int result = Integer.MAX_VALUE; 28.126 + for (Map.Entry<Integer, Integer> m : M.entrySet()) { 28.127 + if (depth(m.getKey()) == r-1) result = Math.min(m.getValue(), result); 28.128 + } 28.129 + 28.130 + if (result == Integer.MAX_VALUE) return -1; 28.131 + return result; 28.132 + } 28.133 + 28.134 + private void addToM(int q, int i) { 28.135 + Integer original = M.get(q); 28.136 + if ( original == null ) M.put(q, i); 28.137 + else M.put(q, Math.min(original, i)); 28.138 + } 28.139 + 28.140 + private int fall(int row, int column) { 28.141 + int res = 0; 28.142 + for ( int p = row+1 ; p < r ; p++) { 28.143 + if (grid[p][column] == AIR) res++; 28.144 + else break; 28.145 + } 28.146 + return res; 28.147 + } 28.148 + 28.149 + private boolean stuck(int q) { 28.150 + return start(q) == end(q); 28.151 + } 28.152 + 28.153 + private int depth(int q) { 28.154 + return q % 50; 28.155 + } 28.156 + 28.157 + private int start(int q) { 28.158 + return q / (50*50); 28.159 + } 28.160 + 28.161 + private int end(int q) { 28.162 + return (q / 50) % 50; 28.163 + } 28.164 + 28.165 + private int calcWalkingRange(int depth, int pos) { 28.166 + return calcWalkingRange(depth, pos, Integer.MAX_VALUE, Integer.MIN_VALUE); 28.167 + } 28.168 + 28.169 + private int calcWalkingRange(int depth, int pos, int airOverrideStart, int airOverrideEnd) { 28.170 + int left = pos, right = pos; 28.171 + if (depth >= r) return (c-1)*50 + depth; 28.172 + 28.173 + while (left > 0) { 28.174 + if (grid[depth][left-1] == ROCK && (left-1 < airOverrideStart || left-1 > airOverrideEnd)) break; 28.175 + if (depth < r-1 && grid[depth+1][left-1] == AIR) { 28.176 + left--; 28.177 + break; 28.178 + } 28.179 + left--; 28.180 + } 28.181 + while (right < c-1) { 28.182 + if (grid[depth][right+1] == ROCK && (right+1 < airOverrideStart || right+1 > airOverrideEnd)) break; 28.183 + if (depth < r-1 && grid[depth+1][right+1] == AIR) { 28.184 + right++; 28.185 + break; 28.186 + } 28.187 + right++; 28.188 + } 28.189 + 28.190 + return left *50*50 + right*50 + depth; 28.191 + } 28.192 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/test/compiler/5091921/Test6890943.sh Wed May 04 13:12:42 2011 -0700 29.3 @@ -0,0 +1,67 @@ 29.4 +#!/bin/sh 29.5 +# 29.6 +# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 29.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.8 +# 29.9 +# This code is free software; you can redistribute it and/or modify it 29.10 +# under the terms of the GNU General Public License version 2 only, as 29.11 +# published by the Free Software Foundation. 29.12 +# 29.13 +# This code is distributed in the hope that it will be useful, but WITHOUT 29.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.15 +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.16 +# version 2 for more details (a copy is included in the LICENSE file that 29.17 +# accompanied this code). 29.18 +# 29.19 +# You should have received a copy of the GNU General Public License version 29.20 +# 2 along with this work; if not, write to the Free Software Foundation, 29.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.22 +# 29.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 29.24 +# or visit www.oracle.com if you need additional information or have any 29.25 +# questions. 29.26 +# 29.27 +# 29.28 + 29.29 +if [ "${TESTSRC}" = "" ] 29.30 +then 29.31 + echo "TESTSRC not set. Test cannot execute. Failed." 29.32 + exit 1 29.33 +fi 29.34 +echo "TESTSRC=${TESTSRC}" 29.35 +if [ "${TESTJAVA}" = "" ] 29.36 +then 29.37 + echo "TESTJAVA not set. Test cannot execute. Failed." 29.38 + exit 1 29.39 +fi 29.40 +echo "TESTJAVA=${TESTJAVA}" 29.41 +if [ "${TESTCLASSES}" = "" ] 29.42 +then 29.43 + echo "TESTCLASSES not set. Test cannot execute. Failed." 29.44 + exit 1 29.45 +fi 29.46 +echo "TESTCLASSES=${TESTCLASSES}" 29.47 +echo "CLASSPATH=${CLASSPATH}" 29.48 + 29.49 +set -x 29.50 + 29.51 +cp ${TESTSRC}/Test6890943.java . 29.52 +cp ${TESTSRC}/input6890943.txt . 29.53 +cp ${TESTSRC}/output6890943.txt . 29.54 +cp ${TESTSRC}/Test6890943.sh . 29.55 + 29.56 +${TESTJAVA}/bin/javac -d . Test6890943.java 29.57 + 29.58 +${TESTJAVA}/bin/java ${TESTVMOPTS} Test6890943 < input6890943.txt > test.out 2>&1 29.59 + 29.60 +diff output6890943.txt test.out 29.61 + 29.62 +result=$? 29.63 +if [ $result -eq 0 ] 29.64 +then 29.65 + echo "Passed" 29.66 + exit 0 29.67 +else 29.68 + echo "Failed" 29.69 + exit 1 29.70 +fi
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/compiler/5091921/Test6897150.java Wed May 04 13:12:42 2011 -0700 30.3 @@ -0,0 +1,58 @@ 30.4 +/* 30.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 + * 30.8 + * This code is free software; you can redistribute it and/or modify it 30.9 + * under the terms of the GNU General Public License version 2 only, as 30.10 + * published by the Free Software Foundation. 30.11 + * 30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.15 + * version 2 for more details (a copy is included in the LICENSE file that 30.16 + * accompanied this code). 30.17 + * 30.18 + * You should have received a copy of the GNU General Public License version 30.19 + * 2 along with this work; if not, write to the Free Software Foundation, 30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.21 + * 30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.23 + * or visit www.oracle.com if you need additional information or have any 30.24 + * questions. 30.25 + * 30.26 + */ 30.27 + 30.28 +/** 30.29 + * @test 30.30 + * @bug 6897150 30.31 + * @summary Hotspot optimises away a valid loop 30.32 + * 30.33 + * @run main Test6897150 30.34 + */ 30.35 + 30.36 +// Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. 30.37 +public class Test6897150 { 30.38 + public static void main(String[] args) { 30.39 + // This works 30.40 + loopAndPrint(Integer.MAX_VALUE -1); 30.41 + // This doesn't 30.42 + loopAndPrint(Integer.MAX_VALUE); 30.43 + } 30.44 + 30.45 + static void verify(int max, int a) { 30.46 + if ( a != (max - 1)) { 30.47 + System.out.println("Expected: " + (max - 1)); 30.48 + System.out.println("Actual : " + a); 30.49 + System.exit(97); 30.50 + } 30.51 + } 30.52 + static void loopAndPrint(int max) { 30.53 + int a = -1; 30.54 + int i = 1; 30.55 + for (; i < max; i++) { 30.56 + a = i; 30.57 + } 30.58 + verify(max, a); 30.59 + } 30.60 +} 30.61 +
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/test/compiler/5091921/Test6905845.java Wed May 04 13:12:42 2011 -0700 31.3 @@ -0,0 +1,76 @@ 31.4 +/* 31.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.7 + * 31.8 + * This code is free software; you can redistribute it and/or modify it 31.9 + * under the terms of the GNU General Public License version 2 only, as 31.10 + * published by the Free Software Foundation. 31.11 + * 31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.15 + * version 2 for more details (a copy is included in the LICENSE file that 31.16 + * accompanied this code). 31.17 + * 31.18 + * You should have received a copy of the GNU General Public License version 31.19 + * 2 along with this work; if not, write to the Free Software Foundation, 31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.21 + * 31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 31.23 + * or visit www.oracle.com if you need additional information or have any 31.24 + * questions. 31.25 + * 31.26 + */ 31.27 + 31.28 +/** 31.29 + * @test 31.30 + * @bug 6905845 31.31 + * @summary Server VM improperly optimizing away loop. 31.32 + * 31.33 + * @run main Test6905845 31.34 + */ 31.35 + 31.36 +public class Test6905845 { 31.37 + 31.38 + public static void main(String[] args){ 31.39 + for (int asdf = 0; asdf < 5; asdf++){ 31.40 + //test block 31.41 + { 31.42 + StringBuilder strBuf1 = new StringBuilder(65); 31.43 + long start = System.currentTimeMillis(); 31.44 + int count = 0; 31.45 + 31.46 + for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ 31.47 + strBuf1.append(i); 31.48 + count++; 31.49 + strBuf1.delete(0, 65); 31.50 + } 31.51 + 31.52 + System.out.println(count); 31.53 + if (count != 54366674) { 31.54 + System.out.println("wrong count: " + count +", should be 54366674"); 31.55 + System.exit(97); 31.56 + } 31.57 + } 31.58 + //test block 31.59 + { 31.60 + StringBuilder strBuf1 = new StringBuilder(65); 31.61 + long start = System.currentTimeMillis(); 31.62 + int count = 0; 31.63 + 31.64 + for (int i = Integer.MIN_VALUE; i < (Integer.MAX_VALUE - 80); i += 79){ 31.65 + strBuf1.append(i); 31.66 + count++; 31.67 + strBuf1.delete(0, 65); 31.68 + } 31.69 + 31.70 + System.out.println(count); 31.71 + if (count != 54366674) { 31.72 + System.out.println("wrong count: " + count +", should be 54366674"); 31.73 + System.exit(97); 31.74 + } 31.75 + } 31.76 + } 31.77 + } 31.78 +} 31.79 +
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/compiler/5091921/Test6931567.java Wed May 04 13:12:42 2011 -0700 32.3 @@ -0,0 +1,62 @@ 32.4 +/* 32.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 32.23 + * or visit www.oracle.com if you need additional information or have any 32.24 + * questions. 32.25 + * 32.26 + */ 32.27 + 32.28 +/** 32.29 + * @test 32.30 + * @bug 6931567 32.31 + * @summary JIT Error (on class file compiled with eclipse) on JVM x64 (but not on x32!). 32.32 + * 32.33 + * @run main Test6931567 32.34 + */ 32.35 + 32.36 +// Should be compiled with javac from JDK1.3 to get bytecode which shows the problem. 32.37 +public class Test6931567 { 32.38 + 32.39 + public static void main(final String[] args) { 32.40 + booleanInvert(Integer.MAX_VALUE); 32.41 + booleanInvert(Integer.MAX_VALUE - 1); 32.42 + } 32.43 + 32.44 + private static void booleanInvert(final int max) { 32.45 + boolean test1 = false; 32.46 + boolean test2 = false; 32.47 + 32.48 + for (int i = 0; i < max; i++) { 32.49 + test1 = !test1; 32.50 + } 32.51 + 32.52 + for (int i = 0; i < max; i++) { 32.53 + test2 ^= true; 32.54 + } 32.55 + 32.56 + if (test1 != test2) { 32.57 + System.out.println("ERROR: Boolean invert\n\ttest1=" + test1 32.58 + + "\n\ttest2=" + test2); 32.59 + System.exit(97); 32.60 + } else { 32.61 + System.out.println("Passed!"); 32.62 + } 32.63 + } 32.64 +} 32.65 +
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/test/compiler/5091921/Test6935022.java Wed May 04 13:12:42 2011 -0700 33.3 @@ -0,0 +1,74 @@ 33.4 +/* 33.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.7 + * 33.8 + * This code is free software; you can redistribute it and/or modify it 33.9 + * under the terms of the GNU General Public License version 2 only, as 33.10 + * published by the Free Software Foundation. 33.11 + * 33.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 33.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.15 + * version 2 for more details (a copy is included in the LICENSE file that 33.16 + * accompanied this code). 33.17 + * 33.18 + * You should have received a copy of the GNU General Public License version 33.19 + * 2 along with this work; if not, write to the Free Software Foundation, 33.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.21 + * 33.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 33.23 + * or visit www.oracle.com if you need additional information or have any 33.24 + * questions. 33.25 + * 33.26 + */ 33.27 + 33.28 +/** 33.29 + * @test 33.30 + * @bug 6935022 33.31 + * @summary Server VM incorrectly breaks out of while loop 33.32 + * 33.33 + * @run main Test6935022 33.34 + */ 33.35 + 33.36 +public class Test6935022 { 33.37 + public static final void main(String[] args) throws Exception { 33.38 + Test6935022 test = new Test6935022(); 33.39 + 33.40 + int cnt = 0; 33.41 + 33.42 + while (cnt < 10000) { 33.43 + try { 33.44 + ++cnt; 33.45 + if ((cnt&1023) == 0) 33.46 + System.out.println("Thread="+Thread.currentThread().getName() + " iteration: " + cnt); 33.47 + test.loop(2147483647, (cnt&1023)); 33.48 + } 33.49 + 33.50 + catch (Exception e) { 33.51 + System.out.println("Caught on iteration " + cnt); 33.52 + e.printStackTrace(); 33.53 + System.exit(97); 33.54 + } 33.55 + } 33.56 + } 33.57 + 33.58 + private void loop(int endingRow, int mask) throws Exception { 33.59 + int rows = 1; 33.60 + boolean next = true; 33.61 + 33.62 + while(rows <= endingRow && next) { 33.63 + rows++; 33.64 + if (rows == mask) 33.65 + System.out.println("Rows="+rows+", end="+endingRow+", next="+next); 33.66 + next = next(rows); 33.67 + } 33.68 + 33.69 + if (next) 33.70 + throw new Exception("Ended on rows(no rs): " + rows); 33.71 + } 33.72 + 33.73 + private boolean next(int rows) { 33.74 + return rows < 12; 33.75 + } 33.76 +} 33.77 +
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/test/compiler/5091921/Test6959129.java Wed May 04 13:12:42 2011 -0700 34.3 @@ -0,0 +1,90 @@ 34.4 +/* 34.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.7 + * 34.8 + * This code is free software; you can redistribute it and/or modify it 34.9 + * under the terms of the GNU General Public License version 2 only, as 34.10 + * published by the Free Software Foundation. 34.11 + * 34.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 34.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 34.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 34.15 + * version 2 for more details (a copy is included in the LICENSE file that 34.16 + * accompanied this code). 34.17 + * 34.18 + * You should have received a copy of the GNU General Public License version 34.19 + * 2 along with this work; if not, write to the Free Software Foundation, 34.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 34.21 + * 34.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 34.23 + * or visit www.oracle.com if you need additional information or have any 34.24 + * questions. 34.25 + * 34.26 + */ 34.27 + 34.28 +/** 34.29 + * @test 34.30 + * @bug 6959129 34.31 + * @summary COMPARISON WITH INTEGER.MAX_INT DOES NOT WORK CORRECTLY IN THE CLIENT VM. 34.32 + * 34.33 + * @run main/othervm -ea Test6959129 34.34 + */ 34.35 + 34.36 +public class Test6959129 { 34.37 + 34.38 + public static void main(String[] args) { 34.39 + long start = System.currentTimeMillis(); 34.40 + int min = Integer.MAX_VALUE-30000; 34.41 + int max = Integer.MAX_VALUE; 34.42 + long maxmoves = 0; 34.43 + try { 34.44 + maxmoves = maxMoves(min, max); 34.45 + } catch (AssertionError e) { 34.46 + System.out.println("Passed"); 34.47 + System.exit(95); 34.48 + } 34.49 + System.out.println("maxMove:" + maxmoves); 34.50 + System.out.println("FAILED"); 34.51 + System.exit(97); 34.52 + } 34.53 + /** 34.54 + * Imperative implementation that returns the length hailstone moves 34.55 + * for a given number. 34.56 + */ 34.57 + public static long hailstoneLengthImp(long n) { 34.58 + long moves = 0; 34.59 + while (n != 1) { 34.60 + assert n > 1; 34.61 + if (isEven(n)) { 34.62 + n = n / 2; 34.63 + } else { 34.64 + n = 3 * n + 1; 34.65 + } 34.66 + ++moves; 34.67 + } 34.68 + return moves; 34.69 + } 34.70 + 34.71 + private static boolean isEven(long n) { 34.72 + return n % 2 == 0; 34.73 + } 34.74 + 34.75 + /** 34.76 + * Returns the maximum length of the hailstone sequence for numbers 34.77 + * between min to max. 34.78 + * 34.79 + * For rec1 - Assume that min is bigger than max. 34.80 + */ 34.81 + public static long maxMoves(int min, int max) { 34.82 + long maxmoves = 0; 34.83 + for (int n = min; n <= max; n++) { 34.84 + if ((n & 1023) == 0) System.out.println(n); 34.85 + long moves = hailstoneLengthImp(n); 34.86 + if (moves > maxmoves) { 34.87 + maxmoves = moves; 34.88 + } 34.89 + } 34.90 + return maxmoves; 34.91 + } 34.92 +} 34.93 +
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/test/compiler/5091921/Test6985295.java Wed May 04 13:12:42 2011 -0700 35.3 @@ -0,0 +1,53 @@ 35.4 +/* 35.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.7 + * 35.8 + * This code is free software; you can redistribute it and/or modify it 35.9 + * under the terms of the GNU General Public License version 2 only, as 35.10 + * published by the Free Software Foundation. 35.11 + * 35.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 35.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 35.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 35.15 + * version 2 for more details (a copy is included in the LICENSE file that 35.16 + * accompanied this code). 35.17 + * 35.18 + * You should have received a copy of the GNU General Public License version 35.19 + * 2 along with this work; if not, write to the Free Software Foundation, 35.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 35.21 + * 35.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 35.23 + * or visit www.oracle.com if you need additional information or have any 35.24 + * questions. 35.25 + * 35.26 + */ 35.27 + 35.28 +/** 35.29 + * @test 35.30 + * @bug 6985295 35.31 + * @summary JVM fails to evaluate condition randomly 35.32 + * 35.33 + * @run main/othervm -Xbatch Test6985295 35.34 + */ 35.35 + 35.36 +public class Test6985295 { 35.37 + 35.38 + public static void main(String[] args) { 35.39 + int min = Integer.MAX_VALUE-50000; 35.40 + int max = Integer.MAX_VALUE; 35.41 + System.out.println("max = " + max); 35.42 + long counter = 0; 35.43 + int i; 35.44 + for(i = min; i <= max; i++) { 35.45 + counter++; 35.46 + if (counter > 1000000) { 35.47 + System.out.println("Passed"); 35.48 + System.exit(95); 35.49 + } 35.50 + } 35.51 + System.out.println("iteration went " + counter + " times (" + i + ")"); 35.52 + System.out.println("FAILED"); 35.53 + System.exit(97); 35.54 + } 35.55 +} 35.56 +
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/test/compiler/5091921/Test6992759.java Wed May 04 13:12:42 2011 -0700 36.3 @@ -0,0 +1,66 @@ 36.4 +/* 36.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.7 + * 36.8 + * This code is free software; you can redistribute it and/or modify it 36.9 + * under the terms of the GNU General Public License version 2 only, as 36.10 + * published by the Free Software Foundation. 36.11 + * 36.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 36.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 36.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 36.15 + * version 2 for more details (a copy is included in the LICENSE file that 36.16 + * accompanied this code). 36.17 + * 36.18 + * You should have received a copy of the GNU General Public License version 36.19 + * 2 along with this work; if not, write to the Free Software Foundation, 36.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 36.21 + * 36.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 36.23 + * or visit www.oracle.com if you need additional information or have any 36.24 + * questions. 36.25 + * 36.26 + */ 36.27 + 36.28 +/** 36.29 + * @test 36.30 + * @bug 6992759 36.31 + * @summary Bad code generated for integer <= comparison, fails for Integer.MAX_VALUE 36.32 + * 36.33 + * @run main Test6992759 36.34 + */ 36.35 + 36.36 +public class Test6992759 { 36.37 + 36.38 + static final int N_TESTS = 1000000000; 36.39 + 36.40 + public static void main(String[] args) throws Exception { 36.41 + 36.42 + /* 36.43 + * If MAX_VALUE is changed to MAX_VALUE - 1 below, the test passes 36.44 + * because (apparently) bad code is only generated when comparing 36.45 + * <= MAX_VALUE in the doTest method. 36.46 + */ 36.47 + Test6992759 test = new Test6992759(); 36.48 + for (int i = 0; i < N_TESTS; i += 1) { 36.49 + test.doTest(10, Integer.MAX_VALUE, i); 36.50 + //test.doTest(10, Integer.MAX_VALUE - 1, i); 36.51 + } 36.52 + System.out.println("No failure"); 36.53 + } 36.54 + 36.55 + void doTest(int expected, int max, int i) { 36.56 + int counted; 36.57 + for (counted = 0; 36.58 + (counted <= max) && (counted < expected); 36.59 + counted += 1) { 36.60 + } 36.61 + if (counted != expected) { 36.62 + throw new RuntimeException("Failed test iteration=" + i + 36.63 + " max=" + max + 36.64 + " counted=" + counted + 36.65 + " expected=" + expected); 36.66 + } 36.67 + } 36.68 +} 36.69 +
37.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 37.2 +++ b/test/compiler/5091921/Test7005594.java Wed May 04 13:12:42 2011 -0700 37.3 @@ -0,0 +1,59 @@ 37.4 +/* 37.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 37.7 + * 37.8 + * This code is free software; you can redistribute it and/or modify it 37.9 + * under the terms of the GNU General Public License version 2 only, as 37.10 + * published by the Free Software Foundation. 37.11 + * 37.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 37.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 37.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 37.15 + * version 2 for more details (a copy is included in the LICENSE file that 37.16 + * accompanied this code). 37.17 + * 37.18 + * You should have received a copy of the GNU General Public License version 37.19 + * 2 along with this work; if not, write to the Free Software Foundation, 37.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 37.21 + * 37.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 37.23 + * or visit www.oracle.com if you need additional information or have any 37.24 + * questions. 37.25 + * 37.26 + */ 37.27 + 37.28 +/** 37.29 + * @test 37.30 + * @bug 7005594 37.31 + * @summary Array overflow not handled correctly with loop optimzations 37.32 + * 37.33 + * @run main/othervm -Xms2048m -Xcomp -XX:CompileOnly=Test7005594.test Test7005594 37.34 + */ 37.35 + 37.36 +public class Test7005594 { 37.37 + 37.38 + static int test(byte a[]){ 37.39 + int result=0; 37.40 + for( int i=0; i<a.length; i+=((0x7fffffff>>1)+1) ){ 37.41 + result += a[i]; 37.42 + } 37.43 + return result; 37.44 + } 37.45 + 37.46 + public static void main(String [] args){ 37.47 + byte a[]=new byte[(0x7fffffff>>1)+2]; 37.48 + int result = 0; 37.49 + try { 37.50 + result = test(a); 37.51 + } catch (ArrayIndexOutOfBoundsException e) { 37.52 + e.printStackTrace(System.out); 37.53 + System.out.println("Passed"); 37.54 + System.exit(95); 37.55 + } 37.56 + System.out.println(result); 37.57 + System.out.println("FAILED"); 37.58 + System.exit(97); 37.59 + } 37.60 + 37.61 +} 37.62 +
38.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 38.2 +++ b/test/compiler/5091921/Test7020614.java Wed May 04 13:12:42 2011 -0700 38.3 @@ -0,0 +1,58 @@ 38.4 +/* 38.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 38.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 38.7 + * 38.8 + * This code is free software; you can redistribute it and/or modify it 38.9 + * under the terms of the GNU General Public License version 2 only, as 38.10 + * published by the Free Software Foundation. 38.11 + * 38.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 38.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 38.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 38.15 + * version 2 for more details (a copy is included in the LICENSE file that 38.16 + * accompanied this code). 38.17 + * 38.18 + * You should have received a copy of the GNU General Public License version 38.19 + * 2 along with this work; if not, write to the Free Software Foundation, 38.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 38.21 + * 38.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 38.23 + * or visit www.oracle.com if you need additional information or have any 38.24 + * questions. 38.25 + * 38.26 + */ 38.27 + 38.28 +/** 38.29 + * @test 38.30 + * @bug 7020614 38.31 + * @summary "-server" mode optimizer makes code hang 38.32 + * 38.33 + * @run main/othervm/timeout=30 -Xbatch Test7020614 38.34 + */ 38.35 + 38.36 +public class Test7020614 { 38.37 + 38.38 + private static final int ITERATIONS = 1000; 38.39 + private static int doNotOptimizeOut = 0; 38.40 + 38.41 + public static long bitCountShort() { 38.42 + long t0 = System.currentTimeMillis(); 38.43 + int sum = 0; 38.44 + for (int it = 0; it < ITERATIONS; ++it) { 38.45 + short value = 0; 38.46 + do { 38.47 + sum += Integer.bitCount(value); 38.48 + } while (++value != 0); 38.49 + } 38.50 + doNotOptimizeOut += sum; 38.51 + return System.currentTimeMillis() - t0; 38.52 + } 38.53 + 38.54 + public static void main(String[] args) { 38.55 + for (int i = 0; i < 4; ++i) { 38.56 + System.out.println((i + 1) + ": " + bitCountShort()); 38.57 + } 38.58 + System.out.println("doNotOptimizeOut value: " + doNotOptimizeOut); 38.59 + } 38.60 +} 38.61 +
39.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 39.2 +++ b/test/compiler/5091921/input6890943.txt Wed May 04 13:12:42 2011 -0700 39.3 @@ -0,0 +1,1543 @@ 39.4 +50 39.5 +4 5 1 39.6 +..... 39.7 +##### 39.8 +..### 39.9 +.#... 39.10 +4 5 1 39.11 +..... 39.12 +##### 39.13 +###.. 39.14 +...#. 39.15 +5 4 2 39.16 +.... 39.17 +#### 39.18 +..## 39.19 +.### 39.20 +.#.# 39.21 +6 10 5 39.22 +.......... 39.23 +####.##### 39.24 +####.##### 39.25 +####.##### 39.26 +####.##### 39.27 +####.##### 39.28 +6 10 4 39.29 +.......... 39.30 +#....##### 39.31 +#....##### 39.32 +#....##### 39.33 +#....##### 39.34 +#....##### 39.35 +6 10 1 39.36 +.......... 39.37 +####.##### 39.38 +####.##### 39.39 +####.##### 39.40 +####.##### 39.41 +####.##### 39.42 +6 10 2 39.43 +.......... 39.44 +####.##### 39.45 +####.##### 39.46 +####.##### 39.47 +####.##### 39.48 +####.##### 39.49 +6 11 2 39.50 +.....###### 39.51 +########### 39.52 +###.......# 39.53 +###.#.#...# 39.54 +###.#.##..# 39.55 +###.#.###.# 39.56 +6 11 1 39.57 +.....###### 39.58 +########### 39.59 +###.......# 39.60 +###.#.#...# 39.61 +###.#.##..# 39.62 +###.#.###.# 39.63 +6 11 2 39.64 +.......#### 39.65 +########### 39.66 +###.......# 39.67 +###.#.#...# 39.68 +###.#.##..# 39.69 +###.#.###.# 39.70 +7 11 1 39.71 +..#........ 39.72 +##.#....... 39.73 +###.#...... 39.74 +####.#..... 39.75 +#####.#.... 39.76 +######.#... 39.77 +#########.. 39.78 +13 16 2 39.79 +................ 39.80 +#.#.#.#.#.#.#.#. 39.81 +................ 39.82 +.#.#.#.#.#.#.#.# 39.83 +................ 39.84 +#.#.#.#.#.#.#.#. 39.85 +................ 39.86 +.#.#.#.#.#.#.#.# 39.87 +................ 39.88 +#.#.#.#.#.#.#.#. 39.89 +................ 39.90 +.#.#.#.#.#.#.#.# 39.91 +................ 39.92 +4 16 3 39.93 +................ 39.94 +#.#.#.#.#.#.#.#. 39.95 +.#.#.#.#.#.#.#.# 39.96 +................ 39.97 +50 50 1 39.98 +.................................................. 39.99 +################################################.# 39.100 +.#............#....#.......................#....## 39.101 +..#.....#......#....#.....................#....#.. 39.102 +...#.......#....#....#...................#....#... 39.103 +#...#....#.......#....#.................#....#.... 39.104 +##...#.......#....#....#...............#....#..... 39.105 +###...#....#.......#....#.............#....#...... 39.106 +####...#.......#....#....#...........#....#....... 39.107 +.####...#....#.......#....#.........#....#........ 39.108 +..####...#.......#....#....#.......#....#......... 39.109 +...####...#....#.......#....#.....#....#.......... 39.110 +....####...#.......#....#....#...#....#...###..... 39.111 +.....####...#....#.......#....#.#....#..##..###... 39.112 +......####...#.......#....#....#.............##... 39.113 +.......####...#....#.......#...............##..... 39.114 +........####...#.......#....#............##....... 39.115 +.........####...#....#.......#.........#######.... 39.116 +..###.....####...#.......#....#................... 39.117 +.#..###....####...#....#.......#.........####..... 39.118 +##...###....####...#.......#....#.......##..##.... 39.119 +##...........####...#....#.......#......##..##.... 39.120 +##..####......####...#.......#....##....##..##.... 39.121 +##....##.......####...#....#......##....##..##.... 39.122 +.###.##.........####.............##.....##..##.... 39.123 +..###............#######........##.......####..... 39.124 +.........###......######.......##................. 39.125 +.......##..##..........#......##.........####..... 39.126 +......##....##........#......##.........##..##.... 39.127 +......##.............#......##..........##..##.... 39.128 +......##............#......##...........##..##.... 39.129 +......##....#......#......##............##..##.... 39.130 +.......##..##.....#....########.........##..##.... 39.131 +........####.....#.....###.#...#.........####..... 39.132 +.#####..........#.....#..##.#...#................. 39.133 +...##..........#.....#....##.#...#.........####... 39.134 +...##.........#.....#..#...##.#...#.......##..##.. 39.135 +...##........#.....#..##....##.#...#......##..##.. 39.136 +...##.......#.....#....##....##.#...#.....##..##.. 39.137 +##.##......#.....#...###......##.#...#.....#####.. 39.138 +.###......#.....#..##..........##.#...#.......##.. 39.139 +.........#.....#...##..####.....##.#...#.....##... 39.140 +........#.....#...###..#.##......##.#...#...##.... 39.141 +.......#.....#....##.....###......##.#...#........ 39.142 +......#.....#..#.##...###..........##.#...#....... 39.143 +.....#.....#...##..#..#..##.##.#....##.#...#...... 39.144 +....#.....#........###.....##........##.#...#..... 39.145 +...#.....#.......##...####..###.......##.#...#.... 39.146 +..#.....#......##.#.#..#.#..##.........##.#...#... 39.147 +.#..............#.#.#.#.#.#.#...........##.#...#.. 39.148 +50 50 13 39.149 +.................................................. 39.150 +################################################## 39.151 +################################################## 39.152 +################################################## 39.153 +################################################## 39.154 +################################################## 39.155 +################################################## 39.156 +################################################## 39.157 +################################################## 39.158 +################################################## 39.159 +################################################## 39.160 +################################################## 39.161 +################################################## 39.162 +################################################## 39.163 +################################################## 39.164 +################################################## 39.165 +################################################## 39.166 +################################################## 39.167 +################################################## 39.168 +################################################## 39.169 +################################################## 39.170 +################################################## 39.171 +################################################## 39.172 +################################################## 39.173 +################################################## 39.174 +################################################## 39.175 +################################################## 39.176 +################################################## 39.177 +################################################## 39.178 +################################################## 39.179 +################################################## 39.180 +################################################## 39.181 +################################################## 39.182 +################################################## 39.183 +################################################## 39.184 +################################################## 39.185 +################################################## 39.186 +################################################## 39.187 +################################################## 39.188 +################################################## 39.189 +################################################## 39.190 +################################################## 39.191 +################################################## 39.192 +################################################## 39.193 +################################################## 39.194 +################################################## 39.195 +################################################## 39.196 +################################################## 39.197 +################################################## 39.198 +################################################## 39.199 +20 49 5 39.200 +................................................. 39.201 +################################################# 39.202 +################################################# 39.203 +##################################.############## 39.204 +################################################# 39.205 +################################################# 39.206 +################################################# 39.207 +################################################# 39.208 +################################################# 39.209 +################################################# 39.210 +############################.#################### 39.211 +################################################# 39.212 +######.########################################## 39.213 +################################################# 39.214 +################################################# 39.215 +################################################# 39.216 +################################################# 39.217 +################################################# 39.218 +################################################# 39.219 +################################################# 39.220 +49 49 48 39.221 +................................................. 39.222 +################################################# 39.223 +################################################. 39.224 +################################################# 39.225 +####################################.############ 39.226 +################################################# 39.227 +##########.###################################### 39.228 +#######.######################################### 39.229 +################################################# 39.230 +################################################# 39.231 +################################################# 39.232 +#######################################.######### 39.233 +################################################# 39.234 +################################################# 39.235 +################################################# 39.236 +################################################# 39.237 +################################################# 39.238 +###########################################.##### 39.239 +################################################# 39.240 +################################################# 39.241 +###.############################################# 39.242 +###############.################################# 39.243 +################################################# 39.244 +##.############################################## 39.245 +################################################# 39.246 +################################################# 39.247 +################################################# 39.248 +################################################# 39.249 +################################################# 39.250 +#####################################.########### 39.251 +################################################# 39.252 +################################################# 39.253 +################################################# 39.254 +################################################# 39.255 +################################################# 39.256 +################################################# 39.257 +################################################# 39.258 +#####.########################################### 39.259 +#####################.########################### 39.260 +################################################# 39.261 +###.############################################# 39.262 +################################################# 39.263 +################################################# 39.264 +################################################# 39.265 +#############.###########.####################### 39.266 +###.##############.####.######################### 39.267 +#########################################.####### 39.268 +################################################# 39.269 +########################################.######## 39.270 +40 49 10 39.271 +................................................. 39.272 +################################################# 39.273 +..#..............#............................... 39.274 +.......................#.......................#. 39.275 +..#....#...................#.................#... 39.276 +..........#...............................#...... 39.277 +............#..................#.......#......... 39.278 +........#............#............#.............. 39.279 +...................#.....#....................... 39.280 +....#..........#........................#........ 39.281 +....#.................................#......#... 39.282 +...........#..................................... 39.283 +....................#............................ 39.284 +.##........#................#.................... 39.285 +..............#.................................. 39.286 +........#......................................#. 39.287 +.................................#....#........#. 39.288 +................................................. 39.289 +.............................#..##............... 39.290 +...........................................#.#... 39.291 +........#..........#........#.............#.....# 39.292 +..........#.#.................................... 39.293 +.............................#............#...... 39.294 +.......#.......................#.........#....... 39.295 +..............................#.................. 39.296 +......#.......................................... 39.297 +.............#................#.................. 39.298 +......#.............................#............ 39.299 +#.................#..................#......#.... 39.300 +..............#.................................. 39.301 +...........#...........................#.....#... 39.302 +............#............#...#................... 39.303 +.......................#.......................#. 39.304 +............................#.................... 39.305 +..........................#...................... 39.306 +...........................#.............#...#... 39.307 +.#............................................... 39.308 +..................#.............................. 39.309 +...#..............................#.............. 39.310 +.....#..................#........................ 39.311 +49 49 20 39.312 +.........................................##..#..# 39.313 +########################################.##...#.# 39.314 +#.##..#....#####..####...#..#.##.###.#..#..#..... 39.315 +..#...#.##...##.#....#...##..#.#..###...###...... 39.316 +..#..##.#.###......#.....##.....#.......##.#.#.#. 39.317 +..##......###.#.##.....##.#..#.##.###..##.#.##### 39.318 +#.#.##....#..#..#.....#.#.##.#.#.##.#.....###.#.# 39.319 +..###.#..#..###...###..#.#.....#..######.#.#....# 39.320 +..#...#...##.#..##.#.#.#..###.#..#..#...#....##.. 39.321 +.#..#.#..##.#...##........##.##..#..........#.#.. 39.322 +#.#.###.####...#.#...#..###..#.##....#........... 39.323 +#..#.#######.#....#.#.##...#.#.............##.... 39.324 +###..###....#..#....#.#.###...#..##.#.#..##.##### 39.325 +....####...#.#...........##.#.#.#..#.#.#.##.#.#.. 39.326 +##.#...##..#..#...#..##..####.##.#...#.....#...#. 39.327 +...###.##.#..##.....#.#.##..#..###.#.###.#.#..#.# 39.328 +###....##...#.#.##.##..#.#...#...##....#.###..... 39.329 +##..#....###..#.....#..#....#.#.#.##.......##.### 39.330 +.#.#....#.....####..##....##...##...#.##..##.#... 39.331 +##....#....#.#.###.##...#..##.##...##....#.###### 39.332 +..#....#..##.....##.##.#.........##..##...#.#.... 39.333 +#..#..#.#....##.#.#...#.###..#...#..#.##.#.#....# 39.334 +.....#..#...###.....##...###....###.##.....#...#. 39.335 +#..#.#...###..#....#..####....#.#......#..##....# 39.336 +.....#.#...###...###.#..#.#.#.........#.#.#..#.## 39.337 +.#..##..##..#..#.#....##.........#..#.##.#..##... 39.338 +##.#.#.....##.##..###...#.#.#..#.#.####.#.###.#.. 39.339 +..#.#.......#.#.#...#####..#.##.#....#...#.#..... 39.340 +..########.####.....#..#.........#..#####.##.#... 39.341 +.#......##.####..###..#.####........#....#....#.# 39.342 +#.....#....#...#...#..###......#.##..#..#...#.### 39.343 +...#..###.....#....#..#..#......#.....#.#.#.#..## 39.344 +....#.##..####.#..###...#...#...#######..#..#.... 39.345 +.#..#...##...#...#......##...#####.##...#..##.... 39.346 +..#.#.#######.#....#.#.###....#.##...#..#.##..#.. 39.347 +#..#.##.#.#.##..###....#.##.#..#..#...##....##..# 39.348 +.###.#.#..##.###...#..##.#.#...#.#.####....#..### 39.349 +#.#......#...##.##...#.#.....##..#..##....#.##... 39.350 +#.#...#.#.##...##.###.#..##..##..####..##.#.#...# 39.351 +....#....#..####.##.....#.#....#..##..##....#..#. 39.352 +....#...###.....##..#..###....#........###..##..# 39.353 +.###....##...........#....#........####.#.####..# 39.354 +.#........##...#.###..###.#...##.##..###..###..## 39.355 +#.#######.#....###...#..##..#...#....##....#....# 39.356 +#....#..#......#..#...##.....##.#.#.#..#......##. 39.357 +#.##.##.#.#.##..#..##..######.##.###.#.#..#....#. 39.358 +.###.##.....#.##.#..###....###..##....#.#..#..... 39.359 +#####..#.#....#.#......##..##.#...........####.#. 39.360 +..#..#.#..#...##....###.##.#.#...#..#..#....#..## 39.361 +49 49 5 39.362 +.........................................#....### 39.363 +#########################################..#..... 39.364 +.....#.###...#...#...........##...#...#....#...#. 39.365 +....#.....#..#....#....##...#..###.#...#..##.#.## 39.366 +....#...###.##...........#.#.##.......#.#.#.#..#. 39.367 +...........#..###..#..##.....#.........#.....#... 39.368 +.....#......#.##.#..##.###.....#...###.#....#...# 39.369 +.#......##.#.......##...##.....###..#......#.##.. 39.370 +#.....#.#..#.#...#####...#.###.##.....#..#....... 39.371 +........##....#....#....#.#.#....####....#.##.### 39.372 +....#.#......#.##.....#..........##.............# 39.373 +#..##....#.#....#..#.....#.#.#....#.#.#....##...# 39.374 +...#..##..#...#....#.#....#..#....#..#..#.......# 39.375 +......#...##.#.####.....####.###.#..#........#### 39.376 +##..........#...........#..#.##......##......#.## 39.377 +....###....##...#.####.....#............#..#..... 39.378 +...#....#....##.....##.....#.#.....#..#.#..#..#.. 39.379 +...........#...#.##..##..##.#......#..#.#..##.... 39.380 +.#........##......#.........##..#..........#.#... 39.381 +#....##.#.##..#.....#.....##.....##....#......... 39.382 +.#.......###.......#..#.....#.....#..##.##...#..# 39.383 +###......##.....##...##..#.#....#...####.##...... 39.384 +....#..#....##...#.##.##.#.#...#...#.#..#.##.#..# 39.385 +..........#.#..#####..####....##..#.#.#.........# 39.386 +........##.#.###..###....#...#........##.#......# 39.387 +...........##.##..#.....#.#.#..#....#.###..#.###. 39.388 +#.#....#.#...##............#.#.....#....#...#.#.. 39.389 +..###.#.##...#....#..##.##...#........#.......... 39.390 +...........#...##...#..#..##.....#..#.......#..#. 39.391 +#.#.#......##.#.....#...#.#.#.#...#..#######.#.## 39.392 +...##..#.......###..#..#.##....#......####.#..... 39.393 +....##......#.#......#....##..#...##.......#..#.. 39.394 +#..###.##....##..##.#..#.###.##.....#...#........ 39.395 +#......#....####....#.........#.........#.##.##.. 39.396 +.#.#..###......#...##.#.##..#.#.....#...#.#...... 39.397 +......#.#...##.#....#..#.#.......#.#.....#.#.###. 39.398 +###..#.....#....#.#...##..#.#.....#.#.....#.#.#.. 39.399 +..........#........#....#...#..#...#...#.#.#.#... 39.400 +#..##..#...###....#.#..#....##....#...#..##....#. 39.401 +.#.#.#....#..##.#...#.....#.##..#....##........#. 39.402 +..#.##....###...#...#..#..#.....#..#..###..#...#. 39.403 +##....#........#..#..#..#......#...#.##....#.#.## 39.404 +....#.............#..#...#...#.#.#...##....#..#.# 39.405 +...#.........#....###.....#.#..#..#...#..#...#... 39.406 +.#.#.###..###..##.#.##...#...#..#................ 39.407 +.#......#..#..#.#.#...#.....................#..#. 39.408 +..#.....#.......#..##.......#...#...##.#.....#.#. 39.409 +#..####.#....#......#.........#.#...###...#....#. 39.410 +#.#.#.#....#......#..#.#........###..#....##..... 39.411 +31 47 7 39.412 +.........................#.#..##.#..#...#.#...# 39.413 +#########################.#.#...#...#.#........ 39.414 +...#...........#...#...#...##...#..#.#.#...#.## 39.415 +.#........#.......#.#.....#......#........#.... 39.416 +#.#....###...#...#....#....#......##...#....... 39.417 +#.#......##..##...#.....#.##.#.........#....... 39.418 +.......#.....##........#..#.......#.##...#..... 39.419 +..#.......##.#...#.#..#.#..#....#......#......# 39.420 +#.##.........#####..###.......#........#......# 39.421 +.#..#.#.#...#....####...#...........#....#..... 39.422 +##..##..#..###..###....##......#....#..##...#.# 39.423 +#......#........##...#.#.#..#..#....#..#...##.# 39.424 +.#.#.##..........#.#..#...##.##................ 39.425 +##.##.#...#....#.............#.#.....###...#.#. 39.426 +..#..#.#..#..#.#....#....#............#.##..#.. 39.427 +......###......#..##..#.#...##.........#.#.###. 39.428 +..#.##.#..#......##....#.#........#....##..#..# 39.429 +.........#.#.#.....##...#.#...#.##.....##.##... 39.430 +.#........#...#.###.........#.#.#.............. 39.431 +....##........#.....#....###....###.#..#....##. 39.432 +..#..#....#....#.#.......#.#.#..........###.... 39.433 +.#..###.#...#.###...##...#....#...#............ 39.434 +##.....#..##.#.##.##.......#.##.....###...##.#. 39.435 +.###.......#...#.....#.....###.........#...#... 39.436 +#.....#..####.....##...#........####..........# 39.437 +#..#...........##.#.#.#..............#....##... 39.438 +..#.#..........#..##.#.##...##..##.#.#..##..#.. 39.439 +#..........................###......#....##.... 39.440 +.....#..........#..#......#...#.#..#....#...#.. 39.441 +#......#....##.........#..#.......#..#.......#. 39.442 +.#......#...###...##....##.#..........#...#..#. 39.443 +44 35 13 39.444 +...........................##..#### 39.445 +############################.....## 39.446 +..###.#.##.#...#.##.####.###.###.## 39.447 +#.##.#.#.#.#..###.#..#...###.##..## 39.448 +.#.##.#.##..#.###.###.##.#.#...#.#. 39.449 +##....##.#..#####.#.####..##.##...# 39.450 +####.##..##.###.##.#.#...#.##.###.# 39.451 +#.#######.#.#.#..#.#..#..#...###.#. 39.452 +##.###.#..#.####.##.#.#########.##. 39.453 +#.##.#######..#.#.####.#..#..###### 39.454 +.#.##..########...##.###..#..##.##. 39.455 +#.#######.###...##.#...#.####.#..#. 39.456 +.###..###....#.#.##.###..##.##.##.# 39.457 +...#.###.#.##.#.####.##.####.#.#... 39.458 +#..#......##....#.##.#.#.###.#..#.. 39.459 +...##.###.###.#.####..#.#.#..###.#. 39.460 +.#####.#..#..##.#.#...##.#.#.##...# 39.461 +..##..#.#....##.#.#.###.##.##...#.. 39.462 +###.#..###....#######..#.#.###.##.# 39.463 +##.##.#.#.##..#.#.#.#.#..##.####... 39.464 +##.###...#.###.#.#.#..#####.###.#.. 39.465 +...#.#...##......#.##..##.##.#.#.## 39.466 +##..#..####..###...###.#........### 39.467 +##..#....#..#.#..##.#####..###.#... 39.468 +##...#.#####.###.##....###...####.. 39.469 +#.####.#..#.##.#.#...#.###.#...##.. 39.470 +####.#####.###.#.##...##...#...#.## 39.471 +#..##.##....###..#..####.##..#.#.## 39.472 +..#.###.##....####.##.#..###.#....# 39.473 +#.#.###.#..#.##.##...###.##..###### 39.474 +##.#.##.###.#..#...###.####..##.### 39.475 +.########.#....#..#........#..##..# 39.476 +####..#.##.#.##.####..#.###...##### 39.477 +#..##..#..##.###....####.#.#...#.#. 39.478 +.#...##.##.###.###...##..##..###... 39.479 +###.##...#.##...####.#.#.##..#.#### 39.480 +##.###..##.#....#.###..##.#...###.# 39.481 +##..##.###..#..#.####.#.....##.#### 39.482 +.#....##...#####.....####...#.##.#. 39.483 +##.#.#.....##...#..#...#....#....## 39.484 +#..#.#..#####.##..###.#.########### 39.485 +.#.###.#..###.##.###.#.###.##.#.### 39.486 +.###..####.#..##......#..##.######. 39.487 +...##..###.#.....##.#.#..##......#. 39.488 +6 10 2 39.489 +.......#.. 39.490 +########## 39.491 +##.#...#.. 39.492 +.#..###... 39.493 +#.##.##### 39.494 +.####..#.# 39.495 +7 9 4 39.496 +......##. 39.497 +######### 39.498 +.#.###.## 39.499 +..#...#.. 39.500 +.....##.# 39.501 +####...## 39.502 +.#..#.#.# 39.503 +10 9 2 39.504 +......... 39.505 +######### 39.506 +..###.### 39.507 +#..###.## 39.508 +.....#.#. 39.509 +..##..... 39.510 +###.#.... 39.511 +.##..#... 39.512 +##...#..# 39.513 +#..##..## 39.514 +10 7 1 39.515 +....#.. 39.516 +####..# 39.517 +####..# 39.518 +..#.#.. 39.519 +...##.# 39.520 +#....## 39.521 +..#..## 39.522 +#.#.... 39.523 +.##.#.. 39.524 +###...# 39.525 +6 10 2 39.526 +.......#.. 39.527 +#######.#. 39.528 +..##.#.##. 39.529 +..#..#.... 39.530 +.#.#....## 39.531 +..#....#.. 39.532 +40 40 5 39.533 +........................................ 39.534 +###############################..####### 39.535 +#..##############.....################## 39.536 +........................................ 39.537 +...........................##########... 39.538 +#####...################..############## 39.539 +##################.##################### 39.540 +.............................#####...... 39.541 +#.............................########## 39.542 +...............................####..... 39.543 +.........#################.............. 39.544 +..........................###........... 39.545 +........................................ 39.546 +....................#####............... 39.547 +##########....................########## 39.548 +.......##################............... 39.549 +########........###############..####### 39.550 +........................................ 39.551 +..........#########################..... 39.552 +#####................................... 39.553 +.........................####........... 39.554 +......................#####...######.... 39.555 +######..................################ 39.556 +........#########....................... 39.557 +############.........................### 39.558 +........####################............ 39.559 +......................################## 39.560 +....................######......#....... 39.561 +............################............ 39.562 +........................................ 39.563 +......................#########......... 39.564 +#######............##################### 39.565 +........###############................. 39.566 +........................................ 39.567 +.........###################............ 39.568 +.............................#.......... 39.569 +######................................## 39.570 +........................#############... 39.571 +......##................................ 39.572 +........................................ 39.573 +30 20 11 39.574 +.................... 39.575 +#################### 39.576 +......##.##......... 39.577 +#.....####....###### 39.578 +...##............... 39.579 +........#######.###. 39.580 +.......##........... 39.581 +....#####..##....... 39.582 +........##.#........ 39.583 +.....###...........# 39.584 +..##########.....##. 39.585 +..#........#.#...... 39.586 +......##...##....... 39.587 +....##...###..###... 39.588 +.####...#####...#### 39.589 +###................. 39.590 +.......##........... 39.591 +..........###..####. 39.592 +..####..#####.#####. 39.593 +..###....#.......##. 39.594 +......##....##...... 39.595 +....##.###.......... 39.596 +.##.....#####..#.... 39.597 +.................... 39.598 +......###........... 39.599 +####..###.#########. 39.600 +.......#######...... 39.601 +....###............. 39.602 +.........###.#####.. 39.603 +................#### 39.604 +50 20 17 39.605 +.................... 39.606 +###################. 39.607 +#..##............... 39.608 +.................... 39.609 +............####.... 39.610 +........#####....... 39.611 +..............#..#.. 39.612 +.........####...#### 39.613 +.............####... 39.614 +.....#....###....... 39.615 +####...............# 39.616 +.................... 39.617 +.....######......... 39.618 +......#............. 39.619 +.####......#####.... 39.620 +.............##..... 39.621 +#####....#####...... 39.622 +..#####............. 39.623 +##..####....###..### 39.624 +.................... 39.625 +.................... 39.626 +........######.###.. 39.627 +....####....#####... 39.628 +....########........ 39.629 +...#####............ 39.630 +.###................ 39.631 +...............###.. 39.632 +.......#########.... 39.633 +..................## 39.634 +.......####......... 39.635 +..#####............. 39.636 +...####............. 39.637 +.##..........#####.. 39.638 +.................... 39.639 +...#.##.......###... 39.640 +######.....##......# 39.641 +......####.......... 39.642 +......#............. 39.643 +.................... 39.644 +.................... 39.645 +.................... 39.646 +.....#.............. 39.647 +.....####....###.... 39.648 +......#.........#### 39.649 +.......######...###. 39.650 +.................... 39.651 +.................... 39.652 +##...........###...# 39.653 +.###................ 39.654 +......#######....... 39.655 +45 25 10 39.656 +......................... 39.657 +######################### 39.658 +#...................#..## 39.659 +....................#.... 39.660 +......................... 39.661 +......................... 39.662 +...................#####. 39.663 +##.....................## 39.664 +.#.....................#. 39.665 +##.....................## 39.666 +......................... 39.667 +.....####................ 39.668 +.....##.#................ 39.669 +.....##.#................ 39.670 +.....##.#............#### 39.671 +.....##.#.......###..#### 39.672 +.....##.#.......#.#...... 39.673 +.....##.######..#.#...... 39.674 +.....####....#..#.#..###. 39.675 +........#....#..#.#..###. 39.676 +...##...#....#..#.#...... 39.677 +...##...#....#..#.#...... 39.678 +...##...#....#..#.#...... 39.679 +...##...#....#..#.#...... 39.680 +...########..#..###...... 39.681 +##.##...#....#........### 39.682 +.#.##...######..#####.#.. 39.683 +.#.##...........#...#.#.. 39.684 +.#.##...........#...#.#.. 39.685 +.#..............#...#.#.. 39.686 +.#..............#...#.#.. 39.687 +.#.####.........#...#.#.. 39.688 +.#.#..#.........#...#.#.. 39.689 +.#.#..#.........#####.#.. 39.690 +##.#.##########.......### 39.691 +...#.####.....#.......... 39.692 +..#####.#.....#..####.... 39.693 +..#####.#.....#..#..#.... 39.694 +..#..#..#.....#..#..#.... 39.695 +..#..#..#.....#..#..#.... 39.696 +#.#..#..#.....#..#..#..## 39.697 +#.#..#..#######..#..#..#. 39.698 +#.####.......#####..#..#. 39.699 +#............#..##..#..#. 39.700 +#............########..#. 39.701 +25 45 5 39.702 +............................................. 39.703 +############################################# 39.704 +..........#...###################.#...#...... 39.705 +#########.#....############################## 39.706 +#########.#.............##################... 39.707 +####################....##################### 39.708 +#########..........#........################# 39.709 +####################........################# 39.710 +..................####################.....#. 39.711 +####..............#...........############### 39.712 +######################################.###### 39.713 +#########################.....#...########### 39.714 +###.###################.......#.....######### 39.715 +#####.#.........#.....#.....################# 39.716 +############################################# 39.717 +###.#############...####............######### 39.718 +......############################...#....#.. 39.719 +....#########....................#...######.. 39.720 +##########.##..............################## 39.721 +#####################......################## 39.722 +############################################# 39.723 +############################################# 39.724 +#######################################...### 39.725 +############################################# 39.726 +##########....############################### 39.727 +40 40 5 39.728 +...............................######### 39.729 +######################################## 39.730 +######################################## 39.731 +######################################## 39.732 +#########....########################### 39.733 +######################################## 39.734 +######################################## 39.735 +######################################## 39.736 +######################################## 39.737 +######################################## 39.738 +######################################## 39.739 +..#######.######################........ 39.740 +######################################## 39.741 +######################################## 39.742 +######################################## 39.743 +...........#####################........ 39.744 +####.................################### 39.745 +######################################## 39.746 +######################################## 39.747 +######################################## 39.748 +######################################## 39.749 +#####................################### 39.750 +###################...........########## 39.751 +######################################## 39.752 +######################################## 39.753 +.......##############################... 39.754 +######################################## 39.755 +######################################## 39.756 +######################################## 39.757 +##############..............############ 39.758 +######################################## 39.759 +######################################## 39.760 +######################################## 39.761 +######################################## 39.762 +######################################## 39.763 +######################################## 39.764 +######################################## 39.765 +######################################## 39.766 +######################################## 39.767 +######################################## 39.768 +30 20 2 39.769 +.................... 39.770 +#################### 39.771 +#############.....## 39.772 +##...############### 39.773 +#################### 39.774 +#################### 39.775 +#################### 39.776 +....##.....#...#.... 39.777 +#################### 39.778 +##########.######### 39.779 +###....############# 39.780 +#########....####### 39.781 +###....############# 39.782 +#################### 39.783 +....#######.....###. 39.784 +#################### 39.785 +########.########### 39.786 +#################### 39.787 +#############.....## 39.788 +....#####..######### 39.789 +#################### 39.790 +##..########.##.#### 39.791 +########.########### 39.792 +#########..######### 39.793 +#........########### 39.794 +#########..######.## 39.795 +###.################ 39.796 +#################### 39.797 +#################### 39.798 +##############...### 39.799 +50 20 7 39.800 +...................# 39.801 +#################### 39.802 +#####...############ 39.803 +#################### 39.804 +#################### 39.805 +#################### 39.806 +#################### 39.807 +#################### 39.808 +#################### 39.809 +.....##############. 39.810 +#################### 39.811 +#################### 39.812 +.........########... 39.813 +#################### 39.814 +#################### 39.815 +#################### 39.816 +#################### 39.817 +#################### 39.818 +#################### 39.819 +#################### 39.820 +#################### 39.821 +#################### 39.822 +#################### 39.823 +#################### 39.824 +#################### 39.825 +#################### 39.826 +#########.########## 39.827 +#################### 39.828 +#################### 39.829 +#################### 39.830 +....###########..... 39.831 +#################### 39.832 +#################### 39.833 +#################### 39.834 +#################### 39.835 +#################### 39.836 +#################### 39.837 +#################### 39.838 +#################### 39.839 +##........########## 39.840 +#################### 39.841 +#################### 39.842 +#################### 39.843 +#################### 39.844 +#################### 39.845 +#################### 39.846 +#################### 39.847 +#################### 39.848 +....##########...... 39.849 +#################### 39.850 +49 49 3 39.851 +................................................. 39.852 +################################################# 39.853 +################################################# 39.854 +################################################# 39.855 +################################################# 39.856 +################################################# 39.857 +################################################# 39.858 +################################################# 39.859 +################################################# 39.860 +################################################# 39.861 +################################################# 39.862 +################################################# 39.863 +################################################# 39.864 +################################################# 39.865 +################################################# 39.866 +################################################# 39.867 +################################################# 39.868 +################################################# 39.869 +................................................. 39.870 +................................................. 39.871 +################################################# 39.872 +################################################# 39.873 +################################################# 39.874 +################################################# 39.875 +################################################# 39.876 +################################################# 39.877 +################################################# 39.878 +........##########............................... 39.879 +################################################# 39.880 +###########..................#################### 39.881 +################################################# 39.882 +################################################# 39.883 +################################################# 39.884 +################################################# 39.885 +................................................. 39.886 +################################################# 39.887 +################################################# 39.888 +################################################# 39.889 +################################################# 39.890 +################################################# 39.891 +.......#####..................................... 39.892 +................................................. 39.893 +################################################# 39.894 +................................################. 39.895 +..................................###########.... 39.896 +################################################# 39.897 +################################################# 39.898 +################################################# 39.899 +################################################# 39.900 +45 25 4 39.901 +......................... 39.902 +######################### 39.903 +########............##### 39.904 +######################### 39.905 +......................... 39.906 +###############.#######.# 39.907 +###############.#######.# 39.908 +############....#######.# 39.909 +......................... 39.910 +############.#.########## 39.911 +############...########## 39.912 +######################### 39.913 +.................######.. 39.914 +################.######.# 39.915 +......................... 39.916 +....................##... 39.917 +......................... 39.918 +######################### 39.919 +######################### 39.920 +######################### 39.921 +######################### 39.922 +######################### 39.923 +######################### 39.924 +..........####........... 39.925 +##....................... 39.926 +##....................... 39.927 +#########.####.########## 39.928 +..........####........... 39.929 +######################### 39.930 +######################### 39.931 +######################### 39.932 +######################### 39.933 +######################### 39.934 +######################### 39.935 +......................... 39.936 +##################.###### 39.937 +##################.###### 39.938 +##################.###### 39.939 +......................... 39.940 +######################### 39.941 +######################### 39.942 +######################### 39.943 +......................... 39.944 +......................... 39.945 +......................... 39.946 +25 45 5 39.947 +............................................. 39.948 +############################################# 39.949 +####################################.######## 39.950 +###########.################################# 39.951 +###########.################################# 39.952 +###########.################################# 39.953 +############################################# 39.954 +############################################# 39.955 +############################################# 39.956 +############################################# 39.957 +############################################# 39.958 +############################################# 39.959 +############################################# 39.960 +############################################# 39.961 +############################################# 39.962 +#############################...############# 39.963 +#############################.#.############# 39.964 +#############################...############# 39.965 +############################################# 39.966 +############################################# 39.967 +############################################# 39.968 +###..######################################## 39.969 +###..######################################## 39.970 +#########################################.... 39.971 +####################################.####.##. 39.972 +50 50 18 39.973 +.................................................. 39.974 +################################################## 39.975 +..##..##..##..##..##..##..##..##..##..##..##..##.. 39.976 +.###.###.###.###.###.###.###.###.###.###.###.###.# 39.977 +....####....####....####....####....####....####.. 39.978 +.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 39.979 +..######..######..######..######..######..######.. 39.980 +.#######.#######.#######.#######.#######.#######.# 39.981 +........########........########........########.. 39.982 +.#.#.#.#########.#.#.#.#########.#.#.#.#########.# 39.983 +..##..##########..##..##########..##..##########.. 39.984 +.###.###########.###.###########.###.###########.# 39.985 +....############....############....############.. 39.986 +.#.#############.#.#############.#.#############.# 39.987 +..##############..##############..##############.. 39.988 +.###############.###############.###############.# 39.989 +................################................## 39.990 +.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### 39.991 +..##..##..##..##################..##..##..##..#### 39.992 +.###.###.###.###################.###.###.###.##### 39.993 +....####....####################....####....###### 39.994 +.#.#####.#.#####################.#.#####.#.####### 39.995 +..######..######################..######..######## 39.996 +.#######.#######################.#######.######### 39.997 +........########################........########## 39.998 +.#.#.#.#########################.#.#.#.########### 39.999 +..##..##########################..##..############ 39.1000 +.###.###########################.###.############# 39.1001 +....############################....############## 39.1002 +.#.#############################.#.############### 39.1003 +..##############################..################ 39.1004 +.###############################.################# 39.1005 +................................################## 39.1006 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### 39.1007 +..##..##..##..##..##..##..##..#################### 39.1008 +.###.###.###.###.###.###.###.##################### 39.1009 +....####....####....####....###################### 39.1010 +.#.#####.#.#####.#.#####.#.####################### 39.1011 +..######..######..######..######################## 39.1012 +.#######.#######.#######.######################### 39.1013 +........########........########################## 39.1014 +.#.#.#.#########.#.#.#.########################### 39.1015 +..##..##########..##..############################ 39.1016 +.###.###########.###.############################# 39.1017 +....############....############################## 39.1018 +.#.#############.#.############################### 39.1019 +..##############..################################ 39.1020 +.###############.################################# 39.1021 +................################################## 39.1022 +.#.#.#.#.#.#.#.################################### 39.1023 +50 50 19 39.1024 +.................................................. 39.1025 +################################################## 39.1026 +..##..##..##..##..##..##..##..##..##..##..##..##.. 39.1027 +.###.###.###.###.###.###.###.###.###.###.###.###.# 39.1028 +....####....####....####....####....####....####.. 39.1029 +.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 39.1030 +..######..######..######..######..######..######.. 39.1031 +.#######.#######.#######.#######.#######.#######.# 39.1032 +........########........########........########.. 39.1033 +.#.#.#.#########.#.#.#.#########.#.#.#.#########.# 39.1034 +..##..##########..##..##########..##..##########.. 39.1035 +.###.###########.###.###########.###.###########.# 39.1036 +....############....############....############.. 39.1037 +.#.#############.#.#############.#.#############.# 39.1038 +..##############..##############..##############.. 39.1039 +.###############.###############.###############.# 39.1040 +................################................## 39.1041 +.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### 39.1042 +..##..##..##..##################..##..##..##..#### 39.1043 +.###.###.###.###################.###.###.###.##### 39.1044 +....####....####################....####....###### 39.1045 +.#.#####.#.#####################.#.#####.#.####### 39.1046 +..######..######################..######..######## 39.1047 +.#######.#######################.#######.######### 39.1048 +........########################........########## 39.1049 +.#.#.#.#########################.#.#.#.########### 39.1050 +..##..##########################..##..############ 39.1051 +.###.###########################.###.############# 39.1052 +....############################....############## 39.1053 +.#.#############################.#.############### 39.1054 +..##############################..################ 39.1055 +.###############################.################# 39.1056 +................................################## 39.1057 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### 39.1058 +..##..##..##..##..##..##..##..#################### 39.1059 +.###.###.###.###.###.###.###.##################### 39.1060 +....####....####....####....###################### 39.1061 +.#.#####.#.#####.#.#####.#.####################### 39.1062 +..######..######..######..######################## 39.1063 +.#######.#######.#######.######################### 39.1064 +........########........########################## 39.1065 +.#.#.#.#########.#.#.#.########################### 39.1066 +..##..##########..##..############################ 39.1067 +.###.###########.###.############################# 39.1068 +....############....############################## 39.1069 +.#.#############.#.############################### 39.1070 +..##############..################################ 39.1071 +.###############.################################# 39.1072 +................################################## 39.1073 +.#.#.#.#.#.#.#.################################### 39.1074 +50 50 20 39.1075 +.................................................. 39.1076 +################################################## 39.1077 +..##..##..##..##..##..##..##..##..##..##..##..##.. 39.1078 +.###.###.###.###.###.###.###.###.###.###.###.###.# 39.1079 +....####....####....####....####....####....####.. 39.1080 +.#.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 39.1081 +..######..######..######..######..######..######.. 39.1082 +.#######.#######.#######.#######.#######.#######.# 39.1083 +........########........########........########.. 39.1084 +.#.#.#.#########.#.#.#.#########.#.#.#.#########.# 39.1085 +..##..##########..##..##########..##..##########.. 39.1086 +.###.###########.###.###########.###.###########.# 39.1087 +....############....############....############.. 39.1088 +.#.#############.#.#############.#.#############.# 39.1089 +..##############..##############..##############.. 39.1090 +.###############.###############.###############.# 39.1091 +................################................## 39.1092 +.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.#.### 39.1093 +..##..##..##..##################..##..##..##..#### 39.1094 +.###.###.###.###################.###.###.###.##### 39.1095 +....####....####################....####....###### 39.1096 +.#.#####.#.#####################.#.#####.#.####### 39.1097 +..######..######################..######..######## 39.1098 +.#######.#######################.#######.######### 39.1099 +........########################........########## 39.1100 +.#.#.#.#########################.#.#.#.########### 39.1101 +..##..##########################..##..############ 39.1102 +.###.###########################.###.############# 39.1103 +....############################....############## 39.1104 +.#.#############################.#.############### 39.1105 +..##############################..################ 39.1106 +.###############################.################# 39.1107 +................................################## 39.1108 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.################### 39.1109 +..##..##..##..##..##..##..##..#################### 39.1110 +.###.###.###.###.###.###.###.##################### 39.1111 +....####....####....####....###################### 39.1112 +.#.#####.#.#####.#.#####.#.####################### 39.1113 +..######..######..######..######################## 39.1114 +.#######.#######.#######.######################### 39.1115 +........########........########################## 39.1116 +.#.#.#.#########.#.#.#.########################### 39.1117 +..##..##########..##..############################ 39.1118 +.###.###########.###.############################# 39.1119 +....############....############################## 39.1120 +.#.#############.#.############################### 39.1121 +..##############..################################ 39.1122 +.###############.################################# 39.1123 +................################################## 39.1124 +.#.#.#.#.#.#.#.################################### 39.1125 +49 48 5 39.1126 +................................................ 39.1127 +################################################ 39.1128 +################################.############### 39.1129 +###############################..##############. 39.1130 +##############################.#.#############.# 39.1131 +#############################....############... 39.1132 +############################.###.###########.### 39.1133 +###########################..##..##########..##. 39.1134 +##########################.#.#.#.#########.#.#.# 39.1135 +#########################........########....... 39.1136 +########################.#######.#######.####### 39.1137 +#######################..######..######..######. 39.1138 +######################.#.#####.#.#####.#.#####.# 39.1139 +#####################....####....####....####... 39.1140 +####################.###.###.###.###.###.###.### 39.1141 +###################..##..##..##..##..##..##..##. 39.1142 +##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 39.1143 +#################............................... 39.1144 +################.############################### 39.1145 +###############..##############################. 39.1146 +##############.#.#############################.# 39.1147 +#############....############################... 39.1148 +############.###.###########################.### 39.1149 +###########..##..##########################..##. 39.1150 +##########.#.#.#.#########################.#.#.# 39.1151 +#########........########################....... 39.1152 +########.#######.#######################.####### 39.1153 +#######..######..######################..######. 39.1154 +######.#.#####.#.#####################.#.#####.# 39.1155 +#####....####....####################....####... 39.1156 +####.###.###.###.###################.###.###.### 39.1157 +###..##..##..##..##################..##..##..##. 39.1158 +##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# 39.1159 +#................################............... 39.1160 +.###############.###############.############### 39.1161 +.##############..##############..##############. 39.1162 +.#############.#.#############.#.#############.# 39.1163 +.############....############....############... 39.1164 +.###########.###.###########.###.###########.### 39.1165 +.##########..##..##########..##..##########..##. 39.1166 +.#########.#.#.#.#########.#.#.#.#########.#.#.# 39.1167 +.########........########........########....... 39.1168 +.#######.#######.#######.#######.#######.####### 39.1169 +.######..######..######..######..######..######. 39.1170 +.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 39.1171 +.####....####....####....####....####....####... 39.1172 +.###.###.###.###.###.###.###.###.###.###.###.### 39.1173 +.##..##..##..##..##..##..##..##..##..##..##..##. 39.1174 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 39.1175 +49 48 11 39.1176 +................................................ 39.1177 +################################################ 39.1178 +################################.############### 39.1179 +###############################..##############. 39.1180 +##############################.#.#############.# 39.1181 +#############################....############... 39.1182 +############################.###.###########.### 39.1183 +###########################..##..##########..##. 39.1184 +##########################.#.#.#.#########.#.#.# 39.1185 +#########################........########....... 39.1186 +########################.#######.#######.####### 39.1187 +#######################..######..######..######. 39.1188 +######################.#.#####.#.#####.#.#####.# 39.1189 +#####################....####....####....####... 39.1190 +####################.###.###.###.###.###.###.### 39.1191 +###################..##..##..##..##..##..##..##. 39.1192 +##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 39.1193 +#################............................... 39.1194 +################.############################### 39.1195 +###############..##############################. 39.1196 +##############.#.#############################.# 39.1197 +#############....############################... 39.1198 +############.###.###########################.### 39.1199 +###########..##..##########################..##. 39.1200 +##########.#.#.#.#########################.#.#.# 39.1201 +#########........########################....... 39.1202 +########.#######.#######################.####### 39.1203 +#######..######..######################..######. 39.1204 +######.#.#####.#.#####################.#.#####.# 39.1205 +#####....####....####################....####... 39.1206 +####.###.###.###.###################.###.###.### 39.1207 +###..##..##..##..##################..##..##..##. 39.1208 +##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# 39.1209 +#................################............... 39.1210 +.###############.###############.############### 39.1211 +.##############..##############..##############. 39.1212 +.#############.#.#############.#.#############.# 39.1213 +.############....############....############... 39.1214 +.###########.###.###########.###.###########.### 39.1215 +.##########..##..##########..##..##########..##. 39.1216 +.#########.#.#.#.#########.#.#.#.#########.#.#.# 39.1217 +.########........########........########....... 39.1218 +.#######.#######.#######.#######.#######.####### 39.1219 +.######..######..######..######..######..######. 39.1220 +.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 39.1221 +.####....####....####....####....####....####... 39.1222 +.###.###.###.###.###.###.###.###.###.###.###.### 39.1223 +.##..##..##..##..##..##..##..##..##..##..##..##. 39.1224 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 39.1225 +49 48 30 39.1226 +................................................ 39.1227 +################################################ 39.1228 +################################.############### 39.1229 +###############################..##############. 39.1230 +##############################.#.#############.# 39.1231 +#############################....############... 39.1232 +############################.###.###########.### 39.1233 +###########################..##..##########..##. 39.1234 +##########################.#.#.#.#########.#.#.# 39.1235 +#########################........########....... 39.1236 +########################.#######.#######.####### 39.1237 +#######################..######..######..######. 39.1238 +######################.#.#####.#.#####.#.#####.# 39.1239 +#####################....####....####....####... 39.1240 +####################.###.###.###.###.###.###.### 39.1241 +###################..##..##..##..##..##..##..##. 39.1242 +##################.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 39.1243 +#################............................... 39.1244 +################.############################### 39.1245 +###############..##############################. 39.1246 +##############.#.#############################.# 39.1247 +#############....############################... 39.1248 +############.###.###########################.### 39.1249 +###########..##..##########################..##. 39.1250 +##########.#.#.#.#########################.#.#.# 39.1251 +#########........########################....... 39.1252 +########.#######.#######################.####### 39.1253 +#######..######..######################..######. 39.1254 +######.#.#####.#.#####################.#.#####.# 39.1255 +#####....####....####################....####... 39.1256 +####.###.###.###.###################.###.###.### 39.1257 +###..##..##..##..##################..##..##..##. 39.1258 +##.#.#.#.#.#.#.#.#################.#.#.#.#.#.#.# 39.1259 +#................################............... 39.1260 +.###############.###############.############### 39.1261 +.##############..##############..##############. 39.1262 +.#############.#.#############.#.#############.# 39.1263 +.############....############....############... 39.1264 +.###########.###.###########.###.###########.### 39.1265 +.##########..##..##########..##..##########..##. 39.1266 +.#########.#.#.#.#########.#.#.#.#########.#.#.# 39.1267 +.########........########........########....... 39.1268 +.#######.#######.#######.#######.#######.####### 39.1269 +.######..######..######..######..######..######. 39.1270 +.#####.#.#####.#.#####.#.#####.#.#####.#.#####.# 39.1271 +.####....####....####....####....####....####... 39.1272 +.###.###.###.###.###.###.###.###.###.###.###.### 39.1273 +.##..##..##..##..##..##..##..##..##..##..##..##. 39.1274 +.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# 39.1275 +50 10 4 39.1276 +.......... 39.1277 +#####..... 39.1278 +#####..... 39.1279 +.####..... 39.1280 +#.###..... 39.1281 +##.##..... 39.1282 +.......... 39.1283 +#####..... 39.1284 +#####..... 39.1285 +####...... 39.1286 +###.#..... 39.1287 +##.##..... 39.1288 +.......... 39.1289 +#####..... 39.1290 +#####..... 39.1291 +.####..... 39.1292 +#.###..... 39.1293 +##.##..... 39.1294 +.......... 39.1295 +#####..... 39.1296 +#......... 39.1297 +.#........ 39.1298 +..#....... 39.1299 +...#...... 39.1300 +.......... 39.1301 +....#..... 39.1302 +...#...... 39.1303 +..#....... 39.1304 +.#........ 39.1305 +.......... 39.1306 +#####..... 39.1307 +#####..... 39.1308 +.####..... 39.1309 +#.###..... 39.1310 +##.##..... 39.1311 +.......... 39.1312 +#####..... 39.1313 +#####..... 39.1314 +####...... 39.1315 +###.#..... 39.1316 +##.##..... 39.1317 +.......... 39.1318 +#####..... 39.1319 +#####..... 39.1320 +#####..... 39.1321 +#####..... 39.1322 +#####..... 39.1323 +.......... 39.1324 +#####..... 39.1325 +#####..... 39.1326 +50 10 5 39.1327 +.......... 39.1328 +#####..... 39.1329 +...##..... 39.1330 +.......... 39.1331 +.......... 39.1332 +.......... 39.1333 +#####..... 39.1334 +##........ 39.1335 +.......... 39.1336 +.......... 39.1337 +.......... 39.1338 +#####..... 39.1339 +##........ 39.1340 +.......... 39.1341 +.......... 39.1342 +.......... 39.1343 +#####..... 39.1344 +#......... 39.1345 +.#........ 39.1346 +..#....... 39.1347 +...#...... 39.1348 +.......... 39.1349 +....#..... 39.1350 +...#...... 39.1351 +..#....... 39.1352 +.#........ 39.1353 +.......... 39.1354 +#####..... 39.1355 +#####..... 39.1356 +####...... 39.1357 +###.#..... 39.1358 +##.##..... 39.1359 +.......... 39.1360 +#####..... 39.1361 +#####..... 39.1362 +.####..... 39.1363 +#.###..... 39.1364 +##.##..... 39.1365 +.......... 39.1366 +#####..... 39.1367 +#......... 39.1368 +.#........ 39.1369 +..#....... 39.1370 +...#...... 39.1371 +.......... 39.1372 +....#..... 39.1373 +...#...... 39.1374 +..#....... 39.1375 +.#........ 39.1376 +.......... 39.1377 +50 10 4 39.1378 +.......... 39.1379 +#####..... 39.1380 +#......... 39.1381 +.#........ 39.1382 +..#....... 39.1383 +...#...... 39.1384 +.......... 39.1385 +....#..... 39.1386 +...#...... 39.1387 +..#....... 39.1388 +.#........ 39.1389 +.......... 39.1390 +#####..... 39.1391 +#####..... 39.1392 +####...... 39.1393 +###.#..... 39.1394 +##.##..... 39.1395 +.......... 39.1396 +#####..... 39.1397 +#####..... 39.1398 +#####..... 39.1399 +#####..... 39.1400 +#####..... 39.1401 +.......... 39.1402 +#####..... 39.1403 +##........ 39.1404 +.......... 39.1405 +.......... 39.1406 +.......... 39.1407 +#####..... 39.1408 +#####..... 39.1409 +#####..... 39.1410 +#####..... 39.1411 +#####..... 39.1412 +.......... 39.1413 +#####..... 39.1414 +##........ 39.1415 +.......... 39.1416 +.......... 39.1417 +.......... 39.1418 +#####..... 39.1419 +##........ 39.1420 +.......... 39.1421 +.......... 39.1422 +.......... 39.1423 +#####..... 39.1424 +#####..... 39.1425 +####...... 39.1426 +###.#..... 39.1427 +##.##..... 39.1428 +50 10 5 39.1429 +.......... 39.1430 +#####..... 39.1431 +##........ 39.1432 +.......... 39.1433 +.......... 39.1434 +.......... 39.1435 +#####..... 39.1436 +#####..... 39.1437 +#####..... 39.1438 +#####..... 39.1439 +#####..... 39.1440 +.......... 39.1441 +#####..... 39.1442 +##........ 39.1443 +.......... 39.1444 +.......... 39.1445 +.......... 39.1446 +#####..... 39.1447 +#####..... 39.1448 +.####..... 39.1449 +#.###..... 39.1450 +##.##..... 39.1451 +.......... 39.1452 +#####..... 39.1453 +#####..... 39.1454 +####...... 39.1455 +###.#..... 39.1456 +##.##..... 39.1457 +.......... 39.1458 +#####..... 39.1459 +...##..... 39.1460 +.......... 39.1461 +.......... 39.1462 +.......... 39.1463 +#####..... 39.1464 +#####..... 39.1465 +#####..... 39.1466 +#####..... 39.1467 +#####..... 39.1468 +.......... 39.1469 +#####..... 39.1470 +#####..... 39.1471 +####...... 39.1472 +###.#..... 39.1473 +##.##..... 39.1474 +.......... 39.1475 +#####..... 39.1476 +#......... 39.1477 +.#........ 39.1478 +..#....... 39.1479 +35 41 11 39.1480 +........................................# 39.1481 +######################################### 39.1482 +##.......####.#..######.##.###...#####.## 39.1483 +.##.#.#...#.###...##...#..#.#..##..###### 39.1484 +.#...##....#.###...##.#.##.#.###...####.. 39.1485 +.###...##.##..####..##.#.#####.#...#.#... 39.1486 +..#...#.##..#...##..###..##...###...#.#.. 39.1487 +.#.####.##.##.###.....#..#..##.###..#.##. 39.1488 +##..##..#...##.###.#...####...#..##....#. 39.1489 +#....#..##.#.#.#......####.#.....#...#.#. 39.1490 +#.##.#####......####......###.###..###.#. 39.1491 +##..######...######.##.#.##.......#...#.. 39.1492 +.#.....###......#####...#..#.#.###...##.# 39.1493 +...##.##.##..##...####.#.###...#..#.##..# 39.1494 +....###.#.#..#...###..###.###..#####...## 39.1495 +....##.##..#.#.#.#.#####...##..######.... 39.1496 +#.#.##.##.#...#####....##.#.#...#.##.#..# 39.1497 +#.##.##.##.#...#.#.####...#..#.......##.# 39.1498 +.##.#..###..####.#..###...#...###.##.##.. 39.1499 +.####.#.#######.#......##....#######..##. 39.1500 +.#..#...#.#.####..#.######.#.#..##.#.#### 39.1501 +...#.###..#.##.#.###.#.#....#.###.#.#...# 39.1502 +..#.#.####....###...#..##..#####.#.###### 39.1503 +#......####.#..##.....#####.##...###..... 39.1504 +##..##..####......#.#.##..##...###.#..... 39.1505 +#.#.####.####.......##......####.###..### 39.1506 +##...###.#...#.####.##.#........##..#.### 39.1507 +....#..#####.#....#.##...###..#####.#.### 39.1508 +####.#.###.........####..###.#..######.## 39.1509 +.#..########..###..#####.######.###.#...# 39.1510 +.##..#.##..#....####...#.###.....##.#...# 39.1511 +##.#..##.##..##.##...##.##.##.#.##.###### 39.1512 +..#..#..####..##...###.#...#.....###..#.. 39.1513 +####.#..####.###...##..#.#.###.#..#..#### 39.1514 +#...#..#..#.#...#...#.#.##.##.#...###.#.# 39.1515 +31 41 12 39.1516 +......................................... 39.1517 +#################################.....#.. 39.1518 +.#..........#.......#....##....#...#..... 39.1519 +.........#......#.#...#...#..#........#.. 39.1520 +#......#.#......#...#.........#.........# 39.1521 +.................#....#...#...##......... 39.1522 +.......#.#..#.....#..#.....##........#..# 39.1523 +.....#..#..#......................#..#... 39.1524 +..............#....##....#...#..#..#....# 39.1525 +...#.#.#........##.#..#..........#......# 39.1526 +...#......#..#......#....#....#....#..... 39.1527 +......##.#...#.##..........#............. 39.1528 +.......##.#.#..#...#.....#.#..#.......... 39.1529 +.........#..........#.................#.. 39.1530 +.#....#..#......#.......#.#..#..####.##.. 39.1531 +#...#................##...#..........#... 39.1532 +..........#...#.#..#..###..#...#......... 39.1533 +........##.......#.....##.#......#...#.#. 39.1534 +.#.....#.#..#.....#.#..##.#.#...........# 39.1535 +.......####...#.#.........#...#.#........ 39.1536 +.##.................#.#.#................ 39.1537 +.....###.#...#..#.#..............#....... 39.1538 +.....#...#.....#........#....##.......#.. 39.1539 +.........#...........##.#..#.....##...... 39.1540 +...#....#.........#...#...#.#............ 39.1541 +.....#..............#..............#....# 39.1542 +#.##...#.............#....#.#..#......#.. 39.1543 +........#...#...##.............#.#....... 39.1544 +.......#.......#..............#.......... 39.1545 +.....#.........#.........#..#...#..#....# 39.1546 +####..#...#.#.....##...........#.#.#.#.#.
40.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 40.2 +++ b/test/compiler/5091921/output6890943.txt Wed May 04 13:12:42 2011 -0700 40.3 @@ -0,0 +1,50 @@ 40.4 +Case #1: Yes 2 40.5 +Case #2: Yes 2 40.6 +Case #3: Yes 1 40.7 +Case #4: Yes 0 40.8 +Case #5: No 40.9 +Case #6: No 40.10 +Case #7: Yes 6 40.11 +Case #8: Yes 6 40.12 +Case #9: No 40.13 +Case #10: Yes 1 40.14 +Case #11: Yes 6 40.15 +Case #12: Yes 0 40.16 +Case #13: No 40.17 +Case #14: Yes 22 40.18 +Case #15: Yes 1225 40.19 +Case #16: Yes 178 40.20 +Case #17: No 40.21 +Case #18: Yes 1 40.22 +Case #19: Yes 7 40.23 +Case #20: Yes 2 40.24 +Case #21: Yes 1 40.25 +Case #22: No 40.26 +Case #23: Yes 3 40.27 +Case #24: Yes 1 40.28 +Case #25: Yes 7 40.29 +Case #26: No 40.30 +Case #27: Yes 2 40.31 +Case #28: Yes 4 40.32 +Case #29: Yes 2 40.33 +Case #30: Yes 1 40.34 +Case #31: Yes 2 40.35 +Case #32: Yes 20 40.36 +Case #33: Yes 161 40.37 +Case #34: Yes 48 40.38 +Case #35: No 40.39 +Case #36: Yes 218 40.40 +Case #37: Yes 51 40.41 +Case #38: Yes 247 40.42 +Case #39: Yes 32 40.43 +Case #40: Yes 31 40.44 +Case #41: Yes 31 40.45 +Case #42: Yes 25 40.46 +Case #43: Yes 17 40.47 +Case #44: Yes 2 40.48 +Case #45: Yes 61 40.49 +Case #46: Yes 25 40.50 +Case #47: No 40.51 +Case #48: No 40.52 +Case #49: Yes 8 40.53 +Case #50: Yes 0