Mon, 08 Oct 2012 13:02:13 -0700
8000313: C2 should use jlong for 64bit values
Summary: Replace all occurrences of long with jlong in C2 code.
Reviewed-by: kvn, twisti
1.1 --- a/src/share/vm/opto/graphKit.cpp Fri Oct 05 19:44:49 2012 -0700 1.2 +++ b/src/share/vm/opto/graphKit.cpp Mon Oct 08 13:02:13 2012 -0700 1.3 @@ -1115,7 +1115,7 @@ 1.4 // short-circuit a common case 1.5 jint offset_con = find_int_con(offset, Type::OffsetBot); 1.6 if (offset_con != Type::OffsetBot) { 1.7 - return longcon((long) offset_con); 1.8 + return longcon((jlong) offset_con); 1.9 } 1.10 return _gvn.transform( new (C) ConvI2LNode(offset)); 1.11 }
2.1 --- a/src/share/vm/opto/loopTransform.cpp Fri Oct 05 19:44:49 2012 -0700 2.2 +++ b/src/share/vm/opto/loopTransform.cpp Mon Oct 08 13:02:13 2012 -0700 2.3 @@ -92,10 +92,10 @@ 2.4 limit_n != NULL && limit_n->is_Con()) { 2.5 // Use longs to avoid integer overflow. 2.6 int stride_con = cl->stride_con(); 2.7 - long init_con = cl->init_trip()->get_int(); 2.8 - long limit_con = cl->limit()->get_int(); 2.9 + jlong init_con = cl->init_trip()->get_int(); 2.10 + jlong limit_con = cl->limit()->get_int(); 2.11 int stride_m = stride_con - (stride_con > 0 ? 1 : -1); 2.12 - long trip_count = (limit_con - init_con + stride_m)/stride_con; 2.13 + jlong trip_count = (limit_con - init_con + stride_m)/stride_con; 2.14 if (trip_count > 0 && (julong)trip_count < (julong)max_juint) { 2.15 // Set exact trip count. 2.16 cl->set_exact_trip_count((uint)trip_count); 2.17 @@ -1212,16 +1212,16 @@ 2.18 } else if (loop_head->has_exact_trip_count() && init->is_Con()) { 2.19 // Loop's limit is constant. Loop's init could be constant when pre-loop 2.20 // become peeled iteration. 2.21 - long init_con = init->get_int(); 2.22 + jlong init_con = init->get_int(); 2.23 // We can keep old loop limit if iterations count stays the same: 2.24 // old_trip_count == new_trip_count * 2 2.25 // Note: since old_trip_count >= 2 then new_trip_count >= 1 2.26 // so we also don't need to adjust zero trip test. 2.27 - long limit_con = limit->get_int(); 2.28 + jlong limit_con = limit->get_int(); 2.29 // (stride_con*2) not overflow since stride_con <= 8. 2.30 int new_stride_con = stride_con * 2; 2.31 int stride_m = new_stride_con - (stride_con > 0 ? 1 : -1); 2.32 - long trip_count = (limit_con - init_con + stride_m)/new_stride_con; 2.33 + jlong trip_count = (limit_con - init_con + stride_m)/new_stride_con; 2.34 // New trip count should satisfy next conditions. 2.35 assert(trip_count > 0 && (julong)trip_count < (julong)max_juint/2, "sanity"); 2.36 uint new_trip_count = (uint)trip_count;
3.1 --- a/src/share/vm/opto/loopnode.cpp Fri Oct 05 19:44:49 2012 -0700 3.2 +++ b/src/share/vm/opto/loopnode.cpp Mon Oct 08 13:02:13 2012 -0700 3.3 @@ -328,12 +328,12 @@ 3.4 const TypeInt* limit_t = gvn->type(limit)->is_int(); 3.5 3.6 if (stride_con > 0) { 3.7 - long init_p = (long)init_t->_lo + stride_con; 3.8 - if (init_p > (long)max_jint || init_p > (long)limit_t->_hi) 3.9 + jlong init_p = (jlong)init_t->_lo + stride_con; 3.10 + if (init_p > (jlong)max_jint || init_p > (jlong)limit_t->_hi) 3.11 return false; // cyclic loop or this loop trips only once 3.12 } else { 3.13 - long init_p = (long)init_t->_hi + stride_con; 3.14 - if (init_p < (long)min_jint || init_p < (long)limit_t->_lo) 3.15 + jlong init_p = (jlong)init_t->_hi + stride_con; 3.16 + if (init_p < (jlong)min_jint || init_p < (jlong)limit_t->_lo) 3.17 return false; // cyclic loop or this loop trips only once 3.18 } 3.19 3.20 @@ -716,16 +716,16 @@ 3.21 #endif 3.22 if (cl->has_exact_trip_count()) { 3.23 // Simple case: loop has constant boundaries. 3.24 - // Use longs to avoid integer overflow. 3.25 + // Use jlongs to avoid integer overflow. 3.26 int stride_con = cl->stride_con(); 3.27 - long init_con = cl->init_trip()->get_int(); 3.28 - long limit_con = cl->limit()->get_int(); 3.29 + jlong init_con = cl->init_trip()->get_int(); 3.30 + jlong limit_con = cl->limit()->get_int(); 3.31 julong trip_cnt = cl->trip_count(); 3.32 - long final_con = init_con + trip_cnt*stride_con; 3.33 + jlong final_con = init_con + trip_cnt*stride_con; 3.34 int final_int = (int)final_con; 3.35 // The final value should be in integer range since the loop 3.36 // is counted and the limit was checked for overflow. 3.37 - assert(final_con == (long)final_int, "final value should be integer"); 3.38 + assert(final_con == (jlong)final_int, "final value should be integer"); 3.39 limit = _igvn.intcon(final_int); 3.40 } else { 3.41 // Create new LoopLimit node to get exact limit (final iv value). 3.42 @@ -790,16 +790,16 @@ 3.43 return NULL; // Identity 3.44 3.45 if (init_t->is_int()->is_con() && limit_t->is_int()->is_con()) { 3.46 - // Use longs to avoid integer overflow. 3.47 - long init_con = init_t->is_int()->get_con(); 3.48 - long limit_con = limit_t->is_int()->get_con(); 3.49 + // Use jlongs to avoid integer overflow. 3.50 + jlong init_con = init_t->is_int()->get_con(); 3.51 + jlong limit_con = limit_t->is_int()->get_con(); 3.52 int stride_m = stride_con - (stride_con > 0 ? 1 : -1); 3.53 - long trip_count = (limit_con - init_con + stride_m)/stride_con; 3.54 - long final_con = init_con + stride_con*trip_count; 3.55 + jlong trip_count = (limit_con - init_con + stride_m)/stride_con; 3.56 + jlong final_con = init_con + stride_con*trip_count; 3.57 int final_int = (int)final_con; 3.58 // The final value should be in integer range since the loop 3.59 // is counted and the limit was checked for overflow. 3.60 - assert(final_con == (long)final_int, "final value should be integer"); 3.61 + assert(final_con == (jlong)final_int, "final value should be integer"); 3.62 return TypeInt::make(final_int); 3.63 } 3.64 3.65 @@ -829,7 +829,7 @@ 3.66 const TypeInt* init_t = phase->type(in(Init) )->is_int(); 3.67 const TypeInt* limit_t = phase->type(in(Limit))->is_int(); 3.68 int stride_p; 3.69 - long lim, ini; 3.70 + jlong lim, ini; 3.71 julong max; 3.72 if (stride_con > 0) { 3.73 stride_p = stride_con;
4.1 --- a/src/share/vm/opto/phaseX.hpp Fri Oct 05 19:44:49 2012 -0700 4.2 +++ b/src/share/vm/opto/phaseX.hpp Mon Oct 08 13:02:13 2012 -0700 4.3 @@ -497,8 +497,8 @@ 4.4 #ifndef PRODUCT 4.5 protected: 4.6 // Sub-quadratic implementation of VerifyIterativeGVN. 4.7 - unsigned long _verify_counter; 4.8 - unsigned long _verify_full_passes; 4.9 + julong _verify_counter; 4.10 + julong _verify_full_passes; 4.11 enum { _verify_window_size = 30 }; 4.12 Node* _verify_window[_verify_window_size]; 4.13 void verify_step(Node* n);