History log of /art/runtime/entrypoints/quick/quick_trampoline_entrypoints.cc
Revision Date Author Comments
72d72ef51aef106d6f0300a72b583bcc5cd90a13 28-Jan-2015 Mathieu Chartier <mathieuc@google.com> Force set resolved method for static invokes

For static invokes, we may dispatch to the static method in the
superclass but resolve using the subclass. To prevent getting slow
paths on each invoke, we force set the resolved method for the
super class dex method index if we are in the same dex file.

Added test.

Bug: 19175856
(cherry picked from commit e4a91bbeaa118bc01a5c338c6a6d9ee094a6a2c6)
Change-Id: I26f8644a7f725f5c2dc2a94a8e9578f573792507
fcfc8a70894be642dae08350361d04c14a6d7be5 25-Nov-2014 Sebastien Hertz <shertz@google.com> Support proxy method in StackVisitor::GetThisObject

Adds function artQuickGetProxyThisObject which returns the 'this'
object of the proxy method using the QuickArgumentVisitor. Since
proxy methods have the same layout than the kRefsAndArgs runtime
method and 'this' is the 1st method argument, it is located in the
first GPR.

Bug: 17965861
(cherry picked from commit a836bc9760419af4a515f96c66100a39e865f3b9)

Change-Id: I09b5c1cdfc051d9395bba929d4650804eb3b1f7f
e832e64a7e82d7f72aedbd7d798fb929d458ee8f 10-Nov-2014 Mathieu Chartier <mathieuc@google.com> Change 64 bit ArtMethod fields to be pointer sized

Changed the 64 bit entrypoint and gc map fields in ArtMethod to be
pointer sized. This saves a large amount of memory on 32 bit systems.
Reduces ArtMethod size by 16 bytes on 32 bit.

Total number of ArtMethod on low memory mako: 169957
Image size: 49203 methods -> 787248 image size reduction.
Zygote space size: 1070 methods -> 17120 size reduction.
App methods: ~120k -> 2 MB savings.

Savings per app on low memory mako: 125K+ per app
(less active apps -> more image methods per app).

Savings depend on how often the shared methods are on dirty pages vs
shared.

TODO in another CL, delete gc map field from ArtMethod since we
should be able to get it from the Oat method header.

Bug: 17643507

Change-Id: Ie9508f05907a9f693882d4d32a564460bf273ee8
ebee8de725d5fa83483642786b19ea453d865762 13-Aug-2014 Nicolas Geoffray <ngeoffray@google.com> Fix bugs in the x86 and arm versions of generic JNI.

Also fix the run script of 116-nodex2oat to use the non-prebuild
script for target.

Bug: 17000769

(cherry-picked from commit 54accbca0b549b1b1ad3ef09655dad438bc1e104)

Change-Id: I439fcd710fb8bb408f3288ff8fb34fef23890adb
4bf8d11df5dccc1b276cd9c40a98e8a14d79a9c8 25-Jul-2014 Jeff Hao <jeffhao@google.com> Fix proxy tracing and enable tests that now work with tracing.

Also updates proxy_test to generate an image for GetQuickOatCodeFor.

Bug: 16386215

(cherry picked from commit f0a3f09c3d54646166a55c05a6b39c7dd504129c)

Change-Id: I138edbad9e1646db8590f2b1b73f2788d9710e68
4ef12f5b0e26c6016c87866f6a33da5ed8e98d74 01-Aug-2014 Andreas Gampe <agampe@google.com> ART: Add guards to the dex cache and its shortcuts

Do not return fields, methods or classes if the (declaring) class is
erroneous.

Bug: 16692788

(cherry picked from commit 58a5af8568d224ca7eccf2483396ff9862f8d1ee)

Change-Id: I7d3e4cb8113e2e764ed7433eed25e1031e6a0f14
b551fdcda9eb128c80de37c4fb978968bec6d4b3 25-Jul-2014 Zheng Xu <zheng.xu@arm.com> AArch64: Clean up CalleeSaveMethod frame and the use of temp registers.

CalleeSaveMethod frame size changes :
SaveAll : 368 -> 176
RefOnly : 176 -> 96
RefsAndArgs : 304 -> 224

JNI register spill size changes :
160 -> 88

