2 thoughts on “bare instructions mode should not emit RawInstruction headers

  1. Right now we have the following overhead on armv8:

    * `RawObject::tags_` - 4 bytes
    * `RawObject::hash_` - 4 bytes
    * `RawInstructions::size_and_flags` - 4 bytes
    * `RawInstructions::unchecked_entrypoint_pc_offset_` - 4 bytes

    Since those are actual heap objects, they are also subject to kObjectAlignment = 2 * kWordSize = 16 bytes. On average 8 bytes might be wasted.

    In AOT we don’t necessarily need any of those (even the unchecked entry is not needed, it’s already cached in the Code objects).

    The potential savings in the AOT snapshot are therefore 24 bytes per instruction object. The gallery seems to have around 18030 Precompiled_* symbols, which would make this 24 * 18030 = 422 kb, representing 3.8%% of flutter_gallery_total_size (and 5.9%% of RX).

  2. The savings in space are not worth the lost of information from Instructions not being part of the heap.

    I am not sure I understand this argument. Could you expand it? In AOT Instructions are anyway not a really part of the heap: they are immovable, immutable and for all intents and purposes immortal. So I am not sure things like allocation stats are meaningful for them.

    As @mkustermann explains it is quite a significant saving in code size and it will only become more prominent as we squeeze more and more air from the snapshot.

Comments are closed.