History log of /art/runtime/jni_internal.h
Revision Date Author Comments
a967c62e4e6675d3553445aa8e95a09e7a3381b0 11-Sep-2014 Mathieu Chartier <mathieuc@google.com> Delete pin table

The pin table was brought over from dalvik but not really needed
since ART doesn't support pinning in movable spaces. The only
thing it did was hold objects live for JNI functions.
This shouldn't be necessary since people keep jni references to
these objects or else they could never release the elements.

Bug: 17456946

Change-Id: Ibed0d029157ffb9e75ecd80d4d544d690986c090
94f7b49578b6aaa80de8ffed230648d601393905 23-Jul-2014 Hiroshi Yamauchi <yamauchi@google.com> Add GcRoot to clean up and enforce read barriers.

Introduce a value-type wrapper around Object* for GC roots so that 1)
we won't have to directly add the read barrier code in many places and
2) we can avoid accidentally bypassing/missing read barriers on GC
roots (the GcRoot interface ensures that the read barrier is executed
on a read).

The jdwp test passed.

Bug: 12687968
Change-Id: Ib167c7c325b3c7e3900133578815f04d219972a1
576ca0cd692c0b6ae70e776de91015b8ff000a08 07-Jun-2014 Ian Rogers <irogers@google.com> Reduce header files including header files.

Main focus is getting heap.h out of runtime.h.

Change-Id: I8d13dce8512816db2820a27b24f5866cc871a04b
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
196851b634a5bfdd8ab3fb59a320e550b21b0f4d 29-May-2014 Hiroshi Yamauchi <yamauchi@google.com> Add read barriers for the weak roots in the JNI weak globals.

Bug: 12687968
Change-Id: Ic265a0e162e8cc9edc4ab7fa34f8afd5ce968d08
0cd81352a7c06e381951cea1b104fd73516f4341 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Revert "Fix an outstanding compaction bug in interpreter.""

Fixed the generic trampoline to not use ToJObject when unnecessary.

Bug: 15167269

This reverts commit 3bdb873122964da7937eb070cbcf2ef638a8e459.

Change-Id: I0525d0e0f3afb753c770e1572070a0fa22b02271
3bdb873122964da7937eb070cbcf2ef638a8e459 23-May-2014 Mathieu Chartier <mathieuc@google.com> Revert "Fix an outstanding compaction bug in interpreter."

This reverts commit e09ae0920be57760fb390b6944bce420fa0b5582.

Change-Id: I48036306130d5ccfec683d0dc3e9a642a02ee9c1
e09ae0920be57760fb390b6944bce420fa0b5582 15-May-2014 Mathieu Chartier <mathieuc@google.com> Fix an outstanding compaction bug in interpreter.

Fixed a bug in DoFieldPut where the FieldHelper GetType could cause
thread suspension which would result in a stale obj.

Added more handles in the class linker to facilitate moving fiels
and methods in the future.

Removed un-necessarly passing handle references since these are value
types and don't need to be passed by reference.

Added a special NullHandle type which allows null handles without a
handle scope.

Change-Id: I1b51723920a2e4f4f8b2907066f578a3e879fd5b
35aef2ce9d9cbfb37e9b2f6776afce3caed37063 19-May-2014 Yevgeny Rouban <yevgeny.y.rouban@intel.com> Fix race condition between GCDaemon and DeleteLocalReference

There is a race condition between the GCDaemon visiting
thread local roots starting from the thread's indirect ref table (IRT)
and another thread calling JNI::DeleteLocalReference, which is clearing
one of the indirect references.

To cope with the race condition the DeleteLocalReference used to transit
from suspended to running state by creating a ScopedObjectReference(env).
But this transition was removed with the following patch:
https://android.googlesource.com/platform/art/+/ef28b14268ed0f9db0c7bbd571aa514354a360bd%5E!/#F0

If so the GCDaemon must be careful to work with IRT entries.

This new patch:
1. calls the visitor only if the reference is not null. This if-null
behavior of ART GC is consistent with what Dalvik GC does.
2. But this might be not enough for some future sophisticated GC algorithms.
For example, if GC moves an object, then the IRT entry must be changed
with CAS only if it has not been cleared. So, for the safety reasons
the patch put backs the ScopedObjectReference soa(env) to
DeleteLocalReference.

Only one of those two changes would be enough.

mathieuc note: I decided to delete the root null check but kept the
ScopedObjectAccess in DeleteLocalRef and added missing annotations as
well as more ScopedObjectAccess in jni internals.

Bug: 14626564

Change-Id: I90d4b8494f61404579ecdd2918d1482093d99387
Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
Signed-off-by: Yang Chang <yang.chang@intel.com>
eb8167a4f4d27fce0530f6724ab8032610cd146b 08-May-2014 Mathieu Chartier <mathieuc@google.com> Add Handle/HandleScope and delete SirtRef.

Delete SirtRef and replaced it with Handle. Handles are value types
which wrap around StackReference*.

Renamed StackIndirectReferenceTable to HandleScope.

