changeset 2237:3ef1a1866a60

7027232: JSR 292: wrong numeric value returned by MH on solaris-sparc Reviewed-by: kvn, never
author twisti
date Mon, 21 Mar 2011 02:30:49 -0700
parents fc5ebbb2d1a8
children 9dc311b8473e
files src/cpu/sparc/vm/methodHandles_sparc.cpp
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Mar 18 01:44:15 2011 -0700
+++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Mon Mar 21 02:30:49 2011 -0700
@@ -775,9 +775,13 @@
       switch (ek) {
       case _adapter_opt_i2l:
         {
-          __ ldsw(arg_lsw, O2_scratch);                           // Load LSW
-          NOT_LP64(__ srlx(O2_scratch, BitsPerInt, O3_scratch));  // Move high bits to lower bits for std
-          __ st_long(O2_scratch, arg_msw);                        // Uses O2/O3 on !_LP64
+#ifdef _LP64
+          __ ldsw(arg_lsw, O2_scratch);                 // Load LSW sign-extended
+#else
+          __ ldsw(arg_lsw, O3_scratch);                 // Load LSW sign-extended
+          __ srlx(O3_scratch, BitsPerInt, O2_scratch);  // Move MSW value to lower 32-bits for std
+#endif
+          __ st_long(O2_scratch, arg_msw);              // Uses O2/O3 on !_LP64
         }
         break;
       case _adapter_opt_unboxl: