changeset 1170:f58ec27b8941

2008-11-03 Gary Benson <gbenson@redhat.com> * ports/hotspot/src/share/vm/shark/sharkBlock.cpp (SharkBlock::parse): Fix shift instructions to use only the lower order bits of the second argument.
author Gary Benson <gbenson@redhat.com>
date Mon, 03 Nov 2008 08:56:35 -0500
parents 002c8f181f67
children 3120ce63433d
files ChangeLog ports/hotspot/src/share/vm/shark/sharkBlock.cpp
diffstat 2 files changed, 27 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Nov 03 08:30:13 2008 -0500
+++ b/ChangeLog	Mon Nov 03 08:56:35 2008 -0500
@@ -1,3 +1,9 @@
+2008-11-03  Gary Benson  <gbenson@redhat.com>
+
+	* ports/hotspot/src/share/vm/shark/sharkBlock.cpp
+	(SharkBlock::parse): Fix shift instructions to use only the
+	lower order bits of the second argument.
+
 2008-11-03  Gary Benson  <gbenson@redhat.com>
 
 	* ports/hotspot/src/cpu/zero/vm/bytecodeInterpreter_zero.inline.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Mon Nov 03 08:30:13 2008 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp	Mon Nov 03 08:56:35 2008 -0500
@@ -486,19 +486,28 @@
       b = pop();
       a = pop();
       push(SharkValue::create_jint(
-        builder()->CreateShl(a->jint_value(), b->jint_value())));
+        builder()->CreateShl(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))));
       break;
     case Bytecodes::_ishr:
       b = pop();
       a = pop();
       push(SharkValue::create_jint(
-        builder()->CreateAShr(a->jint_value(), b->jint_value())));
+        builder()->CreateAShr(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))));
       break;
     case Bytecodes::_iushr:
       b = pop();
       a = pop();
       push(SharkValue::create_jint(
-        builder()->CreateLShr(a->jint_value(), b->jint_value())));
+        builder()->CreateLShr(
+          a->jint_value(),
+          builder()->CreateAnd(
+            b->jint_value(), LLVMValue::jint_constant(0x1f))));
       break;
     case Bytecodes::_iand:
       b = pop();
@@ -555,7 +564,9 @@
         builder()->CreateShl(
           a->jlong_value(),
           builder()->CreateIntCast(
-            b->jint_value(), SharkType::jlong_type(), true))));
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true))));
       break;
     case Bytecodes::_lshr:
       b = pop();
@@ -564,7 +575,9 @@
         builder()->CreateAShr(
           a->jlong_value(),
           builder()->CreateIntCast(
-            b->jint_value(), SharkType::jlong_type(), true))));
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true))));
       break;
     case Bytecodes::_lushr:
       b = pop();
@@ -573,7 +586,9 @@
         builder()->CreateLShr(
           a->jlong_value(),
           builder()->CreateIntCast(
-            b->jint_value(), SharkType::jlong_type(), true))));
+            builder()->CreateAnd(
+              b->jint_value(), LLVMValue::jint_constant(0x3f)),
+            SharkType::jlong_type(), true))));
       break;
     case Bytecodes::_land:
       b = pop();