src/share/vm/opto/loopnode.cpp

changeset 4157
377508648226
parent 4115
e626685e9f6c
child 4589
8b3da8d14c93
     1.1 --- a/src/share/vm/opto/loopnode.cpp	Fri Oct 05 19:44:49 2012 -0700
     1.2 +++ b/src/share/vm/opto/loopnode.cpp	Mon Oct 08 13:02:13 2012 -0700
     1.3 @@ -328,12 +328,12 @@
     1.4    const TypeInt* limit_t = gvn->type(limit)->is_int();
     1.5  
     1.6    if (stride_con > 0) {
     1.7 -    long init_p = (long)init_t->_lo + stride_con;
     1.8 -    if (init_p > (long)max_jint || init_p > (long)limit_t->_hi)
     1.9 +    jlong init_p = (jlong)init_t->_lo + stride_con;
    1.10 +    if (init_p > (jlong)max_jint || init_p > (jlong)limit_t->_hi)
    1.11        return false; // cyclic loop or this loop trips only once
    1.12    } else {
    1.13 -    long init_p = (long)init_t->_hi + stride_con;
    1.14 -    if (init_p < (long)min_jint || init_p < (long)limit_t->_lo)
    1.15 +    jlong init_p = (jlong)init_t->_hi + stride_con;
    1.16 +    if (init_p < (jlong)min_jint || init_p < (jlong)limit_t->_lo)
    1.17        return false; // cyclic loop or this loop trips only once
    1.18    }
    1.19  
    1.20 @@ -716,16 +716,16 @@
    1.21  #endif
    1.22    if (cl->has_exact_trip_count()) {
    1.23      // Simple case: loop has constant boundaries.
    1.24 -    // Use longs to avoid integer overflow.
    1.25 +    // Use jlongs to avoid integer overflow.
    1.26      int stride_con = cl->stride_con();
    1.27 -    long  init_con = cl->init_trip()->get_int();
    1.28 -    long limit_con = cl->limit()->get_int();
    1.29 +    jlong  init_con = cl->init_trip()->get_int();
    1.30 +    jlong limit_con = cl->limit()->get_int();
    1.31      julong trip_cnt = cl->trip_count();
    1.32 -    long final_con = init_con + trip_cnt*stride_con;
    1.33 +    jlong final_con = init_con + trip_cnt*stride_con;
    1.34      int final_int = (int)final_con;
    1.35      // The final value should be in integer range since the loop
    1.36      // is counted and the limit was checked for overflow.
    1.37 -    assert(final_con == (long)final_int, "final value should be integer");
    1.38 +    assert(final_con == (jlong)final_int, "final value should be integer");
    1.39      limit = _igvn.intcon(final_int);
    1.40    } else {
    1.41      // Create new LoopLimit node to get exact limit (final iv value).
    1.42 @@ -790,16 +790,16 @@
    1.43      return NULL;  // Identity
    1.44  
    1.45    if (init_t->is_int()->is_con() && limit_t->is_int()->is_con()) {
    1.46 -    // Use longs to avoid integer overflow.
    1.47 -    long init_con   =  init_t->is_int()->get_con();
    1.48 -    long limit_con  = limit_t->is_int()->get_con();
    1.49 +    // Use jlongs to avoid integer overflow.
    1.50 +    jlong init_con   =  init_t->is_int()->get_con();
    1.51 +    jlong limit_con  = limit_t->is_int()->get_con();
    1.52      int  stride_m   = stride_con - (stride_con > 0 ? 1 : -1);
    1.53 -    long trip_count = (limit_con - init_con + stride_m)/stride_con;
    1.54 -    long final_con  = init_con + stride_con*trip_count;
    1.55 +    jlong trip_count = (limit_con - init_con + stride_m)/stride_con;
    1.56 +    jlong final_con  = init_con + stride_con*trip_count;
    1.57      int final_int = (int)final_con;
    1.58      // The final value should be in integer range since the loop
    1.59      // is counted and the limit was checked for overflow.
    1.60 -    assert(final_con == (long)final_int, "final value should be integer");
    1.61 +    assert(final_con == (jlong)final_int, "final value should be integer");
    1.62      return TypeInt::make(final_int);
    1.63    }
    1.64  
    1.65 @@ -829,7 +829,7 @@
    1.66    const TypeInt* init_t  = phase->type(in(Init) )->is_int();
    1.67    const TypeInt* limit_t = phase->type(in(Limit))->is_int();
    1.68    int stride_p;
    1.69 -  long lim, ini;
    1.70 +  jlong lim, ini;
    1.71    julong max;
    1.72    if (stride_con > 0) {
    1.73      stride_p = stride_con;

mercurial