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