History log of /art/test/004-JniTest/jni_test.cc
Revision Date Author Comments
997673870a487baa136f1b13f81ae26dd3005e14 11-Jul-2015 Mathieu Chartier <mathieuc@google.com> Fix proxy handling in FindDeclaredVirtualMethod

Added missing GetInterfaceMethodIfProxy and test.

Fixed formatting.

Bug: 22411819
https://code.google.com/p/android-developer-preview/issues/detail?id=2635

(cherry picked from commit 72156e28fd6bc72ac965b29446f8801b2e82f2fd)

Change-Id: I3eece9c72091bb9d0262aacf0a75ec6908b5f4d2
ff6d8cffb7c14eee56df16d1422b1fcc180decde 02-Jun-2015 Mathieu Chartier <mathieuc@google.com> Add more info for attempting to delete non-JNI local reference

Now we print the stack trace of the method which tried to remove the
non-JNI local reference.

Added test, example output:
Attempt to remove non-JNI local reference, dumping thread
"main" prio=5 tid=1 Runnable
| group="main" sCount=0 dsCount=0 obj=0x12c2b400 self=0xf878af28
| sysTid=32662 nice=0 cgrp=default sched=0/0 handle=0xf73df700
| state=R schedstat=( 154297228 636505 121 ) utm=5 stm=10 core=11 HZ=100
| stack=0xff6f2000-0xff6f4000 stackSize=7MB
| held mutexes= "mutator lock"(shared held)
native: #00 pc 00455a7f /out/host/linux-x86/lib/libartd.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::ArtMethod*, void*)+191)
native: #01 pc 00425d79 /out/host/linux-x86/lib/libartd.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+473)
native: #02 pc 0028c555 /out/host/linux-x86/lib/libartd.so (art::IndirectReferenceTable::Remove(unsigned int, void*)+421)
native: #03 pc 003319c8 /out/host/linux-x86/lib/libartd.so (art::JNI::DeleteLocalRef(_JNIEnv*, _jobject*)+56)
native: #04 pc 0012db14 /out/host/linux-x86/lib/libartd.so (art::CheckJNI::DeleteRef(char const*, _JNIEnv*, _jobject*, art::IndirectRefKind)+292)
native: #05 pc 00122176 /out/host/linux-x86/lib/libartd.so (art::CheckJNI::DeleteLocalRef(_JNIEnv*, _jobject*)+54)
native: #06 pc 00005724 /out/host/linux-x86/lib/libarttest.so (Java_Main_removeLocalObject+36)
native: #07 pc 00004d6e /tmp/test-32506/dalvik-cache/x86/tmp@mathieuc@test-32506@004-JniTest.jar@classes.dex (void Main.removeLocalObject(java.lang.Object)+130)
at Main.removeLocalObject(Native method)
at Main.testRemoveLocalObject(Main.java:118)
at Main.main(Main.java:37)

Bug: 20683465
Change-Id: I56b99c77ae7020cabf1aaeb1d5317b1d5ba940e5
7be83025b62ab499ed8b2b59521f8fbe8e2b13ab 28-May-2015 Jeff Hao <jeffhao@google.com> Add JNI String.<init> test for global and weak global refs.

Test for change:
https://googleplex-android-review.git.corp.google.com/#/c/698642/

Change-Id: I3e1182d42f9e24448d8616000de58ebfe1e50fb8
15e9ad1d028d7f12cb598b075453173532a00d91 20-May-2015 Jeff Hao <jeffhao@google.com> Intercept JNI invocation of String.<init> methods.

libmono uses JNI AllocObject and CallNonvirtualVoidMethod to create and
initialize a string instead of using the recommended NewObject. This
change adds an intercept to change the String.<init> call to a
StringFactory call instead. Then, it uses the object id of the original
string object referrer and maps it to the result of the StringFactory.

Bug: 21288130
Change-Id: Ib4db402c178bc37188d5c5faf30b6e4fdc747b17
848f70a3d73833fc1bf3032a9ff6812e429661d9 15-Jan-2014 Jeff Hao <jeffhao@google.com> Replace String CharArray with internal uint16_t array.

