History log of /dalvik/vm/alloc/Alloc.h
Revision Date Author Comments
21fefbaa3874c42f8a017c4794add2d7c337643a 14-Oct-2011 Elliott Hughes <enh@google.com> Avoid deadlock.

dvmIsHeapAddress is the pointer validity checker for use outside the GC. If
it doesn't take the heap lock, it risks looking at data structures that are
changing under its feet. If it does take the heap lock, it risks deadlock
between a thread doing an explicit GC and the signal catcher trying to dump
threads (causing the GC thread to be suspended while holding the heap lock).

Calling back into managed code while holding the heap lock and with other
threads resumed sounds like an inherently bad idea to me, but that's a battle
for another day.

With this change, we can handle SIGQUIT while we're in ReferenceQueue.add
as a result of an explicit GC in a system doing concurrent collections, so
the only known problem is fixed.

Bug: 5425802
Change-Id: I42d434d5ea3ffbcb77a4c544b81b08a4c7364a16
8bc8bf71a52e17d483021b4c9dc8e735d9bce3ed 20-Jul-2011 Elliott Hughes <enh@google.com> Don't use dvmIsValidObject outside the GC.

Use dvmIsHeapPointer outside the GC. (This still isn't safe because there's
no synchronization when dealing with the HeapSource.)

Bug: 5049447
Change-Id: Ie0b325ef0a92687ea1eaf1491a4bb832298893c5
375fb116bcb817b37509ab579dbd55cdbb765cbf 15-Jun-2011 Carl Shapiro <cshapiro@google.com> Normalize the include guard style.

An leading underscore followed by a capital letter is a reserved
name space in C and C++.

This change also moves any #include directives within the include
guard in some of the compiler/codegen/arm header files.

Change-Id: I9715e2c5301699d31886e61d0fe6e29483555a2a
d537d4840fcdf0e279b6a7c91a27306e0544aeaa 26-May-2011 Carl Shapiro <cshapiro@google.com> Eliminate the dvmHeapSourceGetPtrFlag interface.

This routine served answering questions about object addresses. While
it was private to the garbage collector, its remaining use was inside
the heap profiler. Within the heap profiler, a single path was
executed to tested a pointer for containment within the zygote. In
its place, a new function, dvmIsZygoteObject, has been added to the GC
interface superseding the only use of dvmHeapSourceGetPtrFlag.

Change-Id: I347c9adb293bd6c196bbac3765015453133dc492
dc9e44cc0af797679822484d88ef76bff15ffc98 06-May-2011 Carl Shapiro <cshapiro@google.com> Make interned strings non-movable.

At present objects referenced from dex files must have stable reference
values. With this change, only non-moving strings are interned. If a
user interns a movable string a non-moving copy is made and the copy is
added to the intern table.

As part of this change, the internal string hash code access routine will
update the hash code slot of a string object. In addition, StringObject
has been made a subclass of Object eliminating various down-casts that
would otherwise be explicitly required.

Change-Id: I6b015b972aac44948470c0034ad17e5eef456aeb
52e2626eb3bf620c53459a90d912733de2ce0369 28-Apr-2011 Carl Shapiro <cshapiro@google.com> Add a non-moving option to dvmMalloc and make use of it.

At present, class objects, non-moving arrays, and interned strings have
location dependencies in native code. Allocating non-moving is a no-op
for the present heap, but this option will have an effect after the
copying collector is integrated.

Change-Id: I674f83a086ac65db303baab0599831f80f52a4a5
5cdd4a3f91d3fc25c8eeca8f58e35bb6c4e908ca 28-Apr-2011 Carl Shapiro <cshapiro@google.com> Normalize some enumerations.

This change pulls a few enumeration types to the top of their header
file alongside other types. It also eliminates the use of the now
redundant enum qualifier.

Change-Id: I6f853bed09176cde9a83faccea7a76f595f60f2b
50e5fd5984c9b0a6f0927ed5ddf13bde40e338c7 27-Apr-2011 Carl Shapiro <cshapiro@google.com> Use C++ linkage in GC headers and remove unneeded typedefs.

Some interfaces in Alloc.h had to be left with C linkage as they are
referenced by the interpreter assembler code. That dependency will be
addressed in a future commit.

Change-Id: I6b2097a2139ddf6b4b13e592710e241442e08488
ae188c676c681e47a93ade7fdf0144099b470e03 08-Apr-2011 Carl Shapiro <cshapiro@google.com> Compile the garbage collector and heap profiler as C++.

Change-Id: I25d8fa821987a3dd6d7109d07fd42dbf2fe0e589
ce87bfed41bbe4248b2770fb1a90f34b2518f6fa 31-Mar-2011 Carl Shapiro <cshapiro@google.com> Delegate the queuing of cleared references to managed code.

Previously, the garbage collector would pass each cleared reference to
the heap worker thread for queuing. The heap worker thread would then
perform a callback into managed code for each cleared reference which
assigned the reference to its reference queue.

With this change, the garbage collector instead links together all of
the cleared references and calls back into managed code exactly once
to hand off the references for processing. This change makes the heap
worker thread and its data structures obsolete.

