Remove ShadowFrame::HasReferenceArray()

It is always true.

Change-Id: I96ddeeb87b8166d0fc08edafd1800b539eec3a7d
diff --git a/runtime/interpreter/interpreter_switch_impl-inl.h b/runtime/interpreter/interpreter_switch_impl-inl.h
index 2689838..fc3005d 100644
--- a/runtime/interpreter/interpreter_switch_impl-inl.h
+++ b/runtime/interpreter/interpreter_switch_impl-inl.h
@@ -1914,11 +1914,6 @@
   Thread* self = ctx->self;
   const CodeItemDataAccessor& accessor = ctx->accessor;
   ShadowFrame& shadow_frame = ctx->shadow_frame;
-  if (UNLIKELY(!shadow_frame.HasReferenceArray())) {
-    LOG(FATAL) << "Invalid shadow frame for interpreter use";
-    ctx->result = JValue();
-    return;
-  }
   self->VerifyStack();
 
   uint32_t dex_pc = shadow_frame.GetDexPC();
diff --git a/runtime/interpreter/shadow_frame-inl.h b/runtime/interpreter/shadow_frame-inl.h
index 7eaad59..799b2d2 100644
--- a/runtime/interpreter/shadow_frame-inl.h
+++ b/runtime/interpreter/shadow_frame-inl.h
@@ -33,9 +33,7 @@
   ReadBarrier::MaybeAssertToSpaceInvariant(val.Ptr());
   uint32_t* vreg = &vregs_[i];
   reinterpret_cast<StackReference<mirror::Object>*>(vreg)->Assign(val);
-  if (HasReferenceArray()) {
-    References()[i].Assign(val);
-  }
+  References()[i].Assign(val);
 }
 
 }  // namespace art
diff --git a/runtime/interpreter/shadow_frame.h b/runtime/interpreter/shadow_frame.h
index bc97ace..8cb2b33 100644
--- a/runtime/interpreter/shadow_frame.h
+++ b/runtime/interpreter/shadow_frame.h
@@ -97,12 +97,6 @@
 
   ~ShadowFrame() {}
 
-  // TODO(iam): Clean references array up since they're always there,
-  // we don't need to do conditionals.
-  bool HasReferenceArray() const {
-    return true;
-  }
-
   uint32_t NumberOfVRegs() const {
     return number_of_vregs_;
   }
@@ -157,7 +151,6 @@
   }
 
   uint32_t* GetShadowRefAddr(size_t i) {
-    DCHECK(HasReferenceArray());
     DCHECK_LT(i, NumberOfVRegs());
     return &vregs_[i + NumberOfVRegs()];
   }