Added a scoped handle wrapper which wraps around an Object** and
restores it in its destructor.

Renamed Handle::get -> Get.

Bug: 8473721

Change-Id: Idbfebd4f35af629f0f43931b7c5184b334822c7a
c56057e40938c587a74984651a510e320a8cb4fd 04-May-2014 Mathieu Chartier <mathieuc@google.com> Add lockless SynchronizedGet for indirect reference table.

Used for decoding global references without holding locks.

Results on JniCallback:
Before: 615ms (3 samples).
After: 585ms (3 samples).

Change-Id: Ifcac8d0359cf658d87f695c6eb869d148af002e5
987560fee798e48fb725c44b796d8ca7a5872ad6 22-Apr-2014 Ian Rogers <irogers@google.com> Remove support for app JNI workarounds.

Change-Id: I4396df7e93fcace4b5b19c2c387e5c30089182a6
53b8b09fc80329539585dcf43657bc5f4ecefdff 14-Mar-2014 Ian Rogers <irogers@google.com> Refactor reflective method invocation.

Move invocation code out of JNI internal into reflection, including ArgArray
code. Make reflective invocation use the ArgArray to build arguments rather
than allocating a jvalue[] and unboxing arguments into that.
Move reflection part of jni_internal_test into reflection_test.
Make greater use of fast JNI.

Change-Id: Ib381372df5f9a83679e30e7275de24fa0e6b1057
c645f1ddb7c40bea6a38eda4b3f83f6b6dec405b 07-Mar-2014 Mathieu Chartier <mathieuc@google.com> Add more VerifyObject calls.

Added verify object calls to SirtRef, IndirectReferenceTable,
ReferenceTable.

Removed un-needed verify object in ScopedObjectAccess / DecodeJObject
since object sources are handled.

Bug: 12934910
Change-Id: I55a46a8ea61fed2a77526eda27fd2cce97a9b125
491ca9e75fad381468dd7f5fdbff56d1a9738dd7 03-Mar-2014 Brian Carlstrom <bdc@google.com> Add ART -help and -showversion

Bug: https://code.google.com/p/android/issues/detail?id=62149
Change-Id: I5c21c0433f5f341f94e7d977e8d2d69cc46d6fe3
0177e53ea521ad58b70c305700dab32f1ac773b7 12-Feb-2014 Ian Rogers <irogers@google.com> Work in the direction of hard float quick ABIs.

Pass a shorty to ArtMethod::Invoke so that register setup can use it.
Document x86-64 ABI.
Add extra debug output for one JNI native method registration fails, namely a
dump of the Class and its dex file's location.
Add hack to get testing of OatMethod's without GC maps working in 64bit.

Change-Id: Ic06b68e18eac33637df2caf5e7e775ff95ae70f3
83c8ee000d525017ead8753fce6bc1020249b96a 28-Jan-2014 Mathieu Chartier <mathieuc@google.com> Add root types and thread id to root visiting.

Enables us to pass the root type and thread id to hprof.

Bug: 12680863
Change-Id: I6a0f1f9e3aa8f9b4033d695818ae7ca3460d67cb
055d46c479369ea825712834353660b45215c195 06-Feb-2014 Mathieu Chartier <mathieuc@google.com> Add missing SIRT to LoadNativeLibrary.

When we transition to kWaitingForJniOnLoad, we are suspended and
a GC can occur. This caused issues since classloaders are movable.

Change-Id: Iae59019c22ac64322a82300107d06a4323ee602b
590fee9e8972f872301c2d16a575d579ee564bee 13-Sep-2013 Mathieu Chartier <mathieuc@google.com> Compacting collector.

The compacting collector is currently similar to semispace. It works by
copying objects back and forth between two bump pointer spaces. There
are types of objects which are "non-movable" due to current runtime
limitations. These are Classes, Methods, and Fields.

Bump pointer spaces are a new type of continuous alloc space which have
no lock in the allocation code path. When you allocate from these it uses
atomic operations to increase an index. Traversing the objects in the bump
pointer space relies on Object::SizeOf matching the allocated size exactly.

Runtime changes:
JNI::GetArrayElements returns copies objects if you attempt to get the
backing data of a movable array. For GetArrayElementsCritical, we return
direct backing storage for any types of arrays, but temporarily disable
the GC until the critical region is completed.

Added a new runtime call called VisitObjects, this is used in place of
the old pattern which was flushing the allocation stack and walking
the bitmaps.

Changed image writer to be compaction safe and use object monitor word
for forwarding addresses.

Added a bunch of added SIRTs to ClassLinker, MethodLinker, etc..

TODO: Enable switching allocators, compacting on background, etc..

Bug: 8981901

Change-Id: I3c886fd322a6eef2b99388d19a765042ec26ab99
1eb512d33f94d1dd7ea38263307ba0f7a0dfa653 19-Oct-2013 Ian Rogers <irogers@google.com> Fast JNI support.

Use a modifier to signal a native method is a fast JNI method. If the
modifier is set then don't perform runnable transitions.