In the transition assembly, use registers following the rules:
1. x0-x7 as temp/argument registers.
2. IP0, IP1 as scratch registers.
3. After correct type of callee-save-frame has been setup, all registers
are scratch-able(probably except xSELF and xSUSPEND).
4. When restore callee-save-frame, IP0 and IP1 should be untouched.
5. From C to managed code, we assume all callee save register in AAPCS
will be restored by managed code except x19(SUSPEND).

In quick compiler:
1. Use IP0, IP1 as scratch register.
2. Use IP1 as hidden argument register(IP0 will be scratched by
trampoline.)

Change-Id: I05ed9d418b01b9e87218a7608536f57e7a286e4c
0398e171f206cd3b140a358ac31b0a3760380df1 25-Jul-2014 Jeff Hao <jeffhao@google.com> Fix proxy tracing and enable tests that now work with tracing.

Bug: 16386215
Change-Id: Iec2a372c921caceb050c6baf72d48b3d822899a4
167cc7c33f7100e3f7acc1594c066daa0122e27a 29-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Fix proxy tracing and enable tests that now work with tracing."

This reverts commit 0398e171f206cd3b140a358ac31b0a3760380df1.

Change-Id: I1346ab01485cc7207be0ecb4d8788c500c0df903
22d5e735f403c57525fe868304c7123f0ce66399 16-Jul-2014 Ian Rogers <irogers@google.com> Remove object_utils.h.

Break into object_lock, field_helper and method_helper.
Clean up header files following this.
Also tidy some of the Handle code in response to compiler errors when resolving
the changes in this CL.

Change-Id: I73e63015a0f02a754d0866bfaf58208aebcaa295
98d1cc8033251c93786e2fa8c59a2e555a9493be 16-May-2014 Mingyao Yang <mingyao@google.com> Improve performance of invokevirtual/invokeinterface with embedded imt/vtable

Add an embedded version of imt/vtable into class object. Both tables start at
fixed offset within class object so method/entry point can be loaded directly
from class object for invokeinterface/invokevirtual.

Bug: 8142917
Change-Id: I4240d58cfbe9250107c95c0708c036854c455968
c380191f3048db2a3796d65db8e5d5a5e7b08c65 08-Jul-2014 Serguei Katkov <serguei.i.katkov@intel.com> x86_64: Enable fp-reg promotion

Patch introduces 4 register XMM12-15 available for promotion of
fp virtual registers.

Change-Id: I3f89ad07fc8ae98b70f550eada09be7b693ffb67
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
04c31d2c984d382b4186974fa0a416aecbed2625 08-Jul-2014 Ian Rogers <irogers@google.com> JNI dlsym lookup fixes.

Thread* self is passed on all architectures apart from ARM and ARM64.
On x86 restore ebx correctly. Pass self in correct register on x86-64.
Ensure methods are compiled in jni_compiler_test even if the generic JNI
trampoline is present.

Change-Id: If5fdb1de97b78ac5a5cf8d0915c5b82311f23eb9
c200a4abeca91e19969f5b35543f17f812ba32b9 17-Jun-2014 Andreas Gampe <agampe@google.com> ART: Rework Generic JNI, add ARM version

Refactors and optimizes Generic JNI. This version uses TwoWordReturn
to avoid writing to / loading from the bottom of the alloca.

Change-Id: I3287007c976f79c9fd32d3b3a43f2d1371bf4cd3
6c5cb212fa7010ae7caf9dc765533aa967c95342 19-Jun-2014 Ian Rogers <irogers@google.com> Ensure classes are initialized rather than initializing.

A class can be being initialized on a different thread, in that case other
threads should block trying to access the class. The initializing state shows
the class is being initialized but not that its safe for other threads to
access. Change occurances of IsInitializing to IsInitialized primarily in
slow-path code.
Bug: 15347354

Change-Id: Ib586d0a385be6086a890dfbf8868d76f16767fac
41c507a9dae44b8329a857da3d9810fab2e9ddc6 15-May-2014 Alexei Zavjalov <alexei.zavjalov@intel.com> ART: Generalize code to find PC for artInvokeInterfaceTrampoline

This allows to determine target method when the interface method has
no dex index, now also for X86-64 and ARM64.

