summaryrefslogtreecommitdiffstats
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
authorVladimir Marko <vmarko@google.com>2015-02-10 18:22:57 +0000
committerVladimir Marko <vmarko@google.com>2015-02-10 18:22:57 +0000
commit862f43c65652d132e73eff89667a11c9757e817d (patch)
tree9ae6634e963fe495d65b0f5a5bdc372899f249ff /runtime/class_linker.cc
parent4ba86c428f839cb75f5838b8327e893694377590 (diff)
downloadart-862f43c65652d132e73eff89667a11c9757e817d.zip
art-862f43c65652d132e73eff89667a11c9757e817d.tar.gz
art-862f43c65652d132e73eff89667a11c9757e817d.tar.bz2
Fix HasSameSignatureWithDifferentClassLoaders().
Add a missing handle and make sure that the handle's Get() is sequenced after the call that can cause GC. Change-Id: I3c0479650c40ceb803bfbf658238aeea8e4b0a1a
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index e0df6db..178d6e7 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -4297,7 +4297,9 @@ static bool HasSameSignatureWithDifferentClassLoaders(Thread* self,
{
StackHandleScope<1> hs(self);
Handle<mirror::Class> return_type(hs.NewHandle(method1->GetReturnType()));
- if (UNLIKELY(method2->GetReturnType() != return_type.Get())) {
+ mirror::Class* other_return_type = method2->GetReturnType();
+ // NOTE: return_type.Get() must be sequenced after method2->GetReturnType().
+ if (UNLIKELY(other_return_type != return_type.Get())) {
return false;
}
}
@@ -4313,11 +4315,13 @@ static bool HasSameSignatureWithDifferentClassLoaders(Thread* self,
return false;
}
for (uint32_t i = 0; i < num_types; ++i) {
- mirror::Class* param_type =
- method1->GetClassFromTypeIndex(types1->GetTypeItem(i).type_idx_, true);
+ StackHandleScope<1> hs(self);
+ Handle<mirror::Class> param_type(hs.NewHandle(
+ method1->GetClassFromTypeIndex(types1->GetTypeItem(i).type_idx_, true)));
mirror::Class* other_param_type =
method2->GetClassFromTypeIndex(types2->GetTypeItem(i).type_idx_, true);
- if (UNLIKELY(param_type != other_param_type)) {
+ // NOTE: param_type.Get() must be sequenced after method2->GetClassFromTypeIndex(...).
+ if (UNLIKELY(param_type.Get() != other_param_type)) {
return false;
}
}