--- old/src/share/vm/oops/methodOop.cpp Tue Sep 13 17:10:37 2011 +++ new/src/share/vm/oops/methodOop.cpp Tue Sep 13 17:10:36 2011 @@ -1268,12 +1268,19 @@ // Comparer for sorting an object array containing // methodOops. -template -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*)(methods->base()), length, method_comparator, idempotent); + QuickSort::sort((narrowOop*)(methods->base()), length, method_comparator_narrowOop, idempotent); } else { - QuickSort::sort((oop*)(methods->base()), length, method_comparator, idempotent); + QuickSort::sort((oop*)(methods->base()), length, method_comparator_oop, idempotent); } if (UseConcMarkSweepGC) { // For CMS we need to dirty the cards for the array