Add constexpr functions to callee_save_frame.h to have compile-time
sizes of callee-save frames. Add a test that ensures they agree
with computations by the corresponding ArtMethod methods.

Move some instruction-set functions into the header file to allow
inlining them. Move arch-specific pointer sizes and alignment sizes
out of globals.h to instruction_set.h to reduce dependencies.

Change-Id: I2997592c7dd1f4dd2bd497522c64bd235ae615a6
Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
ea248f8b048d904a8fe806b6a52372985945274d 10-Jun-2014 Ian Rogers <irogers@google.com> Remove TARGET_REX_SUPPORT define.

Change-Id: I1c3644176c101064261d13b50484d2e3ae456316
779f8c951c0fbe36d4b213113a99541132947bb7 10-Jun-2014 Andreas Gampe <agampe@google.com> ART: Generic JNI for x86

Add the generic JNI trampoline for x86. Small cleanup in the C code.

Change-Id: Icaf9de7c0e5e8d1e6cb1135a54552040344cc5a3
bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe 22-May-2014 Mathieu Chartier <mathieuc@google.com> Change MethodHelper to use a Handle.

Added ConstHandle to help prevent errors where you modify the value
stored in the handle of the caller. Also fixed compaction bugs
related to not knowing MethodHelper::GetReturnType can resolve types.
This bug was present in interpreter RETURN_OBJECT.

Bug: 13077697

Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
d58342caa97108ba413bad467c285c0377f138f5 05-Jun-2014 Andreas Gampe <agampe@google.com> ART: Add instrumentation stubs for ARM64 and X86-64

Adds instrumentation stubs necessary for debugger support.

Refactors MethodAndCode to a top-level TwoWordReturn. A function
having a return type of TwoWordReturn will return its two-word
content, either 2x32b or 2x64b, in two registers according to
the architecture's ABI.

Bug: 15443938
Change-Id: Id7e1fbd4ad8eb6f29e23d48903c76f77b28d981a
58994cdb00b323339bd83828eddc53976048006f 16-May-2014 Dmitry Petrochenko <dmitry.petrochenko@intel.com> x86_64: Hard Float ABI support in QCG

This patch shows our efforts on resolving the ART limitations:
- passing "float"/"double" arguments via FPR
- passing "long" arguments via single GPR, not pair
- passing more than 3 agruments via GPR.

Work done:
- Extended SpecialTargetRegister enum with kARG4, kARG5, fARG4..fARG7.
- Created initial LoadArgRegs/GenDalvikX/FlushIns version in X86Mir2Lir.
- Unlimited number of long/double/float arguments support
- Refactored (v2)

Change-Id: I5deadd320b4341d5b2f50ba6fa4a98031abc3902
Signed-off-by: Serguei Katkov <serguei.i.katkov@intel.com>
Signed-off-by: Dmitry Petrochenko <dmitry.petrochenko@intel.com>
Signed-off-by: Chao-ying Fu <chao-ying.fu@intel.com>
Signed-off-by: Mark Mendell <mark.p.mendell@intel.com>
ffddfdf6fec0b9d98a692e27242eecb15af5ead2 03-Jun-2014 Tim Murray <timmurray@google.com> DO NOT MERGE

Merge ART from AOSP to lmp-preview-dev.

Change-Id: I0f578733a4b8756fd780d4a052ad69b746f687a9
cf4035a4c41ccfcc3e89a0cee25f5218a11b0705 29-May-2014 Andreas Gampe <agampe@google.com> ART: Use StackReference in Quick Stack Frame

The method reference at the bottom of a quick frame is a stack
reference and not a native pointer. This is important for 64b
architectures, where the notions do not coincide.

Change key methods to have StackReference<mirror::ArtMethod>*
parameter instead of mirror::ArtMethod**. Make changes to
invoke stubs for 64b archs, change the frame setup for JNI code
(both generic JNI and compilers), tie up loose ends.

Tested on x86 and x86-64 with host tests. On x86-64, tests succeed
with jni compiler activated. x86-64 QCG was not tested.

Tested on ARM32 with device tests.

Fix ARM64 not saving x19 (used for wSUSPEND) on upcalls.

Tested on ARM64 in interpreter-only + generic-jni mode.

Fix ARM64 JNI Compiler to work with the CL.

