summaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-02 00:02:52 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2003-03-02 00:02:52 +0000
commit43886c6f483486fa79f1a92efa77add030e5bbcd (patch)
tree57fe79acd1240f3ba30275f6045ad27678cd180d /libjava/java
parentd03da085bc50e83dbbf4ec4e29fdf17fa9973e6e (diff)
downloadgcc-43886c6f483486fa79f1a92efa77add030e5bbcd.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@63636 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/lang/natObject.cc49
1 files changed, 24 insertions, 25 deletions
diff --git a/libjava/java/lang/natObject.cc b/libjava/java/lang/natObject.cc
index 33f3e8de27f..e9c74fdb285 100644
--- a/libjava/java/lang/natObject.cc
+++ b/libjava/java/lang/natObject.cc
@@ -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))
{