summaryrefslogtreecommitdiffstats
path: root/runtime/hprof
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2014-01-15 13:49:50 -0800
committerJeff Hao <jeffhao@google.com>2015-04-27 18:54:52 -0700
commit848f70a3d73833fc1bf3032a9ff6812e429661d9 (patch)
treeb0349b3a40aab5a915af491b100659a5ca9fbbf6 /runtime/hprof
parentd14438f0c5071962be7fab572b54687d32d9d087 (diff)
downloadart-848f70a3d73833fc1bf3032a9ff6812e429661d9.zip
art-848f70a3d73833fc1bf3032a9ff6812e429661d9.tar.gz
art-848f70a3d73833fc1bf3032a9ff6812e429661d9.tar.bz2
Replace String CharArray with internal uint16_t array.
Summary of high level changes: - Adds compiler inliner support to identify string init methods - Adds compiler support (quick & optimizing) with new invoke code path that calls method off the thread pointer - Adds thread entrypoints for all string init methods - Adds map to verifier to log when receiver of string init has been copied to other registers. used by compiler and interpreter Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
Diffstat (limited to 'runtime/hprof')
-rw-r--r--runtime/hprof/hprof.cc34
1 files changed, 30 insertions, 4 deletions
diff --git a/runtime/hprof/hprof.cc b/runtime/hprof/hprof.cc
index fb7ff54..d0eb083 100644
--- a/runtime/hprof/hprof.cc
+++ b/runtime/hprof/hprof.cc
@@ -981,7 +981,7 @@ void Hprof::DumpHeapClass(mirror::Class* klass) {
// ClassObjects have their static fields appended, so aren't all the same size.
// But they're at least this size.
__ AddU4(sizeof(mirror::Class)); // instance size
- } else if (klass->IsArrayClass() || klass->IsPrimitive()) {
+ } else if (klass->IsArrayClass() || klass->IsStringClass() || klass->IsPrimitive()) {
__ AddU4(0);
} else {
__ AddU4(klass->GetObjectSize()); // instance size
@@ -1036,13 +1036,22 @@ void Hprof::DumpHeapClass(mirror::Class* klass) {
// Instance fields for this class (no superclass fields)
int iFieldCount = klass->IsObjectClass() ? 0 : klass->NumInstanceFields();
- __ AddU2((uint16_t)iFieldCount);
+ if (klass->IsStringClass()) {
+ __ AddU2((uint16_t)iFieldCount + 1);
+ } else {
+ __ AddU2((uint16_t)iFieldCount);
+ }
for (int i = 0; i < iFieldCount; ++i) {
ArtField* f = klass->GetInstanceField(i);
__ AddStringId(LookupStringId(f->GetName()));
HprofBasicType t = SignatureToBasicTypeAndSize(f->GetTypeDescriptor(), nullptr);
__ AddU1(t);
}
+ // Add native value character array for strings.
+ if (klass->IsStringClass()) {
+ __ AddStringId(LookupStringId("value"));
+ __ AddU1(hprof_basic_object);
+ }
}
void Hprof::DumpHeapArray(mirror::Array* obj, mirror::Class* klass) {
@@ -1099,6 +1108,7 @@ void Hprof::DumpHeapInstanceObject(mirror::Object* obj, mirror::Class* klass) {
// Write the instance data; fields for this class, followed by super class fields,
// and so on. Don't write the klass or monitor fields of Object.class.
+ mirror::Class* orig_klass = klass;
while (!klass->IsObjectClass()) {
int ifieldCount = klass->NumInstanceFields();
for (int i = 0; i < ifieldCount; ++i) {
@@ -1133,8 +1143,24 @@ void Hprof::DumpHeapInstanceObject(mirror::Object* obj, mirror::Class* klass) {
klass = klass->GetSuperClass();
}
- // Patch the instance field length.
- __ UpdateU4(size_patch_offset, output_->Length() - (size_patch_offset + 4));
+ // Output native value character array for strings.
+ if (orig_klass->IsStringClass()) {
+ mirror::String* s = obj->AsString();
+ __ AddObjectId(reinterpret_cast<mirror::Object*>(s->GetValue()));
+
+ // Patch the instance field length.
+ __ UpdateU4(size_patch_offset, output_->Length() - (size_patch_offset + 4));
+
+ __ AddU1(HPROF_PRIMITIVE_ARRAY_DUMP);
+ __ AddObjectId(reinterpret_cast<mirror::Object*>(s->GetValue()));
+ __ AddU4(StackTraceSerialNumber(obj));
+ __ AddU4(s->GetLength());
+ __ AddU1(hprof_basic_char);
+ __ AddU2List(s->GetValue(), s->GetLength());
+ } else {
+ // Patch the instance field length.
+ __ UpdateU4(size_patch_offset, output_->Length() - (size_patch_offset + 4));
+ }
}
void Hprof::VisitRoot(mirror::Object* obj, const RootInfo& info) {