History log of /dalvik/vm/IndirectRefTable.cpp
Revision Date Author Comments
c1a4ab9c313d8a3d12007f2dbef7b5a6fa4ac2ef 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGE(_IF) to (IF_)ALOGE(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/157220

Also fix an occurrence of LOGW missed in an earlier change.

Bug: 5449033
Change-Id: I2e3b23839e6dcd09015d6402280e9300c75e3406
e8e1ddccd616e8226b7cc1e4e9fdb327429249e8 06-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGW(_IF) to (IF_)ALOGW(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/157065

Bug: 5449033
Change-Id: Ia5d301248024df26c2a29dabdfe738e39ec87c82
4308417beec548c2b2c06ecec4f7f4a965b09fb2 04-Jan-2012 Steve Block <steveblock@google.com> Rename (IF_)LOGI(_IF) to (IF_)ALOGI(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156801

Bug: 5449033
Change-Id: Ic558031c75b3702d90eb78bd730501ae5d3c077b
062bf509a77fce9dfcb7e7b2e401cf2a124d83d5 20-Dec-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGD(_IF) to (IF_)ALOGD(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/156016

Bug: 5449033
Change-Id: Ic663376d1ad6a6cb14bf81405ad9afd247cf2f60
ee155d4fe47fa751262beb43437a339fde8eabe5 30-Nov-2011 Ben Cheng <bccheng@google.com> Initialize the JNI indirect ref table to make Valgrind happy.

Specifically, this is to eliminate the benign warning about the
'serial' field being uninitialized.

BUG: 5542417
Change-Id: I8550972e70db94f24c47c4e5dea0b59cc5840b48
68ecde1134a8d05803552fcd82994053ada3e80d 27-Oct-2011 Jeff Brown <jeffbrown@google.com> DO NOT MERGE: Optimize IndirectRefTable.

Removed unused debugging code that maintained pointers to the
4 previous objects in each slot.

Promoted the serial number property of a slot to be first class.
This is a sufficiently cheap and useful check to perform that we
might as well always do it.

Changed get() and remove() so they check the validity of the
references at the same time as they retrieve them. They're
also a bit smarter about checking the reference kind given
that they can assume that the table will only contain references
of one kind. The checks are now much more consistent.
For example, remove() used to check whether an index was
stale only in the case where it was not removing the top entry
(now it always checks).

Made add() return NULL instead of dvmAbort()'ing in the case
where the table overflowed and ensure we don't blow away the
table in that cases. This change resolves an issue with
TestIndirectRefTable.cpp which deliberately overflows the table
and expects add() to return NULL (as documented!). As it
happens, the add() method is called in exactly 3 places in
Jni.cpp. In each of those cases, the code was written to
handle a NULL result and only in the case of adding a weak
global reference did it not abort. Fixed the weak global
reference case to be consistent with the others.

Changed the signature of contains() to take an Object* since
that's what we're actually looking for inside the table.

Added a couple of calls to dump() in TestIndirectRefTable.cpp
for visual inspection of its correctness.

Performance as measured by TestIndirectRefTable on same hardware.

Old implementation:
- Add/remove 100 objects FIFO order, 100000 iterations, 0.023ms / iteration
- Add/remove 100 objects LIFO order, 100000 iterations, 0.020ms / iteration
- Get 100 objects, 100000 iterations, 0.009ms / iteration

New implementation:
- Add/remove 100 objects FIFO order, 100000 iterations, 0.010ms / iteration
- Add/remove 100 objects LIFO order, 100000 iterations, 0.009ms / iteration
- Get 100 objects, 100000 iterations, 0.002ms / iteration

Cherry-pick from master.

Conflicts:

vm/IndirectRefTable.cpp

Change-Id: I157f3c1ba598137222878b8e6a5890efb744fe76
5552e62455d486d19e5986a67ae2545411d50fbe 27-Oct-2011 Jeff Brown <jeffbrown@google.com> Optimize IndirectRefTable.

Removed unused debugging code that maintained pointers to the
4 previous objects in each slot.

Promoted the serial number property of a slot to be first class.
This is a sufficiently cheap and useful check to perform that we
might as well always do it.

Changed get() and remove() so they check the validity of the
references at the same time as they retrieve them. They're
also a bit smarter about checking the reference kind given
that they can assume that the table will only contain references
of one kind. The checks are now much more consistent.
For example, remove() used to check whether an index was
stale only in the case where it was not removing the top entry
(now it always checks).

Made add() return NULL instead of dvmAbort()'ing in the case
where the table overflowed and ensure we don't blow away the
table in that cases. This change resolves an issue with
TestIndirectRefTable.cpp which deliberately overflows the table
and expects add() to return NULL (as documented!). As it
happens, the add() method is called in exactly 3 places in
Jni.cpp. In each of those cases, the code was written to
handle a NULL result and only in the case of adding a weak
global reference did it not abort. Fixed the weak global
reference case to be consistent with the others.

Changed the signature of contains() to take an Object* since
that's what we're actually looking for inside the table.

Added a couple of calls to dump() in TestIndirectRefTable.cpp
for visual inspection of its correctness.

Performance as measured by TestIndirectRefTable on same hardware.

Old implementation:
- Add/remove 100 objects FIFO order, 100000 iterations, 0.023ms / iteration
- Add/remove 100 objects LIFO order, 100000 iterations, 0.020ms / iteration
- Get 100 objects, 100000 iterations, 0.009ms / iteration

New implementation:
- Add/remove 100 objects FIFO order, 100000 iterations, 0.010ms / iteration
- Add/remove 100 objects LIFO order, 100000 iterations, 0.009ms / iteration
- Get 100 objects, 100000 iterations, 0.002ms / iteration

Change-Id: I1c904eb03bc8dd9822e6d9cce702c696e976974e
92c1f6f1b4249e4e379452ee7b49f027052bf4ce 20-Oct-2011 Steve Block <steveblock@google.com> Rename (IF_)LOGV(_IF) to (IF_)ALOGV(_IF) DO NOT MERGE

See https://android-git.corp.google.com/g/#/c/143865

Bug: 5449033
Change-Id: I8bd96961e369a08e86ff78b82d90f20f42787eb1
b27341588c31ede077762de4c200049abc0417aa 21-Jul-2011 Elliott Hughes <enh@google.com> Only allocate slot_data_ as needed.

Bug: 5052119
Change-Id: I41434b111c1f91cf1beb3125af6e81cab258cb92
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
259a8a5154c63a793ea0ee438d146acda7d990b6 12-Jul-2011 Elliott Hughes <enh@google.com> Fix the jweak implementation.

We need to distinguish between "cleared weak global" and "deleted weak global".
Previously we used NULL for both. Now we add a magic value for cleared weak
globals. I've also switched the GC over to using iterators, so IndirectRefTable
itself becomes responsible for not showing bad pointers to the GC.

I've also improved the reference table dumping to cope with the new scheme and
to be a bit easier to read (through extra indentation).

Bug: 4260055
Change-Id: I26af301fb2b46d014c6f6b0915a8f8a7fb6d7c5b
ea333384b92db9c400be1b4c8cb6992d9ba5f14d 11-Jul-2011 Elliott Hughes <enh@google.com> Add JNI app bug workarounds.

Specifically, this hands out direct pointers for all local references,
and lets you use a JNIEnv* on the wrong thread. This is off by default,
but enabled for apps that don't have ICS as their targetSdkVersion.

Bug: 4772166
Change-Id: I20c403a8e63481a35d579d2bd3b121c80ec08f89
ddbd6f44af283415162ea7bb1b4e7ef77c8de492 06-Jul-2011 Elliott Hughes <enh@google.com> Don't abort when a weak global's referent is cleared.

This also makes us less likely to output spurious warnings when
dealing with nulled-out weak globals, and lets us provide more
helpful warnings when warnings are called for.

Bug: 4991942
Change-Id: I99b88e66e07f79562da2cd9d594b93bff218d595
24c57f1d575fccc11239cf71089c7d04270a21c3 29-Jun-2011 Elliott Hughes <enh@google.com> Make it easier to recognize JNI reference bugs.

CheckJNI is still your best choice, but now, even without CheckJNI, you'll get
a strong clue:

E/dalvikvm( 4168): JNI ERROR (app bug): accessed stale local reference at index 10 (top=8)
E/dalvikvm( 4168): VM aborting

Change-Id: Ia65e1e430bc53509add19816ef06cc5dbd1b3e98
7a921948c597d72a6db9ec6f3a0f1fbdfd3e49c8 25-Jun-2011 Doug Kwan <dougkwan@google.com> Fix gcc-4.6 warnings.

Change-Id: I62cfb8b1a39499366ee18c1904e6991567f78571
ce0968340f9ddd54f20e38d4946bfd2ef8f1f343 21-Jun-2011 Elliott Hughes <enh@google.com> Clean up IndirectRefTable a bit.

The main purpose here was to have slightly less unclear warnings for
JNI local reference abuse.

Change-Id: I2c6378dd0a94d8afb96a8e409f7460205e3cd315
60fc806b679a3655c228b4093058c59941a49cfe 26-May-2011 Dan Bornstein <danfuzz@android.com> Further conservation of newlines.

Friends don't let friends end LOG() strings with newlines.

Change-Id: I5a18c766c90c4ab5f03caa6acd601d34d91beb00
d5c36b9040bd26a81219a7f399513526f9b46324 16-Apr-2011 Carl Shapiro <cshapiro@google.com> Move the remaining non-compiler VM code into C++.

Change-Id: Id8693208d2741c55a7b0474d1264f2112019d11f