Tested on ARM64 in interpreter-only + jni compiler.

Change-Id: I77931a0cbadd04d163b3eb8d6f6a6f8740578f13
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
51f763506c7bb34420242e88e1631550f94d6417 21-May-2014 Andreas Gampe <agampe@google.com> ART: Add INVOKE_TRAMPOLINE and imt_conflict stub to 64b architectures

"Generalize" the return type notion of the interface helpers.

Includes a simple test for imt_conflict. The other interface
trampolines are as of yet untested.

Change-Id: I30fc75f5103766d57628ff22bcbac7c7f81037e3
700a402244a1a423da4f3ba8032459f4b65fa18f 20-May-2014 Ian Rogers <irogers@google.com> Now we have a proper C++ library, use std::unique_ptr.

Also remove the Android.libcxx.mk and other bits of stlport compatibility
mechanics.

Change-Id: Icdf7188ba3c79cdf5617672c1cfd0a68ae596a61
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
f5c3243530805c41cd8706989a1e60367447a493 05-May-2014 Mingyao Yang <mingyao@google.com> Add some debugging info for bug 14469172.

Change-Id: Iba7d47b6a697ab61e10dfc9e1c2b8fde24af27be
f486778d50fc8afa61330df495e94f4f3ec0e238 05-May-2014 Mingyao Yang <mingyao@google.com> Add some debugging info for bug 14469172.

Change-Id: Iba7d47b6a697ab61e10dfc9e1c2b8fde24af27be
42fcd9838a87abaf7a2ef86853a5287f86dbe391 22-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "Revert "64bit changes to the stack walker for the Quick ABI.""

This reverts commit 8d5ead52a92675c258113d3dfa71bf8fceba5d9f.

Change-Id: I6b4774a9bd180de33551975e106322ba1192e6ab
8d5ead52a92675c258113d3dfa71bf8fceba5d9f 22-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Revert "64bit changes to the stack walker for the Quick ABI."

This reverts commit 5cb328362a633302ca0fcdbaa0da7d94069df051.

Change-Id: Icc0ec1a9f15c2e4e9103e732d7ba75a4feb853b1
5cb328362a633302ca0fcdbaa0da7d94069df051 17-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> 64bit changes to the stack walker for the Quick ABI.

- Spill registers have different sizes.
- The ArtMethod at the bottom of the stack is always of kWordSize.

Change-Id: I92f67ff928477970c393c7146980255d08e8e6af
1dd61ba3081a52c3e2efdc78d64f5c134eea7895 02-Apr-2014 Vladimir Kostyukov <vladimir.kostyukov@intel.com> ART: A workaround for a wrongly-read caller's frame

The quick-trampoline treats caller's frame in a different way
then it was formed by quck-invoke stub for hard float ABI targets
such as x86_64 and aarch64. The patch workarounds the issue of
wrongly-read stack arguments due to no contract between quick-invoke
stub and quick-trampoline/shadow-frame-builder regarding the reg-
spill area.

Change-Id: I302f212b4ea5e38632527a5ace03f136b21ef806
Signed-off-by: Vladimir Kostyukov <vladimir.kostyukov@intel.com>
ad61517890168ff6ed19063cc8032a9c033d135b 05-Apr-2014 Andreas Gampe <agampe@google.com> Fix wrong handling of Generic JNI not finding native method.

Code did not properly call JNIMethodEnd, such that locks etc
where not correctly handled.

Add a test case to jni_compiler_test.

Change-Id: If2d5c628517d65a56dd6bb5c4cabdff77c7664a1
0bf8b9ca3899a2913948d02fa17ce5fbe3e7af54 04-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Please clang by making explicit instantiations non-static.

Change-Id: I4112bf62c69b4f28ca369c4bf3c626be43692afd
8689a0a0f266dde073fe7b328c3ceeaa1b23276a 04-Apr-2014 Nicolas Geoffray <ngeoffray@google.com> Explicitly instantiate artInvokeCommon to please analysis tool.

Change-Id: I5c078a197c5026e9bd886d0ba1e188054b5ffa75
5f3ded46a1da26f6a51cad16d421ca2fdc0f23ad 04-Apr-2014 Mathieu Chartier <mathieuc@google.com> Restore the args in the invoke trampoline slow paths.

