History log of /art/compiler/optimizing/stack_map_stream.h
Revision Date Author Comments
61b28a17d9b6e8e998103646e98e4a9772e11927 25-Feb-2016 David Srbecky <dsrbecky@google.com> Use bit-level packing for InlineInfo in stackmaps as well.

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
09ed09866da6d8c7448ef297c148bfa577a247c2 12-Feb-2016 David Srbecky <dsrbecky@google.com> Pack stack map entries on bit level to save space.

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
1bbdfd73a98b149c31f8a80888c7ee9ab2587630 24-Feb-2016 David Srbecky <dsrbecky@google.com> Verify encoded stack maps in debug builds.

Read all stack map data back after we write it and DCHECK the content.

Change-Id: Ia679594ac9e5805f6d4c56686030af153b45ea8b
1f49764f7d62b2f80ce3418234a5036a59b2b762 05-Oct-2015 Vladimir Marko <vmarko@google.com> ART: Use arena allocator with HashSet/HashMap.

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
ec7802a102d49ab5c17495118d4fe0bcc7287beb 01-Oct-2015 Vladimir Marko <vmarko@google.com> Add DCHECKs to ArenaVector and ScopedArenaVector.

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
225b6464a58ebe11c156144653f11a1c6607f4eb 28-Sep-2015 Vladimir Marko <vmarko@google.com> Optimizing: Tag arena allocations in code generators.

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
2a5c4681ba19411c1cb22e9a7ab446dab910af1c 14-Aug-2015 Andreas Gampe <agampe@google.com> ART: Some header cleaning around bit-utils

Try to remove dependencies where they are not necessary.

Change-Id: I5ff35cb17aea369bed3725b1610b50d7eb05b81e
cf93a5cd9c978f59113d42f9f642fab5e2cc8877 16-Jun-2015 Vladimir Marko <vmarko@google.com> Revert "Revert "ART: Implement literal pool for arm, fix branch fixup.""

This reverts commit fbeb4aede0ddc5b1e6a5a3a40cc6266fe8518c98.

Adjust block label positions. Bad catch block labels were the
reason for the revert.

Change-Id: Ia6950d639d46b9da6b07f3ade63ab46d03d63310
fbeb4aede0ddc5b1e6a5a3a40cc6266fe8518c98 16-Jun-2015 Vladimir Marko <vmarko@google.com> Revert "ART: Implement literal pool for arm, fix branch fixup."

This reverts commit f38caa68cce551fb153dff37d01db518e58ed00f.

Change-Id: Id88b82cc949d288cfcdb3c401b96f884b777fc40
Reason: broke the tests.
f38caa68cce551fb153dff37d01db518e58ed00f 29-May-2015 Vladimir Marko <vmarko@google.com> ART: Implement literal pool for arm, fix branch fixup.

Change-Id: Iecc91418bb4ee1c957f42fefb737d0ee2ba960e7
bd8c725e465cc7f44062745a6f2b73248f5159ed 12-Jun-2015 Vladimir Marko <vmarko@google.com> Optimizing: Remove PcInfo, use the StackMapStream instead.

Change-Id: I474f3a89f6c7ee5c7accd21791b1c1e311104158
f677ebfd832c9c614fea5e6735725fec2f7a3f2a 29-May-2015 David Brazdil <dbrazdil@google.com> Cache stack map encoding

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
b176d7c6c8c01a50317f837a78de5da57ee84fb2 20-May-2015 Nicolas Geoffray <ngeoffray@google.com> Also encode the InvokeType in an InlineInfo.

This will be needed to recover the call stack.

Change-Id: I2fe10785eb1167939c8cce1862b2d7f4066e16ec
b1d0f3f7e92fdcc92fe2d4c48cbb1262c005583f 14-May-2015 Nicolas Geoffray <ngeoffray@google.com> Support InlineInfo in StackMap.

Change-Id: I9956091775cedc609fdae7dec1433fcb8858a477
4f46ac5179967dda5966f2dcecf2cf08977951ef 23-Apr-2015 Calin Juravle <calin@google.com> Cleanup and improve stack map stream

- 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
c416d3359179b0ec6152104db8240f4d11c54bc7 23-Apr-2015 Calin Juravle <calin@google.com> Move stack map stream implementation to its own cc file.

