OSDN Git Service

Move dvmFreeClassInnards responsibility.
authorAndy McFadden <fadden@android.com>
Wed, 4 Aug 2010 19:47:21 +0000 (12:47 -0700)
committerAndy McFadden <fadden@android.com>
Wed, 4 Aug 2010 19:47:21 +0000 (12:47 -0700)
commita0b525d50b8b514e1e8f5c9b2852ce056a5eb89d
treea7666b3854360163bab26a54aa1078c1985571ef
parentf13e71fd254774440b6c6895f024934587e5f05d
Move dvmFreeClassInnards responsibility.

The GC has been responsible for ensuring that the "innards" of a
class object are freed before the ClassObject itself is discarded.
Since we don't currently unload classes, this situation can only arise
if something went wrong during the loading of a class (e.g. memory
alloc failure part way through), or another thread loaded the same
class at the same time and won the race.  It makes more sense to
have the cleanup occur at the point we decide that our class object
is not useful.

For the most part this was already being done, but there were a couple
of places where it wasn't.

This change
 - adds the missing dvmFreeClassInnards calls
 - changes the GC code to warn without taking action
 - enables the GC code only when assertions are enabled

The code in MarkSweep.c looks like it merits further rearranging, but
I'll leave that to Team GC.

Also, "dalvik_assert" is now only printed on the VM features line when
assertions are enabled.

For bug 2751668.

Change-Id: I90e4455e830766f94f921c7f23b44b423bce3321
vm/Init.c
vm/alloc/MarkSweep.c
vm/oo/Class.c