interpreter_common.cc revision fa2c054b28d4b540c1b3651401a7a091282a015f
1/*
2 * Copyright (C) 2012 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 "interpreter_common.h"
18
19#include <cmath>
20
21#include "debugger.h"
22#include "entrypoints/runtime_asm_entrypoints.h"
23#include "mirror/array-inl.h"
24#include "unstarted_runtime.h"
25#include "verifier/method_verifier.h"
26
27namespace art {
28namespace interpreter {
29
30void ThrowNullPointerExceptionFromInterpreter() {
31  ThrowNullPointerExceptionFromDexPC();
32}
33
34template<FindFieldType find_type, Primitive::Type field_type, bool do_access_check>
35bool DoFieldGet(Thread* self, ShadowFrame& shadow_frame, const Instruction* inst,
36                uint16_t inst_data) {
37  const bool is_static = (find_type == StaticObjectRead) || (find_type == StaticPrimitiveRead);
38  const uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c();
39  ArtField* f = FindFieldFromCode<find_type, do_access_check>(field_idx, shadow_frame.GetMethod(), self,
40                                                              Primitive::ComponentSize(field_type));
41  if (UNLIKELY(f == nullptr)) {
42    CHECK(self->IsExceptionPending());
43    return false;
44  }
45  Object* obj;
46  if (is_static) {
47    obj = f->GetDeclaringClass();
48  } else {
49    obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
50    if (UNLIKELY(obj == nullptr)) {
51      ThrowNullPointerExceptionForFieldAccess(f, true);
52      return false;
53    }
54  }
55  f->GetDeclaringClass()->AssertInitializedOrInitializingInThread(self);
56  // Report this field access to instrumentation if needed.
57  instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
58  if (UNLIKELY(instrumentation->HasFieldReadListeners())) {
59    Object* this_object = f->IsStatic() ? nullptr : obj;
60    instrumentation->FieldReadEvent(self, this_object, shadow_frame.GetMethod(),
61                                    shadow_frame.GetDexPC(), f);
62  }
63  uint32_t vregA = is_static ? inst->VRegA_21c(inst_data) : inst->VRegA_22c(inst_data);
64  switch (field_type) {
65    case Primitive::kPrimBoolean:
66      shadow_frame.SetVReg(vregA, f->GetBoolean(obj));
67      break;
68    case Primitive::kPrimByte:
69      shadow_frame.SetVReg(vregA, f->GetByte(obj));
70      break;
71    case Primitive::kPrimChar:
72      shadow_frame.SetVReg(vregA, f->GetChar(obj));
73      break;
74    case Primitive::kPrimShort:
75      shadow_frame.SetVReg(vregA, f->GetShort(obj));
76      break;
77    case Primitive::kPrimInt:
78      shadow_frame.SetVReg(vregA, f->GetInt(obj));
79      break;
80    case Primitive::kPrimLong:
81      shadow_frame.SetVRegLong(vregA, f->GetLong(obj));
82      break;
83    case Primitive::kPrimNot:
84      shadow_frame.SetVRegReference(vregA, f->GetObject(obj));
85      break;
86    default:
87      LOG(FATAL) << "Unreachable: " << field_type;
88      UNREACHABLE();
89  }
90  return true;
91}
92
93// Explicitly instantiate all DoFieldGet functions.
94#define EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL(_find_type, _field_type, _do_check) \
95  template bool DoFieldGet<_find_type, _field_type, _do_check>(Thread* self, \
96                                                               ShadowFrame& shadow_frame, \
97                                                               const Instruction* inst, \
98                                                               uint16_t inst_data)
99
100#define EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(_find_type, _field_type)  \
101    EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL(_find_type, _field_type, false);  \
102    EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL(_find_type, _field_type, true);
103
104// iget-XXX
105EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimBoolean)
106EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimByte)
107EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimChar)
108EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimShort)
109EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimInt)
110EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstancePrimitiveRead, Primitive::kPrimLong)
111EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(InstanceObjectRead, Primitive::kPrimNot)
112
113// sget-XXX
114EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimBoolean)
115EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimByte)
116EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimChar)
117EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimShort)
118EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimInt)
119EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticPrimitiveRead, Primitive::kPrimLong)
120EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL(StaticObjectRead, Primitive::kPrimNot)
121
122#undef EXPLICIT_DO_FIELD_GET_ALL_TEMPLATE_DECL
123#undef EXPLICIT_DO_FIELD_GET_TEMPLATE_DECL
124
125// Handles iget-quick, iget-wide-quick and iget-object-quick instructions.
126// Returns true on success, otherwise throws an exception and returns false.
127template<Primitive::Type field_type>
128bool DoIGetQuick(ShadowFrame& shadow_frame, const Instruction* inst, uint16_t inst_data) {
129  Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
130  if (UNLIKELY(obj == nullptr)) {
131    // We lost the reference to the field index so we cannot get a more
132    // precised exception message.
133    ThrowNullPointerExceptionFromDexPC();
134    return false;
135  }
136  MemberOffset field_offset(inst->VRegC_22c());
137  // Report this field access to instrumentation if needed. Since we only have the offset of
138  // the field from the base of the object, we need to look for it first.
139  instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
140  if (UNLIKELY(instrumentation->HasFieldReadListeners())) {
141    ArtField* f = ArtField::FindInstanceFieldWithOffset(obj->GetClass(),
142                                                        field_offset.Uint32Value());
143    DCHECK(f != nullptr);
144    DCHECK(!f->IsStatic());
145    instrumentation->FieldReadEvent(Thread::Current(), obj, shadow_frame.GetMethod(),
146                                    shadow_frame.GetDexPC(), f);
147  }
148  // Note: iget-x-quick instructions are only for non-volatile fields.
149  const uint32_t vregA = inst->VRegA_22c(inst_data);
150  switch (field_type) {
151    case Primitive::kPrimInt:
152      shadow_frame.SetVReg(vregA, static_cast<int32_t>(obj->GetField32(field_offset)));
153      break;
154    case Primitive::kPrimBoolean:
155      shadow_frame.SetVReg(vregA, static_cast<int32_t>(obj->GetFieldBoolean(field_offset)));
156      break;
157    case Primitive::kPrimByte:
158      shadow_frame.SetVReg(vregA, static_cast<int32_t>(obj->GetFieldByte(field_offset)));
159      break;
160    case Primitive::kPrimChar:
161      shadow_frame.SetVReg(vregA, static_cast<int32_t>(obj->GetFieldChar(field_offset)));
162      break;
163    case Primitive::kPrimShort:
164      shadow_frame.SetVReg(vregA, static_cast<int32_t>(obj->GetFieldShort(field_offset)));
165      break;
166    case Primitive::kPrimLong:
167      shadow_frame.SetVRegLong(vregA, static_cast<int64_t>(obj->GetField64(field_offset)));
168      break;
169    case Primitive::kPrimNot:
170      shadow_frame.SetVRegReference(vregA, obj->GetFieldObject<mirror::Object>(field_offset));
171      break;
172    default:
173      LOG(FATAL) << "Unreachable: " << field_type;
174      UNREACHABLE();
175  }
176  return true;
177}
178
179// Explicitly instantiate all DoIGetQuick functions.
180#define EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(_field_type) \
181  template bool DoIGetQuick<_field_type>(ShadowFrame& shadow_frame, const Instruction* inst, \
182                                         uint16_t inst_data)
183
184EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimInt);      // iget-quick.
185EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimBoolean);  // iget-boolean-quick.
186EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimByte);     // iget-byte-quick.
187EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimChar);     // iget-char-quick.
188EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimShort);    // iget-short-quick.
189EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimLong);     // iget-wide-quick.
190EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL(Primitive::kPrimNot);      // iget-object-quick.
191#undef EXPLICIT_DO_IGET_QUICK_TEMPLATE_DECL
192
193template<Primitive::Type field_type>
194static JValue GetFieldValue(const ShadowFrame& shadow_frame, uint32_t vreg)
195    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
196  JValue field_value;
197  switch (field_type) {
198    case Primitive::kPrimBoolean:
199      field_value.SetZ(static_cast<uint8_t>(shadow_frame.GetVReg(vreg)));
200      break;
201    case Primitive::kPrimByte:
202      field_value.SetB(static_cast<int8_t>(shadow_frame.GetVReg(vreg)));
203      break;
204    case Primitive::kPrimChar:
205      field_value.SetC(static_cast<uint16_t>(shadow_frame.GetVReg(vreg)));
206      break;
207    case Primitive::kPrimShort:
208      field_value.SetS(static_cast<int16_t>(shadow_frame.GetVReg(vreg)));
209      break;
210    case Primitive::kPrimInt:
211      field_value.SetI(shadow_frame.GetVReg(vreg));
212      break;
213    case Primitive::kPrimLong:
214      field_value.SetJ(shadow_frame.GetVRegLong(vreg));
215      break;
216    case Primitive::kPrimNot:
217      field_value.SetL(shadow_frame.GetVRegReference(vreg));
218      break;
219    default:
220      LOG(FATAL) << "Unreachable: " << field_type;
221      UNREACHABLE();
222  }
223  return field_value;
224}
225
226template<FindFieldType find_type, Primitive::Type field_type, bool do_access_check,
227         bool transaction_active>
228bool DoFieldPut(Thread* self, const ShadowFrame& shadow_frame, const Instruction* inst,
229                uint16_t inst_data) {
230  bool do_assignability_check = do_access_check;
231  bool is_static = (find_type == StaticObjectWrite) || (find_type == StaticPrimitiveWrite);
232  uint32_t field_idx = is_static ? inst->VRegB_21c() : inst->VRegC_22c();
233  ArtField* f = FindFieldFromCode<find_type, do_access_check>(field_idx, shadow_frame.GetMethod(), self,
234                                                              Primitive::ComponentSize(field_type));
235  if (UNLIKELY(f == nullptr)) {
236    CHECK(self->IsExceptionPending());
237    return false;
238  }
239  Object* obj;
240  if (is_static) {
241    obj = f->GetDeclaringClass();
242  } else {
243    obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
244    if (UNLIKELY(obj == nullptr)) {
245      ThrowNullPointerExceptionForFieldAccess(f, false);
246      return false;
247    }
248  }
249  f->GetDeclaringClass()->AssertInitializedOrInitializingInThread(self);
250  uint32_t vregA = is_static ? inst->VRegA_21c(inst_data) : inst->VRegA_22c(inst_data);
251  // Report this field access to instrumentation if needed. Since we only have the offset of
252  // the field from the base of the object, we need to look for it first.
253  instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
254  if (UNLIKELY(instrumentation->HasFieldWriteListeners())) {
255    JValue field_value = GetFieldValue<field_type>(shadow_frame, vregA);
256    Object* this_object = f->IsStatic() ? nullptr : obj;
257    instrumentation->FieldWriteEvent(self, this_object, shadow_frame.GetMethod(),
258                                     shadow_frame.GetDexPC(), f, field_value);
259  }
260  switch (field_type) {
261    case Primitive::kPrimBoolean:
262      f->SetBoolean<transaction_active>(obj, shadow_frame.GetVReg(vregA));
263      break;
264    case Primitive::kPrimByte:
265      f->SetByte<transaction_active>(obj, shadow_frame.GetVReg(vregA));
266      break;
267    case Primitive::kPrimChar:
268      f->SetChar<transaction_active>(obj, shadow_frame.GetVReg(vregA));
269      break;
270    case Primitive::kPrimShort:
271      f->SetShort<transaction_active>(obj, shadow_frame.GetVReg(vregA));
272      break;
273    case Primitive::kPrimInt:
274      f->SetInt<transaction_active>(obj, shadow_frame.GetVReg(vregA));
275      break;
276    case Primitive::kPrimLong:
277      f->SetLong<transaction_active>(obj, shadow_frame.GetVRegLong(vregA));
278      break;
279    case Primitive::kPrimNot: {
280      Object* reg = shadow_frame.GetVRegReference(vregA);
281      if (do_assignability_check && reg != nullptr) {
282        // FieldHelper::GetType can resolve classes, use a handle wrapper which will restore the
283        // object in the destructor.
284        Class* field_class;
285        {
286          StackHandleScope<2> hs(self);
287          HandleWrapper<mirror::Object> h_reg(hs.NewHandleWrapper(&reg));
288          HandleWrapper<mirror::Object> h_obj(hs.NewHandleWrapper(&obj));
289          field_class = f->GetType<true>();
290        }
291        if (!reg->VerifierInstanceOf(field_class)) {
292          // This should never happen.
293          std::string temp1, temp2, temp3;
294          self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
295                                   "Put '%s' that is not instance of field '%s' in '%s'",
296                                   reg->GetClass()->GetDescriptor(&temp1),
297                                   field_class->GetDescriptor(&temp2),
298                                   f->GetDeclaringClass()->GetDescriptor(&temp3));
299          return false;
300        }
301      }
302      f->SetObj<transaction_active>(obj, reg);
303      break;
304    }
305    default:
306      LOG(FATAL) << "Unreachable: " << field_type;
307      UNREACHABLE();
308  }
309  return true;
310}
311
312// Explicitly instantiate all DoFieldPut functions.
313#define EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, _do_check, _transaction_active) \
314  template bool DoFieldPut<_find_type, _field_type, _do_check, _transaction_active>(Thread* self, \
315      const ShadowFrame& shadow_frame, const Instruction* inst, uint16_t inst_data)
316
317#define EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(_find_type, _field_type)  \
318    EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, false, false);  \
319    EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, true, false);  \
320    EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, false, true);  \
321    EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL(_find_type, _field_type, true, true);
322
323// iput-XXX
324EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimBoolean)
325EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimByte)
326EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimChar)
327EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimShort)
328EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimInt)
329EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstancePrimitiveWrite, Primitive::kPrimLong)
330EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(InstanceObjectWrite, Primitive::kPrimNot)
331
332// sput-XXX
333EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimBoolean)
334EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimByte)
335EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimChar)
336EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimShort)
337EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimInt)
338EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticPrimitiveWrite, Primitive::kPrimLong)
339EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL(StaticObjectWrite, Primitive::kPrimNot)
340
341#undef EXPLICIT_DO_FIELD_PUT_ALL_TEMPLATE_DECL
342#undef EXPLICIT_DO_FIELD_PUT_TEMPLATE_DECL
343
344template<Primitive::Type field_type, bool transaction_active>
345bool DoIPutQuick(const ShadowFrame& shadow_frame, const Instruction* inst, uint16_t inst_data) {
346  Object* obj = shadow_frame.GetVRegReference(inst->VRegB_22c(inst_data));
347  if (UNLIKELY(obj == nullptr)) {
348    // We lost the reference to the field index so we cannot get a more
349    // precised exception message.
350    ThrowNullPointerExceptionFromDexPC();
351    return false;
352  }
353  MemberOffset field_offset(inst->VRegC_22c());
354  const uint32_t vregA = inst->VRegA_22c(inst_data);
355  // Report this field modification to instrumentation if needed. Since we only have the offset of
356  // the field from the base of the object, we need to look for it first.
357  instrumentation::Instrumentation* instrumentation = Runtime::Current()->GetInstrumentation();
358  if (UNLIKELY(instrumentation->HasFieldWriteListeners())) {
359    ArtField* f = ArtField::FindInstanceFieldWithOffset(obj->GetClass(),
360                                                        field_offset.Uint32Value());
361    DCHECK(f != nullptr);
362    DCHECK(!f->IsStatic());
363    JValue field_value = GetFieldValue<field_type>(shadow_frame, vregA);
364    instrumentation->FieldWriteEvent(Thread::Current(), obj, shadow_frame.GetMethod(),
365                                     shadow_frame.GetDexPC(), f, field_value);
366  }
367  // Note: iput-x-quick instructions are only for non-volatile fields.
368  switch (field_type) {
369    case Primitive::kPrimBoolean:
370      obj->SetFieldBoolean<transaction_active>(field_offset, shadow_frame.GetVReg(vregA));
371      break;
372    case Primitive::kPrimByte:
373      obj->SetFieldByte<transaction_active>(field_offset, shadow_frame.GetVReg(vregA));
374      break;
375    case Primitive::kPrimChar:
376      obj->SetFieldChar<transaction_active>(field_offset, shadow_frame.GetVReg(vregA));
377      break;
378    case Primitive::kPrimShort:
379      obj->SetFieldShort<transaction_active>(field_offset, shadow_frame.GetVReg(vregA));
380      break;
381    case Primitive::kPrimInt:
382      obj->SetField32<transaction_active>(field_offset, shadow_frame.GetVReg(vregA));
383      break;
384    case Primitive::kPrimLong:
385      obj->SetField64<transaction_active>(field_offset, shadow_frame.GetVRegLong(vregA));
386      break;
387    case Primitive::kPrimNot:
388      obj->SetFieldObject<transaction_active>(field_offset, shadow_frame.GetVRegReference(vregA));
389      break;
390    default:
391      LOG(FATAL) << "Unreachable: " << field_type;
392      UNREACHABLE();
393  }
394  return true;
395}
396
397// Explicitly instantiate all DoIPutQuick functions.
398#define EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL(_field_type, _transaction_active) \
399  template bool DoIPutQuick<_field_type, _transaction_active>(const ShadowFrame& shadow_frame, \
400                                                              const Instruction* inst, \
401                                                              uint16_t inst_data)
402
403#define EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(_field_type)   \
404  EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL(_field_type, false);     \
405  EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL(_field_type, true);
406
407EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimInt)      // iput-quick.
408EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimBoolean)  // iput-boolean-quick.
409EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimByte)     // iput-byte-quick.
410EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimChar)     // iput-char-quick.
411EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimShort)    // iput-short-quick.
412EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimLong)     // iput-wide-quick.
413EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL(Primitive::kPrimNot)      // iput-object-quick.
414#undef EXPLICIT_DO_IPUT_QUICK_ALL_TEMPLATE_DECL
415#undef EXPLICIT_DO_IPUT_QUICK_TEMPLATE_DECL
416
417uint32_t FindNextInstructionFollowingException(
418    Thread* self, ShadowFrame& shadow_frame, uint32_t dex_pc,
419    const instrumentation::Instrumentation* instrumentation) {
420  self->VerifyStack();
421  StackHandleScope<2> hs(self);
422  Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException()));
423  if (instrumentation->HasExceptionCaughtListeners()
424      && self->IsExceptionThrownByCurrentMethod(exception.Get())) {
425    instrumentation->ExceptionCaughtEvent(self, exception.Get());
426  }
427  bool clear_exception = false;
428  uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(
429      hs.NewHandle(exception->GetClass()), dex_pc, &clear_exception);
430  if (found_dex_pc == DexFile::kDexNoIndex) {
431    // Exception is not caught by the current method. We will unwind to the
432    // caller. Notify any instrumentation listener.
433    instrumentation->MethodUnwindEvent(self, shadow_frame.GetThisObject(),
434                                       shadow_frame.GetMethod(), dex_pc);
435  } else {
436    // Exception is caught in the current method. We will jump to the found_dex_pc.
437    if (clear_exception) {
438      self->ClearException();
439    }
440  }
441  return found_dex_pc;
442}
443
444void UnexpectedOpcode(const Instruction* inst, const ShadowFrame& shadow_frame) {
445  LOG(FATAL) << "Unexpected instruction: "
446             << inst->DumpString(shadow_frame.GetMethod()->GetDexFile());
447  UNREACHABLE();
448}
449
450// Assign register 'src_reg' from shadow_frame to register 'dest_reg' into new_shadow_frame.
451static inline void AssignRegister(ShadowFrame* new_shadow_frame, const ShadowFrame& shadow_frame,
452                                  size_t dest_reg, size_t src_reg)
453    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
454  // Uint required, so that sign extension does not make this wrong on 64b systems
455  uint32_t src_value = shadow_frame.GetVReg(src_reg);
456  mirror::Object* o = shadow_frame.GetVRegReference<kVerifyNone>(src_reg);
457
458  // If both register locations contains the same value, the register probably holds a reference.
459  // Note: As an optimization, non-moving collectors leave a stale reference value
460  // in the references array even after the original vreg was overwritten to a non-reference.
461  if (src_value == reinterpret_cast<uintptr_t>(o)) {
462    new_shadow_frame->SetVRegReference(dest_reg, o);
463  } else {
464    new_shadow_frame->SetVReg(dest_reg, src_value);
465  }
466}
467
468void AbortTransactionF(Thread* self, const char* fmt, ...) {
469  va_list args;
470  va_start(args, fmt);
471  AbortTransactionV(self, fmt, args);
472  va_end(args);
473}
474
475void AbortTransactionV(Thread* self, const char* fmt, va_list args) {
476  CHECK(Runtime::Current()->IsActiveTransaction());
477  // Constructs abort message.
478  std::string abort_msg;
479  StringAppendV(&abort_msg, fmt, args);
480  // Throws an exception so we can abort the transaction and rollback every change.
481  Runtime::Current()->AbortTransactionAndThrowAbortError(self, abort_msg);
482}
483
484// Separate declaration is required solely for the attributes.
485template<bool is_range, bool do_assignability_check> SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
486static inline bool DoCallCommon(ArtMethod* called_method,
487                                Thread* self,
488                                ShadowFrame& shadow_frame,
489                                JValue* result,
490                                uint16_t number_of_inputs,
491                                uint32_t arg[Instruction::kMaxVarArgRegs],
492                                uint32_t vregC) ALWAYS_INLINE;
493
494SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)
495static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) ALWAYS_INLINE;
496
497static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) {
498  ArtMethod* target = new_shadow_frame->GetMethod();
499  if (UNLIKELY(target->IsNative() || target->IsProxyMethod())) {
500    return false;
501  }
502  Runtime* runtime = Runtime::Current();
503  ClassLinker* class_linker = runtime->GetClassLinker();
504  return runtime->GetInstrumentation()->IsForcedInterpretOnly() ||
505        // Doing this check avoids doing compiled/interpreter transitions.
506        class_linker->IsQuickToInterpreterBridge(target->GetEntryPointFromQuickCompiledCode()) ||
507        // Force the use of interpreter when it is required by the debugger.
508        Dbg::IsForcedInterpreterNeededForCalling(self, target);
509}
510
511template<bool is_range, bool do_assignability_check>
512static inline bool DoCallCommon(ArtMethod* called_method,
513                                Thread* self,
514                                ShadowFrame& shadow_frame,
515                                JValue* result,
516                                uint16_t number_of_inputs,
517                                uint32_t arg[Instruction::kMaxVarArgRegs],
518                                uint32_t vregC) {
519  bool string_init = false;
520  // Replace calls to String.<init> with equivalent StringFactory call.
521  if (UNLIKELY(called_method->GetDeclaringClass()->IsStringClass()
522               && called_method->IsConstructor())) {
523    ScopedObjectAccessUnchecked soa(self);
524    jmethodID mid = soa.EncodeMethod(called_method);
525    called_method = soa.DecodeMethod(WellKnownClasses::StringInitToStringFactoryMethodID(mid));
526    string_init = true;
527  }
528
529  // Compute method information.
530  const DexFile::CodeItem* code_item = called_method->GetCodeItem();
531
532  // Number of registers for the callee's call frame.
533  uint16_t num_regs;
534  if (LIKELY(code_item != nullptr)) {
535    num_regs = code_item->registers_size_;
536    DCHECK_EQ(string_init ? number_of_inputs - 1 : number_of_inputs, code_item->ins_size_);
537  } else {
538    DCHECK(called_method->IsNative() || called_method->IsProxyMethod());
539    num_regs = number_of_inputs;
540  }
541
542  // Hack for String init:
543  //
544  // Rewrite invoke-x java.lang.String.<init>(this, a, b, c, ...) into:
545  //         invoke-x StringFactory(a, b, c, ...)
546  // by effectively dropping the first virtual register from the invoke.
547  //
548  // (at this point the ArtMethod has already been replaced,
549  // so we just need to fix-up the arguments)
550  uint32_t string_init_vreg_this = is_range ? vregC : arg[0];
551  if (UNLIKELY(string_init)) {
552    DCHECK_GT(num_regs, 0u);  // As the method is an instance method, there should be at least 1.
553
554    // The new StringFactory call is static and has one fewer argument.
555    if (code_item == nullptr) {
556      DCHECK(called_method->IsNative() || called_method->IsProxyMethod());
557      num_regs--;
558    }  // else ... don't need to change num_regs since it comes up from the string_init's code item
559    number_of_inputs--;
560
561    // Rewrite the var-args, dropping the 0th argument ("this")
562    for (uint32_t i = 1; i < Instruction::kMaxVarArgRegs; ++i) {
563      arg[i - 1] = arg[i];
564    }
565    arg[Instruction::kMaxVarArgRegs - 1] = 0;
566
567    // Rewrite the non-var-arg case
568    vregC++;  // Skips the 0th vreg in the range ("this").
569  }
570
571  // Parameter registers go at the end of the shadow frame.
572  DCHECK_GE(num_regs, number_of_inputs);
573  size_t first_dest_reg = num_regs - number_of_inputs;
574  DCHECK_NE(first_dest_reg, (size_t)-1);
575
576  // Allocate shadow frame on the stack.
577  const char* old_cause = self->StartAssertNoThreadSuspension("DoCallCommon");
578  void* memory = alloca(ShadowFrame::ComputeSize(num_regs));
579  ShadowFrame* new_shadow_frame(ShadowFrame::Create(num_regs, &shadow_frame, called_method, 0,
580                                                    memory));
581
582  // Initialize new shadow frame by copying the registers from the callee shadow frame.
583  if (do_assignability_check) {
584    // Slow path.
585    // We might need to do class loading, which incurs a thread state change to kNative. So
586    // register the shadow frame as under construction and allow suspension again.
587    ScopedStackedShadowFramePusher pusher(
588        self, new_shadow_frame, StackedShadowFrameType::kShadowFrameUnderConstruction);
589    self->EndAssertNoThreadSuspension(old_cause);
590
591    // We need to do runtime check on reference assignment. We need to load the shorty
592    // to get the exact type of each reference argument.
593    const DexFile::TypeList* params = new_shadow_frame->GetMethod()->GetParameterTypeList();
594    uint32_t shorty_len = 0;
595    const char* shorty = new_shadow_frame->GetMethod()->GetShorty(&shorty_len);
596
597    // Handle receiver apart since it's not part of the shorty.
598    size_t dest_reg = first_dest_reg;
599    size_t arg_offset = 0;
600
601    if (!new_shadow_frame->GetMethod()->IsStatic()) {
602      size_t receiver_reg = is_range ? vregC : arg[0];
603      new_shadow_frame->SetVRegReference(dest_reg, shadow_frame.GetVRegReference(receiver_reg));
604      ++dest_reg;
605      ++arg_offset;
606      DCHECK(!string_init);  // All StringFactory methods are static.
607    }
608
609    // Copy the caller's invoke-* arguments into the callee's parameter registers.
610    for (uint32_t shorty_pos = 0; dest_reg < num_regs; ++shorty_pos, ++dest_reg, ++arg_offset) {
611      // Skip the 0th 'shorty' type since it represents the return type.
612      DCHECK_LT(shorty_pos + 1, shorty_len) << "for shorty '" << shorty << "'";
613      const size_t src_reg = (is_range) ? vregC + arg_offset : arg[arg_offset];
614      switch (shorty[shorty_pos + 1]) {
615        // Handle Object references. 1 virtual register slot.
616        case 'L': {
617          Object* o = shadow_frame.GetVRegReference(src_reg);
618          if (do_assignability_check && o != nullptr) {
619            Class* arg_type =
620                new_shadow_frame->GetMethod()->GetClassFromTypeIndex(
621                    params->GetTypeItem(shorty_pos).type_idx_, true);
622            if (arg_type == nullptr) {
623              CHECK(self->IsExceptionPending());
624              return false;
625            }
626            if (!o->VerifierInstanceOf(arg_type)) {
627              // This should never happen.
628              std::string temp1, temp2;
629              self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
630                                       "Invoking %s with bad arg %d, type '%s' not instance of '%s'",
631                                       new_shadow_frame->GetMethod()->GetName(), shorty_pos,
632                                       o->GetClass()->GetDescriptor(&temp1),
633                                       arg_type->GetDescriptor(&temp2));
634              return false;
635            }
636          }
637          new_shadow_frame->SetVRegReference(dest_reg, o);
638          break;
639        }
640        // Handle doubles and longs. 2 consecutive virtual register slots.
641        case 'J': case 'D': {
642          uint64_t wide_value =
643              (static_cast<uint64_t>(shadow_frame.GetVReg(src_reg + 1)) << BitSizeOf<uint32_t>()) |
644               static_cast<uint32_t>(shadow_frame.GetVReg(src_reg));
645          new_shadow_frame->SetVRegLong(dest_reg, wide_value);
646          // Skip the next virtual register slot since we already used it.
647          ++dest_reg;
648          ++arg_offset;
649          break;
650        }
651        // Handle all other primitives that are always 1 virtual register slot.
652        default:
653          new_shadow_frame->SetVReg(dest_reg, shadow_frame.GetVReg(src_reg));
654          break;
655      }
656    }
657  } else {
658    size_t arg_index = 0;
659
660    // Fast path: no extra checks.
661    if (is_range) {
662      // TODO: Implement the range version of invoke-lambda
663      uint16_t first_src_reg = vregC;
664
665      for (size_t src_reg = first_src_reg, dest_reg = first_dest_reg; dest_reg < num_regs;
666          ++dest_reg, ++src_reg) {
667        AssignRegister(new_shadow_frame, shadow_frame, dest_reg, src_reg);
668      }
669    } else {
670      DCHECK_LE(number_of_inputs, Instruction::kMaxVarArgRegs);
671
672      for (; arg_index < number_of_inputs; ++arg_index) {
673        AssignRegister(new_shadow_frame, shadow_frame, first_dest_reg + arg_index, arg[arg_index]);
674      }
675    }
676    self->EndAssertNoThreadSuspension(old_cause);
677  }
678
679  // Do the call now.
680  if (LIKELY(Runtime::Current()->IsStarted())) {
681    if (NeedsInterpreter(self, new_shadow_frame)) {
682      artInterpreterToInterpreterBridge(self, code_item, new_shadow_frame, result);
683    } else {
684      artInterpreterToCompiledCodeBridge(self, code_item, new_shadow_frame, result);
685    }
686  } else {
687    UnstartedRuntime::Invoke(self, code_item, new_shadow_frame, result, first_dest_reg);
688  }
689
690  if (string_init && !self->IsExceptionPending()) {
691    // Set the new string result of the StringFactory.
692    shadow_frame.SetVRegReference(string_init_vreg_this, result->GetL());
693    // Overwrite all potential copies of the original result of the new-instance of string with the
694    // new result of the StringFactory. Use the verifier to find this set of registers.
695    ArtMethod* method = shadow_frame.GetMethod();
696    MethodReference method_ref = method->ToMethodReference();
697    SafeMap<uint32_t, std::set<uint32_t>> string_init_map;
698    SafeMap<uint32_t, std::set<uint32_t>>* string_init_map_ptr;
699    MethodRefToStringInitRegMap& method_to_string_init_map = Runtime::Current()->GetStringInitMap();
700    auto it = method_to_string_init_map.find(method_ref);
701    if (it == method_to_string_init_map.end()) {
702      string_init_map = std::move(verifier::MethodVerifier::FindStringInitMap(method));
703      method_to_string_init_map.Overwrite(method_ref, string_init_map);
704      string_init_map_ptr = &string_init_map;
705    } else {
706      string_init_map_ptr = &it->second;
707    }
708    if (string_init_map_ptr->size() != 0) {
709      uint32_t dex_pc = shadow_frame.GetDexPC();
710      auto map_it = string_init_map_ptr->find(dex_pc);
711      if (map_it != string_init_map_ptr->end()) {
712        const std::set<uint32_t>& reg_set = map_it->second;
713        for (auto set_it = reg_set.begin(); set_it != reg_set.end(); ++set_it) {
714          shadow_frame.SetVRegReference(*set_it, result->GetL());
715        }
716      }
717    }
718  }
719
720  return !self->IsExceptionPending();
721}
722
723template<bool is_range, bool do_assignability_check>
724bool DoLambdaCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame,
725                  const Instruction* inst, uint16_t inst_data, JValue* result) {
726  const uint4_t num_additional_registers = inst->VRegB_25x();
727  // Argument word count.
728  const uint16_t number_of_inputs = num_additional_registers + 1;
729  // The first input register is always present and is not encoded in the count.
730
731  // TODO: find a cleaner way to separate non-range and range information without duplicating
732  //       code.
733  uint32_t arg[Instruction::kMaxVarArgRegs];  // only used in invoke-XXX.
734  uint32_t vregC = 0;   // only used in invoke-XXX-range.
735  if (is_range) {
736    vregC = inst->VRegC_3rc();
737  } else {
738    // TODO(iam): See if it's possible to remove inst_data dependency from 35x to avoid this path
739    UNUSED(inst_data);
740    inst->GetAllArgs25x(arg);
741  }
742
743  // TODO: if there's an assignability check, throw instead?
744  DCHECK(called_method->IsStatic());
745
746  return DoCallCommon<is_range, do_assignability_check>(
747      called_method, self, shadow_frame,
748      result, number_of_inputs, arg, vregC);
749}
750
751template<bool is_range, bool do_assignability_check>
752bool DoCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame,
753            const Instruction* inst, uint16_t inst_data, JValue* result) {
754  // Argument word count.
755  const uint16_t number_of_inputs = (is_range) ? inst->VRegA_3rc(inst_data) : inst->VRegA_35c(inst_data);
756
757  // TODO: find a cleaner way to separate non-range and range information without duplicating
758  //       code.
759  uint32_t arg[Instruction::kMaxVarArgRegs];  // only used in invoke-XXX.
760  uint32_t vregC = 0;
761  if (is_range) {
762    vregC = inst->VRegC_3rc();
763  } else {
764    vregC = inst->VRegC_35c();
765    inst->GetVarArgs(arg, inst_data);
766  }
767
768  return DoCallCommon<is_range, do_assignability_check>(
769      called_method, self, shadow_frame,
770      result, number_of_inputs, arg, vregC);
771}
772
773template <bool is_range, bool do_access_check, bool transaction_active>
774bool DoFilledNewArray(const Instruction* inst, const ShadowFrame& shadow_frame,
775                      Thread* self, JValue* result) {
776  DCHECK(inst->Opcode() == Instruction::FILLED_NEW_ARRAY ||
777         inst->Opcode() == Instruction::FILLED_NEW_ARRAY_RANGE);
778  const int32_t length = is_range ? inst->VRegA_3rc() : inst->VRegA_35c();
779  if (!is_range) {
780    // Checks FILLED_NEW_ARRAY's length does not exceed 5 arguments.
781    CHECK_LE(length, 5);
782  }
783  if (UNLIKELY(length < 0)) {
784    ThrowNegativeArraySizeException(length);
785    return false;
786  }
787  uint16_t type_idx = is_range ? inst->VRegB_3rc() : inst->VRegB_35c();
788  Class* array_class = ResolveVerifyAndClinit(type_idx, shadow_frame.GetMethod(),
789                                              self, false, do_access_check);
790  if (UNLIKELY(array_class == nullptr)) {
791    DCHECK(self->IsExceptionPending());
792    return false;
793  }
794  CHECK(array_class->IsArrayClass());
795  Class* component_class = array_class->GetComponentType();
796  const bool is_primitive_int_component = component_class->IsPrimitiveInt();
797  if (UNLIKELY(component_class->IsPrimitive() && !is_primitive_int_component)) {
798    if (component_class->IsPrimitiveLong() || component_class->IsPrimitiveDouble()) {
799      ThrowRuntimeException("Bad filled array request for type %s",
800                            PrettyDescriptor(component_class).c_str());
801    } else {
802      self->ThrowNewExceptionF("Ljava/lang/InternalError;",
803                               "Found type %s; filled-new-array not implemented for anything but 'int'",
804                               PrettyDescriptor(component_class).c_str());
805    }
806    return false;
807  }
808  Object* new_array = Array::Alloc<true>(self, array_class, length,
809                                         array_class->GetComponentSizeShift(),
810                                         Runtime::Current()->GetHeap()->GetCurrentAllocator());
811  if (UNLIKELY(new_array == nullptr)) {
812    self->AssertPendingOOMException();
813    return false;
814  }
815  uint32_t arg[Instruction::kMaxVarArgRegs];  // only used in filled-new-array.
816  uint32_t vregC = 0;   // only used in filled-new-array-range.
817  if (is_range) {
818    vregC = inst->VRegC_3rc();
819  } else {
820    inst->GetVarArgs(arg);
821  }
822  for (int32_t i = 0; i < length; ++i) {
823    size_t src_reg = is_range ? vregC + i : arg[i];
824    if (is_primitive_int_component) {
825      new_array->AsIntArray()->SetWithoutChecks<transaction_active>(
826          i, shadow_frame.GetVReg(src_reg));
827    } else {
828      new_array->AsObjectArray<Object>()->SetWithoutChecks<transaction_active>(
829          i, shadow_frame.GetVRegReference(src_reg));
830    }
831  }
832
833  result->SetL(new_array);
834  return true;
835}
836
837// TODO fix thread analysis: should be SHARED_LOCKS_REQUIRED(Locks::mutator_lock_).
838template<typename T>
839static void RecordArrayElementsInTransactionImpl(mirror::PrimitiveArray<T>* array, int32_t count)
840    NO_THREAD_SAFETY_ANALYSIS {
841  Runtime* runtime = Runtime::Current();
842  for (int32_t i = 0; i < count; ++i) {
843    runtime->RecordWriteArray(array, i, array->GetWithoutChecks(i));
844  }
845}
846
847void RecordArrayElementsInTransaction(mirror::Array* array, int32_t count)
848    SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
849  DCHECK(Runtime::Current()->IsActiveTransaction());
850  DCHECK(array != nullptr);
851  DCHECK_LE(count, array->GetLength());
852  Primitive::Type primitive_component_type = array->GetClass()->GetComponentType()->GetPrimitiveType();
853  switch (primitive_component_type) {
854    case Primitive::kPrimBoolean:
855      RecordArrayElementsInTransactionImpl(array->AsBooleanArray(), count);
856      break;
857    case Primitive::kPrimByte:
858      RecordArrayElementsInTransactionImpl(array->AsByteArray(), count);
859      break;
860    case Primitive::kPrimChar:
861      RecordArrayElementsInTransactionImpl(array->AsCharArray(), count);
862      break;
863    case Primitive::kPrimShort:
864      RecordArrayElementsInTransactionImpl(array->AsShortArray(), count);
865      break;
866    case Primitive::kPrimInt:
867      RecordArrayElementsInTransactionImpl(array->AsIntArray(), count);
868      break;
869    case Primitive::kPrimFloat:
870      RecordArrayElementsInTransactionImpl(array->AsFloatArray(), count);
871      break;
872    case Primitive::kPrimLong:
873      RecordArrayElementsInTransactionImpl(array->AsLongArray(), count);
874      break;
875    case Primitive::kPrimDouble:
876      RecordArrayElementsInTransactionImpl(array->AsDoubleArray(), count);
877      break;
878    default:
879      LOG(FATAL) << "Unsupported primitive type " << primitive_component_type
880                 << " in fill-array-data";
881      break;
882  }
883}
884
885// Explicit DoCall template function declarations.
886#define EXPLICIT_DO_CALL_TEMPLATE_DECL(_is_range, _do_assignability_check)                      \
887  template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)                                          \
888  bool DoCall<_is_range, _do_assignability_check>(ArtMethod* method, Thread* self,              \
889                                                  ShadowFrame& shadow_frame,                    \
890                                                  const Instruction* inst, uint16_t inst_data,  \
891                                                  JValue* result)
892EXPLICIT_DO_CALL_TEMPLATE_DECL(false, false);
893EXPLICIT_DO_CALL_TEMPLATE_DECL(false, true);
894EXPLICIT_DO_CALL_TEMPLATE_DECL(true, false);
895EXPLICIT_DO_CALL_TEMPLATE_DECL(true, true);
896#undef EXPLICIT_DO_CALL_TEMPLATE_DECL
897
898// Explicit DoLambdaCall template function declarations.
899#define EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(_is_range, _do_assignability_check)               \
900  template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)                                          \
901  bool DoLambdaCall<_is_range, _do_assignability_check>(ArtMethod* method, Thread* self,        \
902                                                        ShadowFrame& shadow_frame,              \
903                                                        const Instruction* inst,                \
904                                                        uint16_t inst_data,                     \
905                                                        JValue* result)
906EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(false, false);
907EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(false, true);
908EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(true, false);
909EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(true, true);
910#undef EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL
911
912// Explicit DoFilledNewArray template function declarations.
913#define EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(_is_range_, _check, _transaction_active)       \
914  template SHARED_LOCKS_REQUIRED(Locks::mutator_lock_)                                            \
915  bool DoFilledNewArray<_is_range_, _check, _transaction_active>(const Instruction* inst,         \
916                                                                 const ShadowFrame& shadow_frame, \
917                                                                 Thread* self, JValue* result)
918#define EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL(_transaction_active)       \
919  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(false, false, _transaction_active);  \
920  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(false, true, _transaction_active);   \
921  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(true, false, _transaction_active);   \
922  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(true, true, _transaction_active)
923EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL(false);
924EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL(true);
925#undef EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL
926#undef EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL
927
928}  // namespace interpreter
929}  // namespace art
930