Mercurial > hg > graal-jvmci-8
comparison src/share/vm/opto/loopTransform.cpp @ 6846:377508648226
8000313: C2 should use jlong for 64bit values
Summary: Replace all occurrences of long with jlong in C2 code.
Reviewed-by: kvn, twisti
author | vlivanov |
---|---|
date | Mon, 08 Oct 2012 13:02:13 -0700 |
parents | e626685e9f6c |
children | 8e47bac5643a |
comparison
equal
deleted
inserted
replaced
6845:9024b6b53ec2 | 6846:377508648226 |
---|---|
90 Node* limit_n = cl->limit(); | 90 Node* limit_n = cl->limit(); |
91 if (init_n != NULL && init_n->is_Con() && | 91 if (init_n != NULL && init_n->is_Con() && |
92 limit_n != NULL && limit_n->is_Con()) { | 92 limit_n != NULL && limit_n->is_Con()) { |
93 // Use longs to avoid integer overflow. | 93 // Use longs to avoid integer overflow. |
94 int stride_con = cl->stride_con(); | 94 int stride_con = cl->stride_con(); |
95 long init_con = cl->init_trip()->get_int(); | 95 jlong init_con = cl->init_trip()->get_int(); |
96 long limit_con = cl->limit()->get_int(); | 96 jlong limit_con = cl->limit()->get_int(); |
97 int stride_m = stride_con - (stride_con > 0 ? 1 : -1); | 97 int stride_m = stride_con - (stride_con > 0 ? 1 : -1); |
98 long trip_count = (limit_con - init_con + stride_m)/stride_con; | 98 jlong trip_count = (limit_con - init_con + stride_m)/stride_con; |
99 if (trip_count > 0 && (julong)trip_count < (julong)max_juint) { | 99 if (trip_count > 0 && (julong)trip_count < (julong)max_juint) { |
100 // Set exact trip count. | 100 // Set exact trip count. |
101 cl->set_exact_trip_count((uint)trip_count); | 101 cl->set_exact_trip_count((uint)trip_count); |
102 } | 102 } |
103 } | 103 } |
1210 "odd trip count for maximally unroll"); | 1210 "odd trip count for maximally unroll"); |
1211 // Don't need to adjust limit for maximally unroll since trip count is even. | 1211 // Don't need to adjust limit for maximally unroll since trip count is even. |
1212 } else if (loop_head->has_exact_trip_count() && init->is_Con()) { | 1212 } else if (loop_head->has_exact_trip_count() && init->is_Con()) { |
1213 // Loop's limit is constant. Loop's init could be constant when pre-loop | 1213 // Loop's limit is constant. Loop's init could be constant when pre-loop |
1214 // become peeled iteration. | 1214 // become peeled iteration. |
1215 long init_con = init->get_int(); | 1215 jlong init_con = init->get_int(); |
1216 // We can keep old loop limit if iterations count stays the same: | 1216 // We can keep old loop limit if iterations count stays the same: |
1217 // old_trip_count == new_trip_count * 2 | 1217 // old_trip_count == new_trip_count * 2 |
1218 // Note: since old_trip_count >= 2 then new_trip_count >= 1 | 1218 // Note: since old_trip_count >= 2 then new_trip_count >= 1 |
1219 // so we also don't need to adjust zero trip test. | 1219 // so we also don't need to adjust zero trip test. |
1220 long limit_con = limit->get_int(); | 1220 jlong limit_con = limit->get_int(); |
1221 // (stride_con*2) not overflow since stride_con <= 8. | 1221 // (stride_con*2) not overflow since stride_con <= 8. |
1222 int new_stride_con = stride_con * 2; | 1222 int new_stride_con = stride_con * 2; |
1223 int stride_m = new_stride_con - (stride_con > 0 ? 1 : -1); | 1223 int stride_m = new_stride_con - (stride_con > 0 ? 1 : -1); |
1224 long trip_count = (limit_con - init_con + stride_m)/new_stride_con; | 1224 jlong trip_count = (limit_con - init_con + stride_m)/new_stride_con; |
1225 // New trip count should satisfy next conditions. | 1225 // New trip count should satisfy next conditions. |
1226 assert(trip_count > 0 && (julong)trip_count < (julong)max_juint/2, "sanity"); | 1226 assert(trip_count > 0 && (julong)trip_count < (julong)max_juint/2, "sanity"); |
1227 uint new_trip_count = (uint)trip_count; | 1227 uint new_trip_count = (uint)trip_count; |
1228 adjust_min_trip = (old_trip_count != new_trip_count*2); | 1228 adjust_min_trip = (old_trip_count != new_trip_count*2); |
1229 } | 1229 } |