Change-Id: I7835b4d837bfdd1cb8e2d54b919c0d5e6cf90499
c11d9b8870de5f860b13c84003ade7b3f3125a52 19-Sep-2013 Mathieu Chartier <mathieuc@google.com> Re-enable concurrent system weak sweeping.

Enabled by disallowing new system weaks during the pause and
re-allowing it after the system weaks have been swept. Reduces
GC pause by ~1ms.

Fixes pause regression caused by fix for
Bug: 10626133

Change-Id: If49d33e7ef19cb728ed3cef5187acfa53b9b05d8
6aa3df965395566ed6a4fec4af37c2b7577992e9 18-Sep-2013 Mathieu Chartier <mathieuc@google.com> Refactor system weak sweeping, add support for modification.

Required for moving collectors.

Change-Id: Ib97ba4a05af1139f8d388077a15e62bcb9534855
b8a0b94735f188bc739e4c55479c37699006b881 21-Aug-2013 Ian Rogers <irogers@google.com> Switch JNI globals lock to reader-writer.

Also, verifier rejected classes lock. These locks show as contended during
dex2oat, however, they're commonly only read access is required.

Change-Id: If8bb834cc69cd8c26494c87fb7f7b20d4e41cdfd
abd7be989a7509d6dd7325d505fa9926ed502355 15-Aug-2013 Ian Rogers <irogers@google.com> Prevent segvs in JNI.

A segv in JNI code (without CheckJNI) is hard to debug as we fail to see
stacks, pending exceptions.. Make JNI code robust to null arguments, but don't
go to the lengths that CheckJNI does in also sanity checking arguments, the
priority here is just to stop the VM from crashing.

Bug 10305723

Also, allow an unknown throw location not to crash exception dumping.

Found/useful for debugging bug 10331039.

(cherry picked from commit bc939663ccfbe0c648dd6a3670041510aca82420)

Change-Id: Id0203db7d9e320d45ae5ba25d2b63939c79e5c16
bc939663ccfbe0c648dd6a3670041510aca82420 15-Aug-2013 Ian Rogers <irogers@google.com> Prevent segvs in JNI.

A segv in JNI code (without CheckJNI) is hard to debug as we fail to see
stacks, pending exceptions.. Make JNI code robust to null arguments, but don't
go to the lengths that CheckJNI does in also sanity checking arguments, the
priority here is just to stop the VM from crashing.

Bug 10305723

Also, allow an unknown throw location not to crash exception dumping.

Found/useful for debugging bug 10331039.

Change-Id: Ib1e5540df87e2d9ce7570802d624baae7797611f
ea46f950e7a51585db293cd7f047de190a482414 30-Jul-2013 Brian Carlstrom <bdc@google.com> Refactor java.lang.reflect implementation

Cherry-picked from commit ed41d5c44299ec5d44b8514f6e17f802f48094d1.

Move to ArtMethod/Field instead of AbstractMethod/Field and have
java.lang.reflect APIs delegate to ArtMethod/ArtField.

Bug: 10014286.

Change-Id: Iafc1d8c5b62562c9af8fb9fd8c5e1d61270536e7
468532ea115657709bc32ee498e701a4c71762d4 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
(cherry picked from commit 848871b4d8481229c32e0d048a9856e5a9a17ef9)
848871b4d8481229c32e0d048a9856e5a9a17ef9 05-Aug-2013 Ian Rogers <irogers@google.com> Entry point clean up.

Create set of entry points needed for image methods to avoid fix-up at load time:
- interpreter - bridge to interpreter, bridge to compiled code
- jni - dlsym lookup
- quick - resolution and bridge to interpreter
- portable - resolution and bridge to interpreter

Fix JNI work around to use JNI work around argument rewriting code that'd been
accidentally disabled.
Remove abstact method error stub, use interpreter bridge instead.
Consolidate trampoline (previously stub) generation in generic helper.
Simplify trampolines to jump directly into assembly code, keeps stack crawlable.
Dex: replace use of int with ThreadOffset for values that are thread offsets.
Tidy entry point routines between interpreter, jni, quick and portable.

Change-Id: I52a7c2bbb1b7e0ff8a3c3100b774212309d0828e
fc0e3219edc9a5bf81b166e82fd5db2796eb6a0d 17-Jul-2013 Brian Carlstrom <bdc@google.com> Fix multiple inclusion guards to match new pathnames

Change-Id: Id7735be1d75bc315733b1773fba45c1deb8ace43
7940e44f4517de5e2634a7e07d58d0fb26160513 12-Jul-2013 Brian Carlstrom <bdc@google.com> Create separate Android.mk for main build targets

The runtime, compiler, dex2oat, and oatdump now are in seperate trees
to prevent dependency creep. They can now be individually built
without rebuilding the rest of the art projects. dalvikvm and jdwpspy
were already this way. Builds in the art directory should behave as
before, building everything including tests.

Change-Id: Ic6b1151e5ed0f823c3dd301afd2b13eb2d8feb81