Initialize runtime native methods before executing any clinit. am: 0e85004ab3 am: bdf12cbab0 am: 2c60f9d763
Original change: https://android-review.googlesource.com/c/platform/art/+/2469484
Change-Id: Id67fc15859a3937d16ea8044f7b6f4296d1e9336
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 86c7772..b84eca8 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -969,6 +969,9 @@
started_ = true;
+ // Before running any clinit, set up the native methods provided by the runtime itself.
+ RegisterRuntimeNativeMethods(self->GetJniEnv());
+
class_linker_->RunEarlyRootClinits(self);
InitializeIntrinsics();
@@ -2181,9 +2184,6 @@
// Must be in the kNative state for calling native methods (JNI_OnLoad code).
CHECK_EQ(self->GetState(), ThreadState::kNative);
- // Set up the native methods provided by the runtime itself.
- RegisterRuntimeNativeMethods(env);
-
// Then set up libjavacore / libopenjdk / libicu_jni ,which are just
// a regular JNI libraries with a regular JNI_OnLoad. Most JNI libraries can
// just use System.loadLibrary, but libcore can't because it's the library