Previously, there were errors caused by not restoring the args for
the slow path in artInvokeInterfaceTrampoline and artInvokeCommon. The
slow path in artInvokeInterfaceTrampoline occurs when you attempt
to do an interface dispatch of a method in another dex file. The slow
path in artInvokeCommon occurs when the method in dex cache is not
already resolved.

Since FindMethodFromCode may resolve a method, it can occasionally
cause thread suspension/GC. If a moving GC occurred at this point it
resulted in this_object being invalid after the trampoline returned
the code pointer. This caused a native crash in one of the money runs
since there was an unbundeled app which did a List.iterator call.

Bug: 12934910
Change-Id: Ib454faad14bef0d7732a6d7f1ca5803472d502a6
b95a5345ae4217b70ca36f0cced92f68dda7caf5 12-Mar-2014 Stuart Monteith <stuart.monteith@arm.com> AArch64: Add arm64 runtime support.

Adds support for arm64 to ART. Assembler stubs are sufficient for
down calls into interpreter. JNI compiler and generics are not finished.

Basic Generic JNI functionality.

Change-Id: I4a07c79d1e037b9f5746673480e32cf456867b82
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
9a6a99aaac2e4c973e0bc71075f196b8b084100f 14-Mar-2014 Andreas Gampe <agampe@google.com> Remove small duplicate code in Generic JNI handling, add comments

Change-Id: Ib276fa63b6a00480eaaff6c352d37917c61e966c
90546836312adda54f28b700f25ff29ec8becdf8 13-Mar-2014 Andreas Gampe <agampe@google.com> Fixes for Generic JNI

This fixes some linking issues and native code retrieval errors.
All host tests are functional with this change.

Make ArtMethod::GetFrameSizeInBytes() templated to bypass the
embedded sanity check. Necessary for fix-up decision.

Add ArtMethod metadata fix-up code to ClassLinker::LinkCode.
Necessitates new parameters to access the shorty and compute
the frame size.

Fix handling the JNI dlsym lookup stub in the generic JNI code.

Change-Id: I4173b0fbb1ba5b1bcbee1bb340cfdd08a54767e5
9758f79a6c1ef7f662caca9c1df39de1934166b8 13-Mar-2014 Ian Rogers <irogers@google.com> Implement FINAL/OVERRIDE for clang.

Separate declaration from definition in certain places to work-around issues
with clang.
Remove bogus lock annotation at definition in compilers.cc that is already
present at the declaration.
Remove duplicate definition of ClassReference.

Change-Id: I5368057bb36319a259110b2198610d9d2b2e5041
36fea8dd490ab6439f391b8cd7f366c59f026fd2 10-Mar-2014 Andreas Gampe <agampe@google.com> Fixing structure of native frame for Generic JNI

This changes the layout of the callee-save frame used in generic
JNI to be consistent with the JNI compiler, that is, the SIRT is
inline (above the method reference). Now the location of the
"this" object is consistent.

Change-Id: Ibad0882680712cb640b4c70ada0229ef7cf4e62c
7a0e504e60441012c78fc2f3ab8d4da131185c50 07-Mar-2014 Andreas Gampe <agampe@google.com> More JNI compiler tests and small fix

Add checks for alignment, floats, and maximum number of parameters
Fixed x86_64 ABI wrong interpretation (floats not widened in registers)

Change-Id: I6c09af4914b7675ac0275ce21003e317ca44a403
e0dcd46314d07eeb332edea292f5110178e4e3d2 09-Mar-2014 Ian Rogers <irogers@google.com> JNI down call fixes.

Ensure SIRT isn't accessed via quick callee save frame.
Some tidying of code.

Change-Id: I8fec3e89aa6d2e86789c60a07550db2e92478ca7
c147b00f86c28f5275c99c8ce515499c90c01e31 07-Mar-2014 Andreas Gampe <agampe@google.com> Release unused parts of a JNI frame before calling native code

Two-pass process for setting up the JNI frame so we can put Sirt
and native call stack as close together as possible.

Change-Id: I827167a55fafc4eba7d4eaf14a35fc69fd5f85ce
bf6b92a158053c98b15f4393abb3b86344ec9a20 06-Mar-2014 Andreas Gampe <agampe@google.com> Generic JNI implementation for x86_64

