1.1 --- a/src/share/vm/opto/type.cpp Thu Feb 20 06:28:18 2020 +0000 1.2 +++ b/src/share/vm/opto/type.cpp Tue Dec 03 20:13:16 2019 +0300 1.3 @@ -3753,29 +3753,22 @@ 1.4 return make(_ptr, const_oop(), _ary, klass(), _klass_is_exact, _offset, instance_id, _speculative, _inline_depth); 1.5 } 1.6 1.7 +//-----------------------------max_array_length------------------------------- 1.8 +// A wrapper around arrayOopDesc::max_array_length(etype) with some input normalization. 1.9 +jint TypeAryPtr::max_array_length(BasicType etype) { 1.10 + if (!is_java_primitive(etype) && !is_reference_type(etype)) { 1.11 + if (etype == T_NARROWOOP) { 1.12 + etype = T_OBJECT; 1.13 + } else if (etype == T_ILLEGAL) { // bottom[] 1.14 + etype = T_BYTE; // will produce conservatively high value 1.15 + } else { 1.16 + fatal(err_msg("not an element type: %s", type2name(etype))); 1.17 + } 1.18 + } 1.19 + return arrayOopDesc::max_array_length(etype); 1.20 +} 1.21 + 1.22 //-----------------------------narrow_size_type------------------------------- 1.23 -// Local cache for arrayOopDesc::max_array_length(etype), 1.24 -// which is kind of slow (and cached elsewhere by other users). 1.25 -static jint max_array_length_cache[T_CONFLICT+1]; 1.26 -static jint max_array_length(BasicType etype) { 1.27 - jint& cache = max_array_length_cache[etype]; 1.28 - jint res = cache; 1.29 - if (res == 0) { 1.30 - switch (etype) { 1.31 - case T_NARROWOOP: 1.32 - etype = T_OBJECT; 1.33 - break; 1.34 - case T_NARROWKLASS: 1.35 - case T_CONFLICT: 1.36 - case T_ILLEGAL: 1.37 - case T_VOID: 1.38 - etype = T_BYTE; // will produce conservatively high value 1.39 - } 1.40 - cache = res = arrayOopDesc::max_array_length(etype); 1.41 - } 1.42 - return res; 1.43 -} 1.44 - 1.45 // Narrow the given size type to the index range for the given array base type. 1.46 // Return NULL if the resulting int type becomes empty. 1.47 const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size) const {