OSDN Git Service

Fill resolved static fields during class initialization
authorMathieu Chartier <mathieuc@google.com>
Tue, 28 Oct 2014 20:57:04 +0000 (13:57 -0700)
committerMathieu Chartier <mathieuc@google.com>
Tue, 28 Oct 2014 23:38:08 +0000 (16:38 -0700)
commit05d89ee90413c51573c8e708a193f4ff87d67d0a
treec3ace311823a639c3434194016184483a73bd278
parente0205d519dd417f749243b42b8711dfa313e5390
Fill resolved static fields during class initialization

Previously everytime we resolved static fields we linear searched
the class to find the field with the specified field id. Now we
eagerly set these fields in the dex cache when we initialize classes.

FB launch timings before:
WaitTime: 2903
WaitTime: 2953
WaitTime: 2918
WaitTime: 2940
WaitTime: 2879
WaitTime: 2792

Timings after:
WaitTime: 2699
WaitTime: 2791
WaitTime: 2653
WaitTime: 2929
WaitTime: 2651
WaitTime: 2971

Perf before:
2.94% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)
After:
0.00% art::mirror::Class::FindDeclaredStaticField(art::mirror::DexCache const*, unsigned int)

Bug: 18054905
Bug: 16828525

(cherry picked from commit bfb21589a6490769690b44aaf8e6a0021a1261b7)

Change-Id: I33255f85d10c29cae085584880196c45ac0ea230
runtime/class_linker.cc