summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vladimir Marko <vmarko@google.com> 2018-06-05 14:04:13 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2018-06-05 14:04:13 +0000
commit302aa98f75213c749c9632a503a77011946b41de (patch)
tree5dc5f40e5eb509810a3a11fcc1536e2f46390292
parent75aed5d2a141fbc3b6dc3d285ffd3ed9d7261217 (diff)
parentc13fbd8596988f1daf71197008007c2eaa380585 (diff)
Merge changes I2079344d,Ie0d08494
* changes: Use pre-allocated Throwables from the boot image. Remove ClassLinker::array_iftable_.
-rw-r--r--dex2oat/linker/image_writer.cc8
-rw-r--r--oatdump/oatdump.cc12
-rw-r--r--patchoat/patchoat.cc2
-rw-r--r--runtime/class_linker.cc29
-rw-r--r--runtime/class_linker.h5
-rw-r--r--runtime/gc/space/image_space.cc2
-rw-r--r--runtime/image-inl.h7
-rw-r--r--runtime/image.cc2
-rw-r--r--runtime/image.h11
-rw-r--r--runtime/mirror/class.cc2
-rw-r--r--runtime/runtime.cc102
-rw-r--r--runtime/runtime.h5
12 files changed, 109 insertions, 78 deletions
diff --git a/dex2oat/linker/image_writer.cc b/dex2oat/linker/image_writer.cc
index 028de34e96..dc0709013c 100644
--- a/dex2oat/linker/image_writer.cc
+++ b/dex2oat/linker/image_writer.cc
@@ -1342,6 +1342,14 @@ ObjectArray<Object>* ImageWriter::CreateImageRoots(size_t oat_index) const {
ObjectArray<Object>::Alloc(self, object_array_class.Get(), image_roots_size)));
image_roots->Set<false>(ImageHeader::kDexCaches, dex_caches.Get());
image_roots->Set<false>(ImageHeader::kClassRoots, class_linker->GetClassRoots());
+ image_roots->Set<false>(ImageHeader::kOomeWhenThrowingException,
+ runtime->GetPreAllocatedOutOfMemoryErrorWhenThrowingException());
+ image_roots->Set<false>(ImageHeader::kOomeWhenThrowingOome,
+ runtime->GetPreAllocatedOutOfMemoryErrorWhenThrowingOOME());
+ image_roots->Set<false>(ImageHeader::kOomeWhenHandlingStackOverflow,
+ runtime->GetPreAllocatedOutOfMemoryErrorWhenHandlingStackOverflow());
+ image_roots->Set<false>(ImageHeader::kNoClassDefFoundError,
+ runtime->GetPreAllocatedNoClassDefFoundError());
// image_roots[ImageHeader::kClassLoader] will be set later for app image.
static_assert(ImageHeader::kClassLoader + 1u == ImageHeader::kImageRootsMax,
"Class loader should be the last image root.");
diff --git a/oatdump/oatdump.cc b/oatdump/oatdump.cc
index 7ac9e984ff..7b72e189b9 100644
--- a/oatdump/oatdump.cc
+++ b/oatdump/oatdump.cc
@@ -105,6 +105,10 @@ const char* image_methods_descriptions_[] = {
const char* image_roots_descriptions_[] = {
"kDexCaches",
"kClassRoots",
+ "kOomeWhenThrowingException",
+ "kOomeWhenThrowingOome",
+ "kOomeWhenHandlingStackOverflow",
+ "kNoClassDefFoundError",
"kClassLoader",
};
@@ -1942,17 +1946,17 @@ class ImageDumper {
os << "COMPILE PIC: " << (image_header_.CompilePic() ? "yes" : "no") << "\n\n";
{
- os << "ROOTS: " << reinterpret_cast<void*>(image_header_.GetImageRoots()) << "\n";
+ os << "ROOTS: " << reinterpret_cast<void*>(image_header_.GetImageRoots().Ptr()) << "\n";
static_assert(arraysize(image_roots_descriptions_) ==
static_cast<size_t>(ImageHeader::kImageRootsMax), "sizes must match");
DCHECK_LE(image_header_.GetImageRoots()->GetLength(), ImageHeader::kImageRootsMax);
for (int32_t i = 0, size = image_header_.GetImageRoots()->GetLength(); i != size; ++i) {
ImageHeader::ImageRoot image_root = static_cast<ImageHeader::ImageRoot>(i);
const char* image_root_description = image_roots_descriptions_[i];
- mirror::Object* image_root_object = image_header_.GetImageRoot(image_root);
- indent_os << StringPrintf("%s: %p\n", image_root_description, image_root_object);
+ ObjPtr<mirror::Object> image_root_object = image_header_.GetImageRoot(image_root);
+ indent_os << StringPrintf("%s: %p\n", image_root_description, image_root_object.Ptr());
if (image_root_object != nullptr && image_root_object->IsObjectArray()) {
- mirror::ObjectArray<mirror::Object>* image_root_object_array
+ ObjPtr<mirror::ObjectArray<mirror::Object>> image_root_object_array
= image_root_object->AsObjectArray<mirror::Object>();
ScopedIndentation indent2(&vios_);
for (int j = 0; j < image_root_object_array->GetLength(); j++) {
diff --git a/patchoat/patchoat.cc b/patchoat/patchoat.cc
index a6d3903f19..3c0b3e42c9 100644
--- a/patchoat/patchoat.cc
+++ b/patchoat/patchoat.cc
@@ -973,7 +973,7 @@ bool PatchOat::PatchImage(bool primary_image) {
ImageHeader* image_header = reinterpret_cast<ImageHeader*>(image_->Begin());
CHECK_GT(image_->Size(), sizeof(ImageHeader));
// These are the roots from the original file.
- auto* img_roots = image_header->GetImageRoots();
+ mirror::ObjectArray<mirror::Object>* img_roots = image_header->GetImageRoots().Ptr();
image_header->RelocateImage(delta_);
PatchArtFields(image_header);
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index fd10f3b5e6..6933174d8b 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -198,8 +198,7 @@ static void HandleEarlierVerifyError(Thread* self,
}
} else {
// Previous error has been stored as an instance. Just rethrow.
- ObjPtr<mirror::Class> throwable_class =
- self->DecodeJObject(WellKnownClasses::java_lang_Throwable)->AsClass();
+ ObjPtr<mirror::Class> throwable_class = GetClassRoot<mirror::Throwable>(class_linker);
ObjPtr<mirror::Class> error_class = obj->GetClass();
CHECK(throwable_class->IsAssignableFrom(error_class));
self->SetException(obj->AsThrowable());
@@ -377,7 +376,6 @@ ClassLinker::ClassLinker(InternTable* intern_table)
: boot_class_table_(new ClassTable()),
failed_dex_cache_class_lookups_(0),
class_roots_(nullptr),
- array_iftable_(nullptr),
find_array_class_cache_next_victim_(0),
init_done_(false),
log_new_roots_(false),
@@ -513,6 +511,10 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b
// Fill in the empty iftable. Needs to be done after the kObjectArrayClass root is set.
java_lang_Object->SetIfTable(AllocIfTable(self, 0));
+ // Create array interface entries to populate once we can load system classes.
+ object_array_class->SetIfTable(AllocIfTable(self, 2));
+ DCHECK_EQ(GetArrayIfTable(), object_array_class->GetIfTable());
+
// Setup the primitive type classes.
SetClassRoot(ClassRoot::kPrimitiveBoolean, CreatePrimitiveClass(self, Primitive::kPrimBoolean));
SetClassRoot(ClassRoot::kPrimitiveByte, CreatePrimitiveClass(self, Primitive::kPrimByte));
@@ -524,9 +526,6 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b
SetClassRoot(ClassRoot::kPrimitiveDouble, CreatePrimitiveClass(self, Primitive::kPrimDouble));
SetClassRoot(ClassRoot::kPrimitiveVoid, CreatePrimitiveClass(self, Primitive::kPrimVoid));
- // Create array interface entries to populate once we can load system classes.
- array_iftable_ = GcRoot<mirror::IfTable>(AllocIfTable(self, 2));
-
// Create int array type for native pointer arrays (for example vtables) on 32-bit archs.
Handle<mirror::Class> int_array_class(hs.NewHandle(
AllocClass(self, java_lang_Class.Get(), mirror::Array::ClassSize(image_pointer_size_))));
@@ -640,8 +639,8 @@ bool ClassLinker::InitWithoutImage(std::vector<std::unique_ptr<const DexFile>> b
CHECK(java_io_Serializable != nullptr);
// We assume that Cloneable/Serializable don't have superinterfaces -- normally we'd have to
// crawl up and explicitly list all of the supers as well.
- array_iftable_.Read()->SetInterface(0, java_lang_Cloneable.Get());
- array_iftable_.Read()->SetInterface(1, java_io_Serializable.Get());
+ object_array_class->GetIfTable()->SetInterface(0, java_lang_Cloneable.Get());
+ object_array_class->GetIfTable()->SetInterface(1, java_io_Serializable.Get());
// Sanity check Class[] and Object[]'s interfaces. GetDirectInterface may cause thread
// suspension.
@@ -842,7 +841,7 @@ void ClassLinker::FinishInit(Thread* self) {
// if possible add new checks there to catch errors early
}
- CHECK(!array_iftable_.IsNull());
+ CHECK(GetArrayIfTable() != nullptr);
// disable the slow paths in FindClass and CreatePrimitiveClass now
// that Object, Class, and Object[] are setup
@@ -1001,11 +1000,6 @@ bool ClassLinker::InitFromBootImage(std::string* error_msg) {
runtime->SetSentinel(heap->AllocNonMovableObject<true>(
self, java_lang_Object, java_lang_Object->GetObjectSize(), VoidFunctor()));
- // reinit array_iftable_ from any array class instance, they should be ==
- array_iftable_ =
- GcRoot<mirror::IfTable>(GetClassRoot(ClassRoot::kObjectArrayClass, this)->GetIfTable());
- DCHECK_EQ(array_iftable_.Read(), GetClassRoot(ClassRoot::kBooleanArrayClass, this)->GetIfTable());
-
for (gc::space::ImageSpace* image_space : spaces) {
// Boot class loader, use a null handle.
std::vector<std::unique_ptr<const DexFile>> dex_files;
@@ -1932,7 +1926,6 @@ void ClassLinker::VisitClassRoots(RootVisitor* visitor, VisitRootFlags flags) {
void ClassLinker::VisitRoots(RootVisitor* visitor, VisitRootFlags flags) {
class_roots_.VisitRootIfNonNull(visitor, RootInfo(kRootVMInternal));
VisitClassRoots(visitor, flags);
- array_iftable_.VisitRootIfNonNull(visitor, RootInfo(kRootVMInternal));
// Instead of visiting the find_array_class_cache_ drop it so that it doesn't prevent class
// unloading if we are marking roots.
DropFindArrayClassCache();
@@ -3540,6 +3533,10 @@ ObjPtr<mirror::Class> ClassLinker::CreatePrimitiveClass(Thread* self, Primitive:
return h_class.Get();
}
+inline ObjPtr<mirror::IfTable> ClassLinker::GetArrayIfTable() {
+ return GetClassRoot<mirror::ObjectArray<mirror::Object>>(this)->GetIfTable();
+}
+
// Create an array class (i.e. the class object for the array, not the
// array itself). "descriptor" looks like "[C" or "[[[[B" or
// "[Ljava/lang/String;".
@@ -3667,7 +3664,7 @@ ObjPtr<mirror::Class> ClassLinker::CreateArrayClass(Thread* self,
// Use the single, global copies of "interfaces" and "iftable"
// (remember not to free them for arrays).
{
- ObjPtr<mirror::IfTable> array_iftable = array_iftable_.Read();
+ ObjPtr<mirror::IfTable> array_iftable = GetArrayIfTable();
CHECK(array_iftable != nullptr);
new_class->SetIfTable(array_iftable);
}
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 548bf915dd..30c242399d 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -1272,6 +1272,8 @@ class ClassLinker {
ObjPtr<mirror::ClassLoader> class_loader)
REQUIRES_SHARED(Locks::mutator_lock_);
+ ObjPtr<mirror::IfTable> GetArrayIfTable() REQUIRES_SHARED(Locks::mutator_lock_);
+
std::vector<const DexFile*> boot_class_path_;
std::vector<std::unique_ptr<const DexFile>> boot_dex_files_;
@@ -1301,9 +1303,6 @@ class ClassLinker {
// Well known mirror::Class roots.
GcRoot<mirror::ObjectArray<mirror::Class>> class_roots_;
- // The interface table used by all arrays.
- GcRoot<mirror::IfTable> array_iftable_;
-
// A cache of the last FindArrayClass results. The cache serves to avoid creating array class
// descriptors for the sake of performing FindClass.
static constexpr size_t kFindArrayCacheSize = 16;
diff --git a/runtime/gc/space/image_space.cc b/runtime/gc/space/image_space.cc
index dbe09e8c5b..e754fbcbae 100644
--- a/runtime/gc/space/image_space.cc
+++ b/runtime/gc/space/image_space.cc
@@ -1287,7 +1287,7 @@ class ImageSpaceLoader {
bitmap->VisitMarkedRange(objects_begin, objects_end, fixup_object_visitor);
// Fixup image roots.
CHECK(app_image.InSource(reinterpret_cast<uintptr_t>(
- image_header.GetImageRoots<kWithoutReadBarrier>())));
+ image_header.GetImageRoots<kWithoutReadBarrier>().Ptr())));
image_header.RelocateImageObjects(app_image.Delta());
CHECK_EQ(image_header.GetImageBegin(), target_base);
// Fix up dex cache DexFile pointers.
diff --git a/runtime/image-inl.h b/runtime/image-inl.h
index 3a66a34cb3..c527f6fbcc 100644
--- a/runtime/image-inl.h
+++ b/runtime/image-inl.h
@@ -23,18 +23,19 @@
#include "imt_conflict_table.h"
#include "imtable.h"
#include "mirror/object_array-inl.h"
+#include "obj_ptr-inl.h"
#include "read_barrier-inl.h"
namespace art {
template <ReadBarrierOption kReadBarrierOption>
-inline mirror::Object* ImageHeader::GetImageRoot(ImageRoot image_root) const {
- mirror::ObjectArray<mirror::Object>* image_roots = GetImageRoots<kReadBarrierOption>();
+inline ObjPtr<mirror::Object> ImageHeader::GetImageRoot(ImageRoot image_root) const {
+ ObjPtr<mirror::ObjectArray<mirror::Object>> image_roots = GetImageRoots<kReadBarrierOption>();
return image_roots->Get<kVerifyNone, kReadBarrierOption>(static_cast<int32_t>(image_root));
}
template <ReadBarrierOption kReadBarrierOption>
-inline mirror::ObjectArray<mirror::Object>* ImageHeader::GetImageRoots() const {
+inline ObjPtr<mirror::ObjectArray<mirror::Object>> ImageHeader::GetImageRoots() const {
// Need a read barrier as it's not visited during root scan.
// Pass in the address of the local variable to the read barrier
// rather than image_roots_ because it won't move (asserted below)
diff --git a/runtime/image.cc b/runtime/image.cc
index 7ad2e7bf95..17fc664bd7 100644
--- a/runtime/image.cc
+++ b/runtime/image.cc
@@ -26,7 +26,7 @@
namespace art {
const uint8_t ImageHeader::kImageMagic[] = { 'a', 'r', 't', '\n' };
-const uint8_t ImageHeader::kImageVersion[] = { '0', '6', '0', '\0' }; // ClassRoot::MethodHandle.
+const uint8_t ImageHeader::kImageVersion[] = { '0', '6', '1', '\0' }; // Pre-allocated Throwables.
ImageHeader::ImageHeader(uint32_t image_begin,
uint32_t image_size,
diff --git a/runtime/image.h b/runtime/image.h
index 8acd5bc4c4..c6fc052a60 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -27,6 +27,7 @@ namespace art {
class ArtField;
class ArtMethod;
+template <class MirrorType> class ObjPtr;
namespace linker {
class ImageWriter;
@@ -206,7 +207,11 @@ class PACKED(4) ImageHeader {
enum ImageRoot {
kDexCaches,
kClassRoots,
- kClassLoader, // App image only.
+ kOomeWhenThrowingException, // Pre-allocated OOME when throwing exception.
+ kOomeWhenThrowingOome, // Pre-allocated OOME when throwing OOME.
+ kOomeWhenHandlingStackOverflow, // Pre-allocated OOME when handling StackOverflowError.
+ kNoClassDefFoundError, // Pre-allocated NoClassDefFoundError.
+ kClassLoader, // App image only.
kImageRootsMax,
};
@@ -277,11 +282,11 @@ class PACKED(4) ImageHeader {
}
template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- mirror::Object* GetImageRoot(ImageRoot image_root) const
+ ObjPtr<mirror::Object> GetImageRoot(ImageRoot image_root) const
REQUIRES_SHARED(Locks::mutator_lock_);
template <ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
- mirror::ObjectArray<mirror::Object>* GetImageRoots() const
+ ObjPtr<mirror::ObjectArray<mirror::Object>> GetImageRoots() const
REQUIRES_SHARED(Locks::mutator_lock_);
void RelocateImage(off_t delta);
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 227ace08c2..44b0c2b007 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -419,7 +419,7 @@ bool Class::IsInSamePackage(ObjPtr<Class> that) {
}
bool Class::IsThrowableClass() {
- return WellKnownClasses::ToClass(WellKnownClasses::java_lang_Throwable)->IsAssignableFrom(this);
+ return GetClassRoot<mirror::Throwable>()->IsAssignableFrom(this);
}
void Class::SetClassLoader(ObjPtr<ClassLoader> new_class_loader) {
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 0d9d16cd01..1e327fc8ed 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1090,6 +1090,17 @@ void Runtime::SetSentinel(mirror::Object* sentinel) {
sentinel_ = GcRoot<mirror::Object>(sentinel);
}
+static inline void InitPreAllocatedException(Thread* self,
+ GcRoot<mirror::Throwable>* exception,
+ const char* exception_class_descriptor,
+ const char* msg)
+ REQUIRES_SHARED(Locks::mutator_lock_) {
+ DCHECK_EQ(self, Thread::Current());
+ self->ThrowNewException(exception_class_descriptor, msg);
+ *exception = GcRoot<mirror::Throwable>(self->GetException());
+ self->ClearException();
+}
+
bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
// (b/30160149): protect subprocesses from modifications to LD_LIBRARY_PATH, etc.
// Take a snapshot of the environment at the time the runtime was created, for use by Exec, etc.
@@ -1505,34 +1516,54 @@ bool Runtime::Init(RuntimeArgumentMap&& runtime_options_in) {
// TODO: move this to just be an Trace::Start argument
Trace::SetDefaultClockSource(runtime_options.GetOrDefault(Opt::ProfileClock));
- // Pre-allocate an OutOfMemoryError for the case when we fail to
- // allocate the exception to be thrown.
- InitPreAllocatedException(self,
- &Runtime::pre_allocated_OutOfMemoryError_when_throwing_exception_,
- "Ljava/lang/OutOfMemoryError;",
- "OutOfMemoryError thrown while trying to throw an exception; "
- "no stack trace available");
- // Pre-allocate an OutOfMemoryError for the double-OOME case.
- InitPreAllocatedException(self,
- &Runtime::pre_allocated_OutOfMemoryError_when_throwing_oome_,
- "Ljava/lang/OutOfMemoryError;",
- "OutOfMemoryError thrown while trying to throw OutOfMemoryError; "
- "no stack trace available");
- // Pre-allocate an OutOfMemoryError for the case when we fail to
- // allocate while handling a stack overflow.
- InitPreAllocatedException(self,
- &Runtime::pre_allocated_OutOfMemoryError_when_handling_stack_overflow_,
- "Ljava/lang/OutOfMemoryError;",
- "OutOfMemoryError thrown while trying to handle a stack overflow; "
- "no stack trace available");
-
- // Pre-allocate a NoClassDefFoundError for the common case of failing to find a system class
- // ahead of checking the application's class loader.
- InitPreAllocatedException(self,
- &Runtime::pre_allocated_NoClassDefFoundError_,
- "Ljava/lang/NoClassDefFoundError;",
- "Class not found using the boot class loader; "
- "no stack trace available");
+ if (GetHeap()->HasBootImageSpace()) {
+ const ImageHeader& image_header = GetHeap()->GetBootImageSpaces()[0]->GetImageHeader();
+ pre_allocated_OutOfMemoryError_when_throwing_exception_ = GcRoot<mirror::Throwable>(
+ image_header.GetImageRoot(ImageHeader::kOomeWhenThrowingException)->AsThrowable());
+ DCHECK(pre_allocated_OutOfMemoryError_when_throwing_exception_.Read()->GetClass()
+ ->DescriptorEquals("Ljava/lang/OutOfMemoryError;"));
+ pre_allocated_OutOfMemoryError_when_throwing_oome_ = GcRoot<mirror::Throwable>(
+ image_header.GetImageRoot(ImageHeader::kOomeWhenThrowingOome)->AsThrowable());
+ DCHECK(pre_allocated_OutOfMemoryError_when_throwing_oome_.Read()->GetClass()
+ ->DescriptorEquals("Ljava/lang/OutOfMemoryError;"));
+ pre_allocated_OutOfMemoryError_when_handling_stack_overflow_ = GcRoot<mirror::Throwable>(
+ image_header.GetImageRoot(ImageHeader::kOomeWhenHandlingStackOverflow)->AsThrowable());
+ DCHECK(pre_allocated_OutOfMemoryError_when_handling_stack_overflow_.Read()->GetClass()
+ ->DescriptorEquals("Ljava/lang/OutOfMemoryError;"));
+ pre_allocated_NoClassDefFoundError_ = GcRoot<mirror::Throwable>(
+ image_header.GetImageRoot(ImageHeader::kNoClassDefFoundError)->AsThrowable());
+ DCHECK(pre_allocated_NoClassDefFoundError_.Read()->GetClass()
+ ->DescriptorEquals("Ljava/lang/NoClassDefFoundError;"));
+ } else {
+ // Pre-allocate an OutOfMemoryError for the case when we fail to
+ // allocate the exception to be thrown.
+ InitPreAllocatedException(self,
+ &pre_allocated_OutOfMemoryError_when_throwing_exception_,
+ "Ljava/lang/OutOfMemoryError;",
+ "OutOfMemoryError thrown while trying to throw an exception; "
+ "no stack trace available");
+ // Pre-allocate an OutOfMemoryError for the double-OOME case.
+ InitPreAllocatedException(self,
+ &pre_allocated_OutOfMemoryError_when_throwing_oome_,
+ "Ljava/lang/OutOfMemoryError;",
+ "OutOfMemoryError thrown while trying to throw OutOfMemoryError; "
+ "no stack trace available");
+ // Pre-allocate an OutOfMemoryError for the case when we fail to
+ // allocate while handling a stack overflow.
+ InitPreAllocatedException(self,
+ &pre_allocated_OutOfMemoryError_when_handling_stack_overflow_,
+ "Ljava/lang/OutOfMemoryError;",
+ "OutOfMemoryError thrown while trying to handle a stack overflow; "
+ "no stack trace available");
+
+ // Pre-allocate a NoClassDefFoundError for the common case of failing to find a system class
+ // ahead of checking the application's class loader.
+ InitPreAllocatedException(self,
+ &pre_allocated_NoClassDefFoundError_,
+ "Ljava/lang/NoClassDefFoundError;",
+ "Class not found using the boot class loader; "
+ "no stack trace available");
+ }
// Runtime initialization is largely done now.
// We load plugins first since that can modify the runtime state slightly.
@@ -1682,16 +1713,6 @@ void Runtime::AttachAgent(JNIEnv* env, const std::string& agent_arg, jobject cla
}
}
-void Runtime::InitPreAllocatedException(Thread* self,
- GcRoot<mirror::Throwable> Runtime::* exception,
- const char* exception_class_descriptor,
- const char* msg) {
- DCHECK_EQ(self, Thread::Current());
- self->ThrowNewException(exception_class_descriptor, msg);
- this->*exception = GcRoot<mirror::Throwable>(self->GetException());
- self->ClearException();
-}
-
void Runtime::InitNativeMethods() {
VLOG(startup) << "Runtime::InitNativeMethods entering";
Thread* self = Thread::Current();
@@ -2048,9 +2069,10 @@ void Runtime::VisitImageRoots(RootVisitor* visitor) {
auto* image_space = space->AsImageSpace();
const auto& image_header = image_space->GetImageHeader();
for (int32_t i = 0, size = image_header.GetImageRoots()->GetLength(); i != size; ++i) {
- auto* obj = image_header.GetImageRoot(static_cast<ImageHeader::ImageRoot>(i));
+ mirror::Object* obj =
+ image_header.GetImageRoot(static_cast<ImageHeader::ImageRoot>(i)).Ptr();
if (obj != nullptr) {
- auto* after_obj = obj;
+ mirror::Object* after_obj = obj;
visitor->VisitRoot(&after_obj, RootInfo(kRootStickyClass));
CHECK_EQ(after_obj, obj);
}
diff --git a/runtime/runtime.h b/runtime/runtime.h
index 10f72e7c5b..d85490c0a6 100644
--- a/runtime/runtime.h
+++ b/runtime/runtime.h
@@ -774,11 +774,6 @@ class Runtime {
bool Init(RuntimeArgumentMap&& runtime_options)
SHARED_TRYLOCK_FUNCTION(true, Locks::mutator_lock_);
- void InitPreAllocatedException(Thread* self,
- GcRoot<mirror::Throwable> Runtime::* exception,
- const char* exception_class_descriptor,
- const char* msg)
- REQUIRES_SHARED(Locks::mutator_lock_);
void InitNativeMethods() REQUIRES(!Locks::mutator_lock_);
void RegisterRuntimeNativeMethods(JNIEnv* env);