* java/lang/natObject.cc (JV_SYNC_HASH): replace signed % by &.
authorHans Boehm <Hans_Boehm@hp.com>
Sat, 15 Mar 2003 01:04:08 +0000 (01:04 +0000)
committerHans Boehm <hboehm@gcc.gnu.org>
Sat, 15 Mar 2003 01:04:08 +0000 (01:04 +0000)
From-SVN: r64386

libjava/ChangeLog
libjava/java/lang/natObject.cc

index b1d3b49939874985aede1ba3c3b754f0d0c273fe..afa56a7b2113d065a97974cd8a84865a10880f09 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-14  Hans Boehm  <Hans.Boehm@hp.com>
+
+       * java/lang/natObject.cc (JV_SYNC_HASH): replace signed % by &.
+
 2003-02-14  Jeroen Frijters  <jeroen@sumatra.nl>
 
        * java/io/ObjectInputStream.java (readObject): Cleaned up the class
index e9c74fdb285b893be25292d5a9cbacb77177b2fa..24faf29e51e165679c8d6915d245e28235e014b3 100644 (file)
@@ -351,7 +351,7 @@ struct heavy_lock {
   obj_addr_t address;          // Object to which this lock corresponds.
                                // Should not be traced by GC.
                                // Cleared as heavy_lock is destroyed.
-                               // Together with the rest of the hevy lock
+                               // Together with the rest of the heavy lock
                                // chain, this is protected by the lock
                                // bit in the hash table entry to which
                                // the chain is attached.
@@ -457,12 +457,12 @@ struct hash_entry {
 };
 
 #ifndef JV_SYNC_TABLE_SZ
-# define JV_SYNC_TABLE_SZ 2048
+# define JV_SYNC_TABLE_SZ 2048 // Must be power of 2.
 #endif
 
 hash_entry light_locks[JV_SYNC_TABLE_SZ];
 
-#define JV_SYNC_HASH(p) (((long)p ^ ((long)p >> 10)) % JV_SYNC_TABLE_SZ)
+#define JV_SYNC_HASH(p) (((long)p ^ ((long)p >> 10)) & (JV_SYNC_TABLE_SZ-1))
 
 // Note that the light_locks table is scanned conservatively by the
 // collector.  It is essential the the heavy_locks field is scanned.