Don't pre-initialize Class.name fields in boot images

The Class.name field is normally allocated and set dynamically when
required. We were pre-initializing it for non-app-images in order to
reduce dirty pages. It turns out that without this very few classes
would ever get this field initialized (~2% according to tests while
running a few apps). No longer pre-initializing the field reduces the
size of each boot image by ~600kb.

This partially reverts commit d418edaf4d.

Prior to the change the smaps entry for an art file look like this:

701cd000-70303000 rw-p 00000000 103:1d 5505036                           /data/dalvik-cache/arm64/system@framework@boot-core-libart.art
Size:               1240 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                 720 kB
Pss:                 190 kB
Shared_Clean:        548 kB
Shared_Dirty:          0 kB
Private_Clean:        44 kB
Private_Dirty:       128 kB
Referenced:          720 kB
Anonymous:           128 kB

With this change running the same program gives us the following smaps
entry:

6fc83000-6fdae000 rw-p 00000000 103:1d 6684684                           /data/dalvik-cache/arm64/system@framework@boot-core-libart.art
Size:               1196 kB
KernelPageSize:        4 kB
MMUPageSize:           4 kB
Rss:                 672 kB
Pss:                 195 kB
Shared_Clean:        496 kB
Shared_Dirty:          0 kB
Private_Clean:        48 kB
Private_Dirty:       128 kB
Referenced:          672 kB
Anonymous:           128 kB

All relevant measures of memory use are either improved or remain
unchanged. (NB private_clean is the amount of memory that another process
could cause to be dirtied by writing to it. It is not relevant to this
change.)

Bug: 32635074
Test: ./tools/field-null-percent/check-null-fields.py 'Ljava/lang/Class;.name:Ljava/lang/String;'
Test: Builds and boots
Test: Examine smaps for both old and new version.

Change-Id: I96aaeb782715db5c1e035bdf76331b4253c74ce6
2 files changed