Starting implementation for generic JNI on x86_64. Frames are of
large static size (>4K) right now, should be compacted later. Passes
the whole of jni_compiler_test.

Change-Id: I88ac3e13a534afe7568d62a1ef97cb766e8260e4
2ec6520d57479d393bffa05defa1479b25ca8382 04-Mar-2014 Brian Carlstrom <bdc@google.com> Support compiler filters for boot classpath

image_writer.cc
Remove assumption that all methods in the boot classpath are compiled

oat_writer.cc
Don't skip writing ArtMethod::quick_code_offset_ for methods that need resolution, leave that to ImageWriter

dex2oat.cc
Allow dex2dex compilation of image dex files by making the in memory pages writable in all cases, not just app case.

oatdump.cc
dump new OatHeader fields
use ImageSpace.GetImageFilename, not command line image filename, since location may be in dalvik-cache
remove inaccurate check about non-null GC map

quick_trampoline_entrypoints.cc
add and improve some DCHECKS that were useful while debugging

class_linker.cc
image_space.cc
fix double facepalm

parsed_options.cc
fix zygote logging to not skip values to two part options like -classpath <foo>

runtime.cc
wireup parsed compiler options to runtime

Change-Id: Iad314df0b80623c0663d61713d5098297ab9ac87
2da882315a61072664f7ce3c212307342e907207 27-Feb-2014 Andreas Gampe <agampe@google.com> Initial changes towards Generic JNI option

Some initial changes that lead to an UNIMPLEMENTED. Works
by not compiling for JNI right now and tracking native methods
which have neither quick nor portable code. Uses new trampoline.

Change-Id: I5448654044eb2717752fd7359f4ef8bd5c17be6e
55871bf5277f8e8041f1303a416be2cd9215aa07 27-Feb-2014 Mathieu Chartier <mathieuc@google.com> Add null check in artQuickResolutionTrampoline

Also fix possible compaction bug around ResolveMethod.

Bug: 13221223
Change-Id: I0495eaee8d5f9ae5da0a87c4800a66cd04dc4aa7
5275bcbf35c2362a10607670e59edbfdfc80a758 21-Feb-2014 Mathieu Chartier <mathieuc@google.com> Restore refs in artQuickProxyInvokeHandler.

Fixes a compaction related bug which could be caused by moving args
in artQuickProxyInvokeHandler and not updating them before returning
back into compiled code.

Also changed some Object** to StackReferences.

Change-Id: I0779c8fd5f10f142d3c6149ddc531c99ff8ee4c2
936b37f3a7f224d990a36b2ec66782a4462180d6 14-Feb-2014 Ian Rogers <irogers@google.com> Upcall support for x86-64.

Sufficient to pass jni_internal_test.

Change-Id: Ia0d9b8241ab8450e04765b9c32eb6dc8fc1a8733
d2fe10a3a34af171bf1631219cd2d6ff6b7778b5 15-Jan-2014 Sebastien Hertz <shertz@google.com> Remove blacklist

Removes the class initialization blacklist and use transaction to detect and
revert class initialization attempting to invoke native method. This only
concerns class initialization happening at compilation time when generating an
image (like boot.art for the system).

In transactional mode, we log every object's field assignment and array update.
Therefore we're able to abort a transaction to restore values of fields and
array as they were before the transaction starts. We also log changes to the
intern string table so we can restore its state prior to transaction start.

Since transactional mode only happens at compilation time, we don't need to log
all these changes at runtime. In order to reduce the overhead of testing if
transactional mode is on/off, we templatize interfaces of mirror::Object and
mirror::Array, respectively responsible for setting a field and setting an
array element.

For various reasons, we skip some specific fields from transaction:
- Object's class and array's length must remain unchanged so garbage collector
can compute object's size.
- Immutable fields only set during class loading: list of fields, method,
dex caches, vtables, ... as all classes have been loaded and verified before a
transaction occurs.
- Object's monitor for performance reason.

Before generating the image, we browse the heap to collect objects that need to
be written into it. Since the heap may still holds references to unreachable
objects due to aborted transactions, we trigger one collection at the end of
the class preinitialization phase.