It's big enough now to separate the implementation from the header.

It also enables faster compilation time for experiments.

Change-Id: Ica0c72994d5e461c62c32628010f46f9e5c46b57
c9d185d2b4ac045840586d3a890eab61c922379f 16-Apr-2015 Dan Albert <danalbert@google.com> Fix undefined behavior in hash calculation.

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
896f8f7fe562f6e59119cb32531da9f0a5f13d18 30-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Use variable encoding for StackMap.

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
a552e1c0584b8ab63150510286478c68cdbce13f 26-Mar-2015 Roland Levillain <rpl@google.com> Use unique location catalogs to encode Dex register maps.

- 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
6ae70962089e4af9718cc9b7c2b79a0c501c1844 18-Mar-2015 Calin Juravle <calin@google.com> Share dex register maps between stack maps when possible.

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
004c230b4cfc856690c61faabc41864061813c88 20-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Compress the StackMaps.

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
aec8f930571ce10d6ce9a4249c45866a7f213397 18-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> StackMap: Always load and store unalign.

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
eeefa1276e83776f08704a3db4237423b0627e20 13-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> Update locations of registers after slow paths spilling.

Change-Id: Id9aafcc13c1a085c17ce65d704c67b73f9de695d
fead4e4f397455aa31905b2982d4d861126ab89d 13-Mar-2015 Nicolas Geoffray <ngeoffray@google.com> [optimizing] Don't record None locations in the stack maps.

- 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
ede7bf8a5cef965974e7c1edcf46a41fbe50a49d 13-Mar-2015 Roland Levillain <rpl@google.com> Align CodeInfo regions instead of their inner subregions.

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
29ba1b068fc9f5a8011782c147b1f7732928aac7 13-Mar-2015 Roland Levillain <rpl@google.com> Fix the computation of the size of the stack maps region.

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
9ac0e4d4ed1b45cf8767ef1d339afcdd205bf55a 12-Mar-2015 Roland Levillain <rpl@google.com> Force word alignment of Dex register maps.

Plus some cosmetic changes.

Change-Id: I45e805aa87c2ef8fe8907eaae726cd2188b54897
a2d8ec6876325e89e5d82f5dbeca59f96ced3ec1 12-Mar-2015 Roland Levillain <rpl@google.com> Compress the Dex register maps built by the optimizing compiler.

- 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
442b46a087c389a91a0b51547ac9205058432364 18-Feb-2015 Roland Levillain <rpl@google.com> Display optimizing compiler's CodeInfo objects in oatdump.

A few elements are not displayed yet (stack mask, inline info) though.

Change-Id: I5e51a801c580169abc5d1ef43ad581aadc110754
376b2bbf7c39108223a7a01568a7b4b04d84eeac 09-Dec-2014 Nicolas Geoffray <ngeoffray@google.com> Ensure stack maps are 4 byte aligned.

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
277ccbd200ea43590dfc06a93ae184a765327ad0 04-Nov-2014 Andreas Gampe <agampe@google.com> ART: More warnings

Enable -Wno-conversion-null, -Wredundant-decls and -Wshadow in general,
and -Wunused-but-set-parameter for GCC builds.

Change-Id: I81bbdd762213444673c65d85edae594a523836e5
0279ebb3efd653e6bb255470c99d26949c7bcd95 09-Oct-2014 Ian Rogers <irogers@google.com> Tidy ELF builder.

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
3946844c34ad965515f677084b07d663d70ad1b8 02-Sep-2014 Nicolas Geoffray <ngeoffray@google.com> Runtime support for the new stack maps for the opt compiler.

Now most of the methods supported by the compiler can be optimized,
instead of using the baseline.

Change-Id: I80ab36a34913fa4e7dd576c7bf55af63594dc1fa
8eddd2a379e1d3c76b22f40d3d4387d12ed1a8d1 28-Jul-2014 Andreas Gampe <agampe@google.com> ART: Fix missing initialization in stack_map_stream.h

Fixes stack_map_test.

Change-Id: Ibd6659b589ec595a7af21ad3d727c0ab2dceb45c
99ea58cc68b51837c065f4a2a54efbf208dd76fa 02-Jul-2014 Nicolas Geoffray <ngeoffray@google.com> Add a new stack map scheme that encodes compilation info per pc.

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