summaryrefslogtreecommitdiffstats
path: root/runtime/runtime.cc
diff options
context:
space:
mode:
authorBrian Carlstrom <bdc@google.com>2013-10-11 00:17:42 -0700
committerBrian Carlstrom <bdc@google.com>2013-10-11 00:17:42 -0700
commit775c496f989f0e37d2e9a43274c0b55f201b4116 (patch)
treeedfd801b7081aa06016b9a16517b09653dc849b2 /runtime/runtime.cc
parent73fd3195bd1f8af54f5a6273775186974078068c (diff)
parentb926b3c6821726bf24245478cf24788c57910f0c (diff)
downloadart-775c496f989f0e37d2e9a43274c0b55f201b4116.zip
art-775c496f989f0e37d2e9a43274c0b55f201b4116.tar.gz
art-775c496f989f0e37d2e9a43274c0b55f201b4116.tar.bz2
resolved conflicts for merge of b926b3c6 to dalvik-dev
Change-Id: Ic56131b49ddfa1ffbc9b50f15e79a0210bd07a41
Diffstat (limited to 'runtime/runtime.cc')
-rw-r--r--runtime/runtime.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index a936baa..bdedef4 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -84,7 +84,6 @@ Runtime::Runtime()
java_vm_(NULL),
pre_allocated_OutOfMemoryError_(NULL),
resolution_method_(NULL),
- system_class_loader_(NULL),
threads_being_born_(0),
shutdown_cond_(new ConditionVariable("Runtime shutdown", *Locks::runtime_shutdown_lock_)),
shutting_down_(false),
@@ -101,6 +100,7 @@ Runtime::Runtime()
use_compile_time_class_path_(false),
main_thread_group_(NULL),
system_thread_group_(NULL),
+ system_class_loader_(NULL),
quick_alloc_entry_points_instrumentation_counter_(0) {
for (int i = 0; i < Runtime::kLastCalleeSaveType; i++) {
callee_save_methods_[i] = NULL;
@@ -679,9 +679,9 @@ bool Runtime::Create(const Options& options, bool ignore_unrecognized) {
return true;
}
-static void CreateSystemClassLoader() {
+jobject CreateSystemClassLoader() {
if (Runtime::Current()->UseCompileTimeClassPath()) {
- return;
+ return NULL;
}
ScopedObjectAccess soa(Thread::Current());
@@ -700,6 +700,10 @@ static void CreateSystemClassLoader() {
mirror::ClassLoader* class_loader = down_cast<mirror::ClassLoader*>(result.GetL());
CHECK(class_loader != NULL);
+ JNIEnv* env = soa.Self()->GetJniEnv();
+ ScopedLocalRef<jobject> system_class_loader(env, soa.AddLocalReference<jobject>(class_loader));
+ CHECK(system_class_loader.get() != NULL);
+
soa.Self()->SetClassLoaderOverride(class_loader);
mirror::Class* thread_class = soa.Decode<mirror::Class*>(WellKnownClasses::java_lang_Thread);
@@ -710,6 +714,8 @@ static void CreateSystemClassLoader() {
CHECK(contextClassLoader != NULL);
contextClassLoader->SetObject(soa.Self()->GetPeer(), class_loader);
+
+ return env->NewGlobalRef(system_class_loader.get());
}
bool Runtime::Start() {
@@ -742,7 +748,7 @@ bool Runtime::Start() {
StartDaemonThreads();
- CreateSystemClassLoader();
+ system_class_loader_ = CreateSystemClassLoader();
self->GetJniEnv()->locals.AssertEmpty();
@@ -1006,6 +1012,11 @@ jobject Runtime::GetSystemThreadGroup() const {
return system_thread_group_;
}
+jobject Runtime::GetSystemClassLoader() const {
+ CHECK(system_class_loader_ != NULL || IsCompiler());
+ return system_class_loader_;
+}
+
void Runtime::RegisterRuntimeNativeMethods(JNIEnv* env) {
#define REGISTER(FN) extern void FN(JNIEnv*); FN(env)
// Register Throwable first so that registration of other native methods can throw exceptions