diff options
author | Mathieu Chartier <mathieuc@google.com> | 2014-06-05 17:42:53 -0700 |
---|---|---|
committer | Mathieu Chartier <mathieuc@google.com> | 2014-06-06 13:12:17 -0700 |
commit | 61c5ebc6aee2cac1c363de6fbdac25ada1697fdb (patch) | |
tree | 444936c3e3718b692ba7f1981b863190f26b4ed7 /runtime/interpreter | |
parent | 25c4f6a25b3de9b9d7ca5162f1629753a0b7f003 (diff) | |
download | art-61c5ebc6aee2cac1c363de6fbdac25ada1697fdb.zip art-61c5ebc6aee2cac1c363de6fbdac25ada1697fdb.tar.gz art-61c5ebc6aee2cac1c363de6fbdac25ada1697fdb.tar.bz2 |
Change FieldHelper to use a handle.
Fixed compaction bugs related to FieldHelper::GetType in:
artSet32InstanceFromCode
SetFieldValueImpl
CheckReceiver
Field_set
interpreter::DoFieldPut
MethodVerifier::VerifyISGet
MethodVerifier::VerifyISPut
MethodVerifier::VerifyIGetQuick
Bug: 13077697
Change-Id: I7de9ded2893b5568d43e4daa86fd135bf5508b72
Diffstat (limited to 'runtime/interpreter')
-rw-r--r-- | runtime/interpreter/interpreter_common.cc | 7 | ||||
-rw-r--r-- | runtime/interpreter/interpreter_common.h | 12 |
2 files changed, 11 insertions, 8 deletions
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc index 19b85e4..a66bd94 100644 --- a/runtime/interpreter/interpreter_common.cc +++ b/runtime/interpreter/interpreter_common.cc @@ -334,12 +334,10 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, Class* klass = shadow_frame->GetVRegReference(arg_offset)->AsClass(); String* name = shadow_frame->GetVRegReference(arg_offset + 1)->AsString(); ArtField* found = NULL; - FieldHelper fh; ObjectArray<ArtField>* fields = klass->GetIFields(); for (int32_t i = 0; i < fields->GetLength() && found == NULL; ++i) { ArtField* f = fields->Get(i); - fh.ChangeField(f); - if (name->Equals(fh.GetName())) { + if (name->Equals(f->GetName())) { found = f; } } @@ -347,8 +345,7 @@ static void UnstartedRuntimeInvoke(Thread* self, MethodHelper& mh, fields = klass->GetSFields(); for (int32_t i = 0; i < fields->GetLength() && found == NULL; ++i) { ArtField* f = fields->Get(i); - fh.ChangeField(f); - if (name->Equals(fh.GetName())) { + if (name->Equals(f->GetName())) { found = f; } } diff --git a/runtime/interpreter/interpreter_common.h b/runtime/interpreter/interpreter_common.h index 029af8d..6e136d6 100644 --- a/runtime/interpreter/interpreter_common.h +++ b/runtime/interpreter/interpreter_common.h @@ -363,9 +363,15 @@ static SOMETIMES_INLINE_KEYWORD bool DoFieldPut(Thread* self, const ShadowFrame& if (do_assignability_check && reg != nullptr) { // FieldHelper::GetType can resolve classes, use a handle wrapper which will restore the // object in the destructor. - StackHandleScope<1> hs(self); - HandleWrapper<mirror::Object> wrapper(hs.NewHandleWrapper(&obj)); - Class* field_class = FieldHelper(f).GetType(); + Class* field_class; + { + StackHandleScope<3> hs(self); + HandleWrapper<mirror::ArtField> h_f(hs.NewHandleWrapper(&f)); + HandleWrapper<mirror::Object> h_reg(hs.NewHandleWrapper(®)); + HandleWrapper<mirror::Object> h_obj(hs.NewHandleWrapper(&obj)); + FieldHelper fh(h_f); + field_class = fh.GetType(); + } if (!reg->VerifierInstanceOf(field_class)) { // This should never happen. self->ThrowNewExceptionF(self->GetCurrentLocationForThrow(), |