Combined patch from master branch
From: Jack Ren <jack.ren@intel.com>
Date: Tue, 1 Mar 2011 21:10:42 +0800
Subject: [PATCH 1/2] sync with korg/master commit
dd19f5b91a1032e60871febb143850fd81000c5a
following patches are applied in one time:
commit
dd19f5b91a1032e60871febb143850fd81000c5a
Merge:
2b3d7e8 a62c84f
Author: Romain Guy <romainguy@android.com>
Date: Thu Feb 24 11:24:47 2011 -0800
Merge "Fix for a crash when GC weak references."
commit
2b3d7e8eccd7cbf64b2ac41c05073a9191d0d3b3
Merge:
ef4b061 b4719ed
Author: Raphael Moll <ralf@android.com>
Date: Tue Feb 22 14:55:59 2011 -0800
Merge "Open dexdump files in binary mode."
commit
b4719eda048c4dc4a4b6e5280c7a2b8299051078
Author: Raphael Moll <ralf@android.com>
Date: Wed Feb 16 13:39:27 2011 -0800
Open dexdump files in binary mode.
Requires change Ia5c0a59e from system/core
(which defines O_BINARY globally.)
commit
a62c84f62a27a08d6bef6da0b96913d616dd659f
Author: Mattias Petersson <mattias.petersson@sonyericsson.com>
Date: Tue Dec 21 09:28:04 2010 +0100
Fix for a crash when GC weak references.
When a weak reference had been cleared there was a small risk that
the VM crashed when the cleared reference was garbage collected.
This is an example of code that can cause the problem:
Integer referent = new Integer(10);
wref = new WeakReference<Integer>(referent);
wref.clear(); //set the referent to null
When a garbage collection starts, all objects are scanned, looking
for objects that can be collected. During this phase, a list of
weak references is created. A check is performed to ensure that
only references with a non-null referent are added to this list.
In most cases, for the example above, the referent will be null
at this point, and it will never be added to the list. But if
the timing is extremely bad it looks like it is possible for the
reference to end up on the list before the referent has been set
to null, and the referent is set to null a little while later.
This means that we now have a reference on the list with a null
referent.
A bit later in the garbage collection flow, the list of weak
s is traversed in order to clear the references that
can be collected. Here we got the crash because the code asserted
that the referent of the references in the list should be
non-null. And in some rare cases it actually was null. The fix
is simply to remove the assert.
commit
ef4b0613d6952770aefac07d503955eb7b962d2b
Merge:
464104b e9503ef
Author: Andy McFadden <fadden@android.com>
Date: Mon Nov 8 19:38:19 2010 -0800
am
e9503ef8: am
886130bc: (-s ours) Two patches.
* commit '
e9503ef8c460f4818062ecc80a9e0b4f8c6745b8':
Two patches.
Change-Id: I04c1c9204af8197a4352358d805af40f1312d2ea
Signed-off-by: Bruce Beare <bruce.j.beare@intel.com>