blob: 43e24faed31c242c306a2e12f7bce54f4f04c756 [file] [log] [blame]
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001/*
2 * Copyright (C) 2015 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "unstarted_runtime.h"
18
19#include <cmath>
20#include <unordered_map>
21
Andreas Gampeaacc25d2015-04-01 14:49:06 -070022#include "ScopedLocalRef.h"
23
Mathieu Chartiere401d142015-04-22 13:56:20 -070024#include "art_method-inl.h"
Andreas Gampe2969bcd2015-03-09 12:57:41 -070025#include "base/logging.h"
26#include "base/macros.h"
27#include "class_linker.h"
28#include "common_throws.h"
29#include "entrypoints/entrypoint_utils-inl.h"
30#include "handle_scope-inl.h"
31#include "interpreter/interpreter_common.h"
32#include "mirror/array-inl.h"
Andreas Gampe2969bcd2015-03-09 12:57:41 -070033#include "mirror/class.h"
Mathieu Chartierdaaf3262015-03-24 13:30:28 -070034#include "mirror/field-inl.h"
Andreas Gampe2969bcd2015-03-09 12:57:41 -070035#include "mirror/object-inl.h"
36#include "mirror/object_array-inl.h"
37#include "mirror/string-inl.h"
38#include "nth_caller_visitor.h"
39#include "thread.h"
Sebastien Hertz2fd7e692015-04-02 11:11:19 +020040#include "transaction.h"
Andreas Gampe2969bcd2015-03-09 12:57:41 -070041#include "well_known_classes.h"
Andreas Gampef778eb22015-04-13 14:17:09 -070042#include "zip_archive.h"
Andreas Gampe2969bcd2015-03-09 12:57:41 -070043
44namespace art {
45namespace interpreter {
46
Andreas Gampe068b0c02015-03-11 12:44:47 -070047static void AbortTransactionOrFail(Thread* self, const char* fmt, ...)
Sebastien Hertz45b15972015-04-03 16:07:05 +020048 __attribute__((__format__(__printf__, 2, 3)))
49 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
50
51static void AbortTransactionOrFail(Thread* self, const char* fmt, ...) {
Andreas Gampe068b0c02015-03-11 12:44:47 -070052 va_list args;
Andreas Gampe068b0c02015-03-11 12:44:47 -070053 if (Runtime::Current()->IsActiveTransaction()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +020054 va_start(args, fmt);
55 AbortTransactionV(self, fmt, args);
Andreas Gampe068b0c02015-03-11 12:44:47 -070056 va_end(args);
57 } else {
Sebastien Hertz45b15972015-04-03 16:07:05 +020058 va_start(args, fmt);
59 std::string msg;
60 StringAppendV(&msg, fmt, args);
61 va_end(args);
62 LOG(FATAL) << "Trying to abort, but not in transaction mode: " << msg;
Andreas Gampe068b0c02015-03-11 12:44:47 -070063 UNREACHABLE();
64 }
65}
66
Andreas Gampe2969bcd2015-03-09 12:57:41 -070067// Helper function to deal with class loading in an unstarted runtime.
68static void UnstartedRuntimeFindClass(Thread* self, Handle<mirror::String> className,
69 Handle<mirror::ClassLoader> class_loader, JValue* result,
70 const std::string& method_name, bool initialize_class,
71 bool abort_if_not_found)
72 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
73 CHECK(className.Get() != nullptr);
74 std::string descriptor(DotToDescriptor(className->ToModifiedUtf8().c_str()));
75 ClassLinker* class_linker = Runtime::Current()->GetClassLinker();
76
77 mirror::Class* found = class_linker->FindClass(self, descriptor.c_str(), class_loader);
78 if (found == nullptr && abort_if_not_found) {
79 if (!self->IsExceptionPending()) {
Andreas Gampe068b0c02015-03-11 12:44:47 -070080 AbortTransactionOrFail(self, "%s failed in un-started runtime for class: %s",
81 method_name.c_str(), PrettyDescriptor(descriptor.c_str()).c_str());
Andreas Gampe2969bcd2015-03-09 12:57:41 -070082 }
83 return;
84 }
85 if (found != nullptr && initialize_class) {
86 StackHandleScope<1> hs(self);
87 Handle<mirror::Class> h_class(hs.NewHandle(found));
88 if (!class_linker->EnsureInitialized(self, h_class, true, true)) {
89 CHECK(self->IsExceptionPending());
90 return;
91 }
92 }
93 result->SetL(found);
94}
95
96// Common helper for class-loading cutouts in an unstarted runtime. We call Runtime methods that
97// rely on Java code to wrap errors in the correct exception class (i.e., NoClassDefFoundError into
98// ClassNotFoundException), so need to do the same. The only exception is if the exception is
Sebastien Hertz2fd7e692015-04-02 11:11:19 +020099// actually the transaction abort exception. This must not be wrapped, as it signals an
100// initialization abort.
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700101static void CheckExceptionGenerateClassNotFound(Thread* self)
102 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
103 if (self->IsExceptionPending()) {
Sebastien Hertz2fd7e692015-04-02 11:11:19 +0200104 // If it is not the transaction abort exception, wrap it.
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700105 std::string type(PrettyTypeOf(self->GetException()));
Sebastien Hertz2fd7e692015-04-02 11:11:19 +0200106 if (type != Transaction::kAbortExceptionDescriptor) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700107 self->ThrowNewWrappedException("Ljava/lang/ClassNotFoundException;",
108 "ClassNotFoundException");
109 }
110 }
111}
112
Andreas Gampe5d4bb1d2015-04-14 22:16:14 -0700113static mirror::String* GetClassName(Thread* self, ShadowFrame* shadow_frame, size_t arg_offset)
114 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
115 mirror::Object* param = shadow_frame->GetVRegReference(arg_offset);
116 if (param == nullptr) {
117 AbortTransactionOrFail(self, "Null-pointer in Class.forName.");
118 return nullptr;
119 }
120 return param->AsString();
121}
122
Andreas Gampe799681b2015-05-15 19:24:12 -0700123void UnstartedRuntime::UnstartedClassForName(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700124 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe5d4bb1d2015-04-14 22:16:14 -0700125 mirror::String* class_name = GetClassName(self, shadow_frame, arg_offset);
126 if (class_name == nullptr) {
127 return;
128 }
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700129 StackHandleScope<1> hs(self);
130 Handle<mirror::String> h_class_name(hs.NewHandle(class_name));
131 UnstartedRuntimeFindClass(self, h_class_name, NullHandle<mirror::ClassLoader>(), result,
132 "Class.forName", true, false);
133 CheckExceptionGenerateClassNotFound(self);
134}
135
Andreas Gampe799681b2015-05-15 19:24:12 -0700136void UnstartedRuntime::UnstartedClassForNameLong(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700137 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe5d4bb1d2015-04-14 22:16:14 -0700138 mirror::String* class_name = GetClassName(self, shadow_frame, arg_offset);
139 if (class_name == nullptr) {
Andreas Gampebf4d3af2015-04-14 10:10:33 -0700140 return;
141 }
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700142 bool initialize_class = shadow_frame->GetVReg(arg_offset + 1) != 0;
143 mirror::ClassLoader* class_loader =
144 down_cast<mirror::ClassLoader*>(shadow_frame->GetVRegReference(arg_offset + 2));
145 StackHandleScope<2> hs(self);
146 Handle<mirror::String> h_class_name(hs.NewHandle(class_name));
147 Handle<mirror::ClassLoader> h_class_loader(hs.NewHandle(class_loader));
148 UnstartedRuntimeFindClass(self, h_class_name, h_class_loader, result, "Class.forName",
149 initialize_class, false);
150 CheckExceptionGenerateClassNotFound(self);
151}
152
Andreas Gampe799681b2015-05-15 19:24:12 -0700153void UnstartedRuntime::UnstartedClassClassForName(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700154 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe5d4bb1d2015-04-14 22:16:14 -0700155 mirror::String* class_name = GetClassName(self, shadow_frame, arg_offset);
156 if (class_name == nullptr) {
157 return;
158 }
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700159 bool initialize_class = shadow_frame->GetVReg(arg_offset + 1) != 0;
160 mirror::ClassLoader* class_loader =
161 down_cast<mirror::ClassLoader*>(shadow_frame->GetVRegReference(arg_offset + 2));
162 StackHandleScope<2> hs(self);
163 Handle<mirror::String> h_class_name(hs.NewHandle(class_name));
164 Handle<mirror::ClassLoader> h_class_loader(hs.NewHandle(class_loader));
165 UnstartedRuntimeFindClass(self, h_class_name, h_class_loader, result, "Class.classForName",
166 initialize_class, false);
167 CheckExceptionGenerateClassNotFound(self);
168}
169
Andreas Gampe799681b2015-05-15 19:24:12 -0700170void UnstartedRuntime::UnstartedClassNewInstance(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700171 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
172 StackHandleScope<2> hs(self); // Class, constructor, object.
Andreas Gampe5d4bb1d2015-04-14 22:16:14 -0700173 mirror::Object* param = shadow_frame->GetVRegReference(arg_offset);
174 if (param == nullptr) {
175 AbortTransactionOrFail(self, "Null-pointer in Class.newInstance.");
176 return;
177 }
178 mirror::Class* klass = param->AsClass();
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700179 Handle<mirror::Class> h_klass(hs.NewHandle(klass));
Andreas Gampe0f7e3d62015-03-11 13:24:35 -0700180
181 // Check that it's not null.
182 if (h_klass.Get() == nullptr) {
183 AbortTransactionOrFail(self, "Class reference is null for newInstance");
184 return;
185 }
186
187 // If we're in a transaction, class must not be finalizable (it or a superclass has a finalizer).
188 if (Runtime::Current()->IsActiveTransaction()) {
189 if (h_klass.Get()->IsFinalizable()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +0200190 AbortTransactionF(self, "Class for newInstance is finalizable: '%s'",
191 PrettyClass(h_klass.Get()).c_str());
Andreas Gampe0f7e3d62015-03-11 13:24:35 -0700192 return;
193 }
194 }
195
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700196 // There are two situations in which we'll abort this run.
197 // 1) If the class isn't yet initialized and initialization fails.
198 // 2) If we can't find the default constructor. We'll postpone the exception to runtime.
199 // Note that 2) could likely be handled here, but for safety abort the transaction.
200 bool ok = false;
Mathieu Chartiere401d142015-04-22 13:56:20 -0700201 auto* cl = Runtime::Current()->GetClassLinker();
202 if (cl->EnsureInitialized(self, h_klass, true, true)) {
203 auto* cons = h_klass->FindDeclaredDirectMethod("<init>", "()V", cl->GetImagePointerSize());
204 if (cons != nullptr) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700205 Handle<mirror::Object> h_obj(hs.NewHandle(klass->AllocObject(self)));
206 CHECK(h_obj.Get() != nullptr); // We don't expect OOM at compile-time.
Mathieu Chartiere401d142015-04-22 13:56:20 -0700207 EnterInterpreterFromInvoke(self, cons, h_obj.Get(), nullptr, nullptr);
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700208 if (!self->IsExceptionPending()) {
209 result->SetL(h_obj.Get());
210 ok = true;
211 }
212 } else {
213 self->ThrowNewExceptionF("Ljava/lang/InternalError;",
214 "Could not find default constructor for '%s'",
215 PrettyClass(h_klass.Get()).c_str());
216 }
217 }
218 if (!ok) {
Andreas Gampe068b0c02015-03-11 12:44:47 -0700219 AbortTransactionOrFail(self, "Failed in Class.newInstance for '%s' with %s",
220 PrettyClass(h_klass.Get()).c_str(),
221 PrettyTypeOf(self->GetException()).c_str());
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700222 }
223}
224
Andreas Gampe799681b2015-05-15 19:24:12 -0700225void UnstartedRuntime::UnstartedClassGetDeclaredField(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700226 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700227 // Special managed code cut-out to allow field lookup in a un-started runtime that'd fail
228 // going the reflective Dex way.
229 mirror::Class* klass = shadow_frame->GetVRegReference(arg_offset)->AsClass();
230 mirror::String* name2 = shadow_frame->GetVRegReference(arg_offset + 1)->AsString();
Mathieu Chartierc7853442015-03-27 14:35:38 -0700231 ArtField* found = nullptr;
232 ArtField* fields = klass->GetIFields();
233 for (int32_t i = 0, count = klass->NumInstanceFields(); i < count; ++i) {
234 ArtField* f = &fields[i];
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700235 if (name2->Equals(f->GetName())) {
236 found = f;
Mathieu Chartierc7853442015-03-27 14:35:38 -0700237 break;
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700238 }
239 }
240 if (found == nullptr) {
241 fields = klass->GetSFields();
Mathieu Chartierc7853442015-03-27 14:35:38 -0700242 for (int32_t i = 0, count = klass->NumStaticFields(); i < count; ++i) {
243 ArtField* f = &fields[i];
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700244 if (name2->Equals(f->GetName())) {
245 found = f;
Mathieu Chartierc7853442015-03-27 14:35:38 -0700246 break;
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700247 }
248 }
249 }
Andreas Gampe068b0c02015-03-11 12:44:47 -0700250 if (found == nullptr) {
251 AbortTransactionOrFail(self, "Failed to find field in Class.getDeclaredField in un-started "
252 " runtime. name=%s class=%s", name2->ToModifiedUtf8().c_str(),
253 PrettyDescriptor(klass).c_str());
254 return;
255 }
Mathieu Chartierdaaf3262015-03-24 13:30:28 -0700256 if (Runtime::Current()->IsActiveTransaction()) {
257 result->SetL(mirror::Field::CreateFromArtField<true>(self, found, true));
258 } else {
259 result->SetL(mirror::Field::CreateFromArtField<false>(self, found, true));
260 }
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700261}
262
Andreas Gampe799681b2015-05-15 19:24:12 -0700263void UnstartedRuntime::UnstartedVmClassLoaderFindLoadedClass(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700264 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700265 mirror::String* class_name = shadow_frame->GetVRegReference(arg_offset + 1)->AsString();
266 mirror::ClassLoader* class_loader =
267 down_cast<mirror::ClassLoader*>(shadow_frame->GetVRegReference(arg_offset));
268 StackHandleScope<2> hs(self);
269 Handle<mirror::String> h_class_name(hs.NewHandle(class_name));
270 Handle<mirror::ClassLoader> h_class_loader(hs.NewHandle(class_loader));
271 UnstartedRuntimeFindClass(self, h_class_name, h_class_loader, result,
272 "VMClassLoader.findLoadedClass", false, false);
273 // This might have an error pending. But semantics are to just return null.
274 if (self->IsExceptionPending()) {
275 // If it is an InternalError, keep it. See CheckExceptionGenerateClassNotFound.
276 std::string type(PrettyTypeOf(self->GetException()));
277 if (type != "java.lang.InternalError") {
278 self->ClearException();
279 }
280 }
281}
282
Mathieu Chartiere401d142015-04-22 13:56:20 -0700283void UnstartedRuntime::UnstartedVoidLookupType(
284 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, JValue* result,
285 size_t arg_offset ATTRIBUTE_UNUSED) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700286 result->SetL(Runtime::Current()->GetClassLinker()->FindPrimitiveClass('V'));
287}
288
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700289// Arraycopy emulation.
290// Note: we can't use any fast copy functions, as they are not available under transaction.
291
292template <typename T>
293static void PrimitiveArrayCopy(Thread* self,
294 mirror::Array* src_array, int32_t src_pos,
295 mirror::Array* dst_array, int32_t dst_pos,
296 int32_t length)
297 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
298 if (src_array->GetClass()->GetComponentType() != dst_array->GetClass()->GetComponentType()) {
299 AbortTransactionOrFail(self, "Types mismatched in arraycopy: %s vs %s.",
300 PrettyDescriptor(src_array->GetClass()->GetComponentType()).c_str(),
301 PrettyDescriptor(dst_array->GetClass()->GetComponentType()).c_str());
302 return;
303 }
304 mirror::PrimitiveArray<T>* src = down_cast<mirror::PrimitiveArray<T>*>(src_array);
305 mirror::PrimitiveArray<T>* dst = down_cast<mirror::PrimitiveArray<T>*>(dst_array);
306 const bool copy_forward = (dst_pos < src_pos) || (dst_pos - src_pos >= length);
307 if (copy_forward) {
308 for (int32_t i = 0; i < length; ++i) {
309 dst->Set(dst_pos + i, src->Get(src_pos + i));
310 }
311 } else {
312 for (int32_t i = 1; i <= length; ++i) {
313 dst->Set(dst_pos + length - i, src->Get(src_pos + length - i));
314 }
315 }
316}
317
Andreas Gampe799681b2015-05-15 19:24:12 -0700318void UnstartedRuntime::UnstartedSystemArraycopy(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700319 Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700320 // Special case array copying without initializing System.
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700321 jint src_pos = shadow_frame->GetVReg(arg_offset + 1);
322 jint dst_pos = shadow_frame->GetVReg(arg_offset + 3);
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700323 jint length = shadow_frame->GetVReg(arg_offset + 4);
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700324 mirror::Array* src_array = shadow_frame->GetVRegReference(arg_offset)->AsArray();
325 mirror::Array* dst_array = shadow_frame->GetVRegReference(arg_offset + 2)->AsArray();
326
327 // Null checking.
328 if (src_array == nullptr) {
329 AbortTransactionOrFail(self, "src is null in arraycopy.");
330 return;
331 }
332 if (dst_array == nullptr) {
333 AbortTransactionOrFail(self, "dst is null in arraycopy.");
334 return;
335 }
336
337 // Bounds checking.
338 if (UNLIKELY(src_pos < 0) || UNLIKELY(dst_pos < 0) || UNLIKELY(length < 0) ||
339 UNLIKELY(src_pos > src_array->GetLength() - length) ||
340 UNLIKELY(dst_pos > dst_array->GetLength() - length)) {
341 self->ThrowNewExceptionF("Ljava/lang/ArrayIndexOutOfBoundsException;",
342 "src.length=%d srcPos=%d dst.length=%d dstPos=%d length=%d",
343 src_array->GetLength(), src_pos, dst_array->GetLength(), dst_pos,
344 length);
345 AbortTransactionOrFail(self, "Index out of bounds.");
346 return;
347 }
348
349 // Type checking.
350 mirror::Class* src_type = shadow_frame->GetVRegReference(arg_offset)->GetClass()->
351 GetComponentType();
352
353 if (!src_type->IsPrimitive()) {
354 // Check that the second type is not primitive.
355 mirror::Class* trg_type = shadow_frame->GetVRegReference(arg_offset + 2)->GetClass()->
356 GetComponentType();
357 if (trg_type->IsPrimitiveInt()) {
358 AbortTransactionOrFail(self, "Type mismatch in arraycopy: %s vs %s",
359 PrettyDescriptor(src_array->GetClass()->GetComponentType()).c_str(),
360 PrettyDescriptor(dst_array->GetClass()->GetComponentType()).c_str());
361 return;
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700362 }
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700363
364 // For simplicity only do this if the component types are the same. Otherwise we have to copy
365 // even more code from the object-array functions.
366 if (src_type != trg_type) {
367 AbortTransactionOrFail(self, "Types not the same in arraycopy: %s vs %s",
368 PrettyDescriptor(src_array->GetClass()->GetComponentType()).c_str(),
369 PrettyDescriptor(dst_array->GetClass()->GetComponentType()).c_str());
370 return;
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700371 }
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700372
373 mirror::ObjectArray<mirror::Object>* src = src_array->AsObjectArray<mirror::Object>();
374 mirror::ObjectArray<mirror::Object>* dst = dst_array->AsObjectArray<mirror::Object>();
375 if (src == dst) {
376 // Can overlap, but not have type mismatches.
377 const bool copy_forward = (dst_pos < src_pos) || (dst_pos - src_pos >= length);
378 if (copy_forward) {
379 for (int32_t i = 0; i < length; ++i) {
380 dst->Set(dst_pos + i, src->Get(src_pos + i));
381 }
382 } else {
383 for (int32_t i = 1; i <= length; ++i) {
384 dst->Set(dst_pos + length - i, src->Get(src_pos + length - i));
385 }
386 }
387 } else {
388 // Can't overlap. Would need type checks, but we abort above.
389 for (int32_t i = 0; i < length; ++i) {
390 dst->Set(dst_pos + i, src->Get(src_pos + i));
391 }
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700392 }
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700393 } else if (src_type->IsPrimitiveChar()) {
394 PrimitiveArrayCopy<uint16_t>(self, src_array, src_pos, dst_array, dst_pos, length);
395 } else if (src_type->IsPrimitiveInt()) {
396 PrimitiveArrayCopy<int32_t>(self, src_array, src_pos, dst_array, dst_pos, length);
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700397 } else {
Andreas Gampe068b0c02015-03-11 12:44:47 -0700398 AbortTransactionOrFail(self, "Unimplemented System.arraycopy for type '%s'",
Andreas Gampe8e6c3fd2015-03-11 18:34:44 -0700399 PrettyDescriptor(src_type).c_str());
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700400 }
401}
402
Andreas Gampe799681b2015-05-15 19:24:12 -0700403void UnstartedRuntime::UnstartedSystemArraycopyChar(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700404 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700405 // Just forward.
406 UnstartedRuntime::UnstartedSystemArraycopy(self, shadow_frame, result, arg_offset);
407}
408
409void UnstartedRuntime::UnstartedSystemArraycopyInt(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700410 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700411 // Just forward.
412 UnstartedRuntime::UnstartedSystemArraycopy(self, shadow_frame, result, arg_offset);
413}
414
415void UnstartedRuntime::UnstartedThreadLocalGet(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700416 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset ATTRIBUTE_UNUSED) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700417 std::string caller(PrettyMethod(shadow_frame->GetLink()->GetMethod()));
418 bool ok = false;
419 if (caller == "java.lang.String java.lang.IntegralToString.convertInt"
420 "(java.lang.AbstractStringBuilder, int)") {
421 // Allocate non-threadlocal buffer.
422 result->SetL(mirror::CharArray::Alloc(self, 11));
423 ok = true;
424 } else if (caller == "java.lang.RealToString java.lang.RealToString.getInstance()") {
425 // Note: RealToString is implemented and used in a different fashion than IntegralToString.
426 // Conversion is done over an actual object of RealToString (the conversion method is an
427 // instance method). This means it is not as clear whether it is correct to return a new
428 // object each time. The caller needs to be inspected by hand to see whether it (incorrectly)
429 // stores the object for later use.
430 // See also b/19548084 for a possible rewrite and bringing it in line with IntegralToString.
431 if (shadow_frame->GetLink()->GetLink() != nullptr) {
432 std::string caller2(PrettyMethod(shadow_frame->GetLink()->GetLink()->GetMethod()));
433 if (caller2 == "java.lang.String java.lang.Double.toString(double)") {
434 // Allocate new object.
435 StackHandleScope<2> hs(self);
436 Handle<mirror::Class> h_real_to_string_class(hs.NewHandle(
437 shadow_frame->GetLink()->GetMethod()->GetDeclaringClass()));
438 Handle<mirror::Object> h_real_to_string_obj(hs.NewHandle(
439 h_real_to_string_class->AllocObject(self)));
440 if (h_real_to_string_obj.Get() != nullptr) {
Mathieu Chartiere401d142015-04-22 13:56:20 -0700441 auto* cl = Runtime::Current()->GetClassLinker();
442 ArtMethod* init_method = h_real_to_string_class->FindDirectMethod(
443 "<init>", "()V", cl->GetImagePointerSize());
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700444 if (init_method == nullptr) {
445 h_real_to_string_class->DumpClass(LOG(FATAL), mirror::Class::kDumpClassFullDetail);
446 } else {
447 JValue invoke_result;
448 EnterInterpreterFromInvoke(self, init_method, h_real_to_string_obj.Get(), nullptr,
449 nullptr);
450 if (!self->IsExceptionPending()) {
451 result->SetL(h_real_to_string_obj.Get());
452 ok = true;
453 }
454 }
455 }
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700456 }
457 }
458 }
459
460 if (!ok) {
Andreas Gampe068b0c02015-03-11 12:44:47 -0700461 AbortTransactionOrFail(self, "Could not create RealToString object");
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700462 }
463}
464
Andreas Gampe799681b2015-05-15 19:24:12 -0700465void UnstartedRuntime::UnstartedMathCeil(
Andreas Gampedd9d0552015-03-09 12:57:41 -0700466 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700467 double in = shadow_frame->GetVRegDouble(arg_offset);
468 double out;
469 // Special cases:
470 // 1) NaN, infinity, +0, -0 -> out := in. All are guaranteed by cmath.
471 // -1 < in < 0 -> out := -0.
472 if (-1.0 < in && in < 0) {
473 out = -0.0;
474 } else {
475 out = ceil(in);
476 }
477 result->SetD(out);
478}
479
Andreas Gampe799681b2015-05-15 19:24:12 -0700480void UnstartedRuntime::UnstartedObjectHashCode(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700481 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700482 mirror::Object* obj = shadow_frame->GetVRegReference(arg_offset);
483 result->SetI(obj->IdentityHashCode());
484}
485
Andreas Gampe799681b2015-05-15 19:24:12 -0700486void UnstartedRuntime::UnstartedDoubleDoubleToRawLongBits(
Andreas Gampedd9d0552015-03-09 12:57:41 -0700487 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700488 double in = shadow_frame->GetVRegDouble(arg_offset);
Roland Levillainda4d79b2015-03-24 14:36:11 +0000489 result->SetJ(bit_cast<int64_t, double>(in));
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700490}
491
Andreas Gampedd9d0552015-03-09 12:57:41 -0700492static mirror::Object* GetDexFromDexCache(Thread* self, mirror::DexCache* dex_cache)
493 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
494 const DexFile* dex_file = dex_cache->GetDexFile();
495 if (dex_file == nullptr) {
496 return nullptr;
497 }
498
499 // Create the direct byte buffer.
500 JNIEnv* env = self->GetJniEnv();
501 DCHECK(env != nullptr);
502 void* address = const_cast<void*>(reinterpret_cast<const void*>(dex_file->Begin()));
Andreas Gampeaacc25d2015-04-01 14:49:06 -0700503 ScopedLocalRef<jobject> byte_buffer(env, env->NewDirectByteBuffer(address, dex_file->Size()));
504 if (byte_buffer.get() == nullptr) {
Andreas Gampedd9d0552015-03-09 12:57:41 -0700505 DCHECK(self->IsExceptionPending());
506 return nullptr;
507 }
508
509 jvalue args[1];
Andreas Gampeaacc25d2015-04-01 14:49:06 -0700510 args[0].l = byte_buffer.get();
511
512 ScopedLocalRef<jobject> dex(env, env->CallStaticObjectMethodA(
513 WellKnownClasses::com_android_dex_Dex,
514 WellKnownClasses::com_android_dex_Dex_create,
515 args));
516
517 return self->DecodeJObject(dex.get());
Andreas Gampedd9d0552015-03-09 12:57:41 -0700518}
519
Andreas Gampe799681b2015-05-15 19:24:12 -0700520void UnstartedRuntime::UnstartedDexCacheGetDexNative(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700521 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampedd9d0552015-03-09 12:57:41 -0700522 // We will create the Dex object, but the image writer will release it before creating the
523 // art file.
524 mirror::Object* src = shadow_frame->GetVRegReference(arg_offset);
525 bool have_dex = false;
526 if (src != nullptr) {
527 mirror::Object* dex = GetDexFromDexCache(self, reinterpret_cast<mirror::DexCache*>(src));
528 if (dex != nullptr) {
529 have_dex = true;
530 result->SetL(dex);
531 }
532 }
533 if (!have_dex) {
534 self->ClearException();
Sebastien Hertz2fd7e692015-04-02 11:11:19 +0200535 Runtime::Current()->AbortTransactionAndThrowAbortError(self, "Could not create Dex object");
Andreas Gampedd9d0552015-03-09 12:57:41 -0700536 }
537}
538
539static void UnstartedMemoryPeek(
540 Primitive::Type type, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
541 int64_t address = shadow_frame->GetVRegLong(arg_offset);
542 // TODO: Check that this is in the heap somewhere. Otherwise we will segfault instead of
543 // aborting the transaction.
544
545 switch (type) {
546 case Primitive::kPrimByte: {
547 result->SetB(*reinterpret_cast<int8_t*>(static_cast<intptr_t>(address)));
548 return;
549 }
550
551 case Primitive::kPrimShort: {
Andreas Gampe799681b2015-05-15 19:24:12 -0700552 typedef int16_t unaligned_short __attribute__ ((aligned (1)));
553 result->SetS(*reinterpret_cast<unaligned_short*>(static_cast<intptr_t>(address)));
Andreas Gampedd9d0552015-03-09 12:57:41 -0700554 return;
555 }
556
557 case Primitive::kPrimInt: {
Andreas Gampe799681b2015-05-15 19:24:12 -0700558 typedef int32_t unaligned_int __attribute__ ((aligned (1)));
559 result->SetI(*reinterpret_cast<unaligned_int*>(static_cast<intptr_t>(address)));
Andreas Gampedd9d0552015-03-09 12:57:41 -0700560 return;
561 }
562
563 case Primitive::kPrimLong: {
Andreas Gampe799681b2015-05-15 19:24:12 -0700564 typedef int64_t unaligned_long __attribute__ ((aligned (1)));
565 result->SetJ(*reinterpret_cast<unaligned_long*>(static_cast<intptr_t>(address)));
Andreas Gampedd9d0552015-03-09 12:57:41 -0700566 return;
567 }
568
569 case Primitive::kPrimBoolean:
570 case Primitive::kPrimChar:
571 case Primitive::kPrimFloat:
572 case Primitive::kPrimDouble:
573 case Primitive::kPrimVoid:
574 case Primitive::kPrimNot:
575 LOG(FATAL) << "Not in the Memory API: " << type;
576 UNREACHABLE();
577 }
578 LOG(FATAL) << "Should not reach here";
579 UNREACHABLE();
580}
581
Andreas Gampe799681b2015-05-15 19:24:12 -0700582void UnstartedRuntime::UnstartedMemoryPeekByte(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700583 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700584 UnstartedMemoryPeek(Primitive::kPrimByte, shadow_frame, result, arg_offset);
585}
586
587void UnstartedRuntime::UnstartedMemoryPeekShort(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700588 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700589 UnstartedMemoryPeek(Primitive::kPrimShort, shadow_frame, result, arg_offset);
590}
591
592void UnstartedRuntime::UnstartedMemoryPeekInt(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700593 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700594 UnstartedMemoryPeek(Primitive::kPrimInt, shadow_frame, result, arg_offset);
595}
596
597void UnstartedRuntime::UnstartedMemoryPeekLong(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700598 Thread* self ATTRIBUTE_UNUSED, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700599 UnstartedMemoryPeek(Primitive::kPrimLong, shadow_frame, result, arg_offset);
Andreas Gampedd9d0552015-03-09 12:57:41 -0700600}
601
602static void UnstartedMemoryPeekArray(
603 Primitive::Type type, Thread* self, ShadowFrame* shadow_frame, size_t arg_offset)
604 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
605 int64_t address_long = shadow_frame->GetVRegLong(arg_offset);
606 mirror::Object* obj = shadow_frame->GetVRegReference(arg_offset + 2);
607 if (obj == nullptr) {
Sebastien Hertz2fd7e692015-04-02 11:11:19 +0200608 Runtime::Current()->AbortTransactionAndThrowAbortError(self, "Null pointer in peekArray");
Andreas Gampedd9d0552015-03-09 12:57:41 -0700609 return;
610 }
611 mirror::Array* array = obj->AsArray();
612
613 int offset = shadow_frame->GetVReg(arg_offset + 3);
614 int count = shadow_frame->GetVReg(arg_offset + 4);
615 if (offset < 0 || offset + count > array->GetLength()) {
616 std::string error_msg(StringPrintf("Array out of bounds in peekArray: %d/%d vs %d",
617 offset, count, array->GetLength()));
Sebastien Hertz2fd7e692015-04-02 11:11:19 +0200618 Runtime::Current()->AbortTransactionAndThrowAbortError(self, error_msg.c_str());
Andreas Gampedd9d0552015-03-09 12:57:41 -0700619 return;
620 }
621
622 switch (type) {
623 case Primitive::kPrimByte: {
624 int8_t* address = reinterpret_cast<int8_t*>(static_cast<intptr_t>(address_long));
625 mirror::ByteArray* byte_array = array->AsByteArray();
626 for (int32_t i = 0; i < count; ++i, ++address) {
627 byte_array->SetWithoutChecks<true>(i + offset, *address);
628 }
629 return;
630 }
631
632 case Primitive::kPrimShort:
633 case Primitive::kPrimInt:
634 case Primitive::kPrimLong:
635 LOG(FATAL) << "Type unimplemented for Memory Array API, should not reach here: " << type;
636 UNREACHABLE();
637
638 case Primitive::kPrimBoolean:
639 case Primitive::kPrimChar:
640 case Primitive::kPrimFloat:
641 case Primitive::kPrimDouble:
642 case Primitive::kPrimVoid:
643 case Primitive::kPrimNot:
644 LOG(FATAL) << "Not in the Memory API: " << type;
645 UNREACHABLE();
646 }
647 LOG(FATAL) << "Should not reach here";
648 UNREACHABLE();
649}
650
Andreas Gampe799681b2015-05-15 19:24:12 -0700651void UnstartedRuntime::UnstartedMemoryPeekByteArray(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700652 Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) {
Andreas Gampe799681b2015-05-15 19:24:12 -0700653 UnstartedMemoryPeekArray(Primitive::kPrimByte, self, shadow_frame, arg_offset);
Andreas Gampedd9d0552015-03-09 12:57:41 -0700654}
655
Andreas Gampef778eb22015-04-13 14:17:09 -0700656// This allows reading security.properties in an unstarted runtime and initialize Security.
Andreas Gampe799681b2015-05-15 19:24:12 -0700657void UnstartedRuntime::UnstartedSecurityGetSecurityPropertiesReader(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700658 Thread* self, ShadowFrame* shadow_frame ATTRIBUTE_UNUSED, JValue* result,
659 size_t arg_offset ATTRIBUTE_UNUSED) {
Andreas Gampef778eb22015-04-13 14:17:09 -0700660 Runtime* runtime = Runtime::Current();
661 const std::vector<const DexFile*>& path = runtime->GetClassLinker()->GetBootClassPath();
662 std::string canonical(DexFile::GetDexCanonicalLocation(path[0]->GetLocation().c_str()));
663 mirror::String* string_data;
664
665 // Use a block to enclose the I/O and MemMap code so buffers are released early.
666 {
667 std::string error_msg;
668 std::unique_ptr<ZipArchive> zip_archive(ZipArchive::Open(canonical.c_str(), &error_msg));
669 if (zip_archive.get() == nullptr) {
670 AbortTransactionOrFail(self, "Could not open zip file %s: %s", canonical.c_str(),
671 error_msg.c_str());
672 return;
673 }
674 std::unique_ptr<ZipEntry> zip_entry(zip_archive->Find("java/security/security.properties",
675 &error_msg));
676 if (zip_entry.get() == nullptr) {
677 AbortTransactionOrFail(self, "Could not find security.properties file in %s: %s",
678 canonical.c_str(), error_msg.c_str());
679 return;
680 }
681 std::unique_ptr<MemMap> map(zip_entry->ExtractToMemMap(canonical.c_str(),
682 "java/security/security.properties",
683 &error_msg));
684 if (map.get() == nullptr) {
685 AbortTransactionOrFail(self, "Could not unzip security.properties file in %s: %s",
686 canonical.c_str(), error_msg.c_str());
687 return;
688 }
689
690 uint32_t length = zip_entry->GetUncompressedLength();
691 std::unique_ptr<char[]> tmp(new char[length + 1]);
692 memcpy(tmp.get(), map->Begin(), length);
693 tmp.get()[length] = 0; // null terminator
694
695 string_data = mirror::String::AllocFromModifiedUtf8(self, tmp.get());
696 }
697
698 if (string_data == nullptr) {
699 AbortTransactionOrFail(self, "Could not create string from file content of %s",
700 canonical.c_str());
701 return;
702 }
703
704 // Create a StringReader.
705 StackHandleScope<3> hs(self);
706 Handle<mirror::String> h_string(hs.NewHandle(string_data));
707
708 Handle<mirror::Class> h_class(hs.NewHandle(
709 runtime->GetClassLinker()->FindClass(self,
710 "Ljava/io/StringReader;",
711 NullHandle<mirror::ClassLoader>())));
712 if (h_class.Get() == nullptr) {
713 AbortTransactionOrFail(self, "Could not find StringReader class");
714 return;
715 }
716
717 if (!runtime->GetClassLinker()->EnsureInitialized(self, h_class, true, true)) {
718 AbortTransactionOrFail(self, "Could not initialize StringReader class");
719 return;
720 }
721
722 Handle<mirror::Object> h_obj(hs.NewHandle(h_class->AllocObject(self)));
723 if (h_obj.Get() == nullptr) {
724 AbortTransactionOrFail(self, "Could not allocate StringReader object");
725 return;
726 }
727
Mathieu Chartiere401d142015-04-22 13:56:20 -0700728 auto* cl = Runtime::Current()->GetClassLinker();
729 ArtMethod* constructor = h_class->FindDeclaredDirectMethod(
730 "<init>", "(Ljava/lang/String;)V", cl->GetImagePointerSize());
Andreas Gampef778eb22015-04-13 14:17:09 -0700731 if (constructor == nullptr) {
732 AbortTransactionOrFail(self, "Could not find StringReader constructor");
733 return;
734 }
735
736 uint32_t args[1];
737 args[0] = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(h_string.Get()));
738 EnterInterpreterFromInvoke(self, constructor, h_obj.Get(), args, nullptr);
739
740 if (self->IsExceptionPending()) {
741 AbortTransactionOrFail(self, "Could not run StringReader constructor");
742 return;
743 }
744
745 result->SetL(h_obj.Get());
746}
747
Kenny Root1c9e61c2015-05-14 15:58:17 -0700748// This allows reading the new style of String objects during compilation.
Andreas Gampe799681b2015-05-15 19:24:12 -0700749void UnstartedRuntime::UnstartedStringGetCharsNoCheck(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700750 Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) {
Kenny Root1c9e61c2015-05-14 15:58:17 -0700751 jint start = shadow_frame->GetVReg(arg_offset + 1);
752 jint end = shadow_frame->GetVReg(arg_offset + 2);
753 jint index = shadow_frame->GetVReg(arg_offset + 4);
754 mirror::String* string = shadow_frame->GetVRegReference(arg_offset)->AsString();
755 if (string == nullptr) {
756 AbortTransactionOrFail(self, "String.getCharsNoCheck with null object");
757 return;
758 }
Kenny Root57f91e82015-05-14 15:58:17 -0700759 DCHECK_GE(start, 0);
760 DCHECK_GE(end, string->GetLength());
Kenny Root1c9e61c2015-05-14 15:58:17 -0700761 StackHandleScope<1> hs(self);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700762 Handle<mirror::CharArray> h_char_array(
763 hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 3)->AsCharArray()));
Kenny Root57f91e82015-05-14 15:58:17 -0700764 DCHECK_LE(index, h_char_array->GetLength());
765 DCHECK_LE(end - start, h_char_array->GetLength() - index);
Kenny Root1c9e61c2015-05-14 15:58:17 -0700766 string->GetChars(start, end, h_char_array, index);
767}
768
769// This allows reading chars from the new style of String objects during compilation.
Andreas Gampe799681b2015-05-15 19:24:12 -0700770void UnstartedRuntime::UnstartedStringCharAt(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700771 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Kenny Root1c9e61c2015-05-14 15:58:17 -0700772 jint index = shadow_frame->GetVReg(arg_offset + 1);
773 mirror::String* string = shadow_frame->GetVRegReference(arg_offset)->AsString();
774 if (string == nullptr) {
775 AbortTransactionOrFail(self, "String.charAt with null object");
776 return;
777 }
778 result->SetC(string->CharAt(index));
779}
780
Kenny Root57f91e82015-05-14 15:58:17 -0700781// This allows setting chars from the new style of String objects during compilation.
Andreas Gampe799681b2015-05-15 19:24:12 -0700782void UnstartedRuntime::UnstartedStringSetCharAt(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700783 Thread* self, ShadowFrame* shadow_frame, JValue* result ATTRIBUTE_UNUSED, size_t arg_offset) {
Kenny Root57f91e82015-05-14 15:58:17 -0700784 jint index = shadow_frame->GetVReg(arg_offset + 1);
785 jchar c = shadow_frame->GetVReg(arg_offset + 2);
786 mirror::String* string = shadow_frame->GetVRegReference(arg_offset)->AsString();
787 if (string == nullptr) {
788 AbortTransactionOrFail(self, "String.setCharAt with null object");
789 return;
790 }
791 string->SetCharAt(index, c);
792}
793
Kenny Root1c9e61c2015-05-14 15:58:17 -0700794// This allows creating the new style of String objects during compilation.
Andreas Gampe799681b2015-05-15 19:24:12 -0700795void UnstartedRuntime::UnstartedStringFactoryNewStringFromChars(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700796 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Kenny Root1c9e61c2015-05-14 15:58:17 -0700797 jint offset = shadow_frame->GetVReg(arg_offset);
798 jint char_count = shadow_frame->GetVReg(arg_offset + 1);
799 DCHECK_GE(char_count, 0);
800 StackHandleScope<1> hs(self);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700801 Handle<mirror::CharArray> h_char_array(
802 hs.NewHandle(shadow_frame->GetVRegReference(arg_offset + 2)->AsCharArray()));
Kenny Root1c9e61c2015-05-14 15:58:17 -0700803 Runtime* runtime = Runtime::Current();
804 gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
805 result->SetL(mirror::String::AllocFromCharArray<true>(self, char_count, h_char_array, offset, allocator));
806}
807
808// This allows creating the new style of String objects during compilation.
Andreas Gampe799681b2015-05-15 19:24:12 -0700809void UnstartedRuntime::UnstartedStringFactoryNewStringFromString(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700810 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Kenny Root57f91e82015-05-14 15:58:17 -0700811 mirror::String* to_copy = shadow_frame->GetVRegReference(arg_offset)->AsString();
812 if (to_copy == nullptr) {
813 AbortTransactionOrFail(self, "StringFactory.newStringFromString with null object");
814 return;
815 }
816 StackHandleScope<1> hs(self);
817 Handle<mirror::String> h_string(hs.NewHandle(to_copy));
818 Runtime* runtime = Runtime::Current();
819 gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
820 result->SetL(mirror::String::AllocFromString<true>(self, h_string->GetLength(), h_string, 0,
821 allocator));
822}
823
Andreas Gampe799681b2015-05-15 19:24:12 -0700824void UnstartedRuntime::UnstartedStringFastSubstring(
Mathieu Chartiere401d142015-04-22 13:56:20 -0700825 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Kenny Root1c9e61c2015-05-14 15:58:17 -0700826 jint start = shadow_frame->GetVReg(arg_offset + 1);
827 jint length = shadow_frame->GetVReg(arg_offset + 2);
Kenny Root57f91e82015-05-14 15:58:17 -0700828 DCHECK_GE(start, 0);
Kenny Root1c9e61c2015-05-14 15:58:17 -0700829 DCHECK_GE(length, 0);
830 StackHandleScope<1> hs(self);
Mathieu Chartiere401d142015-04-22 13:56:20 -0700831 Handle<mirror::String> h_string(
832 hs.NewHandle(shadow_frame->GetVRegReference(arg_offset)->AsString()));
Kenny Root57f91e82015-05-14 15:58:17 -0700833 DCHECK_LE(start, h_string->GetLength());
834 DCHECK_LE(start + length, h_string->GetLength());
Kenny Root1c9e61c2015-05-14 15:58:17 -0700835 Runtime* runtime = Runtime::Current();
836 gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
837 result->SetL(mirror::String::AllocFromString<true>(self, length, h_string, start, allocator));
838}
839
Kenny Root57f91e82015-05-14 15:58:17 -0700840// This allows getting the char array for new style of String objects during compilation.
Andreas Gampe799681b2015-05-15 19:24:12 -0700841void UnstartedRuntime::UnstartedStringToCharArray(
Kenny Root57f91e82015-05-14 15:58:17 -0700842 Thread* self, ShadowFrame* shadow_frame, JValue* result, size_t arg_offset)
843 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
844 mirror::String* string = shadow_frame->GetVRegReference(arg_offset)->AsString();
845 if (string == nullptr) {
846 AbortTransactionOrFail(self, "String.charAt with null object");
847 return;
848 }
849 result->SetL(string->ToCharArray(self));
850}
851
Mathieu Chartiere401d142015-04-22 13:56:20 -0700852void UnstartedRuntime::UnstartedJNIVMRuntimeNewUnpaddedArray(
853 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED,
854 uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700855 int32_t length = args[1];
856 DCHECK_GE(length, 0);
857 mirror::Class* element_class = reinterpret_cast<mirror::Object*>(args[0])->AsClass();
858 Runtime* runtime = Runtime::Current();
859 mirror::Class* array_class = runtime->GetClassLinker()->FindArrayClass(self, &element_class);
860 DCHECK(array_class != nullptr);
861 gc::AllocatorType allocator = runtime->GetHeap()->GetCurrentAllocator();
862 result->SetL(mirror::Array::Alloc<true, true>(self, array_class, length,
863 array_class->GetComponentSizeShift(), allocator));
864}
865
Mathieu Chartiere401d142015-04-22 13:56:20 -0700866void UnstartedRuntime::UnstartedJNIVMStackGetCallingClassLoader(
867 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
868 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700869 result->SetL(nullptr);
870}
871
Mathieu Chartiere401d142015-04-22 13:56:20 -0700872void UnstartedRuntime::UnstartedJNIVMStackGetStackClass2(
873 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED,
874 uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700875 NthCallerVisitor visitor(self, 3);
876 visitor.WalkStack();
877 if (visitor.caller != nullptr) {
878 result->SetL(visitor.caller->GetDeclaringClass());
879 }
880}
881
Mathieu Chartiere401d142015-04-22 13:56:20 -0700882void UnstartedRuntime::UnstartedJNIMathLog(
883 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
884 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700885 JValue value;
886 value.SetJ((static_cast<uint64_t>(args[1]) << 32) | args[0]);
887 result->SetD(log(value.GetD()));
888}
889
Mathieu Chartiere401d142015-04-22 13:56:20 -0700890void UnstartedRuntime::UnstartedJNIMathExp(
891 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
892 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700893 JValue value;
894 value.SetJ((static_cast<uint64_t>(args[1]) << 32) | args[0]);
895 result->SetD(exp(value.GetD()));
896}
897
Mathieu Chartiere401d142015-04-22 13:56:20 -0700898void UnstartedRuntime::UnstartedJNIClassGetNameNative(
899 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver,
900 uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700901 StackHandleScope<1> hs(self);
902 result->SetL(mirror::Class::ComputeName(hs.NewHandle(receiver->AsClass())));
903}
904
Mathieu Chartiere401d142015-04-22 13:56:20 -0700905void UnstartedRuntime::UnstartedJNIFloatFloatToRawIntBits(
906 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
907 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700908 result->SetI(args[0]);
909}
910
Mathieu Chartiere401d142015-04-22 13:56:20 -0700911void UnstartedRuntime::UnstartedJNIFloatIntBitsToFloat(
912 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
913 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700914 result->SetI(args[0]);
915}
916
Mathieu Chartiere401d142015-04-22 13:56:20 -0700917void UnstartedRuntime::UnstartedJNIObjectInternalClone(
918 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver,
919 uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700920 result->SetL(receiver->Clone(self));
921}
922
Mathieu Chartiere401d142015-04-22 13:56:20 -0700923void UnstartedRuntime::UnstartedJNIObjectNotifyAll(
924 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver,
925 uint32_t* args ATTRIBUTE_UNUSED, JValue* result ATTRIBUTE_UNUSED) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700926 receiver->NotifyAll(self);
927}
928
Mathieu Chartiere401d142015-04-22 13:56:20 -0700929void UnstartedRuntime::UnstartedJNIStringCompareTo(
930 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver, uint32_t* args,
931 JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700932 mirror::String* rhs = reinterpret_cast<mirror::Object*>(args[0])->AsString();
933 if (rhs == nullptr) {
Andreas Gampe068b0c02015-03-11 12:44:47 -0700934 AbortTransactionOrFail(self, "String.compareTo with null object");
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700935 }
936 result->SetI(receiver->AsString()->CompareTo(rhs));
937}
938
Mathieu Chartiere401d142015-04-22 13:56:20 -0700939void UnstartedRuntime::UnstartedJNIStringIntern(
940 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver,
941 uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700942 result->SetL(receiver->AsString()->Intern());
943}
944
Mathieu Chartiere401d142015-04-22 13:56:20 -0700945void UnstartedRuntime::UnstartedJNIStringFastIndexOf(
946 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver,
947 uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700948 result->SetI(receiver->AsString()->FastIndexOf(args[0], args[1]));
949}
950
Mathieu Chartiere401d142015-04-22 13:56:20 -0700951void UnstartedRuntime::UnstartedJNIArrayCreateMultiArray(
952 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED,
953 uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700954 StackHandleScope<2> hs(self);
955 auto h_class(hs.NewHandle(reinterpret_cast<mirror::Class*>(args[0])->AsClass()));
956 auto h_dimensions(hs.NewHandle(reinterpret_cast<mirror::IntArray*>(args[1])->AsIntArray()));
957 result->SetL(mirror::Array::CreateMultiArray(self, h_class, h_dimensions));
958}
959
Mathieu Chartiere401d142015-04-22 13:56:20 -0700960void UnstartedRuntime::UnstartedJNIArrayCreateObjectArray(
961 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED,
962 uint32_t* args, JValue* result) {
Andreas Gampee598e042015-04-10 14:57:10 -0700963 int32_t length = static_cast<int32_t>(args[1]);
964 if (length < 0) {
965 ThrowNegativeArraySizeException(length);
966 return;
967 }
968 mirror::Class* element_class = reinterpret_cast<mirror::Class*>(args[0])->AsClass();
969 Runtime* runtime = Runtime::Current();
970 ClassLinker* class_linker = runtime->GetClassLinker();
971 mirror::Class* array_class = class_linker->FindArrayClass(self, &element_class);
Mathieu Chartier2cebb242015-04-21 16:50:40 -0700972 if (UNLIKELY(array_class == nullptr)) {
Andreas Gampee598e042015-04-10 14:57:10 -0700973 CHECK(self->IsExceptionPending());
974 return;
975 }
976 DCHECK(array_class->IsObjectArrayClass());
977 mirror::Array* new_array = mirror::ObjectArray<mirror::Object*>::Alloc(
978 self, array_class, length, runtime->GetHeap()->GetCurrentAllocator());
979 result->SetL(new_array);
980}
981
Mathieu Chartiere401d142015-04-22 13:56:20 -0700982void UnstartedRuntime::UnstartedJNIThrowableNativeFillInStackTrace(
983 Thread* self, ArtMethod* method ATTRIBUTE_UNUSED, mirror::Object* receiver ATTRIBUTE_UNUSED,
984 uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700985 ScopedObjectAccessUnchecked soa(self);
986 if (Runtime::Current()->IsActiveTransaction()) {
987 result->SetL(soa.Decode<mirror::Object*>(self->CreateInternalStackTrace<true>(soa)));
988 } else {
989 result->SetL(soa.Decode<mirror::Object*>(self->CreateInternalStackTrace<false>(soa)));
990 }
991}
992
Mathieu Chartiere401d142015-04-22 13:56:20 -0700993void UnstartedRuntime::UnstartedJNISystemIdentityHashCode(
994 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
995 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -0700996 mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]);
997 result->SetI((obj != nullptr) ? obj->IdentityHashCode() : 0);
998}
999
Mathieu Chartiere401d142015-04-22 13:56:20 -07001000void UnstartedRuntime::UnstartedJNIByteOrderIsLittleEndian(
1001 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
1002 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args ATTRIBUTE_UNUSED, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001003 result->SetZ(JNI_TRUE);
1004}
1005
Mathieu Chartiere401d142015-04-22 13:56:20 -07001006void UnstartedRuntime::UnstartedJNIUnsafeCompareAndSwapInt(
1007 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
1008 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001009 mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]);
1010 jlong offset = (static_cast<uint64_t>(args[2]) << 32) | args[1];
1011 jint expectedValue = args[3];
1012 jint newValue = args[4];
1013 bool success;
1014 if (Runtime::Current()->IsActiveTransaction()) {
1015 success = obj->CasFieldStrongSequentiallyConsistent32<true>(MemberOffset(offset),
1016 expectedValue, newValue);
1017 } else {
1018 success = obj->CasFieldStrongSequentiallyConsistent32<false>(MemberOffset(offset),
1019 expectedValue, newValue);
1020 }
1021 result->SetZ(success ? JNI_TRUE : JNI_FALSE);
1022}
1023
Mathieu Chartiere401d142015-04-22 13:56:20 -07001024void UnstartedRuntime::UnstartedJNIUnsafePutObject(
1025 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
1026 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result ATTRIBUTE_UNUSED) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001027 mirror::Object* obj = reinterpret_cast<mirror::Object*>(args[0]);
1028 jlong offset = (static_cast<uint64_t>(args[2]) << 32) | args[1];
1029 mirror::Object* newValue = reinterpret_cast<mirror::Object*>(args[3]);
1030 if (Runtime::Current()->IsActiveTransaction()) {
1031 obj->SetFieldObject<true>(MemberOffset(offset), newValue);
1032 } else {
1033 obj->SetFieldObject<false>(MemberOffset(offset), newValue);
1034 }
1035}
1036
Andreas Gampe799681b2015-05-15 19:24:12 -07001037void UnstartedRuntime::UnstartedJNIUnsafeGetArrayBaseOffsetForComponentType(
Mathieu Chartiere401d142015-04-22 13:56:20 -07001038 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
1039 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001040 mirror::Class* component = reinterpret_cast<mirror::Object*>(args[0])->AsClass();
1041 Primitive::Type primitive_type = component->GetPrimitiveType();
1042 result->SetI(mirror::Array::DataOffset(Primitive::ComponentSize(primitive_type)).Int32Value());
1043}
1044
Andreas Gampe799681b2015-05-15 19:24:12 -07001045void UnstartedRuntime::UnstartedJNIUnsafeGetArrayIndexScaleForComponentType(
Mathieu Chartiere401d142015-04-22 13:56:20 -07001046 Thread* self ATTRIBUTE_UNUSED, ArtMethod* method ATTRIBUTE_UNUSED,
1047 mirror::Object* receiver ATTRIBUTE_UNUSED, uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001048 mirror::Class* component = reinterpret_cast<mirror::Object*>(args[0])->AsClass();
1049 Primitive::Type primitive_type = component->GetPrimitiveType();
1050 result->SetI(Primitive::ComponentSize(primitive_type));
1051}
1052
Andreas Gampedd9d0552015-03-09 12:57:41 -07001053typedef void (*InvokeHandler)(Thread* self, ShadowFrame* shadow_frame, JValue* result,
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001054 size_t arg_size);
1055
Mathieu Chartiere401d142015-04-22 13:56:20 -07001056typedef void (*JNIHandler)(Thread* self, ArtMethod* method, mirror::Object* receiver,
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001057 uint32_t* args, JValue* result);
1058
1059static bool tables_initialized_ = false;
1060static std::unordered_map<std::string, InvokeHandler> invoke_handlers_;
1061static std::unordered_map<std::string, JNIHandler> jni_handlers_;
1062
Andreas Gampe799681b2015-05-15 19:24:12 -07001063void UnstartedRuntime::InitializeInvokeHandlers() {
1064#define UNSTARTED_DIRECT(ShortName, Sig) \
1065 invoke_handlers_.insert(std::make_pair(Sig, & UnstartedRuntime::Unstarted ## ShortName));
1066#include "unstarted_runtime_list.h"
1067 UNSTARTED_RUNTIME_DIRECT_LIST(UNSTARTED_DIRECT)
1068#undef UNSTARTED_RUNTIME_DIRECT_LIST
1069#undef UNSTARTED_RUNTIME_JNI_LIST
1070#undef UNSTARTED_DIRECT
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001071}
1072
Andreas Gampe799681b2015-05-15 19:24:12 -07001073void UnstartedRuntime::InitializeJNIHandlers() {
1074#define UNSTARTED_JNI(ShortName, Sig) \
1075 jni_handlers_.insert(std::make_pair(Sig, & UnstartedRuntime::UnstartedJNI ## ShortName));
1076#include "unstarted_runtime_list.h"
1077 UNSTARTED_RUNTIME_JNI_LIST(UNSTARTED_JNI)
1078#undef UNSTARTED_RUNTIME_DIRECT_LIST
1079#undef UNSTARTED_RUNTIME_JNI_LIST
1080#undef UNSTARTED_JNI
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001081}
1082
Andreas Gampe799681b2015-05-15 19:24:12 -07001083void UnstartedRuntime::Initialize() {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001084 CHECK(!tables_initialized_);
1085
Andreas Gampe799681b2015-05-15 19:24:12 -07001086 InitializeInvokeHandlers();
1087 InitializeJNIHandlers();
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001088
1089 tables_initialized_ = true;
1090}
1091
Andreas Gampe799681b2015-05-15 19:24:12 -07001092void UnstartedRuntime::Invoke(Thread* self, const DexFile::CodeItem* code_item,
1093 ShadowFrame* shadow_frame, JValue* result, size_t arg_offset) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001094 // In a runtime that's not started we intercept certain methods to avoid complicated dependency
1095 // problems in core libraries.
1096 CHECK(tables_initialized_);
1097
1098 std::string name(PrettyMethod(shadow_frame->GetMethod()));
1099 const auto& iter = invoke_handlers_.find(name);
1100 if (iter != invoke_handlers_.end()) {
Kenny Root57f91e82015-05-14 15:58:17 -07001101 // Clear out the result in case it's not zeroed out.
1102 result->SetL(0);
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001103 (*iter->second)(self, shadow_frame, result, arg_offset);
1104 } else {
1105 // Not special, continue with regular interpreter execution.
1106 artInterpreterToInterpreterBridge(self, code_item, shadow_frame, result);
1107 }
1108}
1109
1110// Hand select a number of methods to be run in a not yet started runtime without using JNI.
Mathieu Chartiere401d142015-04-22 13:56:20 -07001111void UnstartedRuntime::Jni(Thread* self, ArtMethod* method, mirror::Object* receiver,
Andreas Gampe799681b2015-05-15 19:24:12 -07001112 uint32_t* args, JValue* result) {
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001113 std::string name(PrettyMethod(method));
1114 const auto& iter = jni_handlers_.find(name);
1115 if (iter != jni_handlers_.end()) {
Kenny Root57f91e82015-05-14 15:58:17 -07001116 // Clear out the result in case it's not zeroed out.
1117 result->SetL(0);
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001118 (*iter->second)(self, method, receiver, args, result);
1119 } else if (Runtime::Current()->IsActiveTransaction()) {
Sebastien Hertz45b15972015-04-03 16:07:05 +02001120 AbortTransactionF(self, "Attempt to invoke native method in non-started runtime: %s",
1121 name.c_str());
Andreas Gampe2969bcd2015-03-09 12:57:41 -07001122 } else {
1123 LOG(FATAL) << "Calling native method " << PrettyMethod(method) << " in an unstarted "
1124 "non-transactional runtime";
1125 }
1126}
1127
1128} // namespace interpreter
1129} // namespace art