natObject.cc: Don't include assert.h.
authorTom Tromey <tromey@redhat.com>
Sun, 2 Mar 2003 00:02:52 +0000 (00:02 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Sun, 2 Mar 2003 00:02:52 +0000 (00:02 +0000)
* java/lang/natObject.cc: Don't include assert.h.
(heavy_lock_obj_finalization_proc): Use JvAssert.
(remove_all_heavy): Likewise.
(_Jv_MonitorEnter): Likewise.
(_Jv_MonitorExit): Likewise.
(wait): Likewise.

From-SVN: r63636

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

index a86821f246cb72c60f2999c981f302b71adb20d3..5af34bf3018e55b56398c0de7ae7fbd9da2273ac 100644 (file)
@@ -1,3 +1,12 @@
+2003-03-01  Tom Tromey  <tromey@redhat.com>
+
+       * java/lang/natObject.cc: Don't include assert.h.
+       (heavy_lock_obj_finalization_proc): Use JvAssert.
+       (remove_all_heavy): Likewise.
+       (_Jv_MonitorEnter): Likewise.
+       (_Jv_MonitorExit): Likewise.
+       (wait): Likewise.
+
 2003-03-01  Ranjit Mathew  <rmathew@hotmail.com>
 
        * java/io/File (getAbsolutePath): Prefix drive specifier on
index 33f3e8de27fae202243e7970c1d9b1c9eed753ee..e9c74fdb285b893be25292d5a9cbacb77177b2fa 100644 (file)
@@ -303,7 +303,6 @@ _Jv_MonitorExit (jobject obj)
 // that can atomically update only N bits at a time.
 // Author: Hans-J. Boehm  (Hans_Boehm@hp.com, boehm@acm.org)
 
-#include <assert.h>
 #include <limits.h>
 #include <unistd.h>    // for usleep, sysconf.
 #include <gcj/javaprims.h>
@@ -605,7 +604,7 @@ heavy_lock_obj_finalization_proc (void *obj, void *cd)
       release_set(&(he -> address), he_address);
       return;
     }