@@ -194,7 +187,6 @@
   mirror::Object* GetVRegReference(size_t i) const REQUIRES_SHARED(Locks::mutator_lock_) {
     DCHECK_LT(i, NumberOfVRegs());
     mirror::Object* ref;
-    DCHECK(HasReferenceArray());
     ref = References()[i].AsMirrorPtr();
     ReadBarrier::MaybeAssertToSpaceInvariant(ref);
     if (kVerifyFlags & kVerifyReads) {
@@ -214,9 +206,7 @@
     *reinterpret_cast<int32_t*>(vreg) = val;
     // This is needed for moving collectors since these can update the vreg references if they
     // happen to agree with references in the reference array.
-    if (kMovingCollector && HasReferenceArray()) {
-      References()[i].Clear();
-    }
+    References()[i].Clear();
   }
 
   void SetVRegFloat(size_t i, float val) {
@@ -225,9 +215,7 @@
     *reinterpret_cast<float*>(vreg) = val;
     // This is needed for moving collectors since these can update the vreg references if they
     // happen to agree with references in the reference array.
-    if (kMovingCollector && HasReferenceArray()) {
-      References()[i].Clear();
-    }
+    References()[i].Clear();
   }
 
   void SetVRegLong(size_t i, int64_t val) {
@@ -237,10 +225,8 @@
     *reinterpret_cast<unaligned_int64*>(vreg) = val;
     // This is needed for moving collectors since these can update the vreg references if they
     // happen to agree with references in the reference array.
-    if (kMovingCollector && HasReferenceArray()) {
-      References()[i].Clear();
-      References()[i + 1].Clear();
-    }
+    References()[i].Clear();
+    References()[i + 1].Clear();
   }
 
   void SetVRegDouble(size_t i, double val) {
@@ -250,10 +236,8 @@
     *reinterpret_cast<unaligned_double*>(vreg) = val;
     // This is needed for moving collectors since these can update the vreg references if they
     // happen to agree with references in the reference array.
-    if (kMovingCollector && HasReferenceArray()) {
-      References()[i].Clear();
-      References()[i + 1].Clear();
-    }
+    References()[i].Clear();
+    References()[i + 1].Clear();
   }
 
   template<VerifyObjectFlags kVerifyFlags = kDefaultVerifyFlags>
@@ -276,14 +260,8 @@
   mirror::Object* GetThisObject(uint16_t num_ins) const REQUIRES_SHARED(Locks::mutator_lock_);
 
   bool Contains(StackReference<mirror::Object>* shadow_frame_entry_obj) const {
-    if (HasReferenceArray()) {
-      return ((&References()[0] <= shadow_frame_entry_obj) &&
-              (shadow_frame_entry_obj <= (&References()[NumberOfVRegs() - 1])));
-    } else {
-      uint32_t* shadow_frame_entry = reinterpret_cast<uint32_t*>(shadow_frame_entry_obj);
-      return ((&vregs_[0] <= shadow_frame_entry) &&
-              (shadow_frame_entry <= (&vregs_[NumberOfVRegs() - 1])));
-    }
+    return ((&References()[0] <= shadow_frame_entry_obj) &&
+            (shadow_frame_entry_obj <= (&References()[NumberOfVRegs() - 1])));
   }
 
   LockCountData& GetLockCountData() {
@@ -340,7 +318,7 @@
                                             ArtMethod* method,
                                             uint32_t dex_pc,
                                             void* memory) {
-    return new (memory) ShadowFrame(num_vregs, link, method, dex_pc, true);
+    return new (memory) ShadowFrame(num_vregs, link, method, dex_pc);
   }
 
   const uint16_t* GetDexPCPtr() {
@@ -407,8 +385,7 @@
   }
 
  private:
-  ShadowFrame(uint32_t num_vregs, ShadowFrame* link, ArtMethod* method,
-              uint32_t dex_pc, bool has_reference_array)
+  ShadowFrame(uint32_t num_vregs, ShadowFrame* link, ArtMethod* method, uint32_t dex_pc)
       : link_(link),
         method_(method),
         result_register_(nullptr),
@@ -419,13 +396,7 @@
         cached_hotness_countdown_(0),
         hotness_countdown_(0),
         frame_flags_(0) {
-    // TODO(iam): Remove this parameter, it's an an artifact of portable removal
-    DCHECK(has_reference_array);
-    if (has_reference_array) {
-      memset(vregs_, 0, num_vregs * (sizeof(uint32_t) + sizeof(StackReference<mirror::Object>)));
-    } else {
-      memset(vregs_, 0, num_vregs * sizeof(uint32_t));
-    }
+    memset(vregs_, 0, num_vregs * (sizeof(uint32_t) + sizeof(StackReference<mirror::Object>)));
   }
 
   void UpdateFrameFlag(bool enable, FrameFlags flag) {
@@ -441,7 +412,6 @@
   }
 
   const StackReference<mirror::Object>* References() const {
-    DCHECK(HasReferenceArray());
     const uint32_t* vreg_end = &vregs_[NumberOfVRegs()];
     return reinterpret_cast<const StackReference<mirror::Object>*>(vreg_end);
   }
diff --git a/runtime/thread.cc b/runtime/thread.cc
index dcc015c..23861ac 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -3693,7 +3693,6 @@
     VisitDeclaringClass(m);
     DCHECK(m != nullptr);
     size_t num_regs = shadow_frame->NumberOfVRegs();
-    DCHECK(m->IsNative() || shadow_frame->HasReferenceArray());
     // handle scope for JNI or References for interpreter.
     for (size_t reg = 0; reg < num_regs; ++reg) {
       mirror::Object* ref = shadow_frame->GetVRegReference(reg);