ART: Add unstarted-runtime functions
Add more functions to allow compile-time initialization of
code.
Bug: 27248115
Change-Id: Iaf8d92deb73547ccd31c0d6dde68da3bc14c3985
diff --git a/runtime/mirror/abstract_method.cc b/runtime/mirror/abstract_method.cc
index 91a9870..5a07dee 100644
--- a/runtime/mirror/abstract_method.cc
+++ b/runtime/mirror/abstract_method.cc
@@ -21,25 +21,36 @@
namespace art {
namespace mirror {
+template <bool kTransactionActive>
bool AbstractMethod::CreateFromArtMethod(ArtMethod* method) {
- auto* interface_method = method->GetInterfaceMethodIfProxy(sizeof(void*));
- SetArtMethod(method);
- SetFieldObject<false>(DeclaringClassOffset(), method->GetDeclaringClass());
- SetFieldObject<false>(
+ auto* interface_method = method->GetInterfaceMethodIfProxy(
+ kTransactionActive
+ ? Runtime::Current()->GetClassLinker()->GetImagePointerSize()
+ : sizeof(void*));
+ SetArtMethod<kTransactionActive>(method);
+ SetFieldObject<kTransactionActive>(DeclaringClassOffset(), method->GetDeclaringClass());
+ SetFieldObject<kTransactionActive>(
DeclaringClassOfOverriddenMethodOffset(), interface_method->GetDeclaringClass());
- SetField32<false>(AccessFlagsOffset(), method->GetAccessFlags());
- SetField32<false>(DexMethodIndexOffset(), method->GetDexMethodIndex());
+ SetField32<kTransactionActive>(AccessFlagsOffset(), method->GetAccessFlags());
+ SetField32<kTransactionActive>(DexMethodIndexOffset(), method->GetDexMethodIndex());
return true;
}
+template bool AbstractMethod::CreateFromArtMethod<false>(ArtMethod* method);
+template bool AbstractMethod::CreateFromArtMethod<true>(ArtMethod* method);
+
ArtMethod* AbstractMethod::GetArtMethod() {
return reinterpret_cast<ArtMethod*>(GetField64(ArtMethodOffset()));
}
+template <bool kTransactionActive>
void AbstractMethod::SetArtMethod(ArtMethod* method) {
- SetField64<false>(ArtMethodOffset(), reinterpret_cast<uint64_t>(method));
+ SetField64<kTransactionActive>(ArtMethodOffset(), reinterpret_cast<uint64_t>(method));
}
+template void AbstractMethod::SetArtMethod<false>(ArtMethod* method);
+template void AbstractMethod::SetArtMethod<true>(ArtMethod* method);
+
mirror::Class* AbstractMethod::GetDeclaringClass() {
return GetFieldObject<mirror::Class>(DeclaringClassOffset());
}