Mercurial > hg > truffle
diff src/share/vm/oops/methodOop.cpp @ 3929:f94227b6117b
7090259: Fix hotspot sources to build with old compilers
Summary: Fixed warnings which prevent building VM with old compilers.
Reviewed-by: never
author | kvn |
---|---|
date | Tue, 13 Sep 2011 20:28:00 -0700 |
parents | ac8738449b6f |
children | 04b9a2566eec 0382d2b469b2 |
line wrap: on
line diff
--- a/src/share/vm/oops/methodOop.cpp Tue Sep 13 16:58:35 2011 -0700 +++ b/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