interpreter_common.cc revision a2c38644d96cbad4106c0165811d0f670d6cec8f
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_REQUIRES(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
417// We accept a null Instrumentation* meaning we must not report anything to the instrumentation.
418uint32_t FindNextInstructionFollowingException(
419    Thread* self, ShadowFrame& shadow_frame, uint32_t dex_pc,
420    const instrumentation::Instrumentation* instrumentation) {
421  self->VerifyStack();
422  StackHandleScope<2> hs(self);
423  Handle<mirror::Throwable> exception(hs.NewHandle(self->GetException()));
424  if (instrumentation != nullptr && instrumentation->HasExceptionCaughtListeners()
425      && self->IsExceptionThrownByCurrentMethod(exception.Get())) {
426    instrumentation->ExceptionCaughtEvent(self, exception.Get());
427  }
428  bool clear_exception = false;
429  uint32_t found_dex_pc = shadow_frame.GetMethod()->FindCatchBlock(
430      hs.NewHandle(exception->GetClass()), dex_pc, &clear_exception);
431  if (found_dex_pc == DexFile::kDexNoIndex && instrumentation != nullptr) {
432    // Exception is not caught by the current method. We will unwind to the
433    // caller. Notify any instrumentation listener.
434    instrumentation->MethodUnwindEvent(self, shadow_frame.GetThisObject(),
435                                       shadow_frame.GetMethod(), dex_pc);
436  } else {
437    // Exception is caught in the current method. We will jump to the found_dex_pc.
438    if (clear_exception) {
439      self->ClearException();
440    }
441  }
442  return found_dex_pc;
443}
444
445void UnexpectedOpcode(const Instruction* inst, const ShadowFrame& shadow_frame) {
446  LOG(FATAL) << "Unexpected instruction: "
447             << inst->DumpString(shadow_frame.GetMethod()->GetDexFile());
448  UNREACHABLE();
449}
450
451// Assign register 'src_reg' from shadow_frame to register 'dest_reg' into new_shadow_frame.
452static inline void AssignRegister(ShadowFrame* new_shadow_frame, const ShadowFrame& shadow_frame,
453                                  size_t dest_reg, size_t src_reg)
454    SHARED_REQUIRES(Locks::mutator_lock_) {
455  // Uint required, so that sign extension does not make this wrong on 64b systems
456  uint32_t src_value = shadow_frame.GetVReg(src_reg);
457  mirror::Object* o = shadow_frame.GetVRegReference<kVerifyNone>(src_reg);
458
459  // If both register locations contains the same value, the register probably holds a reference.
460  // Note: As an optimization, non-moving collectors leave a stale reference value
461  // in the references array even after the original vreg was overwritten to a non-reference.
462  if (src_value == reinterpret_cast<uintptr_t>(o)) {
463    new_shadow_frame->SetVRegReference(dest_reg, o);
464  } else {
465    new_shadow_frame->SetVReg(dest_reg, src_value);
466  }
467}
468
469void AbortTransactionF(Thread* self, const char* fmt, ...) {
470  va_list args;
471  va_start(args, fmt);
472  AbortTransactionV(self, fmt, args);
473  va_end(args);
474}
475
476void AbortTransactionV(Thread* self, const char* fmt, va_list args) {
477  CHECK(Runtime::Current()->IsActiveTransaction());
478  // Constructs abort message.
479  std::string abort_msg;
480  StringAppendV(&abort_msg, fmt, args);
481  // Throws an exception so we can abort the transaction and rollback every change.
482  Runtime::Current()->AbortTransactionAndThrowAbortError(self, abort_msg);
483}
484
485// Separate declaration is required solely for the attributes.
486template<bool is_range, bool do_assignability_check> SHARED_REQUIRES(Locks::mutator_lock_)
487static inline bool DoCallCommon(ArtMethod* called_method,
488                                Thread* self,
489                                ShadowFrame& shadow_frame,
490                                JValue* result,
491                                uint16_t number_of_inputs,
492                                uint32_t arg[Instruction::kMaxVarArgRegs],
493                                uint32_t vregC) ALWAYS_INLINE;
494
495SHARED_REQUIRES(Locks::mutator_lock_)
496static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) ALWAYS_INLINE;
497
498static inline bool NeedsInterpreter(Thread* self, ShadowFrame* new_shadow_frame) {
499  ArtMethod* target = new_shadow_frame->GetMethod();
500  if (UNLIKELY(target->IsNative() || target->IsProxyMethod())) {
501    return false;
502  }
503  Runtime* runtime = Runtime::Current();
504  ClassLinker* class_linker = runtime->GetClassLinker();
505  return runtime->GetInstrumentation()->IsForcedInterpretOnly() ||
506        // Doing this check avoids doing compiled/interpreter transitions.
507        class_linker->IsQuickToInterpreterBridge(target->GetEntryPointFromQuickCompiledCode()) ||
508        // Force the use of interpreter when it is required by the debugger.
509        Dbg::IsForcedInterpreterNeededForCalling(self, target);
510}
511
512template<bool is_range, bool do_assignability_check>
513static inline bool DoCallCommon(ArtMethod* called_method,
514                                Thread* self,
515                                ShadowFrame& shadow_frame,
516                                JValue* result,
517                                uint16_t number_of_inputs,
518                                uint32_t arg[Instruction::kMaxVarArgRegs],
519                                uint32_t vregC) {
520  bool string_init = false;
521  // Replace calls to String.<init> with equivalent StringFactory call.
522  if (UNLIKELY(called_method->GetDeclaringClass()->IsStringClass()
523               && called_method->IsConstructor())) {
524    ScopedObjectAccessUnchecked soa(self);
525    jmethodID mid = soa.EncodeMethod(called_method);
526    called_method = soa.DecodeMethod(WellKnownClasses::StringInitToStringFactoryMethodID(mid));
527    string_init = true;
528  }
529
530  // Compute method information.
531  const DexFile::CodeItem* code_item = called_method->GetCodeItem();
532
533  // Number of registers for the callee's call frame.
534  uint16_t num_regs;
535  if (LIKELY(code_item != nullptr)) {
536    num_regs = code_item->registers_size_;
537    DCHECK_EQ(string_init ? number_of_inputs - 1 : number_of_inputs, code_item->ins_size_);
538  } else {
539    DCHECK(called_method->IsNative() || called_method->IsProxyMethod());
540    num_regs = number_of_inputs;
541  }
542
543  // Hack for String init:
544  //
545  // Rewrite invoke-x java.lang.String.<init>(this, a, b, c, ...) into:
546  //         invoke-x StringFactory(a, b, c, ...)
547  // by effectively dropping the first virtual register from the invoke.
548  //
549  // (at this point the ArtMethod has already been replaced,
550  // so we just need to fix-up the arguments)
551  uint32_t string_init_vreg_this = is_range ? vregC : arg[0];
552  if (UNLIKELY(string_init)) {
553    DCHECK_GT(num_regs, 0u);  // As the method is an instance method, there should be at least 1.
554
555    // The new StringFactory call is static and has one fewer argument.
556    if (code_item == nullptr) {
557      DCHECK(called_method->IsNative() || called_method->IsProxyMethod());
558      num_regs--;
559    }  // else ... don't need to change num_regs since it comes up from the string_init's code item
560    number_of_inputs--;
561
562    // Rewrite the var-args, dropping the 0th argument ("this")
563    for (uint32_t i = 1; i < Instruction::kMaxVarArgRegs; ++i) {
564      arg[i - 1] = arg[i];
565    }
566    arg[Instruction::kMaxVarArgRegs - 1] = 0;
567
568    // Rewrite the non-var-arg case
569    vregC++;  // Skips the 0th vreg in the range ("this").
570  }
571
572  // Parameter registers go at the end of the shadow frame.
573  DCHECK_GE(num_regs, number_of_inputs);
574  size_t first_dest_reg = num_regs - number_of_inputs;
575  DCHECK_NE(first_dest_reg, (size_t)-1);
576
577  // Allocate shadow frame on the stack.
578  const char* old_cause = self->StartAssertNoThreadSuspension("DoCallCommon");
579  void* memory = alloca(ShadowFrame::ComputeSize(num_regs));
580  ShadowFrame* new_shadow_frame(ShadowFrame::Create(num_regs, &shadow_frame, called_method, 0,
581                                                    memory));
582
583  // Initialize new shadow frame by copying the registers from the callee shadow frame.
584  if (do_assignability_check) {
585    // Slow path.
586    // We might need to do class loading, which incurs a thread state change to kNative. So
587    // register the shadow frame as under construction and allow suspension again.
588    ScopedStackedShadowFramePusher pusher(
589        self, new_shadow_frame, StackedShadowFrameType::kShadowFrameUnderConstruction);
590    self->EndAssertNoThreadSuspension(old_cause);
591
592    // We need to do runtime check on reference assignment. We need to load the shorty
593    // to get the exact type of each reference argument.
594    const DexFile::TypeList* params = new_shadow_frame->GetMethod()->GetParameterTypeList();
595    uint32_t shorty_len = 0;
596    const char* shorty = new_shadow_frame->GetMethod()->GetShorty(&shorty_len);
597
598    // Handle receiver apart since it's not part of the shorty.
599    size_t dest_reg = first_dest_reg;
600    size_t arg_offset = 0;
601
602    if (!new_shadow_frame->GetMethod()->IsStatic()) {
603      size_t receiver_reg = is_range ? vregC : arg[0];
604      new_shadow_frame->SetVRegReference(dest_reg, shadow_frame.GetVRegReference(receiver_reg));
605      ++dest_reg;
606      ++arg_offset;
607      DCHECK(!string_init);  // All StringFactory methods are static.
608    }
609
610    // Copy the caller's invoke-* arguments into the callee's parameter registers.
611    for (uint32_t shorty_pos = 0; dest_reg < num_regs; ++shorty_pos, ++dest_reg, ++arg_offset) {
612      // Skip the 0th 'shorty' type since it represents the return type.
613      DCHECK_LT(shorty_pos + 1, shorty_len) << "for shorty '" << shorty << "'";
614      const size_t src_reg = (is_range) ? vregC + arg_offset : arg[arg_offset];
615      switch (shorty[shorty_pos + 1]) {
616        // Handle Object references. 1 virtual register slot.
617        case 'L': {
618          Object* o = shadow_frame.GetVRegReference(src_reg);
619          if (do_assignability_check && o != nullptr) {
620            size_t pointer_size = Runtime::Current()->GetClassLinker()->GetImagePointerSize();
621            Class* arg_type =
622                new_shadow_frame->GetMethod()->GetClassFromTypeIndex(
623                    params->GetTypeItem(shorty_pos).type_idx_, true /* resolve */, pointer_size);
624            if (arg_type == nullptr) {
625              CHECK(self->IsExceptionPending());
626              return false;
627            }
628            if (!o->VerifierInstanceOf(arg_type)) {
629              // This should never happen.
630              std::string temp1, temp2;
631              self->ThrowNewExceptionF("Ljava/lang/VirtualMachineError;",
632                                       "Invoking %s with bad arg %d, type '%s' not instance of '%s'",
633                                       new_shadow_frame->GetMethod()->GetName(), shorty_pos,
634                                       o->GetClass()->GetDescriptor(&temp1),
635                                       arg_type->GetDescriptor(&temp2));
636              return false;
637            }
638          }
639          new_shadow_frame->SetVRegReference(dest_reg, o);
640          break;
641        }
642        // Handle doubles and longs. 2 consecutive virtual register slots.
643        case 'J': case 'D': {
644          uint64_t wide_value =
645              (static_cast<uint64_t>(shadow_frame.GetVReg(src_reg + 1)) << BitSizeOf<uint32_t>()) |
646               static_cast<uint32_t>(shadow_frame.GetVReg(src_reg));
647          new_shadow_frame->SetVRegLong(dest_reg, wide_value);
648          // Skip the next virtual register slot since we already used it.
649          ++dest_reg;
650          ++arg_offset;
651          break;
652        }
653        // Handle all other primitives that are always 1 virtual register slot.
654        default:
655          new_shadow_frame->SetVReg(dest_reg, shadow_frame.GetVReg(src_reg));
656          break;
657      }
658    }
659  } else {
660    size_t arg_index = 0;
661
662    // Fast path: no extra checks.
663    if (is_range) {
664      // TODO: Implement the range version of invoke-lambda
665      uint16_t first_src_reg = vregC;
666
667      for (size_t src_reg = first_src_reg, dest_reg = first_dest_reg; dest_reg < num_regs;
668          ++dest_reg, ++src_reg) {
669        AssignRegister(new_shadow_frame, shadow_frame, dest_reg, src_reg);
670      }
671    } else {
672      DCHECK_LE(number_of_inputs, Instruction::kMaxVarArgRegs);
673
674      for (; arg_index < number_of_inputs; ++arg_index) {
675        AssignRegister(new_shadow_frame, shadow_frame, first_dest_reg + arg_index, arg[arg_index]);
676      }
677    }
678    self->EndAssertNoThreadSuspension(old_cause);
679  }
680
681  // Do the call now.
682  if (LIKELY(Runtime::Current()->IsStarted())) {
683    if (NeedsInterpreter(self, new_shadow_frame)) {
684      artInterpreterToInterpreterBridge(self, code_item, new_shadow_frame, result);
685    } else {
686      artInterpreterToCompiledCodeBridge(self, code_item, new_shadow_frame, result);
687    }
688  } else {
689    UnstartedRuntime::Invoke(self, code_item, new_shadow_frame, result, first_dest_reg);
690  }
691
692  if (string_init && !self->IsExceptionPending()) {
693    // Set the new string result of the StringFactory.
694    shadow_frame.SetVRegReference(string_init_vreg_this, result->GetL());
695    // Overwrite all potential copies of the original result of the new-instance of string with the
696    // new result of the StringFactory. Use the verifier to find this set of registers.
697    ArtMethod* method = shadow_frame.GetMethod();
698    MethodReference method_ref = method->ToMethodReference();
699    SafeMap<uint32_t, std::set<uint32_t>> string_init_map;
700    SafeMap<uint32_t, std::set<uint32_t>>* string_init_map_ptr;
701    MethodRefToStringInitRegMap& method_to_string_init_map = Runtime::Current()->GetStringInitMap();
702    MethodRefToStringInitRegMap::iterator it;
703    {
704      MutexLock mu(self, *Locks::interpreter_string_init_map_lock_);
705      it = method_to_string_init_map.find(method_ref);
706    }
707    if (it == method_to_string_init_map.end()) {
708      string_init_map = std::move(verifier::MethodVerifier::FindStringInitMap(method));
709      {
710        MutexLock mu(self, *Locks::interpreter_string_init_map_lock_);
711        method_to_string_init_map.Overwrite(method_ref, string_init_map);
712      }
713      string_init_map_ptr = &string_init_map;
714    } else {
715      string_init_map_ptr = &it->second;
716    }
717    if (string_init_map_ptr->size() != 0) {
718      uint32_t dex_pc = shadow_frame.GetDexPC();
719      auto map_it = string_init_map_ptr->find(dex_pc);
720      if (map_it != string_init_map_ptr->end()) {
721        const std::set<uint32_t>& reg_set = map_it->second;
722        for (auto set_it = reg_set.begin(); set_it != reg_set.end(); ++set_it) {
723          shadow_frame.SetVRegReference(*set_it, result->GetL());
724        }
725      }
726    }
727  }
728
729  return !self->IsExceptionPending();
730}
731
732template<bool is_range, bool do_assignability_check>
733bool DoLambdaCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame,
734                  const Instruction* inst, uint16_t inst_data, JValue* result) {
735  const uint4_t num_additional_registers = inst->VRegB_25x();
736  // Argument word count.
737  const uint16_t number_of_inputs = num_additional_registers + 1;
738  // The first input register is always present and is not encoded in the count.
739
740  // TODO: find a cleaner way to separate non-range and range information without duplicating
741  //       code.
742  uint32_t arg[Instruction::kMaxVarArgRegs];  // only used in invoke-XXX.
743  uint32_t vregC = 0;   // only used in invoke-XXX-range.
744  if (is_range) {
745    vregC = inst->VRegC_3rc();
746  } else {
747    // TODO(iam): See if it's possible to remove inst_data dependency from 35x to avoid this path
748    UNUSED(inst_data);
749    inst->GetAllArgs25x(arg);
750  }
751
752  // TODO: if there's an assignability check, throw instead?
753  DCHECK(called_method->IsStatic());
754
755  return DoCallCommon<is_range, do_assignability_check>(
756      called_method, self, shadow_frame,
757      result, number_of_inputs, arg, vregC);
758}
759
760template<bool is_range, bool do_assignability_check>
761bool DoCall(ArtMethod* called_method, Thread* self, ShadowFrame& shadow_frame,
762            const Instruction* inst, uint16_t inst_data, JValue* result) {
763  // Argument word count.
764  const uint16_t number_of_inputs = (is_range) ? inst->VRegA_3rc(inst_data) : inst->VRegA_35c(inst_data);
765
766  // TODO: find a cleaner way to separate non-range and range information without duplicating
767  //       code.
768  uint32_t arg[Instruction::kMaxVarArgRegs];  // only used in invoke-XXX.
769  uint32_t vregC = 0;
770  if (is_range) {
771    vregC = inst->VRegC_3rc();
772  } else {
773    vregC = inst->VRegC_35c();
774    inst->GetVarArgs(arg, inst_data);
775  }
776
777  return DoCallCommon<is_range, do_assignability_check>(
778      called_method, self, shadow_frame,
779      result, number_of_inputs, arg, vregC);
780}
781
782template <bool is_range, bool do_access_check, bool transaction_active>
783bool DoFilledNewArray(const Instruction* inst, const ShadowFrame& shadow_frame,
784                      Thread* self, JValue* result) {
785  DCHECK(inst->Opcode() == Instruction::FILLED_NEW_ARRAY ||
786         inst->Opcode() == Instruction::FILLED_NEW_ARRAY_RANGE);
787  const int32_t length = is_range ? inst->VRegA_3rc() : inst->VRegA_35c();
788  if (!is_range) {
789    // Checks FILLED_NEW_ARRAY's length does not exceed 5 arguments.
790    CHECK_LE(length, 5);
791  }
792  if (UNLIKELY(length < 0)) {
793    ThrowNegativeArraySizeException(length);
794    return false;
795  }
796  uint16_t type_idx = is_range ? inst->VRegB_3rc() : inst->VRegB_35c();
797  Class* array_class = ResolveVerifyAndClinit(type_idx, shadow_frame.GetMethod(),
798                                              self, false, do_access_check);
799  if (UNLIKELY(array_class == nullptr)) {
800    DCHECK(self->IsExceptionPending());
801    return false;
802  }
803  CHECK(array_class->IsArrayClass());
804  Class* component_class = array_class->GetComponentType();
805  const bool is_primitive_int_component = component_class->IsPrimitiveInt();
806  if (UNLIKELY(component_class->IsPrimitive() && !is_primitive_int_component)) {
807    if (component_class->IsPrimitiveLong() || component_class->IsPrimitiveDouble()) {
808      ThrowRuntimeException("Bad filled array request for type %s",
809                            PrettyDescriptor(component_class).c_str());
810    } else {
811      self->ThrowNewExceptionF("Ljava/lang/InternalError;",
812                               "Found type %s; filled-new-array not implemented for anything but 'int'",
813                               PrettyDescriptor(component_class).c_str());
814    }
815    return false;
816  }
817  Object* new_array = Array::Alloc<true>(self, array_class, length,
818                                         array_class->GetComponentSizeShift(),
819                                         Runtime::Current()->GetHeap()->GetCurrentAllocator());
820  if (UNLIKELY(new_array == nullptr)) {
821    self->AssertPendingOOMException();
822    return false;
823  }
824  uint32_t arg[Instruction::kMaxVarArgRegs];  // only used in filled-new-array.
825  uint32_t vregC = 0;   // only used in filled-new-array-range.
826  if (is_range) {
827    vregC = inst->VRegC_3rc();
828  } else {
829    inst->GetVarArgs(arg);
830  }
831  for (int32_t i = 0; i < length; ++i) {
832    size_t src_reg = is_range ? vregC + i : arg[i];
833    if (is_primitive_int_component) {
834      new_array->AsIntArray()->SetWithoutChecks<transaction_active>(
835          i, shadow_frame.GetVReg(src_reg));
836    } else {
837      new_array->AsObjectArray<Object>()->SetWithoutChecks<transaction_active>(
838          i, shadow_frame.GetVRegReference(src_reg));
839    }
840  }
841
842  result->SetL(new_array);
843  return true;
844}
845
846// TODO fix thread analysis: should be SHARED_REQUIRES(Locks::mutator_lock_).
847template<typename T>
848static void RecordArrayElementsInTransactionImpl(mirror::PrimitiveArray<T>* array, int32_t count)
849    NO_THREAD_SAFETY_ANALYSIS {
850  Runtime* runtime = Runtime::Current();
851  for (int32_t i = 0; i < count; ++i) {
852    runtime->RecordWriteArray(array, i, array->GetWithoutChecks(i));
853  }
854}
855
856void RecordArrayElementsInTransaction(mirror::Array* array, int32_t count)
857    SHARED_REQUIRES(Locks::mutator_lock_) {
858  DCHECK(Runtime::Current()->IsActiveTransaction());
859  DCHECK(array != nullptr);
860  DCHECK_LE(count, array->GetLength());
861  Primitive::Type primitive_component_type = array->GetClass()->GetComponentType()->GetPrimitiveType();
862  switch (primitive_component_type) {
863    case Primitive::kPrimBoolean:
864      RecordArrayElementsInTransactionImpl(array->AsBooleanArray(), count);
865      break;
866    case Primitive::kPrimByte:
867      RecordArrayElementsInTransactionImpl(array->AsByteArray(), count);
868      break;
869    case Primitive::kPrimChar:
870      RecordArrayElementsInTransactionImpl(array->AsCharArray(), count);
871      break;
872    case Primitive::kPrimShort:
873      RecordArrayElementsInTransactionImpl(array->AsShortArray(), count);
874      break;
875    case Primitive::kPrimInt:
876      RecordArrayElementsInTransactionImpl(array->AsIntArray(), count);
877      break;
878    case Primitive::kPrimFloat:
879      RecordArrayElementsInTransactionImpl(array->AsFloatArray(), count);
880      break;
881    case Primitive::kPrimLong:
882      RecordArrayElementsInTransactionImpl(array->AsLongArray(), count);
883      break;
884    case Primitive::kPrimDouble:
885      RecordArrayElementsInTransactionImpl(array->AsDoubleArray(), count);
886      break;
887    default:
888      LOG(FATAL) << "Unsupported primitive type " << primitive_component_type
889                 << " in fill-array-data";
890      break;
891  }
892}
893
894// Explicit DoCall template function declarations.
895#define EXPLICIT_DO_CALL_TEMPLATE_DECL(_is_range, _do_assignability_check)                      \
896  template SHARED_REQUIRES(Locks::mutator_lock_)                                                \
897  bool DoCall<_is_range, _do_assignability_check>(ArtMethod* method, Thread* self,              \
898                                                  ShadowFrame& shadow_frame,                    \
899                                                  const Instruction* inst, uint16_t inst_data,  \
900                                                  JValue* result)
901EXPLICIT_DO_CALL_TEMPLATE_DECL(false, false);
902EXPLICIT_DO_CALL_TEMPLATE_DECL(false, true);
903EXPLICIT_DO_CALL_TEMPLATE_DECL(true, false);
904EXPLICIT_DO_CALL_TEMPLATE_DECL(true, true);
905#undef EXPLICIT_DO_CALL_TEMPLATE_DECL
906
907// Explicit DoLambdaCall template function declarations.
908#define EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(_is_range, _do_assignability_check)               \
909  template SHARED_REQUIRES(Locks::mutator_lock_)                                                \
910  bool DoLambdaCall<_is_range, _do_assignability_check>(ArtMethod* method, Thread* self,        \
911                                                        ShadowFrame& shadow_frame,              \
912                                                        const Instruction* inst,                \
913                                                        uint16_t inst_data,                     \
914                                                        JValue* result)
915EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(false, false);
916EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(false, true);
917EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(true, false);
918EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL(true, true);
919#undef EXPLICIT_DO_LAMBDA_CALL_TEMPLATE_DECL
920
921// Explicit DoFilledNewArray template function declarations.
922#define EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(_is_range_, _check, _transaction_active)       \
923  template SHARED_REQUIRES(Locks::mutator_lock_)                                                  \
924  bool DoFilledNewArray<_is_range_, _check, _transaction_active>(const Instruction* inst,         \
925                                                                 const ShadowFrame& shadow_frame, \
926                                                                 Thread* self, JValue* result)
927#define EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL(_transaction_active)       \
928  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(false, false, _transaction_active);  \
929  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(false, true, _transaction_active);   \
930  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(true, false, _transaction_active);   \
931  EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL(true, true, _transaction_active)
932EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL(false);
933EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL(true);
934#undef EXPLICIT_DO_FILLED_NEW_ARRAY_ALL_TEMPLATE_DECL
935#undef EXPLICIT_DO_FILLED_NEW_ARRAY_TEMPLATE_DECL
936
937}  // namespace interpreter
938}  // namespace art
939