unstarted_runtime: Add additional cutouts
These allow us to initialize a further 90 classes. getIntVolatile
was used by the static initializer for ThreadLocal, which is used
quite frequently. This class was compile time initializable for M.
java.lang.System.getSecurityManager : 5 classes
sun.misc.Unsafe.getIntVolatile : 85 classes
bug: 27265238
Change-Id: I7e9820112bc87aec47c9b1b40ec6ba4f56172916
diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc
index eaea01d..30733b5 100644
--- a/runtime/interpreter/unstarted_runtime.cc
+++ b/runtime/interpreter/unstarted_runtime.cc
@@ -444,6 +444,12 @@
UnstartedRuntime::UnstartedSystemArraycopy(self, shadow_frame, result, arg_offset);
}
+void UnstartedRuntime::UnstartedSystemGetSecurityManager(
+ Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame ATTRIBUTE_UNUSED,
+ JValue* result, size_t arg_offset ATTRIBUTE_UNUSED) {
+ result->SetL(nullptr);
+}
+
void UnstartedRuntime::UnstartedThreadLocalGet(
Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset ATTRIBUTE_UNUSED) {
std::string caller(PrettyMethod(shadow_frame->GetLink()->GetMethod()));
@@ -1234,6 +1240,19 @@
result->SetZ(success ? JNI_TRUE : JNI_FALSE);
}
+void UnstartedRuntime::UnstartedJNIUnsafeGetIntVolatile(
+ Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED,
+ uint32_t* args, JValue* result) {
+ mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]);
+ if (obj == nullptr) {
+ AbortTransactionOrFail(self, "Cannot access null object, retry at runtime.");
+ return;
+ }
+
+ jlong offset = (static_cast<uint64_t>(args[2]) << 32) | args[1];
+ result->SetI(obj->GetField32Volatile(MemberOffset(offset)));
+}
+
void UnstartedRuntime::UnstartedJNIUnsafePutObject(
Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result ATTRIBUTE_UNUSED) {