Mercurial > hg > graal-compiler
comparison src/share/vm/oops/method.cpp @ 7457:35431a769282
8004823: Add VM support for type annotation reflection
Reviewed-by: dholmes, coleenp
Contributed-by: joel.franck@oracle.com
author | stefank |
---|---|
date | Thu, 20 Dec 2012 10:22:19 +0100 |
parents | 5505fbbae3d3 |
children | ade95d680b42 |
comparison
equal
deleted
inserted
replaced
7456:7d42f3b08300 | 7457:35431a769282 |
---|---|
1329 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array | 1329 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array |
1330 void Method::sort_methods(Array<Method*>* methods, | 1330 void Method::sort_methods(Array<Method*>* methods, |
1331 Array<AnnotationArray*>* methods_annotations, | 1331 Array<AnnotationArray*>* methods_annotations, |
1332 Array<AnnotationArray*>* methods_parameter_annotations, | 1332 Array<AnnotationArray*>* methods_parameter_annotations, |
1333 Array<AnnotationArray*>* methods_default_annotations, | 1333 Array<AnnotationArray*>* methods_default_annotations, |
1334 Array<AnnotationArray*>* methods_type_annotations, | |
1334 bool idempotent) { | 1335 bool idempotent) { |
1335 int length = methods->length(); | 1336 int length = methods->length(); |
1336 if (length > 1) { | 1337 if (length > 1) { |
1337 bool do_annotations = false; | 1338 bool do_annotations = false; |
1338 if (methods_annotations != NULL || | 1339 if (methods_annotations != NULL || |
1339 methods_parameter_annotations != NULL || | 1340 methods_parameter_annotations != NULL || |
1340 methods_default_annotations != NULL) { | 1341 methods_default_annotations != NULL || |
1342 methods_type_annotations != NULL) { | |
1341 do_annotations = true; | 1343 do_annotations = true; |
1342 } | 1344 } |
1343 if (do_annotations) { | 1345 if (do_annotations) { |
1344 // Remember current method ordering so we can reorder annotations | 1346 // Remember current method ordering so we can reorder annotations |
1345 for (int i = 0; i < length; i++) { | 1347 for (int i = 0; i < length; i++) { |
1354 | 1356 |
1355 // Sort annotations if necessary | 1357 // Sort annotations if necessary |
1356 assert(methods_annotations == NULL || methods_annotations->length() == methods->length(), ""); | 1358 assert(methods_annotations == NULL || methods_annotations->length() == methods->length(), ""); |
1357 assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), ""); | 1359 assert(methods_parameter_annotations == NULL || methods_parameter_annotations->length() == methods->length(), ""); |
1358 assert(methods_default_annotations == NULL || methods_default_annotations->length() == methods->length(), ""); | 1360 assert(methods_default_annotations == NULL || methods_default_annotations->length() == methods->length(), ""); |
1361 assert(methods_type_annotations == NULL || methods_type_annotations->length() == methods->length(), ""); | |
1359 if (do_annotations) { | 1362 if (do_annotations) { |
1360 ResourceMark rm; | 1363 ResourceMark rm; |
1361 // Allocate temporary storage | 1364 // Allocate temporary storage |
1362 GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length); | 1365 GrowableArray<AnnotationArray*>* temp_array = new GrowableArray<AnnotationArray*>(length); |
1363 reorder_based_on_method_index(methods, methods_annotations, temp_array); | 1366 reorder_based_on_method_index(methods, methods_annotations, temp_array); |
1364 reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array); | 1367 reorder_based_on_method_index(methods, methods_parameter_annotations, temp_array); |
1365 reorder_based_on_method_index(methods, methods_default_annotations, temp_array); | 1368 reorder_based_on_method_index(methods, methods_default_annotations, temp_array); |
1369 reorder_based_on_method_index(methods, methods_type_annotations, temp_array); | |
1366 } | 1370 } |
1367 | 1371 |
1368 // Reset method ordering | 1372 // Reset method ordering |
1369 for (int i = 0; i < length; i++) { | 1373 for (int i = 0; i < length; i++) { |
1370 Method* m = methods->at(i); | 1374 Method* m = methods->at(i); |