src/share/vm/oops/methodOop.cpp

changeset 3128
f94227b6117b
parent 3091
ac8738449b6f
child 3500
0382d2b469b2
     1.1 --- a/src/share/vm/oops/methodOop.cpp	Tue Sep 13 16:58:35 2011 -0700
     1.2 +++ b/src/share/vm/oops/methodOop.cpp	Tue Sep 13 20:28:00 2011 -0700
     1.3 @@ -1268,12 +1268,19 @@
     1.4  
     1.5  // Comparer for sorting an object array containing
     1.6  // methodOops.
     1.7 -template <class T>
     1.8 -static int method_comparator(T a, T b) {
     1.9 +// Used non-template method_comparator methods since
    1.10 +// Visual Studio 2003 compiler generates incorrect
    1.11 +// optimized code for it.
    1.12 +static int method_comparator_narrowOop(narrowOop a, narrowOop b) {
    1.13    methodOop m = (methodOop)oopDesc::decode_heap_oop_not_null(a);
    1.14    methodOop n = (methodOop)oopDesc::decode_heap_oop_not_null(b);
    1.15    return m->name()->fast_compare(n->name());
    1.16  }
    1.17 +static int method_comparator_oop(oop a, oop b) {
    1.18 +  methodOop m = (methodOop)a;
    1.19 +  methodOop n = (methodOop)b;
    1.20 +  return m->name()->fast_compare(n->name());
    1.21 +}
    1.22  
    1.23  // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
    1.24  void methodOopDesc::sort_methods(objArrayOop methods,
    1.25 @@ -1299,9 +1306,9 @@
    1.26      {
    1.27        No_Safepoint_Verifier nsv;
    1.28        if (UseCompressedOops) {
    1.29 -        QuickSort::sort<narrowOop>((narrowOop*)(methods->base()), length, method_comparator<narrowOop>, idempotent);
    1.30 +        QuickSort::sort<narrowOop>((narrowOop*)(methods->base()), length, method_comparator_narrowOop, idempotent);
    1.31        } else {
    1.32 -        QuickSort::sort<oop>((oop*)(methods->base()), length, method_comparator<oop>, idempotent);
    1.33 +        QuickSort::sort<oop>((oop*)(methods->base()), length, method_comparator_oop, idempotent);
    1.34        }
    1.35        if (UseConcMarkSweepGC) {
    1.36          // For CMS we need to dirty the cards for the array

mercurial