comparison src/share/vm/classfile/classFileParser.cpp @ 7462:ade95d680b42

8004728: Add hotspot support for parameter reflection Summary: Add hotspot support for parameter reflection Reviewed-by: acorn, jrose, coleenp Contributed-by: eric.mccorkle@oracle.com
author coleenp
date Tue, 08 Jan 2013 14:01:36 -0500
parents 35431a769282
children adc176e95bf2 ff0a7943fd29
comparison
equal deleted inserted replaced
7460:6c3f47d964f3 7462:ade95d680b42
1933 u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER; 1933 u2 max_lvtt_cnt = INITIAL_MAX_LVT_NUMBER;
1934 u2* localvariable_table_length; 1934 u2* localvariable_table_length;
1935 u2** localvariable_table_start; 1935 u2** localvariable_table_start;
1936 u2* localvariable_type_table_length; 1936 u2* localvariable_type_table_length;
1937 u2** localvariable_type_table_start; 1937 u2** localvariable_type_table_start;
1938 u2 method_parameters_length = 0;
1939 u1* method_parameters_data = NULL;
1938 bool parsed_code_attribute = false; 1940 bool parsed_code_attribute = false;
1939 bool parsed_checked_exceptions_attribute = false; 1941 bool parsed_checked_exceptions_attribute = false;
1940 bool parsed_stackmap_attribute = false; 1942 bool parsed_stackmap_attribute = false;
1941 // stackmap attribute - JDK1.5 1943 // stackmap attribute - JDK1.5
1942 Array<u1>* stackmap_data = NULL; 1944 Array<u1>* stackmap_data = NULL;
2142 parsed_checked_exceptions_attribute = true; 2144 parsed_checked_exceptions_attribute = true;
2143 checked_exceptions_start = 2145 checked_exceptions_start =
2144 parse_checked_exceptions(&checked_exceptions_length, 2146 parse_checked_exceptions(&checked_exceptions_length,
2145 method_attribute_length, 2147 method_attribute_length,
2146 cp, CHECK_(nullHandle)); 2148 cp, CHECK_(nullHandle));
2149 } else if (method_attribute_name == vmSymbols::tag_method_parameters()) {
2150 method_parameters_length = cfs->get_u1_fast();
2151 method_parameters_data = cfs->get_u1_buffer();
2152 cfs->skip_u2_fast(method_parameters_length);
2153 cfs->skip_u4_fast(method_parameters_length);
2154 // ignore this attribute if it cannot be reflected
2155 if (!SystemDictionary::Parameter_klass_loaded())
2156 method_parameters_length = 0;
2147 } else if (method_attribute_name == vmSymbols::tag_synthetic()) { 2157 } else if (method_attribute_name == vmSymbols::tag_synthetic()) {
2148 if (method_attribute_length != 0) { 2158 if (method_attribute_length != 0) {
2149 classfile_parse_error( 2159 classfile_parse_error(
2150 "Invalid Synthetic method attribute length %u in class file %s", 2160 "Invalid Synthetic method attribute length %u in class file %s",
2151 method_attribute_length, CHECK_(nullHandle)); 2161 method_attribute_length, CHECK_(nullHandle));
2229 2239
2230 // All sizing information for a Method* is finally available, now create it 2240 // All sizing information for a Method* is finally available, now create it
2231 Method* m = Method::allocate( 2241 Method* m = Method::allocate(
2232 loader_data, code_length, access_flags, linenumber_table_length, 2242 loader_data, code_length, access_flags, linenumber_table_length,
2233 total_lvt_length, exception_table_length, checked_exceptions_length, 2243 total_lvt_length, exception_table_length, checked_exceptions_length,
2234 generic_signature_index, ConstMethod::NORMAL, CHECK_(nullHandle)); 2244 method_parameters_length, generic_signature_index,
2245 ConstMethod::NORMAL, CHECK_(nullHandle));
2235 2246
2236 ClassLoadingService::add_class_method_size(m->size()*HeapWordSize); 2247 ClassLoadingService::add_class_method_size(m->size()*HeapWordSize);
2237 2248
2238 // Fill in information from fixed part (access_flags already set) 2249 // Fill in information from fixed part (access_flags already set)
2239 m->set_constants(cp()); 2250 m->set_constants(cp());
2275 if (exception_table_length > 0) { 2286 if (exception_table_length > 0) {
2276 int size = 2287 int size =
2277 exception_table_length * sizeof(ExceptionTableElement) / sizeof(u2); 2288 exception_table_length * sizeof(ExceptionTableElement) / sizeof(u2);
2278 copy_u2_with_conversion((u2*) m->exception_table_start(), 2289 copy_u2_with_conversion((u2*) m->exception_table_start(),
2279 exception_table_start, size); 2290 exception_table_start, size);
2291 }
2292
2293 // Copy method parameters
2294 if (method_parameters_length > 0) {
2295 MethodParametersElement* elem = m->constMethod()->method_parameters_start();
2296 for(int i = 0; i < method_parameters_length; i++) {
2297 elem[i].name_cp_index =
2298 Bytes::get_Java_u2(method_parameters_data);
2299 method_parameters_data += 2;
2300 elem[i].flags = Bytes::get_Java_u4(method_parameters_data);
2301 method_parameters_data += 4;
2302 }
2280 } 2303 }
2281 2304
2282 // Copy checked exceptions 2305 // Copy checked exceptions
2283 if (checked_exceptions_length > 0) { 2306 if (checked_exceptions_length > 0) {
2284 int size = checked_exceptions_length * sizeof(CheckedExceptionElement) / sizeof(u2); 2307 int size = checked_exceptions_length * sizeof(CheckedExceptionElement) / sizeof(u2);
3040 KlassHandle host_klass, 3063 KlassHandle host_klass,
3041 GrowableArray<Handle>* cp_patches, 3064 GrowableArray<Handle>* cp_patches,
3042 TempNewSymbol& parsed_name, 3065 TempNewSymbol& parsed_name,
3043 bool verify, 3066 bool verify,
3044 TRAPS) { 3067 TRAPS) {
3068
3045 // When a retransformable agent is attached, JVMTI caches the 3069 // When a retransformable agent is attached, JVMTI caches the
3046 // class bytes that existed before the first retransformation. 3070 // class bytes that existed before the first retransformation.
3047 // If RedefineClasses() was used before the retransformable 3071 // If RedefineClasses() was used before the retransformable
3048 // agent attached, then the cached class bytes may not be the 3072 // agent attached, then the cached class bytes may not be the
3049 // original class bytes. 3073 // original class bytes.