Change-Id: I28e02638f0877a7fd2ac96b9c3f5597a38541ebb
2494c5038e668add68c74dea83aca05187a89e7c 12-Mar-2011 Carl Shapiro <cshapiro@google.com> Add a predicate that returns true for addresses contained by the heap.

Change-Id: Iaa2978c59fc314563555b14f53bdc28be6b71cc4
0f27ad70ce7a8e739cdf5870346af837e2b9b6c0 22-Feb-2011 Andy McFadden <fadden@android.com> Added flags to dvmCloneObject

Updated the call site to use "don't track".

Change-Id: Ibd4b5a9d93b0043c3906ad86b9ae19d1bf70541d
6af2ddd107842c3737c04c37343cac9be17f4209 17-Feb-2011 Andy McFadden <fadden@android.com> Defer marking of objects as finalizable

This shifts responsibility for marking an object as "finalizable" from
object creation to object initialization. We want to make the object
finalizable when Object.<init> completes. For performance reasons we
skip the call to the Object constructor (which doesn't do anything)
and just take the opportunity to check the class flag.

Handling of clone()d object isn't quite right yet.

Also, fixed a minor glitch in stubdefs.

Bug 3342343

Change-Id: I5b7b819079e5862dc9cbd1830bb445a852dc63bf
bc3ba010007b0ed4dddf6d286d59ee41f5f361db 09-Feb-2011 Carl Shapiro <cshapiro@google.com> Remove the unused argument to dvmCollectGarbage.

Change-Id: Id7bf60b99b33cb8f058f9a500dc63cfe01b8e3c2
440ec64e5562096d132486e1f1bd9d48b184024a 09-Feb-2011 Carl Shapiro <cshapiro@google.com> Let tryMalloc field over-sized allocation errors.

Change-Id: I691b8eeca74b7e018f86753b00b7f117d5872916
df39bb7e9a56686c68cd8929c0ad464348e61832 09-Feb-2011 Carl Shapiro <cshapiro@google.com> Replace dvmValidateObject with ordinary null pointer checks.

Change-Id: I8eddca7fac83e014d591bdd06ce2df634672243f
a371fad368c4d697b2906079bfbe8059269ed362 24-Jan-2011 Carl Shapiro <cshapiro@google.com> Replace collect with clear for the SoftReference policy.

The garbage collector is invoked with a parameter that changes the
SoftReference clearing policy. This parameter is normally false,
meaning the garbage collector will attempt to preserve some
softly-reachable referents of SoftReference instances. When true, the
garbage collector will treat SoftReference instances as WeakReference
instances and always clearly referent fields with softly-reachable
referents.

The code refers to this action as collecting soft references which is
misleading. The change to the garbage collector policy has an effect
on the referent field of SoftReference instances and any SoftReference
instance which is unreachable is subject collection like any other
object. With this change we now use the description clearing soft
refernces to describe the policy.

Bug: 3381480

Change-Id: Ie179514e68d4621237b08658c1c55811a49f1210
df9f08b877ecfd8ebadea822bb9e066ee7d30433 19-Jan-2011 Carl Shapiro <cshapiro@google.com> Implement growth limits to support multiple heap configurations.

When a growth limit is in effect, allocations will be limited to
number of bytes specified by the growth limit instead of the maximum
heap size. Growth limits are specified on the command line with the
new parameter -XX:HeapGrowthLimit. A growth limit can be removed at
runtime by calling the new clearGrowthLimit method.

This is a work around until we can adjust the maximum heap size at
runtime.

Change-Id: Ic01e32823b5ca8cf29c0948fb6cd2df10967c1fb
a05f6504440ccf460477e9883c87cd70aca77b24 12-Jan-2011 Carl Shapiro <cshapiro@google.com> Remove support for setting the minimum size of the heap at runtime.

Change-Id: I1752c59184325b5929532b61f4fa0feaa03b8218
6159ef4520073ae8e7ce7b7d1f7648b161a33302 04-Nov-2010 Carl Shapiro <cshapiro@google.com> Parameterize instance counting to include subclasses.
e7bdd8b8c6f3aae552b333d0bd9664ef5e63f0a0 18-Dec-2010 Carl Shapiro <cshapiro@google.com> Remove the external allocation facility.

Change-Id: Iff508a9173382f29c67ca9e6eb6f65855dce0be4
0445e48ba57d0628d5c315a9a07f020879ab0ad9 03-Dec-2010 Carl Shapiro <cshapiro@google.com> Eliminate the GC.h header file.

Change-Id: Ieda8b819032fc6aac80b390960d9c6f4864795ab
f331a60b2a7ad79c2ecb0ba638f66bae1f37eb6c 04-Nov-2010 Carl Shapiro <cshapiro@google.com> Parameterize instance counting to include subclasses.

Change-Id: Idf54343a6a587e512833bbacbd0f7290adf8517e
41eb6e988193a1c6b331c7c208bf8dd74f96d773 17-Aug-2010 Carl Shapiro <cshapiro@google.com> Fix build breakage caused by the countInstancesOfClass change.

There is an apparent visibility skew between passion-eng and sim-eng
builds. On sim-eng, the contents of Heap.h are globally visible but
on passion-eng this is not the case. To resolve this issue, I have
moved the offending declarations to alloc/Alloc.h which is directly
exported from Dalvik.h.

Change-Id: Iaf6f167964f81f24fa0817aa4a84b9fb4ff9a9a0
edcb4601fb799ad080ed418abf164a0a0225960e 11-Aug-2010 Carl Shapiro <cshapiro@google.com> Remove a malfunctioning predicate used only in assertions.

This check thought it filtered pointers aligned on 4-byte boundaries
and inclusion in the heap but actually checked for pointers on 8-byte
boundaries. Both checks surround storing method call return values
which are gauranteed to be stack allocated.

Change-Id: I9cfd9eb06c5bd1d5cf55b372771da20425c56406
ec805eaed940e40212e85b58b163c7649feaca56 29-Jun-2010 Carl Shapiro <cshapiro@google.com> Add a mode for concurrently marking and sweeping.

When enabled, the mutator threads will be resumed while tracing
proceeds from the roots. After the trace completes the mutator
threads are suspended, the roots are remarked, and marked objects
are scanned for updates and re-marked.

There are two limitations to this implementation. For the sake
of expediency, mutators are not permitted to allocate during the
concurrent marking phase. This will be addressed in a subsequent
change. As there is no write barrier, all objects, rather than
just those objects assigned to during the concurrent phase, are
scanned for updates. This will be addressed after a write barrier
is implemented.

Change-Id: I82dba23b58a1cf985589ed21ec0cffb5ebf48aae
364f9d924cbd9d392744a66f80cc084c3d80caf0 12-Jun-2010 Barry Hayes <bhayes@google.com> Put wrappers on all stores of Object pointers into heap Objects.

Also:
Changed ++ loops to [i] loops where I'm touching.
Added some asserts.
Added dvmHeapSourceContainsAddress
Added dvmIsValidObjectAddress

Change-Id: I6586688246064aecabb1e22e1dca276fecee7795
81f3ebe03cd33c9003641084bece0604ee68bf88 16-Jun-2010 Barry Hayes <bhayes@google.com> Remove the "allocFlags" parameter from dvmCreateStringFromCstr and
dvmCreateStringFromCstrAndLength.

The only valid argument would be ALLOC_DEFAULT, so drop the parameter.

Change-Id: Idf469ef0ec12b0743792fc525e0c53fc7486eab6
d4f78d3a764e6aa8f7174c78f537c016dac7f7ec 08-Jun-2010 Barry Hayes <bhayes@google.com> ALLOC_NO_GC is no longer used; remove it, and the nonCollectableRefs table.
Clean up dvmHeapInitHeapRefTable's interface to know the default size.

Change-Id: I535fdfe39924f6f65f286e2809002c2a0e6411b6
fbdcfb9ea9e2a78f295834424c3f24986ea45dac 29-May-2010 Brian Carlstrom <bdc@google.com> Merge remote branch 'goog/dalvik-dev' into dalvik-dev-to-master

Change-Id: I0c0edb3ebf0d5e040d6bbbf60269fab0deb70ef9
ad9400f8c292055307319e7324da2e0a23e5a5ad 02-May-2010 Carl Shapiro <cshapiro@google.com> Include stddef.h instead of stdlib.h for size_t definition.

Change-Id: Id3fa2dff0279985ca865caf7e3dfa7b4e77ee345
72e93344b4d1ffc71e9c832ec23de0657e5b04a5 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
0423f0e813a3807168fe5524405eb96675532097 26-Aug-2009 Andy McFadden <fadden@android.com> Fix some JNI indirect reference stuff.

Convert where needed, don't convert where not needed, and make sure
we're using the right one.

With this, my ad-hoc tests pass, and the boot proceeds until we hit a
failure that looks like it might be due to logic outside the VM.
7fc3ce8f0223a90006ad2c431a43b0bc841ee3c2 15-Jul-2009 Andy McFadden <fadden@android.com> Throw a pre-fabricated NoClassDefFoundError.

When a class loader tries to load a class, it first asks its parent to
look for it. This continues up the chain until the bootstrap class loader
is reached. If the class can't be found, the bootstrap loader throws a
NoClassDefFoundError. As a result, we're throwing at least one exception
for every class we load that doesn't come from the bootstrap path.

This change creates a "stock" NoClassDefFoundError exception with a trivial
stack trace and throws that instead, saving the overhead of creating and
initializing the exception object.

I think the only way that anyone will see this is if they try to
load a class directly from the bootstrap loader, in which case the
ClassNotFoundException will show the canned NCDFE as the cause. I
don't think any useful diagnostic information is being lost.
99409883d9c4c0ffb49b070ce307bb33a9dfe9f1 19-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import //branches/master/...@140412
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
2ad60cfc28e14ee8f0bb038720836a4696c478ad 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution