summaryrefslogtreecommitdiffstats
path: root/runtime/stack.h
Commit message (Collapse)AuthorAgeFilesLines
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-021-69/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Optimizing + quick tests are passing, devices boot. TODO: Test and fix bugs in mips64. Saves 16 bytes per most ArtMethod, 7.5MB reduction in system PSS. Some of the savings are from removal of virtual methods and direct methods object arrays. Bug: 19264997 (cherry picked from commit e401d146407d61eeb99f8d6176b2ac13c4df1e33) Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d Fix some ArtMethod related bugs Added root visiting for runtime methods, not currently required since the GcRoots in these methods are null. Added missing GetInterfaceMethodIfProxy in GetMethodLine, fixes --trace run-tests 005, 044. Fixed optimizing compiler bug where we used a normal stack location instead of double on ARM64, this fixes the debuggable tests. TODO: Fix JDWP tests. Bug: 19264997 Change-Id: I7c55f69c61d1b45351fd0dc7185ffe5efad82bd3 ART: Fix casts for 64-bit pointers on 32-bit compiler. Bug: 19264997 Change-Id: Ief45cdd4bae5a43fc8bfdfa7cf744e2c57529457 Fix JDWP tests after ArtMethod change Fixes Throwable::GetStackDepth for exception event detection after internal stack trace representation change. Adds missing ArtMethod::GetInterfaceMethodIfProxy call in case of proxy method. Bug: 19264997 Change-Id: I363e293796848c3ec491c963813f62d868da44d2 Fix accidental IMT and root marking regression Was always using the conflict trampoline. Also included fix for regression in GC time caused by extra roots. Most of the regression was IMT. Fixed bug in DumpGcPerformanceInfo where we would get SIGABRT due to detached thread. EvaluateAndApplyChanges: From ~2500 -> ~1980 GC time: 8.2s -> 7.2s due to 1s less of MarkConcurrentRoots Bug: 19264997 Change-Id: I4333e80a8268c2ed1284f87f25b9f113d4f2c7e0 Fix bogus image test assert Previously we were comparing the size of the non moving space to size of the image file. Now we properly compare the size of the image space against the size of the image file. Bug: 19264997 Change-Id: I7359f1f73ae3df60c5147245935a24431c04808a [MIPS64] Fix art_quick_invoke_stub argument offsets. ArtMethod reference's size got bigger, so we need to move other args and leave enough space for ArtMethod* and 'this' pointer. This fixes mips64 boot. Bug: 19264997 Change-Id: I47198d5f39a4caab30b3b77479d5eedaad5006ab
* ART: Clean up arm64 kNumberOfXRegisters usage.Vladimir Marko2015-05-261-1/+1
| | | | | | | | | | | | | | | | | | | | | Avoid undefined behavior for arm64 stemming from 1u << 32 in loops with upper bound kNumberOfXRegisters. Create iterators for enumerating bits in an integer either from high to low or from low to high and use them for <arch>Context::FillCalleeSaves() on all architectures. Refactor runtime/utils.{h,cc} by moving all bit-fiddling functions to runtime/base/bit_utils.{h,cc} (together with the new bit iterators) and all time-related functions to runtime/base/time_utils.{h,cc}. Improve test coverage and fix some corner cases for the bit-fiddling functions. Bug: 13925192 (cherry picked from commit 80afd02024d20e60b197d3adfbb43cc303cf29e0) Change-Id: I905257a21de90b5860ebe1e39563758f721eab82
* Add a flag to StackVisitor for inlining.Nicolas Geoffray2015-05-111-4/+19
| | | | | | | | | The flag tells whether the stack walk needs to include inlined Java frames. This does not do anything just yet, as we're not inlining anyways. Change-Id: I716e25094fe56fa335ca1f9a398c1bcdba478e73
* Check IsReferenceVReg during deoptMathieu Chartier2015-05-081-0/+3
| | | | | | | | | | | Required since the quick GC maps may not agree with the verifier ones. Without this check we may copy stale object references into the shadow frame. (cherry picked from commit f00baf56ef647684888a407dbb6adadd704a2039) Bug: 20736048 Change-Id: I7783c8a8ee45cf601b08b4c38f1dec7f7d11380c
* Fix mismatched new[]/delete.Christopher Ferris2015-05-041-2/+8
| | | | | | | Another two cases where a new[] is used but only a delete occurs. Bug: 18202869 Change-Id: If68264807150f3a9783e44ef8823cc366bff8df2
* Debugger: Remove support for setting values in optimizing.Nicolas Geoffray2015-04-241-6/+0
| | | | | bug:19944235 Change-Id: I3bcd56c7844847a7f0367f8ce6a72bddcd09d441
* Replace NULL with nullptrMathieu Chartier2015-04-221-3/+5
| | | | | | | Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
* Refactor and improve GC root handlingMathieu Chartier2015-04-061-13/+1
| | | | | | | | | | | | | | | | | | | | | | Changed GcRoot to use compressed references. Changed root visiting to use virtual functions instead of function pointers. Changed root visting interface to be an array of roots instead of a single root at a time. Added buffered root marking helper to avoid dispatch overhead. Root marking seems a bit faster on EvaluateAndApplyChanges due to batch marking. Pause times unaffected. Mips64 is untested but might work, maybe. Before: MarkConcurrentRoots: Sum: 67.678ms 99% C.I. 2us-664.999us Avg: 161.138us Max: 671us After: MarkConcurrentRoots: Sum: 54.806ms 99% C.I. 2us-499.986us Avg: 136.333us Max: 602us Bug: 19264997 Change-Id: I0a71ebb5928f205b9b3f7945b25db6489d5657ca
* API change in StackVisitor::GetVReg*.Nicolas Geoffray2015-03-131-27/+9
| | | | | | | | | | - Remove GetVReg() and SetVReg() that were expecting to always succeed. - Change Quick-only methods to take a FromQuickCode suffix. - Change deopt to use dead values when GetVReg does not succeed: the optimizing compiler will not have a location for uninitialized Dex registers and potentially dead registers. Change-Id: Ida05773a97aff8aa69e0caf42ea961f80f854b77
* Remove ThrowLocation.Nicolas Geoffray2015-03-101-3/+1
| | | | | | | Note that this is a cleanup change, and has no functionality change. The ThrowLocation had no use anymore. Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
* Stack support for Optimizing compilerSebastien Hertz2015-03-031-2/+43
| | | | | | | | | | | Allows to read/write DEX registers from physical register or stack location when the method is compiled with the Optimizing compiler. Required fixing arm and arm64 JNI compiler by saving floating point registers. Bug: 18547544 Change-Id: I401579f251d1c0a130f6cf4a93a960cdcd7518f5
* Refactor register access from StackVisitorSebastien Hertz2015-01-261-4/+23
| | | | | | | | | | | | | | | | Moves register access checking up to StackVisitor by adding methods IsAccessibleGPR and IsAccessibleFPR in Context class. It allows to simplify GetGPR/FPR and SetGPR/FPR methods in the Context class (and its subclasses). Also simplifies code in StackVisitor by adding IsAccessibleRegister, GetRegister and SetRegister methods which then call either GPR or FPR specific methods in Context depending on the nature of the accessed register. Bug: 18547544 Bug: 19106446 Change-Id: I6e707608d935a71571d0e975a6e766053de3763a
* More of the concurrent copying collector.Hiroshi Yamauchi2015-01-231-0/+7
| | | | | Bug: 12687968 Change-Id: I62f70274d47df6d6cab714df95c518b750ce3105
* Print more info in MarkSweep::VerifyRootMathieu Chartier2015-01-151-0/+14
| | | | | | | | | | | | | | | | | | | | | | | Refactored old root callback to use a new class called RootInfo. RootInfo contains all the relevant info related to the root associated with the callback. The MarkSweep::VerifyRoot function now uses this info to print the StackVisitor's described location if the GC root is of the type kRootJavaFrame. Some other cleanup. Example output: E/art (12167): Tried to mark 0x123 not contained by any spaces E/art (12167): Attempting see if it's a bad root E/art (12167): Found invalid root: 0x123 with type RootJavaFrame E/art (12167): Location=Visiting method 'void java.lang.Runtime.gc()' at dex PC 0xffffffff (native PC 0x0) vreg=0 (cherry picked from commit 12f7423a2bb4bfab76700d84eb6d4338d211983a) Bug: 18588862 Change-Id: Ic5a2781f704e931265ffb3621c2eab4b2e25f60f
* Remove portable.Elliott Hughes2014-12-121-39/+1
| | | | Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
* Instruction set features for ARM64, MIPS and X86.Ian Rogers2014-11-131-1/+1
| | | | | | | | | | | | | Also, refactor how feature strings are handled so they are additive or subtractive. Make MIPS have features for FPU 32-bit and MIPS v2. Use in the quick compiler rather than #ifdefs that wouldn't have worked in cross-compilation. Add SIMD features for x86/x86-64 proposed in: https://android-review.googlesource.com/#/c/112370/ Bug: 18056890 Change-Id: Ic88ff84a714926bd277beb74a430c5c7d5ed7666
* Remove -Wno-unused-parameter and -Wno-sign-promo from base cflags.Ian Rogers2014-11-031-3/+3
| | | | | | | | | | | 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
* Refactor quick entrypointsIan Rogers2014-10-201-21/+7
| | | | | | | | | | | Remove FinishCalleeSaveFrameSetup. Assembly routines write down anchor into TLS as well as placing runtime method in callee save frame. Simplify artSet64InstanceFromCode by not computing the referrer from the stack in the C++ code. Move assembly offset tests next to constant declaration and tidy arch_test. Change-Id: Iededeebc05e54a1e2bb7bb3572b8ba012cffa1c8
* stdint types all the way!Ian Rogers2014-10-091-4/+4
| | | | Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
* Avoid printing absolute addresses in oatdumpBrian Carlstrom2014-09-161-2/+2
| | | | | | | | | | | | | | | | | - Added printing of OatClass offsets. - Added printing of OatMethod offsets. - Added bounds checks for code size size, code size, mapping table, gc map, vmap table. - Added sanity check of 100k for code size. - Added partial disassembly of questionable code. - Added --no-disassemble to disable disassembly. - Added --no-dump:vmap to disable vmap dumping. - Reordered OatMethod info to be in file order. Bug: 15567083 (cherry picked from commit 34fa79ece5b3a1940d412cd94dbdcc4225aae72f) Change-Id: I2c368f3b81af53b735149a866f3e491c9ac33fb8
* ART: Change temporaries to positive namesRazvan A Lupusoru2014-08-261-98/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes compiler temporaries to have positive names. The numbering now puts them above the code VRs (locals + ins, in that order). The patch also introduces APIs to query the number of temporaries, locals and ins. The compiler temp infrastructure suffered from several issues which are also addressed by this patch: -There is no longer a queue of compiler temps. This would be polluted with Method* when post opts were called multiple times. -Sanity checks have been added to allow requesting of temps from BE and to prevent temps after frame is committed. -None of the structures holding temps can overflow because they are allocated to allow holding maximum temps. Thus temps can be requested by BE with no problem. -Since the queue of compiler temps is no longer maintained, it is no longer possible to refer to a temp that has invalid ssa (because it was requested before ssa was run). -The BE can now request temps after all ME allocations and it is guaranteed to actually receive them. -ME temps are now treated like normal VRs in all cases with no special handling. Only the BE temps are handled specially because there are no references to them from MIRs. -Deprecated and removed several fields in CompilationUnit that saved register information and updated callsites to call the new interface from MIRGraph. Change-Id: Ia8b1fec9384a1a83017800a59e5b0498dfb2698c Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com> Signed-off-by: Udayan Banerji <udayan.banerji@intel.com>
* More efficient stack walk in exception throwing.Hiroshi Yamauchi2014-08-131-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | In the exception handling code, we currently walk down the stack twice, once to get the stack height which we use to compute frame IDs (the bottom frame is zero), and once more to find the catch block to jump to. For a deep stack, this could result in very slow exception handling. That is, if have a lot of finally or catch blocks that we end up jumping to in a deep stack, we need to do a lot of catch/rethrow chains. Since we'd need to walk down to the bottom each time to compute frames IDs in each catch/rethrow, we'd need to walk down O(N^2) frames at the worst case. Instead of frames IDs ((the bottom frame is zero), we will use the frame depth (the top frame is zero) and no longer need to walk down the stack just to get the stack height. We walk down O(N) frames. This was what was happening with code.google.gson.functional.CircularReferenceTest. With this change, the test run time went from ~120s down to ~3s on N5 and it no longer crashes due to the thread suspension timeout. Bug: 16800209 Change-Id: Ie815df1e3e8fb9d82e40685d4cc2b8838fd8aa07
* Fix access to long/double stack values from debuggerSebastien Hertz2014-07-171-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | Long and double values live in a pair of DEX registers. When we compile DEX code with the Quick compiler, a DEX register either lives in the stack or is promoted to a physical register. In the case of a pair of DEX registers, the Quick compiler assumes both registers live in the same "area": both live in the stack or both are promoted to physical registers. From the debugger, we used to access these values by reading/writing each DEX register separately. However, this does not work when only one DEX register of a pair is promoted and the other lives in the stack. In this case, the compiled code reads from/writes to the stack only. To fix that, the debugger must follow the same rule than the Quick compiler: if both DEX registers are promoted, read/write them from/to physical registers, otherwise read/write them from/to the stack. We add StackVisitor:GetVRegPair and StackVisitor:SetVRegPair for this purpose. We also follow the same rule when deoptimizing. However we need to do that only when we know two consecutive DEX registers are part of a pair (long or double). We know that thanks to the verifier. Bug: 15527793 Change-Id: I04812285ff26ef0129f39792a1cf776f3591ca2d
* Break apart header files.Ian Rogers2014-07-151-10/+4
| | | | | | | | Create libart-gtest for common runtime and compiler gtest routines. Rename CompilerCallbacksImpl that is quick compiler specific. Rename trace clock source constants to not use the overloaded profiler term. Change-Id: I4aac4bdc7e7850c68335f81e59a390133b54e933
* Revert "Revert "Fix access to FP registers when visiting stack""Sebastien Hertz2014-06-171-4/+15
| | | | | | | | | | This reverts commit 8ebd94ab2e0d9867a7d384f00fa4cab24235216f. Fixes StackVisitor::GetVReg to read register value in a uintptr_t local and cast it into uint32_t pointer argument. Bug: 15433097 Change-Id: I4e13ed5446e823e9ec50fbc378b16be5b17b2294
* Revert "Fix access to FP registers when visiting stack"Sebastien Hertz2014-06-171-15/+4
| | | | | | This reverts commit aa9b3aee1e06f922e4518713f9b3dff00a0b2597. Change-Id: Ied27deb89cca5ec9094d391374e03f83fcb76c33
* Fix access to FP registers when visiting stackSebastien Hertz2014-06-171-4/+15
| | | | | | | | | | | | | | | | | | Adds GetFPR and SetFPR to Context class so we can read from and write to floating-point registers during stack visit. They return a boolean flag indicating whether the read/write is successful. This allows the debugger to return the JDWP error ABSENT_INFORMATION when we can't read/write a register. We also update GetGPR and SetGPR for consistency. We keep a default GetGPR implementation asserting the read was successful using a CHECK so we don't silently fail. Adds missing JDWP object tags for StackFrame.SetValues to avoid crash when setting corresponding objects (thread, thread group, class object or class loader). Also returns JDWP error INVALID_OBJECT (when the given object id is invalid) instead of crashing with an unimplemented message. Bug: 15433097 Change-Id: I70843c9280e694aec1eae5cf6f2dc155cb9ea10e
* Fix GetOutVROffset to use correct Method* size.buzbee2014-06-041-3/+4
| | | | | | | | [Tip 'o the hat to Mark Mendell for noticing this one] Use StackReference to find Method* size in GetOutVROffset. Change-Id: Ie1b25eb839c59305cadc5fdc7cbb5f41f1a85686
* AArch64: Fix cmp-long and method with long arguments.Zheng Xu2014-06-041-32/+32
| | | | | | | | | 1. Fix cmp-long. 2. Use single register to pass long argument. 3. Flush StackReference<ArtMethod> on arm64 the same as in common code. 3. Fix the mismatch in calculate reg offset. Change-Id: Ie2723260fb143512e4da6ee88d4f3aded80d3d5e
* Don't report down-calls as unhandled exceptions.Ian Rogers2014-05-301-0/+8
| | | | | | | | Bug: 15310540 Also, narrow scope of catch/deoptimize stack visitors that are specific to quick exception delivery. Change-Id: Ib13a006ce1347acb93a36b0186550d4c3ec2034b
* ART: Use StackReference in Quick Stack FrameAndreas Gampe2014-05-291-18/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Visit methods in stack frames during root visits.Hiroshi Yamauchi2014-05-161-5/+15
| | | | | | | | | | | | | | | | | | This is necessary for a Baker-style read barrier to-space invariant to hold. That is, an object either needs to be marked/forwarded as root or it must be accessed only through a read barrier by mutators. Since stack frames have direct pointers to methods that a mutator can access without a read barrier, stack frame methods have to be visited as root, which makes sense as stack frames are thread roots. This is the case even if methods do not move as they have to be marked 'gray' for the objects pointed to by them, which can move, to be recursively marked/forwarded. This also puts us in the right direction toward moving methods (and fields) in the future. Bug: 12687968 Change-Id: Id32b913c021a140073deea9149a8782e8f308303
* Add Handle/HandleScope and delete SirtRef.Mathieu Chartier2014-05-131-4/+4
| | | | | | | | | | | | | | | | 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
* Handle implicit stack overflow without affecting stack walksDave Allison2014-05-051-8/+0
| | | | | | | | | | | | | | | | | | | This changes the way in which implicit stack overflows are handled to satisfy concerns about changes to the stack walk code. Instead of creating a gap in the stack and checking for it in the stack walker, use the ManagedStack infrastructure to concoct an invisible gap that will never be seen by a stack walk. Also, this uses madvise to tell the kernel that the main stack's protected region will probably never be accessed, and instead of using memset to map the pages in, use memcpy to read from them. This will save 32K on the main stack. Also adds a 'signals' verbosity level as per a review request. Bug: 14066862 Change-Id: I5257305feeaea241d11e6aa6f021d2a81da20b81
* Replace CountOneBits and __builtin_popcount with POPCOUNT.Vladimir Marko2014-05-021-2/+3
| | | | | | Clean up utils.h, make some functions constexpr. Change-Id: I2399100280cbce81c3c4f5765f0680c1ddcb5883
* Revert "Revert "64bit changes to the stack walker for the Quick ABI.""Nicolas Geoffray2014-05-021-10/+13
| | | | | | This reverts commit 8d5ead52a92675c258113d3dfa71bf8fceba5d9f. Change-Id: I6b4774a9bd180de33551975e106322ba1192e6ab
* Revert "64bit changes to the stack walker for the Quick ABI."Nicolas Geoffray2014-04-221-6/+5
| | | | | | This reverts commit 5cb328362a633302ca0fcdbaa0da7d94069df051. Change-Id: Icc0ec1a9f15c2e4e9103e732d7ba75a4feb853b1
* 64bit changes to the stack walker for the Quick ABI.Nicolas Geoffray2014-04-181-5/+6
| | | | | | | - Spill registers have different sizes. - The ArtMethod at the bottom of the stack is always of kWordSize. Change-Id: I92f67ff928477970c393c7146980255d08e8e6af
* Implement implicit stack overflow checksDave Allison2014-03-311-0/+8
| | | | | | | | | | | | | This also fixes some failing run tests due to missing null pointer markers. The implementation of the implicit stack overflow checks introduces the ability to have a gap in the stack that is skipped during stack walk backs. This gap is protected against read/write and is used to trigger a SIGSEGV at function entry if the stack will overflow. Change-Id: I0c3e214c8b87dc250cf886472c6d327b5d58653e
* Implicit null/suspend checks (oat version bump)Dave Allison2014-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability to use SEGV signals to throw NullPointerException exceptions from Java code rather than having the compiler generate explicit comparisons and branches. It does this by using sigaction to trap SIGSEGV and when triggered makes sure it's in compiled code and if so, sets the return address to the entry point to throw the exception. It also uses this signal mechanism to determine whether to check for thread suspension. Instead of the compiler generating calls to a function to check for threads being suspended, the compiler will now load indirect via an address in the TLS area. To trigger a suspend, the contents of this address are changed from something valid to 0. A SIGSEGV will occur and the handler will check for a valid instruction pattern before invoking the thread suspension check code. If a user program taps SIGSEGV it will prevent our signal handler working. This will cause a failure in the runtime. There are two signal handlers at present. You can control them individually using the flags -implicit-checks: on the runtime command line. This takes a string parameter, a comma separated set of strings. Each can be one of: none switch off null null pointer checks suspend suspend checks all all checks So to switch only suspend checks on, pass: -implicit-checks:suspend There is also -explicit-checks to provide the reverse once we change the default. For dalvikvm, pass --runtime-arg -implicit-checks:foo,bar The default is -implicit-checks:none There is also a property 'dalvik.vm.implicit_checks' whose value is the same string as the command option. The default is 'none'. For example to switch on null checks using the option: setprop dalvik.vm.implicit_checks null It only works for ARM right now. Bumps OAT version number due to change to Thread offsets. Bug: 13121132 Change-Id: If743849138162f3c7c44a523247e413785677370
* Generic JNI implementation for x86_64Andreas Gampe2014-03-051-1/+1
| | | | | | | | 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
* Fix and optimize verify object.Mathieu Chartier2014-02-211-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VerifyObject no longer resides in heap. You can now enable VerifyObject for non-debug builds. VerifyStack is still slow, so it is now guarded by its own flag. Fixed the image writer to not use verification at places where verification fails due to invalid reads. Fixed RosAlloc to use SizeOf which doesn't call verify object. Added a flag paremeter to some of the mirror getters / setters to be able to selectively disable VerifyObject on certain calls. Optimized the GC to not verify each object multiple times during object scanning if verify object is enabled. Added 3 verification options: verify reads, verify this, and verify writes so that you can select how much verification you want for mirror getters and setters. Removed some useless DCHECKs which would slow debug builds without providing any benefits. TODO: RosAlloc verification doesn't currently work with verify objects. Bug: 12934910 Bug: 12879358 Change-Id: Ic61033104dfc334543f89b0fc0ad8cd4f4015d69
* Change root visitor to use Object**.Mathieu Chartier2014-02-181-0/+1
| | | | | | | Simplifies code and improves the performance of root visiting since we usually don't need to check to see if the object moved. Change-Id: Iba998f5a15ae1fa1b53ca5226dd2168a411196cf
* GenSpecialCase support for x86Razvan A Lupusoru2014-02-131-1/+7
| | | | | | | | Moved GenSpecialCase from being ARM specific to common code to allow it to be used by x86 quick as well. Change-Id: I728733e8f4c4da99af6091ef77e5c76ae0fee850 Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
* Object model changes to support 64bit.Ian Rogers2014-02-061-41/+58
| | | | | | | | | | | | | | | | | | | | | | | 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
* Enable compiler temporariesRazvan A Lupusoru2014-01-311-12/+75
| | | | | | | | | | | | | | | | | | | | | | | Compiler temporaries are a facility for having virtual register sized space for dealing with intermediate values during MIR transformations. They receive explicit space in managed frames so they can have a home location in case they need to be spilled. The facility also supports "special" temporaries which have specific semantic purpose and their location in frame must be tracked. The compiler temporaries are treated in the same way as virtual registers so that the MIR level transformations do not need to have special logic. However, generated code needs to know stack layout so that it can distinguish between home locations. MIRGraph has received an interface for dealing with compiler temporaries. This interface allows allocation of wide and non-wide virtual register temporaries. The information about how temporaries are kept on stack has been moved to stack.h. This is was necessary because stack layout is dependent on where the temporaries are placed. Change-Id: Iba5cf095b32feb00d3f648db112a00209c8e5f55 Signed-off-by: Razvan A Lupusoru <razvan.a.lupusoru@intel.com>
* Cleanup invoke's receiver handling in interpreter.Sebastien Hertz2013-12-171-1/+1
| | | | | | | | | | | | | | | | | | To comply with a moving collector, we used to load invoke's receiver (for non static methods only) from the caller shadow frame after resolving the method itself (in case the garbage collector is triggered inside) but before passing invoke arguments, including loading receiver from the caller's shadow frame into the callee's shadow frame. Therefore, we used to load the receiver 3 times in the fast path but only twice in the slow path. The slow path is rarely used (only in method requiring extra runtime checks) so we now move this extra reload to the slow path. Therefore an invoke using the fast path loads the receiver twice while the slow path loads it 3 times. I don't expect much improvement here. The main reason is to keep extra code in the slow path. Change-Id: I10e96b10de4b8c2992e276bd564bc3e2f191779c
* Compacting collector.Mathieu Chartier2013-11-111-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add missing references.Sebastien Hertz2013-10-091-1/+1
| | | | | | This mainly avoids implicit copies when extracting an object from a container. Change-Id: If4d0e6153e8c2b48345fde5bb546b4c65649fcf3
* Cleanup invoke in interpreter.Sebastien Hertz2013-09-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | Some cleanup in invocation stuff: - Get the number of invoke arguments from instruction (vA) rather than get it from its code item. This benefits to native invoke since we no longer need to parse the method's shorty. Also pass the low 16 bits of instructions to avoid fetching it twice when reading vA. - Remove "is_static" tests by taking advantage of invoke type template argument rather than testing method's access flags. - Ensure Instruction::GetArgs is inlined. - Check exception when initializing method's class when transitioning from interpreter to compiled code (artInterpreterToCompiledCodeBridge). - Move UnstartedRuntimeInvoke function to interpreter_common.cc and make it static as it's only used by DoInvoke and DoInvokeVirtualQuick functions. - Avoid duplicating code in ShadowFrame::Create. Performance remains the same according to benchmarks. Hopefully, this should be addressed in next CLs, especially by improving new shadow frame initialization. Bug: 10668955 Change-Id: I514b8f098d0ef3e35921ceb770383aac1a9c7902