diff options
Diffstat (limited to 'runtime/interpreter')
-rw-r--r-- | runtime/interpreter/interpreter.h | 4 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_common.cc | 30 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_common.h | 12 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_goto_table_impl.cc | 12 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_switch_impl.cc | 12 | ||||
-rw-r--r-- | runtime/interpreter/unstarted_runtime.cc | 318 | ||||
-rw-r--r-- | runtime/interpreter/unstarted_runtime.h | 8 | ||||
-rw-r--r-- | runtime/interpreter/unstarted_runtime_list.h | 1 | ||||
-rw-r--r-- | runtime/interpreter/unstarted_runtime_test.cc | 7 |
9 files changed, 158 insertions, 246 deletions
diff --git a/runtime/interpreter/interpreter.h b/runtime/interpreter/interpreter.h index 7d634b3d25..446c5bb4a5 100644 --- a/runtime/interpreter/interpreter.h +++ b/runtime/interpreter/interpreter.h @@ -22,10 +22,10 @@ namespace art { namespace mirror { -class ArtMethod; class Object; } // namespace mirror +class ArtMethod; union JValue; class ShadowFrame; class Thread; @@ -33,7 +33,7 @@ class Thread; namespace interpreter { // Called by ArtMethod::Invoke, shadow frames arguments are taken from the args array. -extern void EnterInterpreterFromInvoke(Thread* self, mirror::ArtMethod* method, +extern void EnterInterpreterFromInvoke(Thread* self, ArtMethod* method, mirror::Object* receiver, uint32_t* args, JValue* result) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 363c65afc1..1ed1a649b8 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -413,25 +413,19 @@ EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimNot) // iput-objec #undef EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL #undef EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL -uint32_t FindNextInstructionFollowingException(Thread* self, - ShadowFrame& shadow_frame, - uint32_t dex_pc, - const instrumentation::Instrumentation* instrumentation) { +uint32_t FindNextInstructionFollowingException( + Thread* self, ShadowFrame& shadow_frame, uint32_t dex_pc, + const instrumentation::Instrumentation* instrumentation) { self->VerifyStack(); - StackHandleScope<3> hs(self); + StackHandleScope<2> hs(self); Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException())); if (instrumentation->HasExceptionCaughtListeners() && self->IsExceptionThrownByCurrentMethod(exception.Get())) { instrumentation->ExceptionCaughtEvent(self, exception.Get()); } bool clear_exception = false; - uint32_t found_dex_pc; - { - Handle<mirror::Class> exception_class(hs.NewHandle(exception->GetClass())); - Handle<mirror::ArtMethod> h_method(hs.NewHandle(shadow_frame.GetMethod())); - found_dex_pc = mirror::ArtMethod::FindCatchBlock(h_method, exception_class, dex_pc, - &clear_exception); - } + uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock( + hs.NewHandle(exception->GetClass()), dex_pc, &clear_exception); if (found_dex_pc == DexFile::kDexNoIndex) { // Exception is not caught by the current method. We will unwind to the // caller. Notify any instrumentation listener. @@ -651,7 +645,7 @@ bool DoCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame, UNREACHABLE(); } // Force the use of interpreter when it is required by the debugger. - mirror::EntryPointFromInterpreter* entry; + EntryPointFromInterpreter* entry; if (UNLIKELY(Dbg::IsForcedInterpreterNeededForCalling(self, new_shadow_frame->GetMethod()))) { entry = &art::artInterpreterToInterpreterBridge; } else { @@ -668,7 +662,7 @@ bool DoCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame, shadow_frame.SetVRegReference(vregC, result->GetL()); // Overwrite all potential copies of the original result of the new-instance of string with the // new result of the StringFactory. Use the verifier to find this set of registers. - mirror::ArtMethod* method = shadow_frame.GetMethod(); + ArtMethod* method = shadow_frame.GetMethod(); MethodReference method_ref = method->ToMethodReference(); SafeMap<uint32_t, std::set<uint32_t>> string_init_map; SafeMap<uint32_t, std::set<uint32_t>>* string_init_map_ptr; @@ -788,13 +782,17 @@ void RecordArrayElementsInTransaction(mirror::Array* array, int32_t count) RecordArrayElementsInTransactionImpl(array->AsShortArray(), count); break; case Primitive::kPrimInt: - case Primitive::kPrimFloat: RecordArrayElementsInTransactionImpl(array->AsIntArray(), count); break; + case Primitive::kPrimFloat: + RecordArrayElementsInTransactionImpl(array->AsFloatArray(), count); + break; case Primitive::kPrimLong: - case Primitive::kPrimDouble: RecordArrayElementsInTransactionImpl(array->AsLongArray(), count); break; + case Primitive::kPrimDouble: + RecordArrayElementsInTransactionImpl(array->AsDoubleArray(), count); + break; default: LOG(FATAL) << "Unsupported primitive type " << primitive_component_type << " in fill-array-data"; diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h index 6acc72e4a9..6fafcd1611 100644 --- a/runtime/interpreter/interpreter_common.h +++ b/runtime/interpreter/interpreter_common.h @@ -25,6 +25,7 @@ #include <sstream> #include "art_field-inl.h" +#include "art_method-inl.h" #include "base/logging.h" #include "base/macros.h" #include "class_linker-inl.h" @@ -33,7 +34,6 @@ #include "dex_instruction-inl.h" #include "entrypoints/entrypoint_utils-inl.h" #include "handle_scope-inl.h" -#include "mirror/art_method-inl.h" #include "mirror/class-inl.h" #include "mirror/object-inl.h" #include "mirror/object_array-inl.h" @@ -41,7 +41,7 @@ #include "thread.h" #include "well_known_classes.h" -using ::art::mirror::ArtMethod; +using ::art::ArtMethod; using ::art::mirror::Array; using ::art::mirror::BooleanArray; using ::art::mirror::ByteArray; @@ -105,7 +105,7 @@ static inline bool DoInvoke(Thread* self, ShadowFrame& shadow_frame, const Instr const uint32_t method_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); const uint32_t vregC = (is_range) ? inst->VRegC_3rc() : inst->VRegC_35c(); Object* receiver = (type == kStatic) ? nullptr : shadow_frame.GetVRegReference(vregC); - mirror::ArtMethod* sf_method = shadow_frame.GetMethod(); + ArtMethod* sf_method = shadow_frame.GetMethod(); ArtMethod* const called_method = FindMethodFromCode<type, do_access_check>( method_idx, &receiver, &sf_method, self); // The shadow frame should already be pushed, so we don't need to update it. @@ -139,7 +139,8 @@ static inline bool DoInvokeVirtualQuick(Thread* self, ShadowFrame& shadow_frame, } const uint32_t vtable_idx = (is_range) ? inst->VRegB_3rc() : inst->VRegB_35c(); CHECK(receiver->GetClass()->ShouldHaveEmbeddedImtAndVTable()); - ArtMethod* const called_method = receiver->GetClass()->GetEmbeddedVTableEntry(vtable_idx); + ArtMethod* const called_method = receiver->GetClass()->GetEmbeddedVTableEntry( + vtable_idx, sizeof(void*)); if (UNLIKELY(called_method == nullptr)) { CHECK(self->IsExceptionPending()); result->SetJ(0); @@ -184,7 +185,6 @@ bool DoIPutQuick(const ShadowFrame& shadow_frame, const Instruction* inst, uint1 // java.lang.String class is initialized. static inline String* ResolveString(Thread* self, ShadowFrame& shadow_frame, uint32_t string_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - CHECK(!kMovingMethods); Class* java_lang_string_class = String::GetJavaLangString(); if (UNLIKELY(!java_lang_string_class->IsInitialized())) { ClassLinker* class_linker = Runtime::Current()->GetClassLinker(); @@ -195,7 +195,7 @@ static inline String* ResolveString(Thread* self, ShadowFrame& shadow_frame, uin return nullptr; } } - mirror::ArtMethod* method = shadow_frame.GetMethod(); + ArtMethod* method = shadow_frame.GetMethod(); mirror::Class* declaring_class = method->GetDeclaringClass(); mirror::String* s = declaring_class->GetDexCacheStrings()->Get(string_idx); if (UNLIKELY(s == nullptr)) { diff --git a/runtime/interpreter/interpreter_goto_table_impl.cc b/runtime/interpreter/interpreter_goto_table_impl.cc index dd1f55e6b2..86027c542f 100644 --- a/runtime/interpreter/interpreter_goto_table_impl.cc +++ b/runtime/interpreter/interpreter_goto_table_impl.cc @@ -1042,7 +1042,8 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF HANDLE_PENDING_EXCEPTION(); } else { int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - IntArray* array = a->AsIntArray(); + DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); + auto* array = down_cast<IntArray*>(a); if (LIKELY(array->CheckIsValidIndex(index))) { shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); ADVANCE(2); @@ -1060,7 +1061,8 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF HANDLE_PENDING_EXCEPTION(); } else { int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - LongArray* array = a->AsLongArray(); + DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); + auto* array = down_cast<LongArray*>(a); if (LIKELY(array->CheckIsValidIndex(index))) { shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); ADVANCE(2); @@ -1173,7 +1175,8 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF } else { int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - IntArray* array = a->AsIntArray(); + DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); + auto* array = down_cast<IntArray*>(a); if (LIKELY(array->CheckIsValidIndex(index))) { array->SetWithoutChecks<transaction_active>(index, val); ADVANCE(2); @@ -1192,7 +1195,8 @@ JValue ExecuteGotoImpl(Thread* self, const DexFile::CodeItem* code_item, ShadowF } else { int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data)); int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - LongArray* array = a->AsLongArray(); + DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); + auto* array = down_cast<LongArray*>(a); if (LIKELY(array->CheckIsValidIndex(index))) { array->SetWithoutChecks<transaction_active>(index, val); ADVANCE(2); diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc index 0e3420ffb5..dd7aa40368 100644 --- a/runtime/interpreter/interpreter_switch_impl.cc +++ b/runtime/interpreter/interpreter_switch_impl.cc @@ -888,7 +888,8 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, break; } int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - IntArray* array = a->AsIntArray(); + DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); + auto* array = down_cast<IntArray*>(a); if (array->CheckIsValidIndex(index)) { shadow_frame.SetVReg(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); inst = inst->Next_2xx(); @@ -906,7 +907,8 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, break; } int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - LongArray* array = a->AsLongArray(); + DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); + auto* array = down_cast<LongArray*>(a); if (array->CheckIsValidIndex(index)) { shadow_frame.SetVRegLong(inst->VRegA_23x(inst_data), array->GetWithoutChecks(index)); inst = inst->Next_2xx(); @@ -1019,7 +1021,8 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } int32_t val = shadow_frame.GetVReg(inst->VRegA_23x(inst_data)); int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - IntArray* array = a->AsIntArray(); + DCHECK(a->IsIntArray() || a->IsFloatArray()) << PrettyTypeOf(a); + auto* array = down_cast<IntArray*>(a); if (array->CheckIsValidIndex(index)) { array->SetWithoutChecks<transaction_active>(index, val); inst = inst->Next_2xx(); @@ -1038,7 +1041,8 @@ JValue ExecuteSwitchImpl(Thread* self, const DexFile::CodeItem* code_item, } int64_t val = shadow_frame.GetVRegLong(inst->VRegA_23x(inst_data)); int32_t index = shadow_frame.GetVReg(inst->VRegC_23x()); - LongArray* array = a->AsLongArray(); + DCHECK(a->IsLongArray() || a->IsDoubleArray()) << PrettyTypeOf(a); + LongArray* array = down_cast<LongArray*>(a); if (array->CheckIsValidIndex(index)) { array->SetWithoutChecks<transaction_active>(index, val); inst = inst->Next_2xx(); diff --git a/runtime/interpreter/unstarted_runtime.cc b/runtime/interpreter/unstarted_runtime.cc index 738e52beac..43e24faed3 100644 --- a/runtime/interpreter/unstarted_runtime.cc +++ b/runtime/interpreter/unstarted_runtime.cc @@ -21,6 +21,7 @@ #include "ScopedLocalRef.h" +#include "art_method-inl.h" #include "base/logging.h" #include "base/macros.h" #include "class_linker.h" @@ -29,7 +30,6 @@ #include "handle_scope-inl.h" #include "interpreter/interpreter_common.h" #include "mirror/array-inl.h" -#include "mirror/art_method-inl.h" #include "mirror/class.h" #include "mirror/field-inl.h" #include "mirror/object-inl.h" @@ -121,8 +121,7 @@ static mirror::String* GetClassName(Thread* self, ShadowFrame* shadow_frame, siz } void UnstartedRuntime::UnstartedClassForName( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { mirror::String* class_name = GetClassName(self, shadow_frame, arg_offset); if (class_name == nullptr) { return; @@ -135,8 +134,7 @@ void UnstartedRuntime::UnstartedClassForName( } void UnstartedRuntime::UnstartedClassForNameLong( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { mirror::String* class_name = GetClassName(self, shadow_frame, arg_offset); if (class_name == nullptr) { return; @@ -153,8 +151,7 @@ void UnstartedRuntime::UnstartedClassForNameLong( } void UnstartedRuntime::UnstartedClassClassForName( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { mirror::String* class_name = GetClassName(self, shadow_frame, arg_offset); if (class_name == nullptr) { return; @@ -171,9 +168,8 @@ void UnstartedRuntime::UnstartedClassClassForName( } void UnstartedRuntime::UnstartedClassNewInstance( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - StackHandleScope<3> hs(self); // Class, constructor, object. + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { + StackHandleScope<2> hs(self); // Class, constructor, object. mirror::Object* param = shadow_frame->GetVRegReference(arg_offset); if (param == nullptr) { AbortTransactionOrFail(self, "Null-pointer in Class.newInstance."); @@ -202,13 +198,13 @@ void UnstartedRuntime::UnstartedClassNewInstance( // 2) If we can't find the default constructor. We'll postpone the exception to runtime. // Note that 2) could likely be handled here, but for safety abort the transaction. bool ok = false; - if (Runtime::Current()->GetClassLinker()->EnsureInitialized(self, h_klass, true, true)) { - Handle<mirror::ArtMethod> h_cons(hs.NewHandle( - h_klass->FindDeclaredDirectMethod("<init>", "()V"))); - if (h_cons.Get() != nullptr) { + auto* cl = Runtime::Current()->GetClassLinker(); + if (cl->EnsureInitialized(self, h_klass, true, true)) { + auto* cons = h_klass->FindDeclaredDirectMethod("<init>", "()V", cl->GetImagePointerSize()); + if (cons != nullptr) { Handle<mirror::Object> h_obj(hs.NewHandle(klass->AllocObject(self))); CHECK(h_obj.Get() != nullptr); // We don't expect OOM at compile-time. - EnterInterpreterFromInvoke(self, h_cons.Get(), h_obj.Get(), nullptr, nullptr); + EnterInterpreterFromInvoke(self, cons, h_obj.Get(), nullptr, nullptr); if (!self->IsExceptionPending()) { result->SetL(h_obj.Get()); ok = true; @@ -227,8 +223,7 @@ void UnstartedRuntime::UnstartedClassNewInstance( } void UnstartedRuntime::UnstartedClassGetDeclaredField( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { // Special managed code cut-out to allow field lookup in a un-started runtime that'd fail // going the reflective Dex way. mirror::Class* klass = shadow_frame->GetVRegReference(arg_offset)->AsClass(); @@ -266,8 +261,7 @@ void UnstartedRuntime::UnstartedClassGetDeclaredField( } void UnstartedRuntime::UnstartedVmClassLoaderFindLoadedClass( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { mirror::String* class_name = shadow_frame->GetVRegReference(arg_offset + 1)->AsString(); mirror::ClassLoader* class_loader = down_cast<mirror::ClassLoader*>(shadow_frame->GetVRegReference(arg_offset)); @@ -286,11 +280,9 @@ void UnstartedRuntime::UnstartedVmClassLoaderFindLoadedClass( } } -void UnstartedRuntime::UnstartedVoidLookupType(Thread* self ATTRIBUTE_UNUSED, - ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, - JValue* result, - size_t arg_offset ATTRIBUTE_UNUSED) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedVoidLookupType( + Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, JValue* result, + size_t arg_offset ATTRIBUTE_UNUSED) { result->SetL(Runtime::Current()->GetClassLinker()->FindPrimitiveClass('V')); } @@ -324,8 +316,7 @@ static void PrimitiveArrayCopy(Thread* self, } void UnstartedRuntime::UnstartedSystemArraycopy( - Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) { // Special case array copying without initializing System. jint src_pos = shadow_frame->GetVReg(arg_offset + 1); jint dst_pos = shadow_frame->GetVReg(arg_offset + 3); @@ -410,22 +401,19 @@ void UnstartedRuntime::UnstartedSystemArraycopy( } void UnstartedRuntime::UnstartedSystemArraycopyChar( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { // Just forward. UnstartedRuntime::UnstartedSystemArraycopy(self, shadow_frame, result, arg_offset); } void UnstartedRuntime::UnstartedSystemArraycopyInt( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { // Just forward. UnstartedRuntime::UnstartedSystemArraycopy(self, shadow_frame, result, arg_offset); } void UnstartedRuntime::UnstartedThreadLocalGet( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset ATTRIBUTE_UNUSED) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset ATTRIBUTE_UNUSED) { std::string caller(PrettyMethod(shadow_frame->GetLink()->GetMethod())); bool ok = false; if (caller == "java.lang.String java.lang.IntegralToString.convertInt" @@ -450,8 +438,9 @@ void UnstartedRuntime::UnstartedThreadLocalGet( Handle<mirror::Object> h_real_to_string_obj(hs.NewHandle( h_real_to_string_class->AllocObject(self))); if (h_real_to_string_obj.Get() != nullptr) { - mirror::ArtMethod* init_method = - h_real_to_string_class->FindDirectMethod("<init>", "()V"); + auto* cl = Runtime::Current()->GetClassLinker(); + ArtMethod* init_method = h_real_to_string_class->FindDirectMethod( + "<init>", "()V", cl->GetImagePointerSize()); if (init_method == nullptr) { h_real_to_string_class->DumpClass(LOG(FATAL), mirror::Class::kDumpClassFullDetail); } else { @@ -488,16 +477,8 @@ void UnstartedRuntime::UnstartedMathCeil( result->SetD(out); } -void UnstartedRuntime::UnstartedArtMethodGetMethodName( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - mirror::ArtMethod* method = shadow_frame->GetVRegReference(arg_offset)->AsArtMethod(); - result->SetL(method->GetNameAsString(self)); -} - void UnstartedRuntime::UnstartedObjectHashCode( - Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { mirror::Object* obj = shadow_frame->GetVRegReference(arg_offset); result->SetI(obj->IdentityHashCode()); } @@ -537,8 +518,7 @@ static mirror::Object* GetDexFromDexCache(Thread* self, mirror::DexCache* dex_ca } void UnstartedRuntime::UnstartedDexCacheGetDexNative( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { // We will create the Dex object, but the image writer will release it before creating the // art file. mirror::Object* src = shadow_frame->GetVRegReference(arg_offset); @@ -600,26 +580,22 @@ static void UnstartedMemoryPeek( } void UnstartedRuntime::UnstartedMemoryPeekByte( - Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { UnstartedMemoryPeek(Primitive::kPrimByte, shadow_frame, result, arg_offset); } void UnstartedRuntime::UnstartedMemoryPeekShort( - Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { UnstartedMemoryPeek(Primitive::kPrimShort, shadow_frame, result, arg_offset); } void UnstartedRuntime::UnstartedMemoryPeekInt( - Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { UnstartedMemoryPeek(Primitive::kPrimInt, shadow_frame, result, arg_offset); } void UnstartedRuntime::UnstartedMemoryPeekLong( - Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { UnstartedMemoryPeek(Primitive::kPrimLong, shadow_frame, result, arg_offset); } @@ -673,18 +649,14 @@ static void UnstartedMemoryPeekArray( } void UnstartedRuntime::UnstartedMemoryPeekByteArray( - Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) { UnstartedMemoryPeekArray(Primitive::kPrimByte, self, shadow_frame, arg_offset); } // This allows reading security.properties in an unstarted runtime and initialize Security. void UnstartedRuntime::UnstartedSecurityGetSecurityPropertiesReader( - Thread* self, - ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, - JValue* result, - size_t arg_offset ATTRIBUTE_UNUSED) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, JValue* result, + size_t arg_offset ATTRIBUTE_UNUSED) { Runtime* runtime = Runtime::Current(); const std::vector<const DexFile*>& path = runtime->GetClassLinker()->GetBootClassPath(); std::string canonical(DexFile::GetDexCanonicalLocation(path[0]->GetLocation().c_str())); @@ -753,8 +725,9 @@ void UnstartedRuntime::UnstartedSecurityGetSecurityPropertiesReader( return; } - mirror::ArtMethod* constructor = h_class->FindDeclaredDirectMethod("<init>", - "(Ljava/lang/String;)V"); + auto* cl = Runtime::Current()->GetClassLinker(); + ArtMethod* constructor = h_class->FindDeclaredDirectMethod( + "<init>", "(Ljava/lang/String;)V", cl->GetImagePointerSize()); if (constructor == nullptr) { AbortTransactionOrFail(self, "Could not find StringReader constructor"); return; @@ -774,8 +747,7 @@ void UnstartedRuntime::UnstartedSecurityGetSecurityPropertiesReader( // This allows reading the new style of String objects during compilation. void UnstartedRuntime::UnstartedStringGetCharsNoCheck( - Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) { jint start = shadow_frame->GetVReg(arg_offset + 1); jint end = shadow_frame->GetVReg(arg_offset + 2); jint index = shadow_frame->GetVReg(arg_offset + 4); @@ -787,7 +759,8 @@ void UnstartedRuntime::UnstartedStringGetCharsNoCheck( DCHECK_GE(start, 0); DCHECK_GE(end, string->GetLength()); StackHandleScope<1> hs(self); - Handle<mirror::CharArray> h_char_array(hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 3)->AsCharArray())); + Handle<mirror::CharArray> h_char_array( + hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 3)->AsCharArray())); DCHECK_LE(index, h_char_array->GetLength()); DCHECK_LE(end - start, h_char_array->GetLength() - index); string->GetChars(start, end, h_char_array, index); @@ -795,8 +768,7 @@ void UnstartedRuntime::UnstartedStringGetCharsNoCheck( // This allows reading chars from the new style of String objects during compilation. void UnstartedRuntime::UnstartedStringCharAt( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { jint index = shadow_frame->GetVReg(arg_offset + 1); mirror::String* string = shadow_frame->GetVRegReference(arg_offset)->AsString(); if (string == nullptr) { @@ -808,8 +780,7 @@ void UnstartedRuntime::UnstartedStringCharAt( // This allows setting chars from the new style of String objects during compilation. void UnstartedRuntime::UnstartedStringSetCharAt( - Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) { jint index = shadow_frame->GetVReg(arg_offset + 1); jchar c = shadow_frame->GetVReg(arg_offset + 2); mirror::String* string = shadow_frame->GetVRegReference(arg_offset)->AsString(); @@ -822,13 +793,13 @@ void UnstartedRuntime::UnstartedStringSetCharAt( // This allows creating the new style of String objects during compilation. void UnstartedRuntime::UnstartedStringFactoryNewStringFromChars( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { jint offset = shadow_frame->GetVReg(arg_offset); jint char_count = shadow_frame->GetVReg(arg_offset + 1); DCHECK_GE(char_count, 0); StackHandleScope<1> hs(self); - Handle<mirror::CharArray> h_char_array(hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 2)->AsCharArray())); + Handle<mirror::CharArray> h_char_array( + hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 2)->AsCharArray())); Runtime* runtime = Runtime::Current(); gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator(); result->SetL(mirror::String::AllocFromCharArray<true>(self, char_count, h_char_array, offset, allocator)); @@ -836,8 +807,7 @@ void UnstartedRuntime::UnstartedStringFactoryNewStringFromChars( // This allows creating the new style of String objects during compilation. void UnstartedRuntime::UnstartedStringFactoryNewStringFromString( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { mirror::String* to_copy = shadow_frame->GetVRegReference(arg_offset)->AsString(); if (to_copy == nullptr) { AbortTransactionOrFail(self, "StringFactory.newStringFromString with null object"); @@ -852,14 +822,14 @@ void UnstartedRuntime::UnstartedStringFactoryNewStringFromString( } void UnstartedRuntime::UnstartedStringFastSubstring( - Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) { jint start = shadow_frame->GetVReg(arg_offset + 1); jint length = shadow_frame->GetVReg(arg_offset + 2); DCHECK_GE(start, 0); DCHECK_GE(length, 0); StackHandleScope<1> hs(self); - Handle<mirror::String> h_string(hs.NewHandle(shadow_frame->GetVRegReference(arg_offset)->AsString())); + Handle<mirror::String> h_string( + hs.NewHandle(shadow_frame->GetVRegReference(arg_offset)->AsString())); DCHECK_LE(start, h_string->GetLength()); DCHECK_LE(start + length, h_string->GetLength()); Runtime* runtime = Runtime::Current(); @@ -879,12 +849,9 @@ void UnstartedRuntime::UnstartedStringToCharArray( result->SetL(string->ToCharArray(self)); } -void UnstartedRuntime::UnstartedJNIVMRuntimeNewUnpaddedArray(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIVMRuntimeNewUnpaddedArray( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED, + uint32_t* args, JValue* result) { int32_t length = args[1]; DCHECK_GE(length, 0); mirror::Class* element_class = reinterpret_cast<mirror::Object*>(args[0])->AsClass(); @@ -896,20 +863,15 @@ void UnstartedRuntime::UnstartedJNIVMRuntimeNewUnpaddedArray(Thread* self, array_class->GetComponentSizeShift(), allocator)); } -void UnstartedRuntime::UnstartedJNIVMStackGetCallingClassLoader(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) { +void UnstartedRuntime::UnstartedJNIVMStackGetCallingClassLoader( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { result->SetL(nullptr); } -void UnstartedRuntime::UnstartedJNIVMStackGetStackClass2(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIVMStackGetStackClass2( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED, + uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { NthCallerVisitor visitor(self, 3); visitor.WalkStack(); if (visitor.caller != nullptr) { @@ -917,76 +879,56 @@ void UnstartedRuntime::UnstartedJNIVMStackGetStackClass2(Thread* self, } } -void UnstartedRuntime::UnstartedJNIMathLog(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) { +void UnstartedRuntime::UnstartedJNIMathLog( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { JValue value; value.SetJ((static_cast<uint64_t>(args[1]) << 32) | args[0]); result->SetD(log(value.GetD())); } -void UnstartedRuntime::UnstartedJNIMathExp(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) { +void UnstartedRuntime::UnstartedJNIMathExp( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { JValue value; value.SetJ((static_cast<uint64_t>(args[1]) << 32) | args[0]); result->SetD(exp(value.GetD())); } -void UnstartedRuntime::UnstartedJNIClassGetNameNative(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIClassGetNameNative( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, + uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { StackHandleScope<1> hs(self); result->SetL(mirror::Class::ComputeName(hs.NewHandle(receiver->AsClass()))); } -void UnstartedRuntime::UnstartedJNIFloatFloatToRawIntBits(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) { +void UnstartedRuntime::UnstartedJNIFloatFloatToRawIntBits( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { result->SetI(args[0]); } -void UnstartedRuntime::UnstartedJNIFloatIntBitsToFloat(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) { +void UnstartedRuntime::UnstartedJNIFloatIntBitsToFloat( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { result->SetI(args[0]); } -void UnstartedRuntime::UnstartedJNIObjectInternalClone(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIObjectInternalClone( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, + uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { result->SetL(receiver->Clone(self)); } -void UnstartedRuntime::UnstartedJNIObjectNotifyAll(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result ATTRIBUTE_UNUSED) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIObjectNotifyAll( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, + uint32_t* args ATTRIBUTE_UNUSED, JValue* result ATTRIBUTE_UNUSED) { receiver->NotifyAll(self); } -void UnstartedRuntime::UnstartedJNIStringCompareTo(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIStringCompareTo( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, uint32_t* args, + JValue* result) { mirror::String* rhs = reinterpret_cast<mirror::Object*>(args[0])->AsString(); if (rhs == nullptr) { AbortTransactionOrFail(self, "String.compareTo with null object"); @@ -994,42 +936,30 @@ void UnstartedRuntime::UnstartedJNIStringCompareTo(Thread* self, result->SetI(receiver->AsString()->CompareTo(rhs)); } -void UnstartedRuntime::UnstartedJNIStringIntern(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIStringIntern( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, + uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { result->SetL(receiver->AsString()->Intern()); } -void UnstartedRuntime::UnstartedJNIStringFastIndexOf(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIStringFastIndexOf( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, + uint32_t* args, JValue* result) { result->SetI(receiver->AsString()->FastIndexOf(args[0], args[1])); } -void UnstartedRuntime::UnstartedJNIArrayCreateMultiArray(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIArrayCreateMultiArray( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED, + uint32_t* args, JValue* result) { StackHandleScope<2> hs(self); auto h_class(hs.NewHandle(reinterpret_cast<mirror::Class*>(args[0])->AsClass())); auto h_dimensions(hs.NewHandle(reinterpret_cast<mirror::IntArray*>(args[1])->AsIntArray())); result->SetL(mirror::Array::CreateMultiArray(self, h_class, h_dimensions)); } -void UnstartedRuntime::UnstartedJNIArrayCreateObjectArray(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIArrayCreateObjectArray( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED, + uint32_t* args, JValue* result) { int32_t length = static_cast<int32_t>(args[1]); if (length < 0) { ThrowNegativeArraySizeException(length); @@ -1049,12 +979,9 @@ void UnstartedRuntime::UnstartedJNIArrayCreateObjectArray(Thread* self, result->SetL(new_array); } -void UnstartedRuntime::UnstartedJNIThrowableNativeFillInStackTrace(Thread* self, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIThrowableNativeFillInStackTrace( + Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED, + uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { ScopedObjectAccessUnchecked soa(self); if (Runtime::Current()->IsActiveTransaction()) { result->SetL(soa.Decode<mirror::Object*>(self->CreateInternalStackTrace<true>(soa))); @@ -1063,30 +990,22 @@ void UnstartedRuntime::UnstartedJNIThrowableNativeFillInStackTrace(Thread* self, } } -void UnstartedRuntime::UnstartedJNISystemIdentityHashCode(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNISystemIdentityHashCode( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]); result->SetI((obj != nullptr) ? obj->IdentityHashCode() : 0); } -void UnstartedRuntime::UnstartedJNIByteOrderIsLittleEndian(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args ATTRIBUTE_UNUSED, - JValue* result) { +void UnstartedRuntime::UnstartedJNIByteOrderIsLittleEndian( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args ATTRIBUTE_UNUSED, JValue* result) { result->SetZ(JNI_TRUE); } -void UnstartedRuntime::UnstartedJNIUnsafeCompareAndSwapInt(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIUnsafeCompareAndSwapInt( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]); jlong offset = (static_cast<uint64_t>(args[2]) << 32) | args[1]; jint expectedValue = args[3]; @@ -1102,12 +1021,9 @@ void UnstartedRuntime::UnstartedJNIUnsafeCompareAndSwapInt(Thread* self ATTRIBUT result->SetZ(success ? JNI_TRUE : JNI_FALSE); } -void UnstartedRuntime::UnstartedJNIUnsafePutObject(Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result ATTRIBUTE_UNUSED) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { +void UnstartedRuntime::UnstartedJNIUnsafePutObject( + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result ATTRIBUTE_UNUSED) { mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]); jlong offset = (static_cast<uint64_t>(args[2]) << 32) | args[1]; mirror::Object* newValue = reinterpret_cast<mirror::Object*>(args[3]); @@ -1119,24 +1035,16 @@ void UnstartedRuntime::UnstartedJNIUnsafePutObject(Thread* self ATTRIBUTE_UNUSED } void UnstartedRuntime::UnstartedJNIUnsafeGetArrayBaseOffsetForComponentType( - Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { mirror::Class* component = reinterpret_cast<mirror::Object*>(args[0])->AsClass(); Primitive::Type primitive_type = component->GetPrimitiveType(); result->SetI(mirror::Array::DataOffset(Primitive::ComponentSize(primitive_type)).Int32Value()); } void UnstartedRuntime::UnstartedJNIUnsafeGetArrayIndexScaleForComponentType( - Thread* self ATTRIBUTE_UNUSED, - mirror::ArtMethod* method ATTRIBUTE_UNUSED, - mirror::Object* receiver ATTRIBUTE_UNUSED, - uint32_t* args, - JValue* result) - SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, + mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) { mirror::Class* component = reinterpret_cast<mirror::Object*>(args[0])->AsClass(); Primitive::Type primitive_type = component->GetPrimitiveType(); result->SetI(Primitive::ComponentSize(primitive_type)); @@ -1145,7 +1053,7 @@ void UnstartedRuntime::UnstartedJNIUnsafeGetArrayIndexScaleForComponentType( typedef void (*InvokeHandler)(Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_size); -typedef void (*JNIHandler)(Thread* self, mirror::ArtMethod* method, mirror::Object* receiver, +typedef void (*JNIHandler)(Thread* self, ArtMethod* method, mirror::Object* receiver, uint32_t* args, JValue* result); static bool tables_initialized_ = false; @@ -1200,7 +1108,7 @@ void UnstartedRuntime::Invoke(Thread* self, const DexFile::CodeItem* code_item, } // Hand select a number of methods to be run in a not yet started runtime without using JNI. -void UnstartedRuntime::Jni(Thread* self, mirror::ArtMethod* method, mirror::Object* receiver, +void UnstartedRuntime::Jni(Thread* self, ArtMethod* method, mirror::Object* receiver, uint32_t* args, JValue* result) { std::string name(PrettyMethod(method)); const auto& iter = jni_handlers_.find(name); diff --git a/runtime/interpreter/unstarted_runtime.h b/runtime/interpreter/unstarted_runtime.h index a361af0542..a357d5fa18 100644 --- a/runtime/interpreter/unstarted_runtime.h +++ b/runtime/interpreter/unstarted_runtime.h @@ -24,14 +24,12 @@ namespace art { +class ArtMethod; class Thread; class ShadowFrame; namespace mirror { - -class ArtMethod; class Object; - } // namespace mirror namespace interpreter { @@ -57,7 +55,7 @@ class UnstartedRuntime { SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); static void Jni(Thread* self, - mirror::ArtMethod* method, + ArtMethod* method, mirror::Object* receiver, uint32_t* args, JValue* result) @@ -80,7 +78,7 @@ class UnstartedRuntime { // Methods that are native. #define UNSTARTED_JNI(ShortName, SigIgnored) \ static void UnstartedJNI ## ShortName(Thread* self, \ - mirror::ArtMethod* method, \ + ArtMethod* method, \ mirror::Object* receiver, \ uint32_t* args, \ JValue* result) \ diff --git a/runtime/interpreter/unstarted_runtime_list.h b/runtime/interpreter/unstarted_runtime_list.h index 8f6014c2b9..047e906614 100644 --- a/runtime/interpreter/unstarted_runtime_list.h +++ b/runtime/interpreter/unstarted_runtime_list.h @@ -31,7 +31,6 @@ V(SystemArraycopyInt, "void java.lang.System.arraycopy(int[], int, int[], int, int)") \ V(ThreadLocalGet, "java.lang.Object java.lang.ThreadLocal.get()") \ V(MathCeil, "double java.lang.Math.ceil(double)") \ - V(ArtMethodGetMethodName, "java.lang.String java.lang.reflect.ArtMethod.getMethodName(java.lang.reflect.ArtMethod)") \ V(ObjectHashCode, "int java.lang.Object.hashCode()") \ V(DoubleDoubleToRawLongBits, "long java.lang.Double.doubleToRawLongBits(double)") \ V(DexCacheGetDexNative, "com.android.dex.Dex java.lang.DexCache.getDexNative()") \ diff --git a/runtime/interpreter/unstarted_runtime_test.cc b/runtime/interpreter/unstarted_runtime_test.cc index 9179d17bf9..4b672e06f4 100644 --- a/runtime/interpreter/unstarted_runtime_test.cc +++ b/runtime/interpreter/unstarted_runtime_test.cc @@ -52,9 +52,9 @@ class UnstartedRuntimeTest : public CommonRuntimeTest { #undef UNSTARTED_DIRECT // Methods that are native. -#define UNSTARTED_JNI(Name, SigIgnored) \ +#define UNSTARTED_JNI(Name, SigIgnored) \ static void UnstartedJNI ## Name(Thread* self, \ - mirror::ArtMethod* method, \ + ArtMethod* method, \ mirror::Object* receiver, \ uint32_t* args, \ JValue* result) \ @@ -253,7 +253,8 @@ TEST_F(UnstartedRuntimeTest, StringInit) { Thread* self = Thread::Current(); ScopedObjectAccess soa(self); mirror::Class* klass = mirror::String::GetJavaLangString(); - mirror::ArtMethod* method = klass->FindDeclaredDirectMethod("<init>", "(Ljava/lang/String;)V"); + ArtMethod* method = klass->FindDeclaredDirectMethod("<init>", "(Ljava/lang/String;)V", + sizeof(void*)); // create instruction data for invoke-direct {v0, v1} of method with fake index uint16_t inst_data[3] = { 0x2070, 0x0000, 0x0010 }; |