Mercurial > hg > graal-jvmci-8
comparison src/share/vm/oops/method.cpp @ 7482:989155e2d07a
Merge with hs25-b15.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 16 Jan 2013 01:34:24 +0100 |
parents | 96ce80e956a1 18c3c3fa291b |
children | 5fc51c1ecdeb |
comparison
equal
deleted
inserted
replaced
7381:6761a8f854a4 | 7482:989155e2d07a |
---|---|
65 AccessFlags access_flags, | 65 AccessFlags access_flags, |
66 int compressed_line_number_size, | 66 int compressed_line_number_size, |
67 int localvariable_table_length, | 67 int localvariable_table_length, |
68 int exception_table_length, | 68 int exception_table_length, |
69 int checked_exceptions_length, | 69 int checked_exceptions_length, |
70 int method_parameters_length, | |
70 u2 generic_signature_index, | 71 u2 generic_signature_index, |
71 ConstMethod::MethodType method_type, | 72 ConstMethod::MethodType method_type, |
72 TRAPS) { | 73 TRAPS) { |
73 assert(!access_flags.is_native() || byte_code_size == 0, | 74 assert(!access_flags.is_native() || byte_code_size == 0, |
74 "native methods should not contain byte codes"); | 75 "native methods should not contain byte codes"); |
76 byte_code_size, | 77 byte_code_size, |
77 compressed_line_number_size, | 78 compressed_line_number_size, |
78 localvariable_table_length, | 79 localvariable_table_length, |
79 exception_table_length, | 80 exception_table_length, |
80 checked_exceptions_length, | 81 checked_exceptions_length, |
82 method_parameters_length, | |
81 generic_signature_index, | 83 generic_signature_index, |
82 method_type, | 84 method_type, |
83 CHECK_NULL); | 85 CHECK_NULL); |
84 | 86 |
85 int size = Method::size(access_flags.is_native()); | 87 int size = Method::size(access_flags.is_native()); |
198 } | 200 } |
199 | 201 |
200 return buf; | 202 return buf; |
201 } | 203 } |
202 | 204 |
203 int Method::fast_exception_handler_bci_for(KlassHandle ex_klass, int throw_bci, TRAPS) { | 205 int Method::fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS) { |
204 // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index) | 206 // exception table holds quadruple entries of the form (beg_bci, end_bci, handler_bci, klass_index) |
205 // access exception table | 207 // access exception table |
206 ExceptionTable table(this); | 208 ExceptionTable table(mh()); |
207 int length = table.length(); | 209 int length = table.length(); |
208 // iterate through all entries sequentially | 210 // iterate through all entries sequentially |
209 constantPoolHandle pool(THREAD, constants()); | 211 constantPoolHandle pool(THREAD, mh->constants()); |
210 for (int i = 0; i < length; i ++) { | 212 for (int i = 0; i < length; i ++) { |
211 //reacquire the table in case a GC happened | 213 //reacquire the table in case a GC happened |
212 ExceptionTable table(this); | 214 ExceptionTable table(mh()); |
213 int beg_bci = table.start_pc(i); | 215 int beg_bci = table.start_pc(i); |
214 int end_bci = table.end_pc(i); | 216 int end_bci = table.end_pc(i); |
215 assert(beg_bci <= end_bci, "inconsistent exception table"); | 217 assert(beg_bci <= end_bci, "inconsistent exception table"); |
216 if (beg_bci <= throw_bci && throw_bci < end_bci) { | 218 if (beg_bci <= throw_bci && throw_bci < end_bci) { |
217 // exception handler bci range covers throw_bci => investigate further | 219 // exception handler bci range covers throw_bci => investigate further |
1042 if (must_be_static) flags_bits |= JVM_ACC_STATIC; | 1044 if (must_be_static) flags_bits |= JVM_ACC_STATIC; |
1043 assert((flags_bits & JVM_ACC_PUBLIC) == 0, "do not expose these methods"); | 1045 assert((flags_bits & JVM_ACC_PUBLIC) == 0, "do not expose these methods"); |
1044 | 1046 |
1045 methodHandle m; | 1047 methodHandle m; |
1046 { | 1048 { |
1047 Method* m_oop = Method::allocate(loader_data, 0, accessFlags_from(flags_bits), | 1049 Method* m_oop = Method::allocate(loader_data, 0, |
1048 0, 0, 0, 0, 0, ConstMethod::NORMAL, CHECK_(empty)); | 1050 accessFlags_from(flags_bits), |
1051 0, 0, 0, 0, 0, 0, | |
1052 ConstMethod::NORMAL, CHECK_(empty)); | |
1049 m = methodHandle(THREAD, m_oop); | 1053 m = methodHandle(THREAD, m_oop); |
1050 } | 1054 } |
1051 m->set_constants(cp()); | 1055 m->set_constants(cp()); |
1052 m->set_name_index(_imcp_invoke_name); | 1056 m->set_name_index(_imcp_invoke_name); |
1053 m->set_signature_index(_imcp_invoke_signature); | 1057 m->set_signature_index(_imcp_invoke_signature); |
1095 AccessFlags flags = m->access_flags(); | 1099 AccessFlags flags = m->access_flags(); |
1096 u2 generic_signature_index = m->generic_signature_index(); | 1100 u2 generic_signature_index = m->generic_signature_index(); |
1097 int checked_exceptions_len = m->checked_exceptions_length(); | 1101 int checked_exceptions_len = m->checked_exceptions_length(); |
1098 int localvariable_len = m->localvariable_table_length(); | 1102 int localvariable_len = m->localvariable_table_length(); |
1099 int exception_table_len = m->exception_table_length(); | 1103 int exception_table_len = m->exception_table_length(); |
1104 int method_parameters_len = m->method_parameters_length(); | |
1100 | 1105 |
1101 ClassLoaderData* loader_data = m->method_holder()->class_loader_data(); | 1106 ClassLoaderData* loader_data = m->method_holder()->class_loader_data(); |
1102 Method* newm_oop = Method::allocate(loader_data, | 1107 Method* newm_oop = Method::allocate(loader_data, |
1103 new_code_length, | 1108 new_code_length, |
1104 flags, | 1109 flags, |
1105 new_compressed_linenumber_size, | 1110 new_compressed_linenumber_size, |
1106 localvariable_len, | 1111 localvariable_len, |
1107 exception_table_len, | 1112 exception_table_len, |
1108 checked_exceptions_len, | 1113 checked_exceptions_len, |
1114 method_parameters_len, | |
1109 generic_signature_index, | 1115 generic_signature_index, |
1110 m->method_type(), | 1116 m->method_type(), |
1111 CHECK_(methodHandle())); | 1117 CHECK_(methodHandle())); |
1112 methodHandle newm (THREAD, newm_oop); | 1118 methodHandle newm (THREAD, newm_oop); |
1113 int new_method_size = newm->method_size(); | 1119 int new_method_size = newm->method_size(); |
1338 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array | 1344 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array |
1339 void Method::sort_methods(Array<Method*>* methods, | 1345 void Method::sort_methods(Array<Method*>* methods, |
1340 Array<AnnotationArray*>* methods_annotations, | 1346 Array<AnnotationArray*>* methods_annotations, |
1341 Array<AnnotationArray*>* methods_parameter_annotations, | 1347 Array<AnnotationArray*>* methods_parameter_annotations, |
1342 Array<AnnotationArray*>* methods_default_annotations, | 1348 Array<AnnotationArray*>* methods_default_annotations, |
1349 Array<AnnotationArray*>* methods_type_annotations, | |
1343 bool idempotent) { | 1350 bool idempotent) { |
1344 int length = methods->length(); | 1351 int length = methods->length(); |
1345 if (length > 1) { | 1352 if (length > 1) { |
1346 bool do_annotations = false; | 1353 bool do_annotations = false; |
1347 if (methods_annotations != NULL || | 1354 if (methods_annotations != NULL || |
1348 methods_parameter_annotations != NULL || | 1355 methods_parameter_annotations != NULL || |
1349 methods_default_annotations != NULL) { | 1356 methods_default_annotations != NULL || |
1357 methods_type_annotations != NULL) { | |
1350 do_annotations = true; | 1358 do_annotations = true; |
1351 } | 1359 } |
1352 if (do_annotations) { | 1360 if (do_annotations) { |
1353 // Remember current method ordering so we can reorder annotations | 1361 // Remember current method ordering so we can reorder annotations |
1354 for (int i = 0; i < length; i++) { | 1362 for (int i = 0; i < length; i++) { |
1363 | 1371 |
1364 // Sort annotations if necessary | 1372 // Sort annotations if necessary |
1365 assert(methods_annotations == NULL || methods_annotations->length() == methods->length(), ""); | 1373 assert(methods_annotations == NULL || methods_annotations->length() == methods->length(), ""); |
1366 assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), ""); | 1374 assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), ""); |
1367 assert(methods_default_annotations == NULL || methods_default_annotations->length() == methods->length(), ""); | 1375 assert(methods_default_annotations == NULL || methods_default_annotations->length() == methods->length(), ""); |
1376 assert(methods_type_annotations == NULL || methods_type_annotations->length() == methods->length(), ""); | |
1368 if (do_annotations) { | 1377 if (do_annotations) { |
1369 ResourceMark rm; | 1378 ResourceMark rm; |
1370 // Allocate temporary storage | 1379 // Allocate temporary storage |
1371 GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length); | 1380 GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length); |
1372 reorder_based_on_method_index(methods, methods_annotations, temp_array); | 1381 reorder_based_on_method_index(methods, methods_annotations, temp_array); |
1373 reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array); | 1382 reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array); |
1374 reorder_based_on_method_index(methods, methods_default_annotations, temp_array); | 1383 reorder_based_on_method_index(methods, methods_default_annotations, temp_array); |
1384 reorder_based_on_method_index(methods, methods_type_annotations, temp_array); | |
1375 } | 1385 } |
1376 | 1386 |
1377 // Reset method ordering | 1387 // Reset method ordering |
1378 for (int i = 0; i < length; i++) { | 1388 for (int i = 0; i < length; i++) { |
1379 Method* m = methods->at(i); | 1389 Method* m = methods->at(i); |