Since the transaction is held by the runtime and all compilation threads share
the same runtime, we need to ensure only one compilation thread has exclusive
access to the runtime. To workaround this issue, we force class initialization
phase to run with only one thread. Note this is only done when generating image
so application compilation is not impacted. This issue will be addressed in a
separate CL.

Bug: 9676614
Change-Id: I221910a9183a5ba6c2b99a277f5a5a68bc69b5f9
bbcc0c0a17262f3d2a70fc0a82e1783862f708cc 03-Feb-2014 Vladimir Marko <vmarko@google.com> Speed up method lookup in a different dex file.

Use already known name and proto.

Change-Id: I4505b81724bd6a0f3cf21ee6fed44774d38c4e15
ef7d42fca18c16fbaf103822ad16f23246e2905d 06-Jan-2014 Ian Rogers <irogers@google.com> Object model changes to support 64bit.

Modify mirror objects so that references between them use an ObjectReference
value type rather than an Object* so that functionality to compress larger
references can be captured in the ObjectRefererence implementation.
ObjectReferences are 32bit and all other aspects of object layout remain as
they are currently.

Expand fields in objects holding pointers so they can hold 64bit pointers. Its
expected the size of these will come down by improving where we hold compiler
meta-data.
Stub out x86_64 architecture specific runtime implementation.
Modify OutputStream so that reads and writes are of unsigned quantities.
Make the use of portable or quick code more explicit.
Templatize AtomicInteger to support more than just int32_t as a type.
Add missing, and fix issues relating to, missing annotalysis information on the
mutator lock.
Refactor and share implementations for array copy between System and uses
elsewhere in the runtime.
Fix numerous 64bit build issues.

Change-Id: I1a5694c251a42c9eff71084dfdd4b51fff716822
c528dba35b5faece51ca658fc008b688f8b690ad 26-Nov-2013 Mathieu Chartier <mathieuc@google.com> Enable moving classes.

Slight reduction in Zygote size, memory savings are in the noise.
Before: Zygote size: 8739224
After: Zygote size: 8733568

Fixed a bug where we didn't set the concurrent start bytes after
switching the allocator from bump pointer to ROSAlloc in the
zygote. This caused excessive memory usage.

Added the method verifiers as roots to fix an issue caused by
RegTypes holding a Class*.

Added logic to clear card table in the SemiSpace collector, this
reduces DalvikOther from ~2400k -> ~1760k when using the SemiSpace
collector.

Added a missing lock to the timing loggers which caused a rare
one time crash in std::set.

Bug: 11771255
Bug: 8499494
Bug: 10802951

Change-Id: I99d2b528cd51c1c5ed7012e3220b3aefded680ae
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
83883d7fddf30fdb8b6903560fa1337ab991e74c 22-Oct-2013 Ian Rogers <irogers@google.com> Populate dex cache for sharpened calls.

We ensured the resolved method was in the dex cache, but for a sharpened call
this is abstract. Ensure that the concrete method is also resolved.
Limit the use of direct dex cache based dispatch to cases where we know how to
patch the dex cache.

Bug 11389002

Change-Id: I08252686a53b5948650632837c74bcd5cbf8a862
07d447bebe6cc358e05ef041db84a5095a69e4f1 26-Sep-2013 Mathieu Chartier <mathieuc@google.com> Make artQuickResolutionTrampoline fix up references after GC points.

Required for compaction.

Bug: 8981901
Change-Id: I53a5f942af2a4428fe3548ba1856967632c2df9f
d3633d52e5d21beea73c2e902c043cf96b70df74 21-Aug-2013 Brian Carlstrom <bdc@google.com> Add some extra DCHECKS for debugging artQuickProxyInvokeHandler

Bug: 10094803
Change-Id: I8cc08cd54dbe67781a8264cf2ceb5dab24b78799
bd136a29f08486525d6abc7d0a0006ce5b4011c1 14-Aug-2013 Dragos Sbirlea <dragoss@google.com> Get PORTABLE + SMALL on x86.

Implemented the portable resolution trampoline and
the portable to interpreter bridge.
Also work on integrating SEA_IR in the PORTABLE+SMALL framework.
Refactor some naming and correct indenting.

Change-Id: Ibd97da5e5b6f5148274c9bff368e3654b661ef51
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