summaryrefslogtreecommitdiffstats
path: root/runtime/entrypoints/entrypoint_utils.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-05-21 17:43:44 -0700
committerMathieu Chartier <mathieuc@google.com>2014-06-09 12:46:32 -0700
commitbfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe (patch)
tree3d3f667c8232a9c1bb6fe9daea0d364f9ae01d8c /runtime/entrypoints/entrypoint_utils.h
parent2e1ca953c7fb165da36cc26ea74d3045d7e272c8 (diff)
downloadart-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.tar.gz
art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.tar.bz2
art-bfd9a4378eacaf2dc2bbe05ad48c5164fc93c9fe.zip
Change MethodHelper to use a Handle.
Added ConstHandle to help prevent errors where you modify the value stored in the handle of the caller. Also fixed compaction bugs related to not knowing MethodHelper::GetReturnType can resolve types. This bug was present in interpreter RETURN_OBJECT. Bug: 13077697 Change-Id: I71f964d4d810ab4debda1a09bc968af8f3c874a3
Diffstat (limited to 'runtime/entrypoints/entrypoint_utils.h')
-rw-r--r--runtime/entrypoints/entrypoint_utils.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/runtime/entrypoints/entrypoint_utils.h b/runtime/entrypoints/entrypoint_utils.h
index d0ae746b20..09899c05bd 100644
--- a/runtime/entrypoints/entrypoint_utils.h
+++ b/runtime/entrypoints/entrypoint_utils.h
@@ -433,9 +433,8 @@ static inline mirror::ArtMethod* FindMethodFromCode(uint32_t method_idx,
if (access_check &&
(vtable == nullptr || vtable_index >= static_cast<uint32_t>(vtable->GetLength()))) {
// Behavior to agree with that of the verifier.
- MethodHelper mh(resolved_method);
- ThrowNoSuchMethodError(type, resolved_method->GetDeclaringClass(), mh.GetName(),
- mh.GetSignature());
+ ThrowNoSuchMethodError(type, resolved_method->GetDeclaringClass(),
+ resolved_method->GetName(), resolved_method->GetSignature());
return nullptr; // Failure.
}
DCHECK(vtable != nullptr);
@@ -450,9 +449,8 @@ static inline mirror::ArtMethod* FindMethodFromCode(uint32_t method_idx,
vtable = (super_class != nullptr) ? super_class->GetVTable() : nullptr;
if (vtable == nullptr || vtable_index >= static_cast<uint32_t>(vtable->GetLength())) {
// Behavior to agree with that of the verifier.
- MethodHelper mh(resolved_method);
- ThrowNoSuchMethodError(type, resolved_method->GetDeclaringClass(), mh.GetName(),
- mh.GetSignature());
+ ThrowNoSuchMethodError(type, resolved_method->GetDeclaringClass(),
+ resolved_method->GetName(), resolved_method->GetSignature());
return nullptr; // Failure.
}
} else {
@@ -682,11 +680,13 @@ static inline void CheckReferenceResult(mirror::Object* o, Thread* self)
JniAbortF(NULL, "invalid reference returned from %s", PrettyMethod(m).c_str());
}
// Make sure that the result is an instance of the type this method was expected to return.
- mirror::Class* return_type = MethodHelper(m).GetReturnType();
+ StackHandleScope<1> hs(self);
+ Handle<mirror::ArtMethod> h_m(hs.NewHandle(m));
+ mirror::Class* return_type = MethodHelper(h_m).GetReturnType();
if (!o->InstanceOf(return_type)) {
- JniAbortF(NULL, "attempt to return an instance of %s from %s",
- PrettyTypeOf(o).c_str(), PrettyMethod(m).c_str());
+ JniAbortF(NULL, "attempt to return an instance of %s from %s", PrettyTypeOf(o).c_str(),
+ PrettyMethod(h_m.Get()).c_str());
}
}