Interpreter entries and instrumentation as a listener.
Make the instrumentation responsible for whether we want method entry/exit
stubs, and allow it to use interpreter entry stubs when instruction by
instruction instrumentation is required. Improve deoptimization so more JDWP
test cases are passing.
Refactor exception debug posting, in particular improve reporting in the
interpreter. Improve class linker exception throwing so that broken dex files
are more likely to be reported. Fixes the performance issue Bug: 8410519.
Fix some error reporting lock level errors for the large object space. Make
fast object verification faster.
Add some debug mode robustness to finding dex PCs in GC maps.
Add printf attributes to JniAbortF and fix errors.
Expand run-test 044 to test return behaviors and fix issues with not throwing
appropriate exceptions for proxies.
Ensure causes are reported with a class linker NoClassDefFoundError and JNI
NoSuchFieldError.
Remove unused debugMe and updateDebuggerFromCode.
There's a minor sizing tweak to the arg array builder, and an extra reference
array check in the interpreter.
Some clean-up of trace code.
Fix reg type cache destructor if it is called after the reg type cache is
shutdown (as is the case in oatdump).
Change-Id: I6519c7b35df77f978d011999354c864f4918e8ce
diff --git a/src/compiler/driver/compiler_driver.cc b/src/compiler/driver/compiler_driver.cc
index 700936c..4e8ebbd 100644
--- a/src/compiler/driver/compiler_driver.cc
+++ b/src/compiler/driver/compiler_driver.cc
@@ -1202,9 +1202,8 @@
manager->GetClassLinker()->FindClass(descriptor,
soa.Decode<mirror::ClassLoader*>(manager->GetClassLoader()));
if (klass == NULL) {
- Thread* self = Thread::Current();
- CHECK(self->IsExceptionPending());
- self->ClearException();
+ CHECK(soa.Self()->IsExceptionPending());
+ soa.Self()->ClearException();
/*
* At compile time, we can still structurally verify the class even if FindClass fails.
@@ -1230,13 +1229,13 @@
if (klass->IsErroneous()) {
// ClassLinker::VerifyClass throws, which isn't useful in the compiler.
- CHECK(Thread::Current()->IsExceptionPending());
- Thread::Current()->ClearException();
+ CHECK(soa.Self()->IsExceptionPending());
+ soa.Self()->ClearException();
}
CHECK(klass->IsCompileTimeVerified() || klass->IsErroneous())
<< PrettyDescriptor(klass) << ": state=" << klass->GetStatus();
- CHECK(!Thread::Current()->IsExceptionPending()) << PrettyTypeOf(Thread::Current()->GetException());
+ soa.Self()->AssertNoPendingException();
}
void CompilerDriver::VerifyDexFile(jobject class_loader, const DexFile& dex_file,
@@ -1435,7 +1434,6 @@
mirror::ClassLoader* class_loader = soa.Decode<mirror::ClassLoader*>(manager->GetClassLoader());
const char* descriptor = manager->GetDexFile()->GetClassDescriptor(class_def);
mirror::Class* klass = manager->GetClassLinker()->FindClass(descriptor, class_loader);
- Thread* self = Thread::Current();
bool compiling_boot = Runtime::Current()->GetHeap()->GetSpaces().size() == 1;
bool can_init_static_fields = compiling_boot &&
manager->GetCompiler()->IsImageClass(descriptor);
@@ -1447,9 +1445,9 @@
// its parents, whose locks are acquired. This leads to a parent-to-child and a child-to-parent
// lock ordering and consequent potential deadlock.
static Mutex lock1("Initializer lock", kMonitorLock);
- MutexLock mu(self, lock1);
+ MutexLock mu(soa.Self(), lock1);
// The lock required to initialize the class.
- ObjectLock lock2(self, klass);
+ ObjectLock lock2(soa.Self(), klass);
// Only try to initialize classes that were successfully verified.
if (klass->IsVerified()) {
manager->GetClassLinker()->EnsureInitialized(klass, false, can_init_static_fields);
@@ -1473,7 +1471,7 @@
} else {
manager->GetClassLinker()->EnsureInitialized(klass, true, can_init_static_fields);
}
- CHECK(!self->IsExceptionPending()) << self->GetException()->Dump();
+ soa.Self()->AssertNoPendingException();
}
}
}
@@ -1494,7 +1492,7 @@
}
}
// Clear any class not found or verification exceptions.
- self->ClearException();
+ soa.Self()->ClearException();
}
void CompilerDriver::InitializeClasses(jobject jni_class_loader, const DexFile& dex_file,
@@ -1651,7 +1649,7 @@
if (self->IsExceptionPending()) {
ScopedObjectAccess soa(self);
LOG(FATAL) << "Unexpected exception compiling: " << PrettyMethod(method_idx, dex_file) << "\n"
- << self->GetException()->Dump();
+ << self->GetException(NULL)->Dump();
}
}