[kaffe] CVS kaffe (dalibor): Fixed bug in interpreter's lcmp

Kaffe CVS Kaffe Mailing List <kaffe@kaffe.org>
Fri Oct 31 12:54:02 2003


PatchSet 4147 
Date: 2003/10/31 20:46:56
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed bug in interpreter's lcmp

Members: 
	ChangeLog:1.1739->1.1740 
	kaffe/kaffevm/intrp/icode.h:1.18->1.19 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1739 kaffe/ChangeLog:1.1740
--- kaffe/ChangeLog:1.1739	Fri Oct 31 15:15:42 2003
+++ kaffe/ChangeLog	Fri Oct 31 20:46:56 2003
@@ -1,3 +1,11 @@
+2003-10-31  Helmer Kraemer <hkraemer@freenet.de>
+	    Dalibor Topic <robilad@kaffe.org>
+
+	* kaffe/kaffevm/intrp/icode.h
+	(lcd) Fixed underflow on i686-linux. Use straight
+	< comparisons for longs instead of substracting 
+	one number from the other.
+ 
 2003-10-31  Ito Kazumitsu <kaz@maczuka.gcd.org>
 
 	* libraries/javalib/java/net/InetAddress.java:
Index: kaffe/kaffe/kaffevm/intrp/icode.h
diff -u kaffe/kaffe/kaffevm/intrp/icode.h:1.18 kaffe/kaffe/kaffevm/intrp/icode.h:1.19
--- kaffe/kaffe/kaffevm/intrp/icode.h:1.18	Tue Sep  2 16:40:58 2003
+++ kaffe/kaffe/kaffevm/intrp/icode.h	Fri Oct 31 20:46:57 2003
@@ -28,8 +28,8 @@
 #define	ashr_long(t, f1, f2)			(t)[0].v.tlong = ((int64)(f1)[0].v.tlong) >> ((f2)[0].v.tint & 63)
 #define	lshr_long(t, f1, f2)			(t)[0].v.tlong = ((uint64)(f1)[0].v.tlong) >> ((f2)[0].v.tint & 63)
 
-#define	lcmp(t, f1, f2)				lcc = ((f2)[0].v.tlong) - ((f1)[0].v.tlong); \
-						(t)[0].v.tint = (lcc < 0 ? -1 : lcc > 0 ? 1 : 0)
+#define	lcmp(t, f1, f2)				do { jlong l2 = ((f2)[0].v.tlong); jlong l1 = ((f1)[0].v.tlong); \
+						(t)[0].v.tint = ((l1 == l2)? 0 : ((l1 > l2) ? -1 : 1)); } while(0);
 
 #define	cvt_int_long(t, f)			(t)[0].v.tlong = (f)[0].v.tint
 #define	cvt_long_int(t, f)			(t)[0].v.tint = (f)[0].v.tlong