summaryrefslogtreecommitdiff
path: root/runtime/stack.cc
AgeCommit message (Collapse)Author
2015-10-13Merge "Revert "Revert "Fix instrumentation frame check with inlining""" Sebastien Hertz
2015-10-12Revert "Revert "Fix instrumentation frame check with inlining"" Sebastien Hertz
This reverts commit e3e2fe5ecc16184ba91018adb3bfbec1c5880c29. Fixes an incorrect CHECK_GT into CHECK_GE in method Instrumentation::ComputeFrameId. Bug: 22519499 Change-Id: I0a11d378f3baa728b9176ff086fe4b835b30bb46
2015-10-12Revert "Fix instrumentation frame check with inlining" Nicolas Geoffray
Times out on some run-tests. Bug: 22519499 This reverts commit 3079e28b00accd19aa1153929fb00497d00956d9. Change-Id: I4c612a5af20e4481eb9865f90abd429f4a40ce57
2015-10-09ART: Lock counting in the interpreter Andreas Gampe
To support structured locking when balanced-locking verification failed, count lock and unlock operations in the verifier. Bug: 23502994 Change-Id: I2bb915da6e3d43c49723a943b42d4d5a7c939aa1
2015-10-08Fix instrumentation frame check with inlining Sebastien Hertz
When instrumenting code compiled with inlining, we must compute frame IDs like instrumentation did for pushing instrumentation stack frames. Bug: 22519499 Change-Id: I4a72dbe9e4d2fd4985e49f8261b54c96df7c4a81
2015-10-02Do more inlining when JITting. Nicolas Geoffray
We now check the verification status of the class. This triggered a bug when an inlined method was not compiled (typically in a JIT configuration), and the path for deopting in StackVisitor was using the wrong ArtMethod in order to know the compiler that compiled the current frame. Change-Id: I81d3ca0cf5cd3864b83b63dd954c58e1f2adaad4
2015-09-22Revert "Revert "Add one LinearAlloc per ClassLoader"" Mathieu Chartier
Issue was fixed by: https://android-review.googlesource.com/#/c/171945/ Bug: 22720414 This reverts commit 7de5dfe37f3cf24e1166412b589f6f67dcd1f1c0.
2015-09-22Revert "Add one LinearAlloc per ClassLoader" Nicolas Geoffray
Times out on 32bit target/host for 132-daemon-locks-shutdown test. Bug: 22720414 This reverts commit 356412e2b7ba3fde164bc08a44fee0ddc19c54e1. Change-Id: I5ab3a09e88a5ad8c306a27d2606ecbecc80b9326
2015-09-21Add one LinearAlloc per ClassLoader Mathieu Chartier
Also added freeing linear alloc and class table when the corresponding class loader is no longer reachable. Bug: 22720414 Change-Id: Icb32c3a4c865f240e147bc87ed080a6b1d8a5795
2015-09-17Deoptimization support in optimizing compiler for setting local values Mingyao Yang
Due to compiler optimizations, we may not always be able to update the value of a local variable in a compiled frame (like a variable seen as constant by the compiler). To avoid that situation, we simply deoptimize compiled frames updated by the debugger so they are executed by the interpreter with the updated value. When the debugger attempts to set a local variable (actually a DEX register or a pair of registers) in a compiled frame, we allocate a ShadowFrame associated to that frame (using its frame id) and set the new value in that ShadowFrame. When we know we are about to continue the execution of the compiled frame, we deoptimize the stack using the preallocated ShadowFrame (instead of creating a new one). We initialize it with the current value of all DEX registers except the ones that have been set by the debugger. Therefore, the ShadowFrame represent the runtime context modified by the debugger. Bumps oat version to force recompilation. Bug: 19944235 Change-Id: I0ebe6241264f7a3be0f14ee4516c1f7436e04da6
2015-09-15Revert "Revert "ART: Register allocation and runtime support for try/catch"" David Brazdil
The original CL triggered b/24084144 which has been fixed by Ib72e12a018437c404e82f7ad414554c66a4c6f8c. This reverts commit 659562aaf133c41b8d90ec9216c07646f0f14362. Change-Id: Id8980436172457d0fcb276349c4405f7c4110a55
2015-09-14Revert "ART: Register allocation and runtime support for try/catch" David Brazdil
Breaks libcore test org.apache.harmony.security.tests.java.security.KeyStorePrivateKeyEntryTest#testGetCertificateChain. Need to investigate. This reverts commit b022fa1300e6d78639b3b910af0cf85c43df44bb. Change-Id: Ib24d3a80064d963d273e557a93469c95f37b1f6f
2015-09-14ART: Register allocation and runtime support for try/catch David Brazdil
This patch completes a series of CLs that add support for try/catch in the Optimizing compiler. With it, Optimizing can compile all methods containing try/catch, provided they don't contain catch loops. Future work will focus on improving performance of the generated code. SsaLivenessAnalysis was updated to propagate liveness information of instructions live at catch blocks, and to keep location information on instructions which may be caught by catch phis. RegisterAllocator was extended to spill values used after catch, and to allocate spill slots for catch phis. Catch phis generated for the same vreg share a spill slot as the raw value must be the same. Location builders and slow paths were updated to reflect the fact that throwing an exception may not lead to escaping the method. Instruction code generators are forbidden from using of implicit null checks in try blocks as live registers need to be saved before handing over to the runtime. CodeGenerator emits a stack map for each catch block, storing locations of catch phis. CodeInfo and StackMapStream recognize this new type of stack map and store them separate from other stack maps to avoid dex_pc conflicts. After having found the target catch block to deliver an exception to, QuickExceptionHandler looks up the dex register maps at the throwing instruction and the catch block and copies the values over to their respective locations. The runtime-support approach was selected because it allows for the best performance in the normal control-flow path, since no propagation of catch phi values is necessary until the exception is thrown. In addition, it also greatly simplifies the register allocation phase. ConstantHoisting was removed from LICMTest because it instantiated (now abstract) HConstant and was bogus anyway (constants are always in the entry block). Change-Id: Ie31038ad8e3ee0c13a5bbbbaf5f0b3e532310e4e
2015-08-25ART: Add (Fpu)RegHigh stack map location kinds David Brazdil
When running Optimized code on 64-bit, high value of vreg pair may be stored in the high 32 bits of a CPU register. This is not reflected in stack maps which would encode both the low and high vreg as kInRegister with the same register number, making it indistinguishable from two non-wide vregs with the same value in the lower 32 bits. Deoptimization deals with this by running the verifier and thus obtaining vreg pair information, but this would be too slow for try/ catch. This patch therefore adds two new stack map location kinds: kInRegisterHigh and kInFpuRegisterHigh to differentiate between the two cases. Note that this also applies to floating-point registers on x86. Change-Id: I15092323e56a661673e77bee1f0fca4261374732
2015-08-04Revert "cleanup: Replace pointers with out-parameters and fix-up formatting" Igor Murashkin
This reverts commit a315f5c546b796f55f4872bb6efc15eb858d9639. -- Revert "runtime: cleanup class_linker out-parameters and formatting" This reverts commit bc1d78daa463572c5a770cdca858a3b51d8e1b7b. -- Revert "base: replace raw pointers for out-parameters with safer out<T>" This reverts commit fb326cffc679cab8eb873b9e44795706f023cb3c.
2015-07-30base: replace raw pointers for out-parameters with safer out<T> Igor Murashkin
Add a zero-cost type-safe abstraction for representing "out" parameters (i.e. when the calling function has to return multiple results out by-reference into the argument slots instead of using the return slot). Change-Id: I33a941e4863b6bed71d2bfa43d7f48e9b111f83f
2015-07-22Move to newer clang annotations Mathieu Chartier
Also enable -Wthread-safety-negative. Changes: Switch to capabilities and negative capabilities. Future work: Use capabilities to implement uninterruptible annotations to work with AssertNoThreadSuspension. Bug: 20072211 Change-Id: I42fcbe0300d98a831c89d1eff3ecd5a7e99ebf33
2015-07-16Use (D)CHECK_ALIGNED more. Roland Levillain
Change-Id: I9d740f6a88d01e028d4ddc3e4e62b0a73ea050af
2015-07-08Revert "Revert "Remove interpreter entrypoint in ArtMethod."" Nicolas Geoffray
The start of the interned strings in the image was not aligned properly, now that ArtMethods just need to be word aligned. This reverts commit 7070ccd8b6439477eafeea7ed3736645d78e003f. bug:22242193 Change-Id: I580c23310c33c239fe0e5d15c72f23a936f58ed1
2015-07-08Revert "Remove interpreter entrypoint in ArtMethod." Nicolas Geoffray
Build failures on bots. Investigating. This reverts commit fa2c054b28d4b540c1b3651401a7a091282a015f. Change-Id: Id65b2009aa66cb291fb8c39758a58e0b0d22616c
2015-07-08Remove interpreter entrypoint in ArtMethod. Nicolas Geoffray
Saves 4/8 bytes for each ArtMethod. Change-Id: I110ecdddf8516b0759a31fa157609643e6d60b15
2015-06-12Use the caller's class loader when walking inlined frames. Nicolas Geoffray
We should not use the outer most class loader. JLS specification is to use the caller's class loader. Change-Id: I736f36c9b6a44fab213ad0c01cf1efc975b9b3a6
2015-06-04Cache stack map encoding David Brazdil
Operations on CodeInfo and StackMap objects repeatedly read encoding information from the MemoryRegion. Since these are 3-bit-loads of values that never change, caching them can measurably reduce compile times. According to benchmarks, this patch saves 1-3% on armv7, 2-4% on x86, and 0-1% on x64. Change-Id: I46b197513601325d8bab562cc80100c00ec28a3b
2015-05-29Move mirror::ArtMethod to native Mathieu Chartier
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 Change-Id: I622469a0cfa0e7082a2119f3d6a9491eb61e3f3d
2015-05-29Support for inlining methods that call/throw. Nicolas Geoffray
Mostly fixes here and there to make it working. Change-Id: I1b535e895105d78b65634636d675b818551f783e
2015-05-22Return an invalid StackMap when one cannot be found. Nicolas Geoffray
This avoids aborting when handling a crash. Change-Id: Ie5b5d48061fa9258b349b0284f7b00c5855d9fbd
2015-05-18Stack walking of inlined frames. Nicolas Geoffray
Be "true" to the stack visitor design, which seems to be: 1) Carry minimal state, so this CL just adds an inlining depth to it. 2) Compute needed information for each method, which is what GetDexPc, GetMethod, and GetVRegFromOptimized code do. Change-Id: I3d14126766f12216a7b448ce856259f1e7f37395
2015-05-11Add a flag to StackVisitor for inlining. Nicolas Geoffray
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
2015-05-08Check IsReferenceVReg during deopt Mathieu Chartier
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
2015-04-24Debugger: Remove support for setting values in optimizing. Nicolas Geoffray
bug:19944235 Change-Id: I3bcd56c7844847a7f0367f8ce6a72bddcd09d441
2015-04-22Replace NULL with nullptr Mathieu Chartier
Also fixed some lines that were too long, and a few other minor details. Change-Id: I6efba5fb6e03eb5d0a300fddb2a75bf8e2f175cb
2015-03-31Use unique location catalogs to encode Dex register maps. Roland Levillain
- For each CodeInfo object (i.e. for each method), compute a variable index size location catalog of unique Dex register locations. In Dex register maps, instead of storing the actual location of a (live) Dex register, store the index of the location catalog entry containing that Dex register location. - Adjust art::StackMapStream, art::CheckReferenceMapVisitor::CheckOptimizedMethod, art::StackVisitor::GetVRegFromOptimizedCode, and art::StackVisitor::SetVRegFromOptimizedCode. - Add LoadBits and StoreBits methods to art::MemoryRegion to load and store a block of adjacent bits in a memory region. - Update compiler/optimizing/stack_map_test.cc. - Remove the default value for parameter EmptyFn of art::HashMap. This default value did not seem to make sense, as it would create an "empty function" for type Key by default, whereas art::HashMap expects an "empty function" for type std::pair<Key, Value>. Change-Id: Id9e49d7756c253ce41c36630cd832208d06c2e28
2015-03-13[optimizing] Don't record None locations in the stack maps. Nicolas Geoffray
- moved environment recording from code generator to stack map stream - added creation/loading factory methods for the DexRegisterMap (hides internal details) - added new tests Change-Id: Ic8b6d044f0d8255c6759c19a41df332ef37876fe
2015-03-13API change in StackVisitor::GetVReg*. Nicolas Geoffray
- 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
2015-03-13Merge "Tweak liveness when instructions are used in environments." Nicolas Geoffray
2015-03-12Tweak liveness when instructions are used in environments. Nicolas Geoffray
Instructions remain live when debuggable, but only instructions with object types remain live when non-debuggable. Enable StackVisitor::GetThisObject for optimizing. Change-Id: Id87b2cbf33a02450059acc9993995782e5f28987
2015-03-12Compress the Dex register maps built by the optimizing compiler. Roland Levillain
- Replace the current list-based (fixed-size) Dex register encoding in stack maps emitted by the optimizing compiler with another list-based variable-size Dex register encoding compressing short locations on 1 byte (3 bits for the location kind, 5 bits for the value); other (large) values remain encoded on 5 bytes. - In addition, use slot offsets instead of byte offsets to encode the location of Dex registers placed in stack slots at small offsets, as it enables more values to use the short (1-byte wide) encoding instead of the large (5-byte wide) one. - Rename art::DexRegisterMap::LocationKind as art::DexRegisterLocation::Kind, turn it into a strongly-typed enum based on a uint8_t, and extend it to support new kinds (kInStackLargeOffset and kConstantLargeValue). - Move art::DexRegisterEntry from compiler/optimizing/stack_map_stream.h to runtime/stack_map.h and rename it as art::DexRegisterLocation. - Adjust art::StackMapStream, art::CodeGenerator::RecordPcInfo, art::CheckReferenceMapVisitor::CheckOptimizedMethod, art::StackVisitor::GetVRegFromOptimizedCode, and art::StackVisitor::SetVRegFromOptimizedCode. - Implement unaligned memory accesses in art::MemoryRegion. - Use them to manipulate data in Dex register maps. - Adjust oatdump to support the new Dex register encoding. - Update compiler/optimizing/stack_map_test.cc. Change-Id: Icefaa2e2b36b3c80bb1b882fe7ea2f77ba85c505
2015-03-10Remove ThrowLocation. Nicolas Geoffray
Note that this is a cleanup change, and has no functionality change. The ThrowLocation had no use anymore. Change-Id: I3d2126af1dc673cec3a0453ff3d56a172663a5f6
2015-03-03Revert GetThisObject change. Nicolas Geoffray
Code was changed to use sizeof(void*) instead of the runtime instruction set pointer size, which caused host compilation crashes. Change-Id: I3e59897620d6e55b43d6d76b5a0d6d0487b8081a
2015-03-03Stack support for Optimizing compiler Sebastien Hertz
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
2015-02-05Handle variable size of methods properly between 32 and 64 bit. Jeff Hao
Bug: 19100762 Change-Id: I62358905fa882284d0201ed3c1e97e1286ccec5f
2015-01-26Refactor register access from StackVisitor Sebastien Hertz
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
2015-01-15Print more info in MarkSweep::VerifyRoot Mathieu Chartier
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
2014-12-09Support proxy method in StackVisitor::GetThisObject Sebastien Hertz
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 Change-Id: Ic6ef6c83b9a549c25f9929d5e00ffe1d3a9a36f0
2014-11-21Fix oatdump to use OatHeader pointer size Mathieu Chartier
Bug: 18473190 Change-Id: If505b4f62105899f4f1257d3bccda3e6eb0dcd7c (cherry picked from commit c934e483ceabbd589422beea1fa35f5182ecfa99)
2014-11-04ART: More warnings Andreas Gampe
Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
2014-10-24Tidy logging code not using UNIMPLEMENTED. Ian Rogers
Change-Id: I7a79c1671a6ff8b2040887133b3e0925ef9a3cfe
2014-10-20Refactor quick entrypoints Ian Rogers
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
2014-10-16Make ART compile with GCC -O0 again. Ian Rogers
Tidy up InstructionSetFeatures so that it has a type hierarchy dependent on architecture. Add to instruction_set_test to warn when InstructionSetFeatures don't agree with ones from system properties, AT_HWCAP and /proc/cpuinfo. Clean-up class linker entry point logic to not return entry points but to test whether the passed code is the particular entrypoint. This works around image trampolines that replicate entrypoints. Bug: 17993736 Change-Id: I5f4b49e88c3b02a79f9bee04f83395146ed7be23
2014-10-09stdint types all the way! Ian Rogers
Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08