Use efficient encoding for compact dex code item fields

Use a compact format for compact dex code items. In the common case,
there are only 4 bytes worth of fields.

This is accomplished by shrining the fields and adding an optional
preheader before each code item that describes fields that don't fit
in the fast path case. The preheader may use up to 12 extra bytes.
Experiments showed that the preheader is only non empty for ~1% of
code items.

CompactDex code item:
0-12 bytes: Optional preheader
<Code item pointer>
4 bits: register size
4 bits: ins size
4 bits: outs size
4 bits: tries size
11 bits: num code item units
5 bits: preheader flags
[Dex Instructions]

Standard dex code item:
See: https://source.android.com/devices/tech/dalvik/dex-format
<Code item pointer>
16 bits: register size
16 bits: ins size
16 bits: outs size
16 bits: tries size
32 bits: num code item units
[Dex Instructions]

Also change code item alignment to be 2 byte aligned for code items
that don't have payload instructions that require 4 byte alignments.

Results (on golem).
The CL reduces vdex size by an average of 4.3%. Interpreter performance
is 0.3-1% slower, but may be noise.

Test: test-art-host

Bug: 63756964

Change-Id: I836fd098063dd1573a3dfb6ac465a6d33d2cb2c9
12 files changed