OSDN Git Service

dex2oat: Pack likely-dirty objects together when generating the boot image
authorIgor Murashkin <iam@google.com>
Fri, 14 Nov 2014 23:01:59 +0000 (15:01 -0800)
committerIgor Murashkin <iam@google.com>
Thu, 20 Nov 2014 00:04:55 +0000 (16:04 -0800)
commit3f735bd4f9d09a0f9b2b01321e4c6917879dcae6
tree7b01eb60edeac13786dae1d01892a94d7949deb6
parentcc03f7956e67da4caafdc0d4948ed644651b39bf
dex2oat: Pack likely-dirty objects together when generating the boot image

This introduces a new algorithm into image writer which "bins" objects
by how likely they are to be dirtied at runtime. Objects in the same bin
are placed contiguously in memory (i.e. into the same page). We try to
tune the bin selection based on how clean or how dirty the object will
likely be at runtime.

As-is, this saves about 150KB per-process (private-dirty pages) and 700KB in
zygote (shared-dirty).

There is still about 800KB of objects that are clean but located in
dirty pages, so with more analysis we can tune the bin selection and get
even more memory savings.

Bug: 17611661
Change-Id: Ia1455e4c56ffd0a36ae2a723d35b7e06502980f7
compiler/image_writer.cc
compiler/image_writer.h
runtime/utils.h
runtime/utils_test.cc