--- a/hotspot/src/share/vm/opto/type.cpp Mon Sep 15 09:58:26 2008 -0700
+++ b/hotspot/src/share/vm/opto/type.cpp Wed Sep 17 08:29:17 2008 -0700
@@ -3157,17 +3157,18 @@
// Narrow the given size type to the index range for the given array base type.
// Return NULL if the resulting int type becomes empty.
-const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size, BasicType elem) {
+const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size) const {
jint hi = size->_hi;
jint lo = size->_lo;
jint min_lo = 0;
- jint max_hi = max_array_length(elem);
+ jint max_hi = max_array_length(elem()->basic_type());
//if (index_not_size) --max_hi; // type of a valid array index, FTR
bool chg = false;
if (lo < min_lo) { lo = min_lo; chg = true; }
if (hi > max_hi) { hi = max_hi; chg = true; }
+ // Negative length arrays will produce weird intermediate dead fath-path code
if (lo > hi)
- return NULL;
+ return TypeInt::ZERO;
if (!chg)
return size;
return TypeInt::make(lo, hi, Type::WidenMin);
@@ -3176,9 +3177,7 @@
//-------------------------------cast_to_size----------------------------------
const TypeAryPtr* TypeAryPtr::cast_to_size(const TypeInt* new_size) const {
assert(new_size != NULL, "");
- new_size = narrow_size_type(new_size, elem()->basic_type());
- if (new_size == NULL) // Negative length arrays will produce weird
- new_size = TypeInt::ZERO; // intermediate dead fast-path goo
+ new_size = narrow_size_type(new_size);
if (new_size == size()) return this;
const TypeAry* new_ary = TypeAry::make(elem(), new_size);
return make(ptr(), const_oop(), new_ary, klass(), klass_is_exact(), _offset, _instance_id);