Commit c7bc0f7 Vladimir Ivanov
committed Dec 3, 2019
1 parent 22ea33c commit c7bc0f7 Copy full SHA for c7bc0f7
File tree 2 files changed +13
-22
lines changed
2 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -4104,32 +4104,22 @@ const TypeOopPtr *TypeAryPtr::cast_to_nonconst() const {
4104
4104
}
4105
4105
4106
4106
4107
- // -----------------------------narrow_size_type-------------------------------
4108
- // Local cache for arrayOopDesc::max_array_length(etype),
4109
- // which is kind of slow (and cached elsewhere by other users).
4110
- static jint max_array_length_cache[T_CONFLICT+1 ];
4111
- static jint max_array_length (BasicType etype) {
4112
- jint& cache = max_array_length_cache[etype];
4113
- jint res = cache;
4114
- if (res == 0 ) {
4115
- switch (etype) {
4116
- case T_NARROWOOP:
4107
+ // -----------------------------max_array_length-------------------------------
4108
+ // A wrapper around arrayOopDesc::max_array_length(etype) with some input normalization.
4109
+ jint TypeAryPtr::max_array_length (BasicType etype) {
4110
+ if (!is_java_primitive (etype) && !is_reference_type (etype)) {
4111
+ if (etype == T_NARROWOOP) {
4117
4112
etype = T_OBJECT;
4118
- break ;
4119
- case T_NARROWKLASS:
4120
- case T_CONFLICT:
4121
- case T_ILLEGAL:
4122
- case T_VOID:
4123
- etype = T_BYTE; // will produce conservatively high value
4124
- break ;
4125
- default :
4126
- break ;
4113
+ } else if (etype == T_ILLEGAL) { // bottom[]
4114
+ etype = T_BYTE; // will produce conservatively high value
4115
+ } else {
4116
+ fatal (" not an element type: %s" , type2name (etype));
4127
4117
}
4128
- cache = res = arrayOopDesc::max_array_length (etype);
4129
4118
}
4130
- return res ;
4119
+ return arrayOopDesc::max_array_length (etype) ;
4131
4120
}
4132
4121
4122
+ // -----------------------------narrow_size_type-------------------------------
4133
4123
// Narrow the given size type to the index range for the given array base type.
4134
4124
// Return NULL if the resulting int type becomes empty.
4135
4125
const TypeInt* TypeAryPtr::narrow_size_type (const TypeInt* size) const {
Original file line number Diff line number Diff line change @@ -455,7 +455,6 @@ class Type {
455
455
456
456
private:
457
457
// support arrays
458
- static const BasicType _basic_type[];
459
458
static const Type* _zero_type[T_CONFLICT+1 ];
460
459
static const Type* _const_basic_type[T_CONFLICT+1 ];
461
460
};
@@ -1225,6 +1224,8 @@ class TypeAryPtr : public TypeOopPtr {
1225
1224
1226
1225
const TypeAryPtr* cast_to_autobox_cache (bool cache) const ;
1227
1226
1227
+ static jint max_array_length (BasicType etype) ;
1228
+
1228
1229
// Convenience common pre-built types.
1229
1230
static const TypeAryPtr *RANGE;
1230
1231
static const TypeAryPtr *OOPS;
You can’t perform that action at this time.
0 commit comments