Two asserts where only 1 is needed?
Peter B. Kessler
Peter.Kessler at Sun.COM
Mon Jul 16 21:22:41 UTC 2007
In hotspot/src/share/vm/utilities/taskqueue.hpptaskqueue.hpp,
there's
template<class E>
GenericTaskQueue<E>::GenericTaskQueue():TaskQueueSuper() {
assert(sizeof(Age) == sizeof(jint), "Depends on this.");
}
which seems good and proper (except it doesn't say why it
depends on the sizes being equal). But there's also
template<class E>
bool GenericTaskQueue<E>::
pop_local_slow(juint localBot, Age oldAge) {
....
assert(sizeof(Age) == sizeof(jint) && sizeof(jint) == sizeof(juint),
"Assumption about CAS unit.");
which checks an additional condition and has a better failure
message.
Since Atomic::cmpxchg only deals in jint's, I don't see the reason
for the check of sizeof(juint). This is the only place in the VM
that checks sizeof(jint) == sizeof(juint).
Can anyone think of a reason for the assert at each call of
pop_local_slow if we've passed already passed the assert in
the ctor?
... peter
P.S. I'll probably fix the weird-line wrapping in the declaration
of GenericTaskQueue<E>::pop_local_slow while I'm in there.
More information about the hotspot-gc-dev
mailing list