diff options
| -rw-r--r-- | src/interpreter/interpreter.cc | 16 | ||||
| -rw-r--r-- | src/object_utils.h | 8 |
2 files changed, 11 insertions, 13 deletions
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc index 0a66a21c05..e68896a48d 100644 --- a/src/interpreter/interpreter.cc +++ b/src/interpreter/interpreter.cc @@ -696,9 +696,11 @@ static JValue Execute(Thread* self, MethodHelper& mh, const DexFile::CodeItem* c shadow_frame.SetReferenceAndVReg(dec_insn.vA, s); break; } - case Instruction::CONST_CLASS: - shadow_frame.SetReferenceAndVReg(dec_insn.vA, mh.ResolveClass(dec_insn.vB)); + case Instruction::CONST_CLASS: { + Class* c = ResolveVerifyAndClinit(dec_insn.vB, shadow_frame.GetMethod(), self, false, true); + shadow_frame.SetReferenceAndVReg(dec_insn.vA, c); break; + } case Instruction::MONITOR_ENTER: { Object* obj = shadow_frame.GetReference(dec_insn.vA); if (UNLIKELY(obj == NULL)) { @@ -718,7 +720,7 @@ static JValue Execute(Thread* self, MethodHelper& mh, const DexFile::CodeItem* c break; } case Instruction::CHECK_CAST: { - Class* c = mh.ResolveClass(dec_insn.vB); + Class* c = ResolveVerifyAndClinit(dec_insn.vB, shadow_frame.GetMethod(), self, false, true); if (UNLIKELY(c == NULL)) { CHECK(self->IsExceptionPending()); } else { @@ -733,7 +735,7 @@ static JValue Execute(Thread* self, MethodHelper& mh, const DexFile::CodeItem* c break; } case Instruction::INSTANCE_OF: { - Class* c = mh.ResolveClass(dec_insn.vC); + Class* c = ResolveVerifyAndClinit(dec_insn.vC, shadow_frame.GetMethod(), self, false, true); if (UNLIKELY(c == NULL)) { CHECK(self->IsExceptionPending()); } else { @@ -767,7 +769,7 @@ static JValue Execute(Thread* self, MethodHelper& mh, const DexFile::CodeItem* c bool is_range = (dec_insn.opcode == Instruction::FILLED_NEW_ARRAY_RANGE); int32_t length = dec_insn.vA; CHECK(is_range || length <= 5); - Class* arrayClass = mh.ResolveClass(dec_insn.vB); + Class* arrayClass = ResolveVerifyAndClinit(dec_insn.vB, shadow_frame.GetMethod(), self, false, true); CHECK(arrayClass->IsArrayClass()); if (arrayClass->GetComponentType()->IsPrimitiveInt()) { IntArray* newArray = IntArray::Alloc(self, length); @@ -1761,6 +1763,10 @@ void EnterInterpreterFromInvoke(Thread* self, AbstractMethod* method, Object* re if (code_item != NULL) { num_regs = code_item->registers_size_; num_ins = code_item->ins_size_; + } else if (method->IsAbstract()) { + self->ThrowNewExceptionF("Ljava/lang/AbstractMethodError;", "abstract method \"%s\"", + PrettyMethod(method).c_str()); + return; } else { DCHECK(method->IsNative()); num_regs = num_ins = AbstractMethod::NumArgRegisters(mh.GetShorty()); diff --git a/src/object_utils.h b/src/object_utils.h index 661773a346..6924f4eb21 100644 --- a/src/object_utils.h +++ b/src/object_utils.h @@ -677,14 +677,6 @@ class MethodHelper { return s; } - Class* ResolveClass(uint16_t type_idx) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - Class* c = GetDexCacheResolvedType(type_idx); - if (UNLIKELY(c == NULL)) { - c = GetClassLinker()->ResolveType(GetDexFile(), type_idx, GetDexCache(), GetClassLoader()); - } - return c; - } - private: // Set the method_ field, for proxy methods looking up the interface method via the resolved // methods table. |