SSE instructions have two prefixes depending on operand size:
0xf3 for 32-bit XMM and 0xf2 for 64-bit XMM.

Signed-off-by: Tomek Grabiec <tgrab...@gmail.com>
---
 arch/x86/emit-code.c                      |    2 +-
 regression/jvm/PutstaticPatchingTest.java |   36 ++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/arch/x86/emit-code.c b/arch/x86/emit-code.c
index c7e759e..fe30b7c 100644
--- a/arch/x86/emit-code.c
+++ b/arch/x86/emit-code.c
@@ -472,7 +472,7 @@ static inline bool is_rex_prefix(unsigned char opc)
 
 static inline bool is_sse_insn(unsigned char *opc)
 {
-       return opc[0] == 0xf3 && opc[1] == 0x0f;
+       return (opc[0] & 0xfe) == 0xf2 && opc[1] == 0x0f;
 }
 
 void fixup_static(struct vm_class *vmc)
diff --git a/regression/jvm/PutstaticPatchingTest.java 
b/regression/jvm/PutstaticPatchingTest.java
index 25740e1..7e0937c 100644
--- a/regression/jvm/PutstaticPatchingTest.java
+++ b/regression/jvm/PutstaticPatchingTest.java
@@ -14,7 +14,7 @@ public class PutstaticPatchingTest extends TestCase {
         }
     }
 
-    public static void main(String[] args) {
+    private static void testClassInitOnPutstatic() {
         int i = 0;
 
         assertFalse(clinit_run);
@@ -28,4 +28,38 @@ public class PutstaticPatchingTest extends TestCase {
         X.y = i;
         assertFalse(clinit_run);
     }
+
+    private static class DoubleFieldClass {
+        public static double x;
+    };
+
+    private static void testDoublePutstaticPatching() {
+        DoubleFieldClass.x = 1.0;
+        assertEquals(DoubleFieldClass.x, 1.0);
+    }
+
+    private static class FloatFieldClass {
+        public static float x;
+    };
+
+    private static void testFloatPutstaticPatching() {
+        FloatFieldClass.x = 1.0f;
+        assertEquals(FloatFieldClass.x, 1.0f);
+    }
+
+    private static class IntFieldClass {
+        public static int x;
+    };
+
+    private static void testIntPutstaticPatching() {
+        IntFieldClass.x = 1;
+        assertEquals(IntFieldClass.x, 1);
+    }
+
+    public static void main(String[] args) {
+        testClassInitOnPutstatic();
+        testDoublePutstaticPatching();
+        testFloatPutstaticPatching();
+        testIntPutstaticPatching();
+    }
 }
-- 
1.6.0.4


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to