Change dex cache to be java object instead of array, add pointer to dex file in dex cache.
Generic clean up to facilitate having GDB macros for Pretty* helper functions.
Improved cleanliness of DexCache since having it as an object array was not the best solution.
Fixed a bug in InOrderWalk caused by ResolveType sometimes allocating classes.
Rename C++ Method to AbstractMethod and add two new classes Constructor, Method which both inherit from AbstractMethod.
Rename done to have the C++ code be closer to the java code.
Change-Id: I4995b4c5e47a3822192b08afa24a639d3b1f4da9
diff --git a/src/trace.cc b/src/trace.cc
index e4bc836..d1f3f50 100644
--- a/src/trace.cc
+++ b/src/trace.cc
@@ -162,14 +162,14 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Trace* tracer = Runtime::Current()->GetTracer();
for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
- Method* method = klass->GetDirectMethod(i);
+ AbstractMethod* method = klass->GetDirectMethod(i);
if (tracer->GetSavedCodeFromMap(method) == NULL) {
tracer->SaveAndUpdateCode(method);
}
}
for (size_t i = 0; i < klass->NumVirtualMethods(); i++) {
- Method* method = klass->GetVirtualMethod(i);
+ AbstractMethod* method = klass->GetVirtualMethod(i);
if (tracer->GetSavedCodeFromMap(method) == NULL) {
tracer->SaveAndUpdateCode(method);
}
@@ -181,14 +181,14 @@
SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
Trace* tracer = Runtime::Current()->GetTracer();
for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
- Method* method = klass->GetDirectMethod(i);
+ AbstractMethod* method = klass->GetDirectMethod(i);
if (tracer->GetSavedCodeFromMap(method) != NULL) {
tracer->ResetSavedCode(method);
}
}
for (size_t i = 0; i < klass->NumVirtualMethods(); i++) {
- Method* method = klass->GetVirtualMethod(i);
+ AbstractMethod* method = klass->GetVirtualMethod(i);
if (tracer->GetSavedCodeFromMap(method) != NULL) {
tracer->ResetSavedCode(method);
}
@@ -221,16 +221,16 @@
visitor.WalkStack();
}
-void Trace::AddSavedCodeToMap(const Method* method, const void* code) {
+void Trace::AddSavedCodeToMap(const AbstractMethod* method, const void* code) {
saved_code_map_.Put(method, code);
}
-void Trace::RemoveSavedCodeFromMap(const Method* method) {
+void Trace::RemoveSavedCodeFromMap(const AbstractMethod* method) {
saved_code_map_.erase(method);
}
-const void* Trace::GetSavedCodeFromMap(const Method* method) {
- typedef SafeMap<const Method*, const void*>::const_iterator It; // TODO: C++0x auto
+const void* Trace::GetSavedCodeFromMap(const AbstractMethod* method) {
+ typedef SafeMap<const AbstractMethod*, const void*>::const_iterator It; // TODO: C++0x auto
It it = saved_code_map_.find(method);
if (it == saved_code_map_.end()) {
return NULL;
@@ -239,7 +239,7 @@
}
}
-void Trace::SaveAndUpdateCode(Method* method) {
+void Trace::SaveAndUpdateCode(AbstractMethod* method) {
#if defined(ART_USE_LLVM_COMPILER)
UNIMPLEMENTED(FATAL);
#else
@@ -250,7 +250,7 @@
#endif
}
-void Trace::ResetSavedCode(Method* method) {
+void Trace::ResetSavedCode(AbstractMethod* method) {
CHECK(GetSavedCodeFromMap(method) != NULL);
method->SetCode(GetSavedCodeFromMap(method));
RemoveSavedCodeFromMap(method);
@@ -419,7 +419,7 @@
}
}
-void Trace::LogMethodTraceEvent(Thread* self, const Method* method, Trace::TraceEvent event) {
+void Trace::LogMethodTraceEvent(Thread* self, const AbstractMethod* method, Trace::TraceEvent event) {
if (thread_clock_base_map_.find(self) == thread_clock_base_map_.end()) {
uint64_t time = ThreadCpuMicroTime();
thread_clock_base_map_.Put(self, time);
@@ -464,16 +464,16 @@
while (ptr < end) {
uint32_t method_value = ptr[2] | (ptr[3] << 8) | (ptr[4] << 16) | (ptr[5] << 24);
- Method* method = reinterpret_cast<Method*>(TraceMethodId(method_value));
+ AbstractMethod* method = reinterpret_cast<AbstractMethod*>(TraceMethodId(method_value));
visited_methods_.insert(method);
ptr += record_size_;
}
}
void Trace::DumpMethodList(std::ostream& os) {
- typedef std::set<const Method*>::const_iterator It; // TODO: C++0x auto
+ typedef std::set<const AbstractMethod*>::const_iterator It; // TODO: C++0x auto
for (It it = visited_methods_.begin(); it != visited_methods_.end(); ++it) {
- const Method* method = *it;
+ const AbstractMethod* method = *it;
MethodHelper mh(method);
os << StringPrintf("%p\t%s\t%s\t%s\t%s\n", method,
PrettyDescriptor(mh.GetDeclaringClassDescriptor()).c_str(), mh.GetName(),
@@ -508,7 +508,7 @@
uint32_t TraceMethodUnwindFromCode(Thread* self) {
Trace* tracer = Runtime::Current()->GetTracer();
TraceStackFrame trace_frame = self->PopTraceStackFrame();
- Method* method = trace_frame.method_;
+ AbstractMethod* method = trace_frame.method_;
uint32_t lr = trace_frame.return_pc_;
tracer->LogMethodTraceEvent(self, method, Trace::kMethodTraceUnwind);