summaryrefslogtreecommitdiff
path: root/runtime/stack.cc
AgeCommit message (Collapse)Author
2017-03-16Add method info to oat files Mathieu Chartier
The method info data is stored separately from the code info to reduce oat size by improving deduplication of stack maps. To reduce code size, this moves the invoke info and inline info method indices to this table. Oat size for a large app (arm64): 77746816 -> 74023552 (-4.8%) Average oat size reduction for golem (arm64): 2% Repurposed unused SrcMapElem deduping to be for MethodInfo. TODO: Delete SrcMapElem in a follow up CL. Bug: 36124906 Test: clean-oat-host && test-art-host-run-test Change-Id: I2241362e728389030b959f42161ce817cf6e2009
2017-02-14Revert^6 "Make class redefinition work with native methods on stack." Alex Light
We were incorrectly trying to obtain the profiling information of a native method. This reverts commit 02b2349b1cd2a78e86b1a7542f8330e6c3aaeb35. Reason for revert: Fixed test failure with jit configurations Test: ART_TEST_JIT=true mma -j40 test-art-host Change-Id: Ic7112104aec64e597d2df80db5dc2a505d2cc2dd
2017-02-14Revert "Revert^4 "Make class redefinition work with native methods on stack."" Roland Levillain
ART run-test 945-obsolete-native is failing in automated testing. This reverts commit 724f77e2fed038d57a3d08fdcf656d703e3473ea. Change-Id: I4eceb45765826ca442ee8f4800b2bed51f98e662
2017-02-13Revert^4 "Make class redefinition work with native methods on stack." Alex Light
We had a problem where there was a brief period of time where the dex file for an obsolete method could not be obtained. This meant that not all functions of ArtMethod could safely be called, causing some problems. This reverts commit 38c20d4a694eea44a1bd3af32a6a99512c139358. Reason for revert: Fixed issues with interp-ac and relocate-npatchoat Test: ART_TEST_RUN_TEST_RELOCATE_NO_PATCHOAT=true \ ART_TEST_INTERPRETER_ACCESS_CHECKS=true \ mma -j40 test-art-host Change-Id: I04991f3e76813831b6446f97636b6fa404397f36
2017-02-11Revert "Revert "Revert "Make class redefinition work with native methods on ↵ Alex Light
stack.""" This reverts commit 4493f92dfc70e01d95ad57bc4c0c38f59a616f70. Reason for revert: Fails interpreter-ac and relocate-npatchoat Change-Id: I15eb4964c9101fa04e34b52acf9ffe25e6d4e60d Test: revert
2017-02-10Revert "Revert "Make class redefinition work with native methods on stack."" Alex Light
When we were scanning the stack for tracing we were getting the wrong stack-frame size for obsolete native methods. This fixes it by creating real obsolete native methods so we can recognize them and then doing the (rather long) calculation to find their real stack-frame size. This reverts commit 7558d27ccd0837fef7c4bfbff7fc82f07a787316. Reason for revert: Fixed tracing failures. Test: mma -j40 test-art-host Test: ART_TEST_TRACE=true ART_TEST_INTERPRETER=true mma -j40 test-art-host Change-Id: Ic65da1b51a43733ff60131832753afa0c4ce66b1
2017-02-08Clean up code info table layout Mathieu Chartier
Previously: Table layout was computed multiple places like stack_map_stream, and getters. This made it difficult to add new stack map tables and made the code hard to understand. This change makes the table layout specified all inside of the code info. Updating the layout only requires changing ComputeTableOffsets. Changed the stack map inline info offset to be an index, so that it is not require the inline infos are directly after the dex register table. Oat file size for a large app: 94459576 -> 93882040 (-0.61%) Updated oatdump and fixed a bug that was incorrectly computing the register mask bytes. Bug: 34621054 Test: test-art-host Change-Id: I3a7f141e09d5a18bce2bc6c9439835244a22016e
2017-02-06Force stack dump to diagnose empty checkpoint timeout (2). Hiroshi Yamauchi
Bug: 33006388 Bug: 12687968 Test: test-art-host Test: Thread dumping in a simulated empty checkpoint timeout. Change-Id: I06641396b8f3d7a1a98366a01807aab2e6f31bd5
2017-02-03ART: Refactor verify_object.h Andreas Gampe
Move the actual VerifyObject check into a new cc file, as we commonly don't enable the check at all. This allows to cut the -inl include from almost all current users. This also exposes missing -inl includes. Also fix up some of our old mess where .h defined functions require -inl.h defined functions. Test: m Change-Id: I3dd821bbe2015564a29bf1ed9be00f7a7276ad61
2017-02-01Fix creating self-recursive obsolete methods. Alex Light
We were using recursive loading of the current art method which was making us miss obsolete methods in some cases. We could also end up checking the wrong method when walking the stack. We also add tests for recursive obsolete methods in general. Bug: 34815470 Test: mma -j40 test-art-host Test: ART_TEST_JIT=true mma -j40 test-art-host Change-Id: I522fd4cac4e3f9d35d03b128bad6d6971cfe6c4a
2016-12-21Revert "Revert "Revert "Revert "Basic obsolete methods support"""" Alex Light
A GetDeclaringClass()->GetDexCache() got inserted during the merge/review process meaning that we would try to access incorrect dex-cache in obsolete methods in some situations. Also when using tracing we would loop forever (or at least until an OOM error) in test 916 due to tracing forcing InterpretOnly mode meaning methods would never be jitted. Bug: 32369913 Bug: 33630159 Test: ART_TEST_TRACE=true \ ART_TEST_JIT=true \ ART_TEST_INTERPRETER=true mma -j40 test-art-host This reverts commit f6abcda293b115a9d7d8a26376ea2dcf2d1dc510. Change-Id: I0773bfcba52e3cd51a83be815c6a50c189558f48
2016-12-21Revert "Revert "Revert "Basic obsolete methods support""" Nicolas Geoffray
Fails in tracing mode Bug: 32369913 Bug: 33630159 This reverts commit ce77fc0e7f60a15354bb20c356537cbf8b53b722. Change-Id: I1bdcf6ad467f2e31f9c5d0c3c987b90a4f5efc69
2016-12-19Revert "Revert "Basic obsolete methods support"" Alex Light
This reverts commit b81a9840b44480bfeacd74b8d9f51e06f295411d. There were 2 issues with the original CL's test 916-obsolete-jit that caused it to sporadically fail. First, when checking if we had jitted the function under test in 916-obsolete-jit we failed to check to see if the function 'doCall', which is used to work-around bugs in our deoptimization & compilation systems, had also been jitted. In the case where the 'sayHi' function had been jitted but the 'doCall' function had not we would (correctly) fail to redefine the 'Transform' class since we would not be able to deoptimize the 'sayHi' function since it is under a quick_to_interpreter_bridge (runtime) frame. Secondly, the function Main.isInterpretedFunction was incorrect and would always return false, regardless of the actual state of the function. This would cause the test to fail as the quick_to_interpreter_bridge frame prevented deoptimization of the obsoleted function. Usually the warm-up period was enough to make sure the methods were jitted anyway but this was not guaranteed. Both of these problems become more likely to occur on systems with more cpu contention such as the buildbots. Test: stress --cpu 60 &; while ./test/run-test --host --jit 916; do ; done Reason for revert: Fixed bug in test that was causing failures. Original Tests: Test: ./test/run-test --host 914 Test: ./test/run-test --host 915 Test: ./test/run-test --host 916 Test: mma -j40 test-art-host Test: ART_TEST_JIT=true \ ART_TEST_INTERPRETER=true mma -j40 test-art-host Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64 Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64 --no-jit Bug: 32369913 Bug: 33630159 Change-Id: If1a92e47b90965a7dc21c5826185debe62bd1554
2016-12-15ART: Move to libbase StringPrintf Andreas Gampe
Remove ART's StringPrintf implementation. Fix up clients. Add missing includes where necessary. Test: m test-art-host Change-Id: I564038d5868595ac3bb88d641af1000cea940e5a
2016-12-15Revert "Basic obsolete methods support" Alex Light
This reverts commit d8936da27b792d1ca02e59c92456a1a53c7b9905. Reason for revert: Some sort of race in JIT Change-Id: Ibb4e520bb0721d6d7aa2c841a52eb5baff07740e
2016-12-14Basic obsolete methods support Alex Light
Add support for executing obsolete methods following redefinitions. This support includes methods that have been jitted. This does not add any additional validity checks to our redefinition functions. Note using work-arounds to ensure 916 works pending some fixes to the compiler, deoptimizer, or both. Test: ./test/run-test --host 914 Test: ./test/run-test --host 915 Test: ./test/run-test --host 916 Test: mma -j40 test-art-host Test: ART_TEST_JIT=true \ ART_TEST_INTERPRETER=true mma -j40 test-art-host Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64 Test: ./art/tools/run-jdwp-tests.sh --mode=host --variant=X64 --no-jit Bug: 32369913 Bug: 33630159 Change-Id: I78ef95f484146f1fb93c37fc50f56575bdab2432
2016-12-12ART: Add precise root visiting Andreas Gampe
Add VisitRootFlags::kVisitRootFlagPrecise to signal a request for precise RootInfo objects. Move VisitRootFlags to gc_root.h. Refactor VisitRoot functions to pass flags. Add code in Thread visiting to decode vregs in compiled code. Bug: 31385354 Test: m test-art-host Change-Id: I8e7280f0ab682871f729f2a1c6b18670cf2dbf82
2016-12-01Class Hierarchy Analysis (CHA) Mingyao Yang
The class linker now tracks whether a method has a single implementation and if so, the JIT compiler will try to devirtualize a virtual call for the method into a direct call. If the single-implementation assumption is violated due to additional class linking, compiled code that makes the assumption is invalidated. Deoptimization is triggered for compiled code live on stack. Instead of patching return pc's on stack, a CHA guard is added which checks a hidden should_deoptimize flag for deoptimization. This approach limits the number of deoptimization points. This CL does not devirtualize abstract/interface method invocation. Slides on CHA: https://docs.google.com/a/google.com/presentation/d/1Ax6cabP1vM44aLOaJU3B26n5fTE9w5YU-1CRevIDsBc/edit?usp=sharing Change-Id: I18bf716a601b6413b46312e925a6ad9e4008efa4 Test: ART_TEST_JIT=true m test-art-host/target-run-test test-art-host-gtest
2016-10-18Remove mirror:: and ArtMethod deps in utils.{h,cc} David Sehr
The latest chapter in the ongoing saga of attempting to dump a DEX file without having to start a whole runtime instance. This episode finds us removing references to ArtMethod/ArtField/mirror. One aspect of this change that I would like to call out specfically is that the utils versions of the "Pretty*" functions all were written to accept nullptr as an argument. I have split these functions up as follows: 1) an instance method, such as PrettyClass that obviously requires this != nullptr. 2) a static method, that behaves the same way as the util method, but calls the instance method if p != nullptr. This requires using a full class qualifier for the static methods, which isn't exactly beautiful. I have tried to remove as many cases as possible where it was clear p != nullptr. Bug: 22322814 Test: test-art-host Change-Id: I21adee3614aa697aa580cd1b86b72d9206e1cb24
2016-09-09MIPS32: Properly handle doubles in GetRegisterIfAccessible Goran Jakovljevic
There was a problem with floating point registers and exception handler. In optimizing compiler fpu registers are treated as 64-bit. This is problematic since logic in GetRegisterIfAccessible doesn't support 64-bit floating point registers. This fixes tests: 510-checker-try-catch 534-checker-bce-deoptimization Test: mma test-art-target on CI20 (mips32r2) and emulator (mips32r6) Change-Id: I0f49c1c30f97077b82ad08fcc3cdb86a4877af23
2016-09-06Change deoptimize entrypoint to save everything. Vladimir Marko
And implement FPU register retrieval from stack on x86. On Nexus 9, AOSP ToT, the boot.oat size reduction is prebuilt multi-part boot image: - 32-bit boot.oat: -20KiB (-0.03%) - 64-bit boot.oat: -45KiB (-0.06%) on-device built single boot image: - 32-bit boot.oat: -24KiB (-0.04%) - 64-bit boot.oat: -36KiB (-0.05%) Test: Run ART test suite on host and Nexus 9. Bug: 30212852 Change-Id: I5d98e2a24363136d73dfec6100ab02f8eb101911
2016-08-30ART: SHARED_REQUIRES to REQUIRES_SHARED Andreas Gampe
This coincides with the actual attribute name and upstream usage. Preparation for deferring to libbase. Test: m Test: m test-art-host Change-Id: Ia8986b5dfd926ba772bf00b0a35eaf83596d8518
2016-08-10Rename callee save enumerators. Vladimir Marko
And related image method enumerators, macros, etc. Clean up some entrypoint assembly comments. This is a follow-up to https://android-review.googlesource.com/252348 Test: Run ART test suite on host and Nexus 9. Bug: 30212852 Change-Id: I2707342d4255c88c547655be83ed97a67e12ae9e
2016-08-01ART: Convert pointer size to enum Andreas Gampe
Move away from size_t to dedicated enum (class). Bug: 30373134 Bug: 30419309 Test: m test-art-host Change-Id: Id453c330f1065012e7d4f9fc24ac477cc9bb9269
2016-07-04Never go to resolution while inspecting inlined frames. Nicolas Geoffray
Instead, do a manual inspection and decoding of the invoke with the dex cache. Also update oatdump to dump types in the dex cache. bug:27858645 Change-Id: I7c0b612ee96e6865fa438c3a1d253686231337bd test:run-test
2016-04-29ART: Disambiguate access-checks mode from lock-counting Andreas Gampe
Lock-counting (when structural locking verification failed) is a special sub-mode of access-checks and must be disambiguated, because we currently use access-checks mode class-wide when at least one method soft-fails, but do not stop the compiler/JIT to compile the "working" methods. So we may end up in the access-checks interpreter for a working method through deopt without knowing which locks are already held. Bug: 28351535 (cherry picked from commit f517e283d477dd2ae229ee3f054120c6953895db) Change-Id: I083032f064d88df8f8f0611ad8b57d1b39cd09fb
2016-04-28Split profile recording from jit compilation Calin Juravle
We still use ProfileInfo objects to record profile information. That gives us the flexibility to add the inline caches in the future and the convenience of the already implemented GC. If UseJIT is false and SaveProfilingInfo true, we will only record the ProfileInfo and never launch compilation tasks. Bug: 27916886 (cherry picked from commit e5de54cfab5f14ba0b8ff25d8d60901c7021943f) Change-Id: I68afc181d71447895fb12346c1806e99bcab1de2
2016-04-27Write conflict tables in image Mathieu Chartier
Add image sections for runtime methods and conflict tables. This makes it that we do not need to fake up a length prefixed array for runtime methods. Reduces .art private dirty and PSS. System wide .art PSS goes from 32.5MB to 30.5MB after system boot. Business card .art private dirty goes from 588K to 504K. Increases image size by ~100K. Bug: 27906566 (cherry picked from commit cda9386add68d94697449c6cb08b356747e55c21) Change-Id: I38cbe3150c3eeb385b8cad7cf93614e3980f4162
2016-04-04Clean up OatQuickMethodHeader after Quick removal. Vladimir Marko
This reduces the size of the pre-header by 8 bytes, reducing oat file size and mmapped .text section size. The memory needed to store a CompiledMethod by dex2oat is also reduced, for 32-bit dex2oat by 8B and for 64-bit dex2oat by 16B. The aosp_flounder-userdebug 32-bit and 64-bit boot.oat are each about 1.1MiB smaller. Disable the broken StubTest.IMT, b/27991555 . Change-Id: I05fe45c28c8ffb7a0fa8b1117b969786748b1039
2016-04-01Use bit-level packing for InlineInfo in stackmaps as well. David Srbecky
Use the same approach as we do for stackmaps to reduce the size. It saves 4.0 MB from non-debuggable boot.oat (AOSP). It does not affect debuggable boot.oat. It saves 3.6 MB (of 96.6 MB) from /system/framework/arm/ (GOOG). It saves 0.6 MB (of 26.7 MB) from /system/framework/oat/arm/ (GOOG). Field loads from inline-info get around 5% slower. (based on the time it takes to load all inline-infos from boot.oat) Change-Id: I67b0fa5eef74c1fdb013680d0231fd44ea696176
2016-04-01Merge "Pack stack map entries on bit level to save space." Calin Juravle
2016-03-31Add way to disable resolving for stack walk Mathieu Chartier
Only occurs for walking the inlined frames case. Bug: 27857910 (cherry picked from commit be2892bf771435eb451c74297b553f7dc9fea4ca) Change-Id: Ied92be96f2f74ba02c02168f704443b95e7a4b04
2016-03-31Pack stack map entries on bit level to save space. David Srbecky
Use only the minimum number of bits required to store stack map data. For example, if native_pc needs 5 bits and dex_pc needs 3 bits, they will share the first byte of the stack map entry. The header is changed to store bit offsets of the fields rather than byte sizes. Offsets also make it easier to access later fields without calculating sum of all previous sizes. All of the header fields are byte sized or encoded as ULEB128 instead of the previous fixed size encoding. This shrinks it by about half. It saves 3.6 MB from non-debuggable boot.oat (AOSP). It saves 3.1 MB from debuggable boot.oat (AOSP). It saves 2.8 MB (of 99.4 MB) from /system/framework/arm/ (GOOG). It saves 1.0 MB (of 27.8 MB) from /system/framework/oat/arm/ (GOOG). Field loads from stackmaps seem to get around 10% faster. (based on the time it takes to load all stackmap entries from boot.oat) Bug: 27640410 Change-Id: I8bf0996b4eb24300c1b0dfc6e9d99fe85d04a1b7
2016-03-02Fix potential linear alloc memory leak Mathieu Chartier
Previously, if we created a linear alloc for a class loader but never created the class table, the linear alloc would never get freed since it would have no corresponding ClassLoaderData. Fixes valgrind-test-art-host-gtest-oat_test Bug: 27384882 Change-Id: Ic8f35b58c3117127a39521b6b9d25ef12c72040c
2016-02-25Implement << operator for DexRegisterLocation::Kind. David Srbecky
This makes it comparable in DCHECK_EQ and similar methods. Change-Id: I6b5b237be89325850ae6860d011fd6741189ab01
2016-02-05Disable kDebugStackWalk Mathieu Chartier
Someone left it enabled. Bug: 27039049 Change-Id: I2bec610a3f20e1214dc34b4e06227609da2a2ab8
2016-02-05Revert "Revert "Implement on-stack replacement for arm/arm64/x86/x86_64."" Nicolas Geoffray
This reverts commit bd89a5c556324062b7d841843b039392e84cfaf4. Change-Id: I08d190431520baa7fcec8fbdb444519f25ac8d44
2016-01-08Don't encode a DexRegisterMap if there is no live register. Nicolas Geoffray
Change-Id: I76a291e6a0ac37f0590d16c7f5b866115588bc55
2015-11-24Revert "lambda: Add support for invoke-interface for boxed innate lambdas" Nicolas Geoffray
955-lambda is flaky Bug: 24618608 Bug: 25107649 This reverts commit 457e874459ae638145cab6d572e34d48480e39d2. Change-Id: I24884344d21d7a4262e53e3f5dba57032687ddb7
2015-11-20lambda: Add support for invoke-interface for boxed innate lambdas Igor Murashkin
Lambda closures created with the 'create-lambda' instruction (termed "innate lambdas") can be turned into an object with 'box-lambda'. This CL enables support for those kinds of lambdas to work with 'invoke-interface' by generating a proxy class for the lambda. Note: MIPS32/64 support not included. Bug: 24618608 Bug: 25107649 Change-Id: Ic8f1bb66ebeaed4097e758a50becf1cff6ccaefb
2015-11-18Merge "Support deoptimization only to set vreg" Sebastien Hertz
2015-11-18Merge "Fix StackVisitor::GetVReg for reference in shadow frame" Sebastien Hertz
2015-11-17Support deoptimization only to set vreg Mingyao Yang
This CL removes the old API that was used to update vreg. We now rely exclusively on deoptimization to change the value of a vreg (mainly from the debugger). This allows to have only one mechanism working with both Quick and Optimizing compilers. It also remove run-test 455-set-vreg which was the only user of the old API. This CL also renames StackVisitor::SetVReg[Pair]FromDebugger to StackVisitor::SetVReg[Pair] to reflect that change. Bug: 25428216 Change-Id: Ib09510185280dbd0f6d02c52549ae9671c187e32
2015-11-17Fix StackVisitor::GetVReg for reference in shadow frame Sebastien Hertz
Also fixes 457-regs run-test that used to pass an incorrect vreg kind. Bug: 25428216 Change-Id: Ic31b51ca0f72350db6325f23087b06e93055d750
2015-11-15x86/x86-64 read barrier support for concurrent GC in Optimizing. Roland Levillain
This first implementation uses slow paths to instrument heap reference loads and GC root loads for the concurrent copying collector, respectively calling the artReadBarrierSlow and artReadBarrierForRootSlow (new) runtime entry points. Notes: - This implementation does not instrument HInvokeVirtual nor HInvokeInterface instructions (for class reference loads), as the corresponding read barriers are not stricly required with the current concurrent copying collector. - Intrinsics which may eventually call (on slow path) are disabled when read barriers are enabled, as the current slow path infrastructure does not support this case. - When read barriers are enabled, the code generated for a HArraySet instruction always go into the array set slow path for object arrays (delegating the operation to the runtime), as we are lacking a mechanism to keep a temporary register live accross a runtime call (needed for the instrumentation of type checking code, which requires two successive read barriers). Bug: 12687968 Change-Id: I14cd6107233c326389120336f93955b28ffbb329
2015-11-02Fix tests flakiness with jit when using Proxy classes. Nicolas Geoffray
We cannot copy the entry point between ArtMethod when the entry point has been JITted. We put the interpreter bridge instead. bug:25334878 Change-Id: I65a50cc1f10a5a152733807f8c85fb3ed81c5829
2015-10-26Support garbage collection of JITted code. Nicolas Geoffray
Change-Id: I9afc544460ae4fb31149644b6196ac7f5182c784
2015-10-20Remove ArtCode. Nicolas Geoffray
- Instead use OatQuickMethodHeader. - Various cleanups now that we don't have all those ArtMethod -> ArtCode -> OatQuickMethodHeader indirections. As a consequence of this cleanup, exception handling got a bit faster. ParserCombinators benchmark (exception intensive) on x64: (lower is better) Before: ParserCombinators(RunTime): 1062500.0 us. After: ParserCombinators(RunTime): 833000.0 us. Change-Id: Idac917b6f1b0dc254ad68fb3781cd61bccadb0f3
2015-10-13Merge "Add an abstraction over a compiled code." Nicolas Geoffray
2015-10-13Add an abstraction over a compiled code. Nicolas Geoffray
That's just step 1, moving code-related functions of ArtMethod to another class. That class is only a wrapper on an ArtMethod, but will be changed to be a wrapper around compiled code. Change-Id: I6f35fc06d37220558dff61691e51ae20066b0dd6