hotspot/src/share/vm/oops/methodOop.cpp
changeset 10537 23539f11e110
parent 10500 0f9de4fc106e
child 11637 030466036615
--- a/hotspot/src/share/vm/oops/methodOop.cpp	Tue Sep 13 16:58:35 2011 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.cpp	Tue Sep 13 20:28:00 2011 -0700
@@ -1268,12 +1268,19 @@
 
 // Comparer for sorting an object array containing
 // methodOops.
-template <class T>
-static int method_comparator(T a, T b) {
+// Used non-template method_comparator methods since
+// Visual Studio 2003 compiler generates incorrect
+// optimized code for it.
+static int method_comparator_narrowOop(narrowOop a, narrowOop b) {
   methodOop m = (methodOop)oopDesc::decode_heap_oop_not_null(a);
   methodOop n = (methodOop)oopDesc::decode_heap_oop_not_null(b);
   return m->name()->fast_compare(n->name());
 }
+static int method_comparator_oop(oop a, oop b) {
+  methodOop m = (methodOop)a;
+  methodOop n = (methodOop)b;
+  return m->name()->fast_compare(n->name());
+}
 
 // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
 void methodOopDesc::sort_methods(objArrayOop methods,
@@ -1299,9 +1306,9 @@
     {
       No_Safepoint_Verifier nsv;
       if (UseCompressedOops) {
-        QuickSort::sort<narrowOop>((narrowOop*)(methods->base()), length, method_comparator<narrowOop>, idempotent);
+        QuickSort::sort<narrowOop>((narrowOop*)(methods->base()), length, method_comparator_narrowOop, idempotent);
       } else {
-        QuickSort::sort<oop>((oop*)(methods->base()), length, method_comparator<oop>, idempotent);
+        QuickSort::sort<oop>((oop*)(methods->base()), length, method_comparator_oop, idempotent);
       }
       if (UseConcMarkSweepGC) {
         // For CMS we need to dirty the cards for the array