comparison src/share/vm/opto/type.cpp @ 1009:03b336640699

6885584: A particular class structure causes large allocation spike for jit Reviewed-by: kvn
author never
date Wed, 07 Oct 2009 15:38:37 -0700
parents 6a8ccac44f41
children 97125851f396 ae4032fb0a5b
comparison
equal deleted inserted replaced
1008:e90521d61f9a 1009:03b336640699
1113 return new TypeInt(_hi,_lo,WidenMax-_widen); 1113 return new TypeInt(_hi,_lo,WidenMax-_widen);
1114 } 1114 }
1115 1115
1116 //------------------------------widen------------------------------------------ 1116 //------------------------------widen------------------------------------------
1117 // Only happens for optimistic top-down optimizations. 1117 // Only happens for optimistic top-down optimizations.
1118 const Type *TypeInt::widen( const Type *old ) const { 1118 const Type *TypeInt::widen( const Type *old, const Type* limit ) const {
1119 // Coming from TOP or such; no widening 1119 // Coming from TOP or such; no widening
1120 if( old->base() != Int ) return this; 1120 if( old->base() != Int ) return this;
1121 const TypeInt *ot = old->is_int(); 1121 const TypeInt *ot = old->is_int();
1122 1122
1123 // If new guy is equal to old guy, no widening 1123 // If new guy is equal to old guy, no widening
1132 // If old guy was a constant, do not bother 1132 // If old guy was a constant, do not bother
1133 if (ot->_lo == ot->_hi) return this; 1133 if (ot->_lo == ot->_hi) return this;
1134 // Now widen new guy. 1134 // Now widen new guy.
1135 // Check for widening too far 1135 // Check for widening too far
1136 if (_widen == WidenMax) { 1136 if (_widen == WidenMax) {
1137 if (min_jint < _lo && _hi < max_jint) { 1137 int max = max_jint;
1138 int min = min_jint;
1139 if (limit->isa_int()) {
1140 max = limit->is_int()->_hi;
1141 min = limit->is_int()->_lo;
1142 }
1143 if (min < _lo && _hi < max) {
1138 // If neither endpoint is extremal yet, push out the endpoint 1144 // If neither endpoint is extremal yet, push out the endpoint
1139 // which is closer to its respective limit. 1145 // which is closer to its respective limit.
1140 if (_lo >= 0 || // easy common case 1146 if (_lo >= 0 || // easy common case
1141 (juint)(_lo - min_jint) >= (juint)(max_jint - _hi)) { 1147 (juint)(_lo - min) >= (juint)(max - _hi)) {
1142 // Try to widen to an unsigned range type of 31 bits: 1148 // Try to widen to an unsigned range type of 31 bits:
1143 return make(_lo, max_jint, WidenMax); 1149 return make(_lo, max, WidenMax);
1144 } else { 1150 } else {
1145 return make(min_jint, _hi, WidenMax); 1151 return make(min, _hi, WidenMax);
1146 } 1152 }
1147 } 1153 }
1148 return TypeInt::INT; 1154 return TypeInt::INT;
1149 } 1155 }
1150 // Returned widened new guy 1156 // Returned widened new guy
1355 return new TypeLong(_hi,_lo,WidenMax-_widen); 1361 return new TypeLong(_hi,_lo,WidenMax-_widen);
1356 } 1362 }
1357 1363
1358 //------------------------------widen------------------------------------------ 1364 //------------------------------widen------------------------------------------
1359 // Only happens for optimistic top-down optimizations. 1365 // Only happens for optimistic top-down optimizations.
1360 const Type *TypeLong::widen( const Type *old ) const { 1366 const Type *TypeLong::widen( const Type *old, const Type* limit ) const {
1361 // Coming from TOP or such; no widening 1367 // Coming from TOP or such; no widening
1362 if( old->base() != Long ) return this; 1368 if( old->base() != Long ) return this;
1363 const TypeLong *ot = old->is_long(); 1369 const TypeLong *ot = old->is_long();
1364 1370
1365 // If new guy is equal to old guy, no widening 1371 // If new guy is equal to old guy, no widening
1374 // If old guy was a constant, do not bother 1380 // If old guy was a constant, do not bother
1375 if (ot->_lo == ot->_hi) return this; 1381 if (ot->_lo == ot->_hi) return this;
1376 // Now widen new guy. 1382 // Now widen new guy.
1377 // Check for widening too far 1383 // Check for widening too far
1378 if (_widen == WidenMax) { 1384 if (_widen == WidenMax) {
1379 if (min_jlong < _lo && _hi < max_jlong) { 1385 jlong max = max_jlong;
1386 jlong min = min_jlong;
1387 if (limit->isa_long()) {
1388 max = limit->is_long()->_hi;
1389 min = limit->is_long()->_lo;
1390 }
1391 if (min < _lo && _hi < max) {
1380 // If neither endpoint is extremal yet, push out the endpoint 1392 // If neither endpoint is extremal yet, push out the endpoint
1381 // which is closer to its respective limit. 1393 // which is closer to its respective limit.
1382 if (_lo >= 0 || // easy common case 1394 if (_lo >= 0 || // easy common case
1383 (julong)(_lo - min_jlong) >= (julong)(max_jlong - _hi)) { 1395 (julong)(_lo - min) >= (julong)(max - _hi)) {
1384 // Try to widen to an unsigned range type of 32/63 bits: 1396 // Try to widen to an unsigned range type of 32/63 bits:
1385 if (_hi < max_juint) 1397 if (max >= max_juint && _hi < max_juint)
1386 return make(_lo, max_juint, WidenMax); 1398 return make(_lo, max_juint, WidenMax);
1387 else 1399 else
1388 return make(_lo, max_jlong, WidenMax); 1400 return make(_lo, max, WidenMax);
1389 } else { 1401 } else {
1390 return make(min_jlong, _hi, WidenMax); 1402 return make(min, _hi, WidenMax);
1391 } 1403 }
1392 } 1404 }
1393 return TypeLong::LONG; 1405 return TypeLong::LONG;
1394 } 1406 }
1395 // Returned widened new guy 1407 // Returned widened new guy