7123315: instanceKlass::_static_oop_field_count and instanceKlass::_java_fields_count should be u2 type

Change instanceKlass::_static_oop_field_count and instanceKlass::_java_fields_count to u2 type.

Reviewed-by: never, bdelsart, dholmes
This commit is contained in:
Jiangli Zhou 2011-12-28 12:15:57 -05:00 committed by Jiangli Zhou
parent 82a0e26723
commit 0671e90755
4 changed files with 14 additions and 12 deletions

View file

@ -1050,7 +1050,7 @@ static FieldAllocationType basic_type_to_atype(bool is_static, BasicType type) {
class FieldAllocationCount: public ResourceObj {
public:
unsigned int count[MAX_FIELD_ALLOCATION_TYPE];
u2 count[MAX_FIELD_ALLOCATION_TYPE];
FieldAllocationCount() {
for (int i = 0; i < MAX_FIELD_ALLOCATION_TYPE; i++) {
@ -1060,6 +1060,8 @@ class FieldAllocationCount: public ResourceObj {
FieldAllocationType update(bool is_static, BasicType type) {
FieldAllocationType atype = basic_type_to_atype(is_static, type);
// Make sure there is no overflow with injected fields.
assert(count[atype] < 0xFFFF, "More than 65535 fields");
count[atype]++;
return atype;
}
@ -1070,7 +1072,7 @@ typeArrayHandle ClassFileParser::parse_fields(Symbol* class_name,
constantPoolHandle cp, bool is_interface,
FieldAllocationCount *fac,
objArrayHandle* fields_annotations,
int* java_fields_count_ptr, TRAPS) {
u2* java_fields_count_ptr, TRAPS) {
ClassFileStream* cfs = stream();
typeArrayHandle nullHandle;
cfs->guarantee_more(2, CHECK_(nullHandle)); // length
@ -2843,7 +2845,7 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
local_interfaces = parse_interfaces(cp, itfs_len, class_loader, protection_domain, _class_name, CHECK_(nullHandle));
}
int java_fields_count = 0;
u2 java_fields_count = 0;
// Fields (offsets are filled in later)
FieldAllocationCount fac;
objArrayHandle fields_annotations;