Move ArtField to native
Add linear alloc. Moved ArtField to be native object. Changed image
writer to put ArtFields after the mirror section.
Savings:
2MB on low ram devices
4MB on normal devices
Total PSS measurements before (normal N5, 95s after shell start):
Image size: 7729152 bytes
23112 kB: .NonMoving
23212 kB: .NonMoving
22868 kB: .NonMoving
23072 kB: .NonMoving
22836 kB: .NonMoving
19618 kB: .Zygote
19850 kB: .Zygote
19623 kB: .Zygote
19924 kB: .Zygote
19612 kB: .Zygote
Avg: 42745.4 kB
After:
Image size: 7462912 bytes
17440 kB: .NonMoving
16776 kB: .NonMoving
16804 kB: .NonMoving
17812 kB: .NonMoving
16820 kB: .NonMoving
18788 kB: .Zygote
18856 kB: .Zygote
19064 kB: .Zygote
18841 kB: .Zygote
18629 kB: .Zygote
3499 kB: .LinearAlloc
3408 kB: .LinearAlloc
3424 kB: .LinearAlloc
3600 kB: .LinearAlloc
3436 kB: .LinearAlloc
Avg: 39439.4 kB
No reflection performance changes.
Bug: 19264997
Bug: 17643507
Change-Id: I10c73a37913332080aeb978c7c94713bdfe4fe1c
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index cdb3e2a..23af25d 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -37,6 +37,7 @@
#include <set>
+#include "art_field-inl.h"
#include "base/logging.h"
#include "base/stringprintf.h"
#include "base/unix_file/fd_file.h"
@@ -51,7 +52,6 @@
#include "globals.h"
#include "jdwp/jdwp.h"
#include "jdwp/jdwp_priv.h"
-#include "mirror/art_field-inl.h"
#include "mirror/class.h"
#include "mirror/class-inl.h"
#include "mirror/object-inl.h"
@@ -999,7 +999,7 @@
__ AddClassStaticsId(klass);
for (size_t i = 0; i < sFieldCount; ++i) {
- mirror::ArtField* f = klass->GetStaticField(i);
+ ArtField* f = klass->GetStaticField(i);
size_t size;
HprofBasicType t = SignatureToBasicTypeAndSize(f->GetTypeDescriptor(), &size);
@@ -1038,7 +1038,7 @@
int iFieldCount = klass->IsObjectClass() ? 0 : klass->NumInstanceFields();
__ AddU2((uint16_t)iFieldCount);
for (int i = 0; i < iFieldCount; ++i) {
- mirror::ArtField* f = klass->GetInstanceField(i);
+ ArtField* f = klass->GetInstanceField(i);
__ AddStringId(LookupStringId(f->GetName()));
HprofBasicType t = SignatureToBasicTypeAndSize(f->GetTypeDescriptor(), nullptr);
__ AddU1(t);
@@ -1102,7 +1102,7 @@
while (!klass->IsObjectClass()) {
int ifieldCount = klass->NumInstanceFields();
for (int i = 0; i < ifieldCount; ++i) {
- mirror::ArtField* f = klass->GetInstanceField(i);
+ ArtField* f = klass->GetInstanceField(i);
size_t size;
auto t = SignatureToBasicTypeAndSize(f->GetTypeDescriptor(), &size);
switch (t) {