summaryrefslogtreecommitdiff
path: root/compiler/optimizing/stack_map_stream.h
AgeCommit message (Collapse)Author
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-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-02-25Verify encoded stack maps in debug builds.David Srbecky
Read all stack map data back after we write it and DCHECK the content. Change-Id: Ia679594ac9e5805f6d4c56686030af153b45ea8b
2015-10-09ART: Use arena allocator with HashSet/HashMap.Vladimir Marko
Allow passing ArenaAllocatorAdapter (or any other allocator) to HashSet/HashMap and create appropriate Arena- aliases. Use the ArenaHashMap in StackMapsStream. Update arena allocator adapters' construct()/destroy() to C++11 std::allocator<> API. Change-Id: I18544f718f84c6d6580228dd35297daf7f6afb5e
2015-10-08Add DCHECKs to ArenaVector and ScopedArenaVector.Vladimir Marko
Implement dchecked_vector<> template that DCHECK()s element access and insert()/emplace()/erase() positions. Change the ArenaVector<> and ScopedArenaVector<> aliases to use the new template instead of std::vector<>. Remove DCHECK()s that have now become unnecessary from the Optimizing compiler. Change-Id: Ib8506bd30d223f68f52bd4476c76d9991acacadc
2015-09-29Optimizing: Tag arena allocations in code generators.Vladimir Marko
And completely remove the deprecated GrowableArray. Replace GrowableArray with ArenaVector in code generators and related classes and tag arena allocations. Label arrays use direct allocations from ArenaAllocator because Label is non-copyable and non-movable and as such cannot be really held in a container. The GrowableArray never actually constructed them, instead relying on the zero-initialized storage from the arena allocator to be correct. We now actually construct the labels. Also avoid StackMapStream::ComputeDexRegisterMapSize() being passed null references, even though unused. Change-Id: I26a46fdd406b23a3969300a67739d55528df8bf4
2015-08-17ART: Some header cleaning around bit-utilsAndreas Gampe
Try to remove dependencies where they are not necessary. Change-Id: I5ff35cb17aea369bed3725b1610b50d7eb05b81e
2015-06-17Revert "Revert "ART: Implement literal pool for arm, fix branch fixup.""Vladimir Marko
This reverts commit fbeb4aede0ddc5b1e6a5a3a40cc6266fe8518c98. Adjust block label positions. Bad catch block labels were the reason for the revert. Change-Id: Ia6950d639d46b9da6b07f3ade63ab46d03d63310
2015-06-16Revert "ART: Implement literal pool for arm, fix branch fixup."Vladimir Marko
This reverts commit f38caa68cce551fb153dff37d01db518e58ed00f. Change-Id: Id88b82cc949d288cfcdb3c401b96f884b777fc40 Reason: broke the tests.
2015-06-15ART: Implement literal pool for arm, fix branch fixup.Vladimir Marko
Change-Id: Iecc91418bb4ee1c957f42fefb737d0ee2ba960e7
2015-06-12Optimizing: Remove PcInfo, use the StackMapStream instead.Vladimir Marko
Change-Id: I474f3a89f6c7ee5c7accd21791b1c1e311104158
2015-06-04Cache stack map encodingDavid 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-21Also encode the InvokeType in an InlineInfo.Nicolas Geoffray
This will be needed to recover the call stack. Change-Id: I2fe10785eb1167939c8cce1862b2d7f4066e16ec
2015-05-18Support InlineInfo in StackMap.Nicolas Geoffray
Change-Id: I9956091775cedc609fdae7dec1433fcb8858a477
2015-04-23Cleanup and improve stack map streamCalin Juravle
- transform AddStackMapEntry into BeginStackMapEntry/EndStackMapEntry. This allows for nicer code and less assumptions when searching for equal dex register maps. - store the components sizes and their start positions as fields to avoid re-computation. - store the current stack map entry as a field to avoid the copy semantic when updating its value in the stack maps array. - remove redundant methods and fix visibility for the remaining ones. Change-Id: Ica2d2969d7e15993bdbf8bc41d9df083cddafd24
2015-04-23Move stack map stream implementation to its own cc file.Calin Juravle
It's big enough now to separate the implementation from the header. It also enables faster compilation time for experiments. Change-Id: Ica0c72994d5e461c62c32628010f46f9e5c46b57
2015-04-17Fix undefined behavior in hash calculation.Dan Albert
dex_register might be >= the width of the map hash. Shifting by that value would be undefined behavior. Constrain the value to within the valid range. Change-Id: I9037c5c7ec554850ba3385585aca96fde1d50387
2015-03-31Use variable encoding for StackMap.Nicolas Geoffray
dex_pc, native_pc_offset, dex_register_map_offset, inline_info_offset, and register_mask can now be encoded in 1, 2, 3, or 4 bytes. Change-Id: I15f93e8226ce374204d44c5a80a9fd89bda2687c
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-25Share dex register maps between stack maps when possible.Calin Juravle
If two stack maps have the same dex register map then one of them will reference the register map from the other instead of owning an independent copy. This saves around 1.5% of space. Change-Id: Ic2c2c81210c6c45a5c5f650f7ba82a46ff6f45e4
2015-03-20Compress the StackMaps.Nicolas Geoffray
First step towards the compression of the StackMap (not the DexRegisterMap). Next step will be to just use what is needed (instead of byte -> word). Change-Id: I4f81b2d05bf5cc508585e16fbbed1bafbc850e2e
2015-03-18StackMap: Always load and store unalign.Nicolas Geoffray
Now that we can have a mix of Quick and Optimized code in an .oat file, a CodeInfo object is not necessarily word aligned. Change-Id: Ic6c5d1a2c6e20363436726a0708b0764b5a76caf
2015-03-16Update locations of registers after slow paths spilling.Nicolas Geoffray
Change-Id: Id9aafcc13c1a085c17ce65d704c67b73f9de695d
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-13Align CodeInfo regions instead of their inner subregions.Roland Levillain
Instead of word-aligning every stack map region, as well as the Dex register maps region of a CodeInfo object, just align the whole CodeInfo region itself. Change-Id: Ia35d213d2bd184729aa0d048874c76f7bc6da0f6
2015-03-13Fix the computation of the size of the stack maps region.Roland Levillain
In art::StackMapStream::ComputeStackMapSize, compute the size of a CodeInfo's stack maps region using the stack mask size, not the maximum element of the stack mask. Also, rename this method as art::StackMapStream::ComputeStackMapsSize to make it clear it that it covers all the stack maps of the CodeInfo item, not just one stack map. Change-Id: Icad21946dbca6e1ade2b82c9c2c535fdfed110a9
2015-03-12Force word alignment of Dex register maps.Roland Levillain
Plus some cosmetic changes. Change-Id: I45e805aa87c2ef8fe8907eaae726cd2188b54897
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-02-19Display optimizing compiler's CodeInfo objects in oatdump.Roland Levillain
A few elements are not displayed yet (stack mask, inline info) though. Change-Id: I5e51a801c580169abc5d1ef43ad581aadc110754
2014-12-09Ensure stack maps are 4 byte aligned.Nicolas Geoffray
With the recent move to gcc 4.9, we are hitting alignment SIGBUS on ARM. The reason is that gcc will optimize two consecutive 32bits loads into one 64bits load, and the instruction (ldrd) will fail if the data is not aligned. Also removed the emission of mapping table when a method is optimized. The information can be found in the StackMap itself. Change-Id: Icf79406c18a3f4db3c05d52fc2c0dd2e35bf0f8f
2014-11-04ART: More warningsAndreas Gampe
Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general, and -Wunused-but-set-parameter for GCC builds. Change-Id: I81bbdd762213444673c65d85edae594a523836e5
2014-10-09Tidy ELF builder.Ian Rogers
Don't do "if (ptr)". Use const. Use DISALLOW_COPY_AND_ASSIGN. Avoid public member variables. Move ValueObject to base and use in ELF builder. Tidy VectorOutputStream to not use non-const reference arguments. Change-Id: I2c727c3fc61769c3726de7cfb68b2d6eb4477e53
2014-09-08Runtime support for the new stack maps for the opt compiler.Nicolas Geoffray
Now most of the methods supported by the compiler can be optimized, instead of using the baseline. Change-Id: I80ab36a34913fa4e7dd576c7bf55af63594dc1fa
2014-07-28ART: Fix missing initialization in stack_map_stream.hAndreas Gampe
Fixes stack_map_test. Change-Id: Ibd6659b589ec595a7af21ad3d727c0ab2dceb45c
2014-07-21Add a new stack map scheme that encodes compilation info per pc.Nicolas Geoffray
Encodes stack mask, register mask, dex register values, and inlining info. The encoding is currently very straightforward: there is no clever encoding, nor compression. Change-Id: I5fd9ae28189a5513cd9e3c8d52c648463207643d