Improve debug-ability of native method registration
If we fail to register a native we construct a stack trace which needs
Throwable and stack trace support. Registering Throwable's natives first
and making Throwable a root supports this. Previously we could only
generate a stack trace when thread start up was complete.
Change-Id: Icc7c1657988c7f36aceb1d4f3e61e7218f55e055
diff --git a/src/object.h b/src/object.h
index e9556ef..c2f8cc1 100644
--- a/src/object.h
+++ b/src/object.h
@@ -2278,6 +2278,15 @@
// in cases like the verifier where the checks cannot fail and initCause isn't overridden.
void SetCause(Throwable* cause);
bool IsCheckedException() const;
+
+ static Class* GetJavaLangThrowable() {
+ DCHECK(java_lang_Throwable_ != NULL);
+ return java_lang_Throwable_;
+ }
+
+ static void SetClass(Class* java_lang_Throwable);
+ static void ResetClass();
+
private:
Object* GetStackState() const {
return GetFieldObject<Object*>(OFFSET_OF_OBJECT_MEMBER(Throwable, stack_state_), true);
@@ -2290,6 +2299,8 @@
Object* stack_trace_;
Object* suppressed_exceptions_;
+ static Class* java_lang_Throwable_;
+
friend struct ThrowableOffsets; // for verifying offset information
DISALLOW_IMPLICIT_CONSTRUCTORS(Throwable);
};