summaryrefslogtreecommitdiffstats
path: root/patchoat
Commit message (Collapse)AuthorAgeFilesLines
* Move image intern table into imageMathieu Chartier2015-06-112-7/+42
| | | | | | | | | | | | | Previously we recreated this intern table during runtime startup. This added 50-100ms of boot time. Fixed bug where we didn't copy over hashcodes into the image. Deleted some stale code. Bug: 20727525 Bug: 19569780 Change-Id: I08959e9aa2a73cedb52f393033e2ffea3a26e76b
* Move mirror::ArtMethod to nativeMathieu Chartier2015-06-022-64/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/+0
| | | | | | | | | | | | | | | | | | | | | 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
* ART: Do not relocate app program headers in patchoat.Vladimir Marko2015-05-141-7/+12
| | | | | | | | | | | | | | | | Change the check whether to relocate program headers in patchoat to simply look whether there is a PT_LOAD section with p_vaddr == 0. If there is, don't relocate the headers, it should be an app. Otherwise, it's a boot image and needs to be relocated. Add overflow checking to ElfFileImpl<>::GetLoadedSize(). Bug: 21047854 (cherry picked from commit 3fc9903407c6e89ffbbc92ded9e272d9de58e9b6) Change-Id: Ib3e1295fc06993bcfbaadd8f253ee4f5498f52e9
* Relocate DWARF using .oat_patches.David Srbecky2015-04-112-80/+1
| | | | | | | | | | | | | | | | | | | | | | The current solution is to hard-code knowledge of DWARF in the linker. This works for simple use of DWARF, but breaks as soon as I try to do anything more complex. Making the linker fully support DWARF would be non-trivial task and would be essentially rewrite. Using .oat_patches is much easier solution. Relocating .debug_* sections required extending .oat_patches to support more sections than just .text. I have encoded each section as null-terminated section name followed by ULEB128 deltas. The ULEB128 encoding shrinks .oat_patches for .text by factor of about 6 with 64-bit compiler, and factor of 3 with 32-bit compiler. On the other hand, it grows by the extra .oat_patches for DWARF which were not present before (if debug symbols are included). Overall, it is still a clear improvement even with the DWARF patches. Change-Id: I78ffeda0f8a3da03341995a3b5ef15c954e16e9f
* Move ArtField to nativeMathieu Chartier2015-04-102-27/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add linear alloc. Moved ArtField to be native object. Changed image writer to put ArtFields after the mirror section. Savings: 2MB on low ram devices 4MB on normal devices Total PSS measurements before (normal N5, 95s after shell start): Image size: 7729152 bytes 23112 kB: .NonMoving 23212 kB: .NonMoving 22868 kB: .NonMoving 23072 kB: .NonMoving 22836 kB: .NonMoving 19618 kB: .Zygote 19850 kB: .Zygote 19623 kB: .Zygote 19924 kB: .Zygote 19612 kB: .Zygote Avg: 42745.4 kB After: Image size: 7462912 bytes 17440 kB: .NonMoving 16776 kB: .NonMoving 16804 kB: .NonMoving 17812 kB: .NonMoving 16820 kB: .NonMoving 18788 kB: .Zygote 18856 kB: .Zygote 19064 kB: .Zygote 18841 kB: .Zygote 18629 kB: .Zygote 3499 kB: .LinearAlloc 3408 kB: .LinearAlloc 3424 kB: .LinearAlloc 3600 kB: .LinearAlloc 3436 kB: .LinearAlloc Avg: 39439.4 kB No reflection performance changes. Bug: 19264997 Bug: 17643507 Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
* Host dex2oat and patchoat require libcutils.Richard Uhler2015-03-231-2/+2
| | | | | | | When atrace_* functions are defined for both target and host, host dex2oat and patchoat require libcutils. Change-Id: I89397e83986686a2b6a6f245c25017eb379081b1
* patchoat: DisableAutoClose when patching in placeJulien Delayen2015-03-101-0/+3
| | | | | | | | | | | Installd can give the same input and output when patching directly in the dalvik-cache. For this particular case, we need to DisableAutoClose to avoid closing twice the same fd. Change-Id: Ic1c0f1006f776e6aeb3772c83c52309c78a4bdfd Signed-off-by: Julien Delayen <julien.delayen@intel.com> Signed-off-by: Guilhem IMBERTON <guilhem.imberton@intel.com>
* ART: Introduce NO_RETURN, Mark DoLongJump noreturnAndreas Gampe2015-02-231-1/+1
| | | | | | | Add NO_RETURN macro that adds C++11 noreturn attribute. Mark DoLongJump methods as noreturn. Change-Id: Ifde4318e370493237050d4c1349285a0382df23f
* ART: Refactor common ELF->InstructionSet codeAndreas Gampe2015-01-211-25/+1
| | | | | | Move code into instruction_set.h/cc. Change-Id: I34d5c82791042c68629df84e0f4b9321231d51b9
* ART: Allow to compile interpret-only mips64 filesAndreas Gampe2015-01-151-0/+2
| | | | | | | | | | | | Include enough infrastructure to allow cross-compiling for mips64, interpret-only. This includes the instruction-set-features, frame size info and utils assembler. Also add a disassembler for oatdump, and support in patchoat. Note: the runtime cannot run mips64, yet. Change-Id: Id106581fa76b478984741c62a8a03be0f370d992
* ART: Introduce Mips32 R6Andreas Gampe2015-01-131-3/+8
| | | | | | | Add an instruction-set feature for Mips R6. Currently restricted to the interpreter. Change-Id: Ic6d888e135bc87340229a0543dd94d0c1e863edd
* Remove portable.Elliott Hughes2014-12-121-6/+0
| | | | Change-Id: I3bf3250fa866fd2265f1b115d52fa5dedc48a7fc
* Delete ArtMethod gc_map_ fieldMathieu Chartier2014-11-241-6/+0
| | | | | | | | | | | Moved the gc_map field from OatMethod to OatQuickMethodHeader. Deleted the ArtMethod gc_map_ field. Bug: 17643507 Change-Id: Ifa0470c3e4c2f8a319744464d94c6838b76b3d48 (cherry picked from commit 807140048f82a2b87ee5bcf337f23b6a3d1d5269)
* ART: Track Flush & Close in FdFileAndreas Gampe2014-11-181-3/+23
| | | | | | | | | | | | | | Implement a check that aborts when a file hasn't been explicitly flushed and closed when it is destructed. Add WARN_UNUSED to FdFile methods. Update dex2oat, patchoat, scoped_flock and some gtests to pass with this. (cherry picked from commit 9433ec60b325b708b9fa87e699ab4a6565741494) Change-Id: I9ab03b1653e69f44cc98946dc89d764c3e045dd4
* Change 64 bit ArtMethod fields to be pointer sizedMathieu Chartier2014-11-182-23/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 (cherry picked from commit e832e64a7e82d7f72aedbd7d798fb929d458ee8f)
* Instruction set features for ARM64, MIPS and X86.Ian Rogers2014-11-132-6/+2
| | | | | | | | | | | | | 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-2/+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
* ART: Add support for patching and loading OAT files compiled with PICIgor Murashkin2014-10-272-25/+240
| | | | | | | | | | | | * Images (.art) compiled with pic now have a new field added. * isDexOptNeeded will now skip patch-ing for apps compiled PIC * First-boot patching now only copies boot.art, boot.oat is linked As a result, all system preopted dex files (with --compile-pic) no longer take up any space in /data/dalvik-cache/<isa>. Bug: 18035729 Change-Id: Ie1acad81a0fd8b2f24e1f3f07a06e6fdb548be62
* Tidy up logging.Ian Rogers2014-10-221-0/+1
| | | | | | | | | | | | | | | | | Move gVerboseMethods to CompilerOptions. Now "--verbose-methods=" option to dex2oat rather than runtime argument "-verbose-methods:". Move ToStr and Dumpable out of logging.h, move LogMessageData into logging.cc except for a forward declaration. Remove ConstDumpable as Dump methods are all const (and make this so if not currently true). Make LogSeverity an enum and improve compile time assertions and type checking. Remove log_severity.h that's only used in logging.h. With system headers gone from logging.h, go add to .cc files missing system header includes. Also, make operator new in ValueObject private for compile time instantiation checking. Change-Id: I3228f614500ccc9b14b49c72b9821c8b0db3d641
* Some code clean-up.Ian Rogers2014-10-162-16/+18
| | | | Change-Id: I4b745fd5298cd61c793e3b57514b48347bd66c0e
* Change MemMap::maps_ to not be global variableMathieu Chartier2014-10-141-0/+1
| | | | | | | | Runtime.exit() was causing globals to get destructed at the same time that another thread was using it for allocating a new mem map. Bug: 17962201 Change-Id: I400cb7b8141d858f3c08a6fe59a02838c04c6962
* Switch to C++11 style [[noreturn]].Ian Rogers2014-10-101-2/+1
| | | | | | | | Also remove old comment about calls to Abort getting merged. We have few LOG(FATAL)s so merging is less of an issue. Also, recompiling with O0 and similar will avoid the optimization and we expect that for GDB debugging. Change-Id: I840dc6f4b8511294be0e117c634ec15b745e7be5
* Fix 2 new sets of clang compiler warnings.Ian Rogers2014-10-101-0/+1
| | | | | | | | | | | Fix issues that are flagged by -Wfloat-equal and -Wmissing-noreturn. In the case of -Wfloat-equal the current cases in regular code are deliberate, so the change is to silence the warning. For gtest code the appropriate fix is to switch from EXPECT_EQ to EXPECT_(FLOAT|DOUBLE)_EQ. The -Wmissing-noreturn warning isn't enabled due to a missing noreturn in gtest. This issue has been reported to gtest. Change-Id: Id84c70c21c542716c9ee0c41492e8ff8788c4ef8
* stdint types all the way!Ian Rogers2014-10-091-2/+2
| | | | Change-Id: I4e4ef3a2002fc59ebd9097087f150eaf3f2a7e08
* Add some missing TEMP_FAILURE_RETRYs around unlink(2)Brian Carlstrom2014-10-031-3/+3
| | | | Change-Id: Ibf446d37092933dce165d7a95c0ff2e52b94ce46
* ART: Prepare for ELF64.Tong Shen2014-10-032-77/+60
| | | | | | Only expose necessary interface in ElfFile, and move all details into template class ElfFileImpl. Change-Id: I9df2bbc55f32ba0ba91f4f3d5d0009e84a2ddf74
* ART: Fix some -Wpedantic errorsAndreas Gampe2014-09-291-1/+1
| | | | | | | | | | | | | | | | Remove extra semicolons. Dollar signs in C++ identifiers are an extension. Named variadic macros are an extension. Binary literals are a C++14 feature. Enum re-declarations are not allowed. Overflow. Change-Id: I7d16b2217b2ef2959ca69de84eaecc754517714a
* ART: Only allow the zygote to create the global boot imageAndreas Gampe2014-09-181-2/+5
| | | | | | | | | Do not allow arbitrary processes, even when root, to write the boot image in /data/dalvik-cache. Bug: 17478752, 17510489, 17439961 Change-Id: Iba2b74be6d0752f4221f4ff5ee295b45a34cb2e1 (cherry picked from commit 33c36d4f22ab6a5e61eb47b654deaf647c34e49c)
* ART: Make elf loading not abortAndreas Gampe2014-09-151-8/+10
| | | | | | | | | | | | | | Changes elf_file code to use less CHECKs and instead return error values (usually nullptr). This avoids aborts. In oat_file, when loading an oat file fails, try to unlink at. If this succeeds, on the next run we may compile again. Bug: 17491333 (cherry picked from commit afa6b8e93a0dc0de33c9d404945c7c5621e20b1a) Change-Id: I50fdd2edacd86f25d4dacf2180ce2a6105eaf4af
* ART: Relax GetInstructionSetFromStringAndreas Gampe2014-08-201-13/+3
| | | | | | | | | | | | | Do not abort on an unknown instruction set string. Instead return kNone and let the caller handle this. Also simplify the patchoat tool to use this. Bug: 17136416 (cherry picked from commit aabbb2066a715b3fd8e752291f74c6d77b970450) Change-Id: I24131914bcf91c04ae93179bf809a2907f1f2b7a
* ART source line debug info in OAT filesYevgeny Rouban2014-08-151-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OAT files have source line information enough for ART runtime needs like jump to/from interpreter and thread suspension. But this information is not enough for finer grained source level debugging and low-level profiling (VTune or perf). This patch adds to OAT files two additional sections: .debug_line - DWARF formatted Elf32 section with detailed source line information (mapping from native PC to Java source lines). In addition to the debugging symbols added using the dex2oat option --include-debug-symbols, the source line information is added to the section .debug_line. The source line info can be read by many Elf reading tools like objdump, readelf, dwarfdump, gdb, perf, VTune, ... gdb can use this debug line information in x86. In 64-bit mode the information can be used if the oat file is mapped in the lower address space (address has higher 32 bits zeroed). Relocation works. Testing: 1. art/test/run-test --host --gdb [--64] 001-HelloWorld 2. in gdb: break Main.java:19 3. in gdb: break Runtime.java:111 4. in gdb: run - stops at void java.lang.Runtime.<init>() 5. in gdb: backtrace - shows call stack down to main() 6. in gdb: continue - stops at void Main.main() (only in 32-bit mode) 7. in gdb: backtrace - shows call stack down to main() 8. objdump -W <oat-file> - addresses are from VMA range of .text section reported by objdump -h <file> 9. dwarfdump -ka <oat-file> - no errors expected Size of aosp-x86-eng boot.oat increased by 11% from 80.5Mb to 89.2Mb with two sections added .debug_line (7.2Mb) and .rel.debug (1.5Mb). Change-Id: Ib8828832686e49782a63d5529008ff4814ed9cda Signed-off-by: Yevgeny Rouban <yevgeny.y.rouban@intel.com>
* Fix art build scriptJunmo Park2014-08-131-2/+2
| | | | | | | Use ART_BUILD_HOST_NDEBUG instead of ART_BUILD_NDEBUG. Change-Id: I0ff590552f47d3354287a155b51936a7aef82f1f Signed-off-by: Junmo Park <junmoz.park@samsung.com>
* Make patchoat use the sht_entsize when patching.Alex Light2014-08-062-15/+30
| | | | | | This fixes an occasional problem with multiarch use of patchoat. Change-Id: I80799de36774720bd985704f9b709a8378bb5af5
* Tweaks to patchoat and other related things.Alex Light2014-07-251-71/+107
| | | | | | | | | Removed some flags from patchoat that were poorly specified and fixed some other issues with the relocation system. Bug: 15358152 Change-Id: Ia6d47b1a008f02373307d833ba45f00ea408d76f
* ART: Make run tests out of oat testsAndreas Gampe2014-07-231-0/+3
| | | | | | Transforms all former oat tests into run tests. Change-Id: I190dd39456454c36e5538a2c044d993965a67533
* Runtime can now be set to require relocationAlex Light2014-07-222-18/+89
| | | | | | | | | | | | | | Add a pair of runtime flags -Xrelocate and -Xnorelocate that can force the runtime to require that all files that are run are relocated, to prevent attacks based on the known art base address. Add support for running patchoat on oat files compiled without an image. Change run-test to have new --prebuild and --relocate flags. Bug: 15358152 Change-Id: I91166c62dd1ab80e5cbcb7883a2cd0d56afca32d
* Break apart header files.Ian Rogers2014-07-151-2/+3
| | | | | | | | 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
* Fix some style nitpicksAlex Light2014-07-082-40/+45
| | | | Change-Id: Icfdd327f4ddf129f0a8607162c09ba271c1d49d9
* Add patchoat tool to Art.Alex Light2014-07-073-0/+1184
Add a new executable called patchoat to art. This tool takes already compiled images and oat files and changes their base address, acting as a cheap form of relocation. Add a --include-patch-information flag to dex2oat and code to add required patch information to oat files created with the quick compiler. Bug: 15358152 Change-Id: Ie0c580db45bb14ec180deb84930def6c3628d97d