Mercurial > hg > truffle
comparison src/share/vm/classfile/classFileParser.cpp @ 7589:5b6a231e5a86
Merge
author | coleenp |
---|---|
date | Mon, 14 Jan 2013 08:37:14 -0800 |
parents | 4a916f2ce331 f9eb431c3efe |
children | f422634e5828 |
comparison
equal
deleted
inserted
replaced
7587:4a916f2ce331 | 7589:5b6a231e5a86 |
---|---|
57 #include "runtime/signature.hpp" | 57 #include "runtime/signature.hpp" |
58 #include "runtime/timer.hpp" | 58 #include "runtime/timer.hpp" |
59 #include "services/classLoadingService.hpp" | 59 #include "services/classLoadingService.hpp" |
60 #include "services/threadService.hpp" | 60 #include "services/threadService.hpp" |
61 #include "utilities/array.hpp" | 61 #include "utilities/array.hpp" |
62 #include "utilities/globalDefinitions.hpp" | |
62 | 63 |
63 // We generally try to create the oops directly when parsing, rather than | 64 // We generally try to create the oops directly when parsing, rather than |
64 // allocating temporary data structures and copying the bytes twice. A | 65 // allocating temporary data structures and copying the bytes twice. A |
65 // temporary area is only needed when parsing utf8 entries in the constant | 66 // temporary area is only needed when parsing utf8 entries in the constant |
66 // pool and when parsing line number tables. | 67 // pool and when parsing line number tables. |
2157 parse_checked_exceptions(&checked_exceptions_length, | 2158 parse_checked_exceptions(&checked_exceptions_length, |
2158 method_attribute_length, | 2159 method_attribute_length, |
2159 cp, CHECK_(nullHandle)); | 2160 cp, CHECK_(nullHandle)); |
2160 } else if (method_attribute_name == vmSymbols::tag_method_parameters()) { | 2161 } else if (method_attribute_name == vmSymbols::tag_method_parameters()) { |
2161 method_parameters_length = cfs->get_u1_fast(); | 2162 method_parameters_length = cfs->get_u1_fast(); |
2163 // Track the actual size (note: this is written for clarity; a | |
2164 // decent compiler will CSE and constant-fold this into a single | |
2165 // expression) | |
2166 u2 actual_size = 1; | |
2162 method_parameters_data = cfs->get_u1_buffer(); | 2167 method_parameters_data = cfs->get_u1_buffer(); |
2168 actual_size += 2 * method_parameters_length; | |
2163 cfs->skip_u2_fast(method_parameters_length); | 2169 cfs->skip_u2_fast(method_parameters_length); |
2170 actual_size += 4 * method_parameters_length; | |
2164 cfs->skip_u4_fast(method_parameters_length); | 2171 cfs->skip_u4_fast(method_parameters_length); |
2172 // Enforce attribute length | |
2173 if (method_attribute_length != actual_size) { | |
2174 classfile_parse_error( | |
2175 "Invalid MethodParameters method attribute length %u in class file %s", | |
2176 method_attribute_length, CHECK_(nullHandle)); | |
2177 } | |
2165 // ignore this attribute if it cannot be reflected | 2178 // ignore this attribute if it cannot be reflected |
2166 if (!SystemDictionary::Parameter_klass_loaded()) | 2179 if (!SystemDictionary::Parameter_klass_loaded()) |
2167 method_parameters_length = 0; | 2180 method_parameters_length = 0; |
2168 } else if (method_attribute_name == vmSymbols::tag_synthetic()) { | 2181 } else if (method_attribute_name == vmSymbols::tag_synthetic()) { |
2169 if (method_attribute_length != 0) { | 2182 if (method_attribute_length != 0) { |
2307 MethodParametersElement* elem = m->constMethod()->method_parameters_start(); | 2320 MethodParametersElement* elem = m->constMethod()->method_parameters_start(); |
2308 for(int i = 0; i < method_parameters_length; i++) { | 2321 for(int i = 0; i < method_parameters_length; i++) { |
2309 elem[i].name_cp_index = | 2322 elem[i].name_cp_index = |
2310 Bytes::get_Java_u2(method_parameters_data); | 2323 Bytes::get_Java_u2(method_parameters_data); |
2311 method_parameters_data += 2; | 2324 method_parameters_data += 2; |
2312 elem[i].flags = Bytes::get_Java_u4(method_parameters_data); | 2325 u4 flags = Bytes::get_Java_u4(method_parameters_data); |
2326 // This caused an alignment fault on Sparc, if flags was a u4 | |
2327 elem[i].flags_lo = extract_low_short_from_int(flags); | |
2328 elem[i].flags_hi = extract_high_short_from_int(flags); | |
2313 method_parameters_data += 4; | 2329 method_parameters_data += 4; |
2314 } | 2330 } |
2315 } | 2331 } |
2316 | 2332 |
2317 // Copy checked exceptions | 2333 // Copy checked exceptions |