1433 // Comparer for sorting an object array containing
1434 // Method*s.
1435 static int method_comparator(Method* a, Method* b) {
1436 return a->name()->fast_compare(b->name());
1437 }
1438
1439 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
1440 // default_methods also uses this without the ordering for fast find_method
1441 void Method::sort_methods(Array<Method*>* methods, bool idempotent, bool set_idnums) {
1442 int length = methods->length();
1443 if (length > 1) {
1444 {
1445 No_Safepoint_Verifier nsv;
1446 QuickSort::sort<Method*>(methods->data(), length, method_comparator, idempotent);
1447 }
1448 // Reset method ordering
1449 if (set_idnums) {
1450 for (int i = 0; i < length; i++) {
1451 Method* m = methods->at(i);
1452 m->set_method_idnum(i);
1453 }
1454 }
1455 }
1456 }
1457
1458 //-----------------------------------------------------------------------------------
1459 // Non-product code unless JVM/TI needs it
1460
1461 #if !defined(PRODUCT) || INCLUDE_JVMTI
1462 class SignatureTypePrinter : public SignatureTypeNames {
1463 private:
1464 outputStream* _st;
1465 bool _use_separator;
1466
1467 void type_name(const char* name) {
1468 if (_use_separator) _st->print(", ");
1469 _st->print("%s", name);
1470 _use_separator = true;
1471 }
1472
|
1433 // Comparer for sorting an object array containing
1434 // Method*s.
1435 static int method_comparator(Method* a, Method* b) {
1436 return a->name()->fast_compare(b->name());
1437 }
1438
1439 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
1440 // default_methods also uses this without the ordering for fast find_method
1441 void Method::sort_methods(Array<Method*>* methods, bool idempotent, bool set_idnums) {
1442 int length = methods->length();
1443 if (length > 1) {
1444 {
1445 No_Safepoint_Verifier nsv;
1446 QuickSort::sort<Method*>(methods->data(), length, method_comparator, idempotent);
1447 }
1448 // Reset method ordering
1449 if (set_idnums) {
1450 for (int i = 0; i < length; i++) {
1451 Method* m = methods->at(i);
1452 m->set_method_idnum(i);
1453 m->set_orig_method_idnum(i);
1454 }
1455 }
1456 }
1457 }
1458
1459 //-----------------------------------------------------------------------------------
1460 // Non-product code unless JVM/TI needs it
1461
1462 #if !defined(PRODUCT) || INCLUDE_JVMTI
1463 class SignatureTypePrinter : public SignatureTypeNames {
1464 private:
1465 outputStream* _st;
1466 bool _use_separator;
1467
1468 void type_name(const char* name) {
1469 if (_use_separator) _st->print(", ");
1470 _st->print("%s", name);
1471 _use_separator = true;
1472 }
1473
|