OSDN Git Service

Handle the case of referent clearing during tracing.
authorCarl Shapiro <cshapiro@google.com>
Wed, 12 Jan 2011 01:16:48 +0000 (17:16 -0800)
committerCarl Shapiro <cshapiro@google.com>
Wed, 12 Jan 2011 18:44:06 +0000 (10:44 -0800)
commit4d7dd56902150ab8db4c20a191bad112928839e9
tree83cfa9b49e350b56839338c018a59664d3c51778
parent6159ef4520073ae8e7ce7b7d1f7648b161a33302
Handle the case of referent clearing during tracing.

Reference objects with non-null referent fields are collected during
tracing for processing after the trace has completed.  Before the
trace was made concurrent there was no way for a reference with a
non-null referent field to have its referent become null by any action
of the garbage collector after it was discovered.  Assertions were
placed in the reference processing code to check this invariant.

After the trace was made concurrent it became possible for a user to
clear the referent field of an already discovered reference.  This
violates the assertions in the reference processing code.

This change replaces the assertions in the reference processing code
with logic to deal with null referent fields.  The assert in the
SoftReference preservation code has been converted to a continue that
short circuits the preservation logic.  The assert in the white
reference clearing code short circuits the clearing and enqueueing.

Bug: 3342757
Change-Id: I967b011485e2691b2752500a3488fbcb54f129d3
vm/alloc/MarkSweep.c