Summary of high level changes:
- Adds compiler inliner support to identify string init methods
- Adds compiler support (quick & optimizing) with new invoke code path
that calls method off the thread pointer
- Adds thread entrypoints for all string init methods
- Adds map to verifier to log when receiver of string init has been
copied to other registers. used by compiler and interpreter

Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
2cebb24bfc3247d3e9be138a3350106737455918 22-Apr-2015 Mathieu Chartier <mathieuc@google.com> Replace NULL with nullptr

Also fixed some lines that were too long, and a few other minor
details.

Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
005f6978d34a3d431193d72fe1cfdd5d0911e8ec 03-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Don't re-use arttest when calling loadLibrary.

When Android's build environment variables are set with envsetup.sh,
the test "works" ok, by getting a LinkageError because two class loaders
try to load the same library. I guess that is the reason for the
if (ExceptionCheck()) after the loading.

However, if the environment variables are set manually, there are
cases where the paths provided between a Java loadLibrary, and a
native loadLibrary are different, so we end up loading the library twice.
This makes the assertion line 32 fail on the second JNI_OnLoad call.
In my particular environment, ANDROID_BUILD_TOP was something lie
/foo/bar/..//.

This change stops re-using the same library, and makes the expected
outcome constant: the native call of loadLibrary with a non exist
library must throw a LinkageError.

Change-Id: I8721a03715e099c55fb8b2b87813f1e772c8e83d
6a3c1fcb4ba42ad4d5d142c17a3712a6ddd3866f 31-Oct-2014 Ian Rogers <irogers@google.com> Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.

Fix associated errors about unused paramenters and implict sign conversions.
For sign conversion this was largely in the area of enums, so add ostream
operators for the effected enums and fix tools/generate-operator-out.py.
Tidy arena allocation code and arena allocated data types, rather than fixing
new and delete operators.
Remove dead code.

Change-Id: I5b433e722d2f75baacfacae4d32aef4a828bfe1b
58e5e5d12d5dc55e09088d6bf8d51e4313248a13 08-Sep-2014 Brian Carlstrom <bdc@google.com> Add CallNonvirtual test

Change-Id: If0cbfc587cb8fe5d47fda1149629954080dd0f6f
ab61295e55c38072095e498053b8f5bebf46ad63 14-Aug-2014 Andreas Gampe <agampe@google.com> ART: Fix another potential N-th visitor issue

Bug: 16867274
Change-Id: I5466af563032041ef4a547894f40f303871302c6
61bf6a1c80bf797af5d7911ff71fc367fdb36742 12-Aug-2014 Andreas Gampe <agampe@google.com> ART: Tolerate shallow call stack in VMStack_getCallingClassLoader

When the call stack does not have the three methods we expect,
the visitor will return a nullptr value.

Add a test to JniTest (and refactor the test a little for code reuse).

Bug: 16867274
Change-Id: I5fb8f91f372a41e0bc11ef9f70640834591afa53
0d334ce54efd791da14536b6a16f61d9085b8785 14-Aug-2014 Andreas Gampe <agampe@google.com> ART: Fix another potential N-th visitor issue

Bug: 16867274

(cherry picked from commit ab61295e55c38072095e498053b8f5bebf46ad63)

Change-Id: I5466af563032041ef4a547894f40f303871302c6
718ac65aa78403124c2269f0dcadd341a18b8efe 12-Aug-2014 Andreas Gampe <agampe@google.com> ART: Tolerate shallow call stack in VMStack_getCallingClassLoader

When the call stack does not have the three methods we expect,
the visitor will return a nullptr value.

Add a test to JniTest (and refactor the test a little for code reuse).

Bug: 16867274

(cherry picked from commit 61bf6a1c80bf797af5d7911ff71fc367fdb36742)

Change-Id: I5fb8f91f372a41e0bc11ef9f70640834591afa53
1268b742c8cff7318dc0b5b283cbaeabfe0725ba 11-Jul-2014 Narayan Kamath <narayan@google.com> Fix broken JNI IsAssignableFrom.

The expected argument order was the opposite of what the spec
dictated.

Reported-By: Mikhail Naganov <mnaganov@google.com>
bug: 16531674

Change-Id: I1ebc6d5814ebb4feeb96f3ecdf1a4602da4ba7ce
1c83cbc4a817acbd7f9abb5b29a2d418a958e6a1 23-Jul-2014 Andreas Gampe <agampe@google.com> ART: Make run tests out of oat tests

Transforms all former oat tests into run tests.

Change-Id: I190dd39456454c36e5538a2c044d993965a67533