Replace String CharArray with internal uint16_t array.
Summary of high level changes:
- Adds compiler inliner support to identify string init methods
- Adds compiler support (quick & optimizing) with new invoke code path
that calls method off the thread pointer
- Adds thread entrypoints for all string init methods
- Adds map to verifier to log when receiver of string init has been
copied to other registers. used by compiler and interpreter
Change-Id: I797b992a8feb566f9ad73060011ab6f51eb7ce01
diff --git a/runtime/reflection.cc b/runtime/reflection.cc
index a2ce0cb..329ceb5 100644
--- a/runtime/reflection.cc
+++ b/runtime/reflection.cc
@@ -564,14 +564,21 @@
mirror::Object* receiver = nullptr;
if (!m->IsStatic()) {
- // Check that the receiver is non-null and an instance of the field's declaring class.
- receiver = soa.Decode<mirror::Object*>(javaReceiver);
- if (!VerifyObjectIsClass(receiver, declaring_class)) {
- return nullptr;
- }
+ // Replace calls to String.<init> with equivalent StringFactory call.
+ if (declaring_class->IsStringClass() && m->IsConstructor()) {
+ jmethodID mid = soa.EncodeMethod(m);
+ m = soa.DecodeMethod(WellKnownClasses::StringInitToStringFactoryMethodID(mid));
+ CHECK(javaReceiver == nullptr);
+ } else {
+ // Check that the receiver is non-null and an instance of the field's declaring class.
+ receiver = soa.Decode<mirror::Object*>(javaReceiver);
+ if (!VerifyObjectIsClass(receiver, declaring_class)) {
+ return nullptr;
+ }
- // Find the actual implementation of the virtual method.
- m = receiver->GetClass()->FindVirtualMethodForVirtualOrInterface(m);
+ // Find the actual implementation of the virtual method.
+ m = receiver->GetClass()->FindVirtualMethodForVirtualOrInterface(m);
+ }
}
// Get our arrays of arguments and their types, and check they're the same size.