Mercurial > hg > graal-compiler
diff src/share/vm/classfile/classFileParser.cpp @ 4745:05de27e852c4
Merge
author | jiangli |
---|---|
date | Wed, 04 Jan 2012 12:36:07 -0500 |
parents | 4ceaf61479fc cd5d8cafcc84 |
children | 2b3acb34791f |
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp Tue Jan 03 10:22:19 2012 -0800 +++ b/src/share/vm/classfile/classFileParser.cpp Wed Jan 04 12:36:07 2012 -0500 @@ -1051,7 +1051,7 @@ 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++) { @@ -1061,6 +1061,8 @@ 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; } @@ -1071,7 +1073,7 @@ 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 @@ -2861,7 +2863,7 @@ 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;