summaryrefslogtreecommitdiff
path: root/src/exception_test.cc
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2012-07-19 15:28:27 -0700
committer Ian Rogers <irogers@google.com> 2012-08-14 10:45:52 -0700
commit00f7d0eaa6bd93d33bf0c1429bf4ba0b3f28abac (patch)
tree6a2172ece15c4699e6c2a67ce76f019db0a9a21d /src/exception_test.cc
parent634ea28f78c4a138e6a1de54eae8696095422415 (diff)
Global lock levels.
Introduce the notion of the mutators/GC being a shared-exclusive (aka reader-writer) lock. Introduce globally ordered locks, analysable by annotalysis, statically at compile time. Add locking attributes to methods. More subtly, remove the heap_lock_ and split between various locks that are held for smaller periods (where work doesn't get blocked). Remove buggy Dalvik style thread transitions. Make GC use CMS in all cases when concurrent is enabled. Fix bug where suspend counts rather than debug suspend counts were sent to JDWP. Move the PathClassLoader to WellKnownClasses. In debugger refactor calls to send request and possibly suspend. Break apart different VmWait thread states. Move identity hash code to a shared method. Change-Id: Icdbfc3ce3fcccd14341860ac7305d8e97b51f5c6
Diffstat (limited to 'src/exception_test.cc')
-rw-r--r--src/exception_test.cc16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/exception_test.cc b/src/exception_test.cc
index 5c7e1a635c..06ae7fb139 100644
--- a/src/exception_test.cc
+++ b/src/exception_test.cc
@@ -19,7 +19,7 @@
#include "dex_file.h"
#include "gtest/gtest.h"
#include "runtime.h"
-#include "scoped_jni_thread_state.h"
+#include "scoped_thread_state_change.h"
#include "thread.h"
#include "UniquePtr.h"
@@ -30,7 +30,8 @@ class ExceptionTest : public CommonTest {
virtual void SetUp() {
CommonTest::SetUp();
- SirtRef<ClassLoader> class_loader(LoadDex("ExceptionHandle"));
+ ScopedObjectAccess soa(Thread::Current());
+ SirtRef<ClassLoader> class_loader(soa.Decode<ClassLoader*>(LoadDex("ExceptionHandle")));
my_klass_ = class_linker_->FindClass("LExceptionHandle;", class_loader.get());
ASSERT_TRUE(my_klass_ != NULL);
class_linker_->EnsureInitialized(my_klass_, false, true);
@@ -116,7 +117,11 @@ TEST_F(ExceptionTest, FindCatchHandler) {
}
TEST_F(ExceptionTest, StackTraceElement) {
+ Thread::Current()->TransitionFromSuspendedToRunnable();
runtime_->Start();
+ Thread* thread = Thread::Current();
+ JNIEnv* env = thread->GetJniEnv();
+ ScopedObjectAccess soa(env);
std::vector<uintptr_t> fake_stack;
ASSERT_EQ(kStackAlignment, 16);
@@ -149,7 +154,6 @@ TEST_F(ExceptionTest, StackTraceElement) {
fake_stack.push_back(0);
// Set up thread to appear as if we called out of method_g_ at pc dex 3
- Thread* thread = Thread::Current();
thread->SetTopOfStack(&fake_stack[0], method_g_->ToNativePC(dex_pc) + 2); // return pc
#else
// Create/push fake 20-byte shadow frame for method g
@@ -171,14 +175,12 @@ TEST_F(ExceptionTest, StackTraceElement) {
thread->PushShadowFrame(reinterpret_cast<ShadowFrame*>(&fake_stack[0]));
#endif
- JNIEnv* env = thread->GetJniEnv();
- ScopedJniThreadState ts(env);
- jobject internal = thread->CreateInternalStackTrace(ts);
+ jobject internal = thread->CreateInternalStackTrace(soa);
ASSERT_TRUE(internal != NULL);
jobjectArray ste_array = Thread::InternalStackTraceToStackTraceElementArray(env, internal);
ASSERT_TRUE(ste_array != NULL);
ObjectArray<StackTraceElement>* trace_array =
- ts.Decode<ObjectArray<StackTraceElement>*>(ste_array);
+ soa.Decode<ObjectArray<StackTraceElement>*>(ste_array);
ASSERT_TRUE(trace_array != NULL);
ASSERT_TRUE(trace_array->Get(0) != NULL);