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 21:51:49 +0000 (14:51 -0700)
commitbfb21589a6490769690b44aaf8e6a0021a1261b7
tree1399d44f5048259b8caa431458aca4d192f56b9a
parent22986a478eff6562896ab8df187b5cd8cbcb8de9
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

Change-Id: I33255f85d10c29cae085584880196c45ac0ea230
runtime/class_linker.cc