Use the new pendingNext field to thread pending references.

Presently, the garbage collector uses the queueNext field to thread
references discovered during a trace.  This is unsafe as a user may
simultaniously call enqueue on a discovered reference which will alias
the queue of pending references to the queue of a reference queue.

To avoid this problem, the garbage collector uses the pendingNext
field to thread together pending references.  If, during reference
processing, the garbage collector discovers that an object has been
enqueued by the user, it will short circuit referencing processing for
that object.

As part of this change, the the reference object processing routines
have been reorganized to eliminate the macrology used by the pending
reference queueing.  In addition, the pending reference lists are now
circular to ensure pendingNext of a pending reference is never NULL.

Change-Id: Id855aa295dd835eacc8d5e765f4edbb869c104b7
3 files changed