summaryrefslogtreecommitdiffstats
path: root/runtime/verifier
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2014-06-06 23:37:27 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-06-06 23:37:27 +0000
commit4479ba35389b03ccc9eabd17fba6168f9505517a (patch)
treefb8091b4637b27d8a9d3d4f390b79263a12d9881 /runtime/verifier
parent081203e06534e4aa27a942e47084289eecab29ed (diff)
parent61c5ebc6aee2cac1c363de6fbdac25ada1697fdb (diff)
downloadart-4479ba35389b03ccc9eabd17fba6168f9505517a.tar.gz
art-4479ba35389b03ccc9eabd17fba6168f9505517a.tar.bz2
art-4479ba35389b03ccc9eabd17fba6168f9505517a.zip
Merge "Change FieldHelper to use a handle."
Diffstat (limited to 'runtime/verifier')
-rw-r--r--runtime/verifier/method_verifier.cc38
1 files changed, 26 insertions, 12 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index 8d46812dae..c7bb20c950 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -3518,13 +3518,17 @@ void MethodVerifier::VerifyISGet(const Instruction* inst, const RegType& insn_ty
}
const RegType* field_type = nullptr;
if (field != NULL) {
- FieldHelper fh(field);
- mirror::Class* field_type_class = fh.GetType(can_load_classes_);
+ Thread* self = Thread::Current();
+ mirror::Class* field_type_class;
+ {
+ StackHandleScope<1> hs(self);
+ HandleWrapper<mirror::ArtField> h_field(hs.NewHandleWrapper(&field));
+ field_type_class = FieldHelper(h_field).GetType(can_load_classes_);
+ }
if (field_type_class != nullptr) {
- field_type = &reg_types_.FromClass(fh.GetTypeDescriptor(), field_type_class,
+ field_type = &reg_types_.FromClass(field->GetTypeDescriptor(), field_type_class,
field_type_class->CannotBeAssignedFromOtherTypes());
} else {
- Thread* self = Thread::Current();
DCHECK(!can_load_classes_ || self->IsExceptionPending());
self->ClearException();
}
@@ -3585,10 +3589,15 @@ void MethodVerifier::VerifyISPut(const Instruction* inst, const RegType& insn_ty
<< " from other class " << GetDeclaringClass();
return;
}
- FieldHelper fh(field);
- mirror::Class* field_type_class = fh.GetType(can_load_classes_);
+ mirror::Class* field_type_class;
+ {
+ StackHandleScope<1> hs(Thread::Current());
+ HandleWrapper<mirror::ArtField> h_field(hs.NewHandleWrapper(&field));
+ FieldHelper fh(h_field);
+ field_type_class = fh.GetType(can_load_classes_);
+ }
if (field_type_class != nullptr) {
- field_type = &reg_types_.FromClass(fh.GetTypeDescriptor(), field_type_class,
+ field_type = &reg_types_.FromClass(field->GetTypeDescriptor(), field_type_class,
field_type_class->CannotBeAssignedFromOtherTypes());
} else {
Thread* self = Thread::Current();
@@ -3648,18 +3657,23 @@ void MethodVerifier::VerifyIGetQuick(const Instruction* inst, const RegType& ins
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Cannot infer field from " << inst->Name();
return;
}
- FieldHelper fh(field);
- mirror::Class* field_type_class = fh.GetType(can_load_classes_);
+ mirror::Class* field_type_class;
+ {
+ StackHandleScope<1> hs(Thread::Current());
+ HandleWrapper<mirror::ArtField> h_field(hs.NewHandleWrapper(&field));
+ FieldHelper fh(h_field);
+ field_type_class = fh.GetType(can_load_classes_);
+ }
const RegType* field_type;
if (field_type_class != nullptr) {
- field_type = &reg_types_.FromClass(fh.GetTypeDescriptor(), field_type_class,
+ field_type = &reg_types_.FromClass(field->GetTypeDescriptor(), field_type_class,
field_type_class->CannotBeAssignedFromOtherTypes());
} else {
Thread* self = Thread::Current();
DCHECK(!can_load_classes_ || self->IsExceptionPending());
self->ClearException();
field_type = &reg_types_.FromDescriptor(field->GetDeclaringClass()->GetClassLoader(),
- fh.GetTypeDescriptor(), false);
+ field->GetTypeDescriptor(), false);
}
DCHECK(field_type != nullptr);
const uint32_t vregA = inst->VRegA_22c();
@@ -3703,7 +3717,7 @@ void MethodVerifier::VerifyIPutQuick(const Instruction* inst, const RegType& ins
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Cannot infer field from " << inst->Name();
return;
}
- const char* descriptor = FieldHelper(field).GetTypeDescriptor();
+ const char* descriptor = field->GetTypeDescriptor();
mirror::ClassLoader* loader = field->GetDeclaringClass()->GetClassLoader();
const RegType& field_type = reg_types_.FromDescriptor(loader, descriptor, false);
if (field != NULL) {