-  assert(hl -> address == addr);
+  JvAssert(hl -> address == addr);
   GC_finalization_proc old_finalization_proc = hl -> old_finalization_proc;
   if (old_finalization_proc != 0)
     {
@@ -653,8 +652,8 @@ heavy_lock_obj_finalization_proc (void *obj, void *cd)
 static void
 remove_all_heavy (hash_entry *he, obj_addr_t new_address_val)
 {
-  assert(he -> heavy_count == 0);
-  assert(he -> address & LOCKED);
+  JvAssert(he -> heavy_count == 0);
+  JvAssert(he -> address & LOCKED);
   heavy_lock *hl = he -> heavy_locks;
   he -> heavy_locks = 0;
   // We would really like to release the lock bit here.  Unfortunately, that
@@ -664,8 +663,8 @@ remove_all_heavy (hash_entry *he, obj_addr_t new_address_val)
   for(; 0 != hl; hl = hl->next)
     {
       obj_addr_t obj = hl -> address;
-      assert(0 != obj);        // If this was previously finalized, it should no
-                       // longer appear on our list.
+      JvAssert(0 != obj);  // If this was previously finalized, it should no
+                          // longer appear on our list.
       hl -> address = 0; // Finalization proc might still see it after we
                         // finish.
       GC_finalization_proc old_finalization_proc = hl -> old_finalization_proc;
@@ -782,13 +781,13 @@ _Jv_MonitorEnter (jobject obj)
   if (__builtin_expect(!addr, false))
     throw new java::lang::NullPointerException;
    
-  assert(!(addr & FLAGS));
+  JvAssert(!(addr & FLAGS));
 retry:
   if (__builtin_expect(compare_and_swap(&(he -> address),
                                        0, addr),true))
     {
-      assert(he -> light_thr_id == INVALID_THREAD_ID);
-      assert(he -> light_count == 0);
+      JvAssert(he -> light_thr_id == INVALID_THREAD_ID);
+      JvAssert(he -> light_count == 0);
       he -> light_thr_id = self;
       // Count fields are set correctly.  Heavy_count was also zero,
       // but can change asynchronously.
@@ -836,7 +835,7 @@ retry:
          // only be held by other threads waiting for conversion, and
          // they, like us, drop it quickly without blocking.
          _Jv_MutexLock(&(hl->si.mutex));
-         assert(he -> address == address | LOCKED );
+         JvAssert(he -> address == address | LOCKED );
          release_set(&(he -> address), (address | REQUEST_CONVERSION | HEAVY));
                                // release lock on he
          while ((he -> address & ~FLAGS) == (address & ~FLAGS))
@@ -849,7 +848,7 @@ retry:
                // Guarantee that hl doesn't get unlinked by finalizer.
                // This is only an issue if the client fails to release
                // the lock, which is unlikely.
-         assert(he -> address & HEAVY);
+         JvAssert(he -> address & HEAVY);
          // Lock has been converted, we hold the heavyweight lock,
          // heavy_count has been incremented.
          return;
@@ -866,7 +865,7 @@ retry:
     {
       // Either was_heavy is true, or something changed out from under us,
       // since the initial test for 0 failed.
-      assert(!(address & REQUEST_CONVERSION));
+      JvAssert(!(address & REQUEST_CONVERSION));
        // Can't convert a nonexistent lightweight lock.
       heavy_lock *hl;
       hl = (was_heavy? find_heavy(addr, he) : 0);
@@ -879,15 +878,15 @@ retry:
          // one first and use that.
          he -> light_thr_id = self;  // OK, since nobody else can hold
                                      // light lock or do this at the same time.
-         assert(he -> light_count == 0);
-         assert(was_heavy == (he -> address & HEAVY));
+         JvAssert(he -> light_count == 0);
+         JvAssert(was_heavy == (he -> address & HEAVY));
          release_set(&(he -> address), (addr | was_heavy));
         }
       else
        {
          // Must use heavy lock.
          ++ (he -> heavy_count);
-         assert(0 == (address & ~HEAVY));
+         JvAssert(0 == (address & ~HEAVY));
           release_set(&(he -> address), HEAVY);
           _Jv_MutexLock(&(hl->si.mutex));
          keep_live(addr);
@@ -898,7 +897,7 @@ retry:
   // We hold the lock on the hash entry, and he -> address can't
   // change from under us.  Neither can the chain of heavy locks.
     {
-      assert(0 == he -> heavy_count || (address & HEAVY));
+      JvAssert(0 == he -> heavy_count || (address & HEAVY));
       heavy_lock *hl = get_heavy(addr, he);
       ++ (he -> heavy_count);
       release_set(&(he -> address), address | HEAVY);
@@ -1006,17 +1005,17 @@ retry:
          he -> light_count = count - 1;
          return;
         }
-      assert(he -> light_thr_id == self);
-      assert(address & REQUEST_CONVERSION);
+      JvAssert(he -> light_thr_id == self);
+      JvAssert(address & REQUEST_CONVERSION);
       // Conversion requested
       // Convert now.
       if (!compare_and_swap(&(he -> address), address, address | LOCKED))
        goto retry;
       heavy_lock *hl = find_heavy(addr, he);
-      assert (0 != hl);
+      JvAssert (0 != hl);
                // Requestor created it.
       he -> light_count = 0;
-      assert(he -> heavy_count > 0);
+      JvAssert(he -> heavy_count > 0);
                // was incremented by requestor.
       _Jv_MutexLock(&(hl->si.mutex));
        // Release the he lock after acquiring the mutex.
@@ -1033,8 +1032,8 @@ retry:
       return;
     }
   // lightweight lock not for this object.
-  assert(!(address & LOCKED));
-  assert((address & ~FLAGS) != addr);
+  JvAssert(!(address & LOCKED));
+  JvAssert((address & ~FLAGS) != addr);
   if (!compare_and_swap(&(he -> address), address, address | LOCKED))
        goto retry;
   heavy_lock *hl = find_heavy(addr, he);
@@ -1049,9 +1048,9 @@ retry:
       throw new java::lang::IllegalMonitorStateException(
                        JvNewStringLatin1("current thread not owner"));
     }
-  assert(address & HEAVY);
+  JvAssert(address & HEAVY);
   count = he -> heavy_count;
-  assert(count > 0);
+  JvAssert(count > 0);
   --count;
   he -> heavy_count = count;
   if (0 == count)
@@ -1160,7 +1159,7 @@ retry:
          throw new IllegalMonitorStateException (JvNewStringLatin1 
                           ("current thread not owner"));
        }
-      assert(address & HEAVY);
+      JvAssert(address & HEAVY);
     }
   switch (_Jv_CondWait (&(hl->si.condition), &(hl->si.mutex), timeout, nanos))
     {