&dex_file,
dex_cache,
class_loader,
- class_def,
+ *class_def,
callbacks,
allow_soft_failures,
log_level,
MethodVerifier::FailureData MethodVerifier::VerifyMethods(Thread* self,
ClassLinker* linker,
const DexFile* dex_file,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
ClassDataItemIterator* it,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
continue;
}
previous_method_idx = method_idx;
- InvokeType type = it->GetMethodInvokeType(*class_def);
+ InvokeType type = it->GetMethodInvokeType(class_def);
ArtMethod* method = linker->ResolveMethod<ClassLinker::kNoICCECheckForCache>(
*dex_file, method_idx, dex_cache, class_loader, nullptr, type);
if (method == nullptr) {
} else {
// If we didn't log a hard failure before, print the header of the message.
*error_string += "Verifier rejected class ";
- *error_string += PrettyDescriptor(dex_file->GetClassDescriptor(*class_def));
+ *error_string += PrettyDescriptor(dex_file->GetClassDescriptor(class_def));
*error_string += ":";
}
*error_string += " ";
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
CompilerCallbacks* callbacks,
bool allow_soft_failures,
LogSeverity log_level,
std::string* error) {
- DCHECK(class_def != nullptr);
ScopedTrace trace(__FUNCTION__);
// A class must not be abstract and final.
- if ((class_def->access_flags_ & (kAccAbstract | kAccFinal)) == (kAccAbstract | kAccFinal)) {
+ if ((class_def.access_flags_ & (kAccAbstract | kAccFinal)) == (kAccAbstract | kAccFinal)) {
*error = "Verifier rejected class ";
- *error += PrettyDescriptor(dex_file->GetClassDescriptor(*class_def));
+ *error += PrettyDescriptor(dex_file->GetClassDescriptor(class_def));
*error += ": class is abstract and final.";
return kHardFailure;
}
- const uint8_t* class_data = dex_file->GetClassData(*class_def);
+ const uint8_t* class_data = dex_file->GetClassData(class_def);
if (class_data == nullptr) {
// empty class, probably a marker interface
return kNoFailure;
// warning.
std::string tmp =
StringPrintf("Class %s failed lock verification and will run slower.",
- PrettyDescriptor(dex_file->GetClassDescriptor(*class_def)).c_str());
+ PrettyDescriptor(dex_file->GetClassDescriptor(class_def)).c_str());
if (!gPrintedDxMonitorText) {
tmp = tmp + "\nCommon causes for lock verification issues are non-optimized dex code\n"
"and incorrect proguard optimizations.";
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
const DexFile::CodeItem* code_item,
ArtMethod* method,
uint32_t method_access_flags,
if (callbacks != nullptr) {
// Let the interested party know that we failed the class.
- ClassReference ref(dex_file, dex_file->GetIndexForClassDef(*class_def));
+ ClassReference ref(dex_file, dex_file->GetIndexForClassDef(class_def));
callbacks->ClassRejected(ref);
}
}
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
const DexFile::CodeItem* code_item,
ArtMethod* method,
uint32_t method_access_flags) {
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
const DexFile::CodeItem* code_item,
uint32_t dex_method_idx,
ArtMethod* method,
is_constructor_(false),
link_(nullptr) {
self->PushVerifier(this);
- DCHECK(class_def != nullptr);
}
MethodVerifier::~MethodVerifier() {
m->GetDexFile(),
dex_cache,
class_loader,
- &m->GetClassDef(),
+ m->GetClassDef(),
m->GetCodeItem(),
m->GetDexMethodIndex(),
m,
m->GetDexFile(),
dex_cache,
class_loader,
- &m->GetClassDef(),
+ m->GetClassDef(),
m->GetCodeItem(),
m->GetDexMethodIndex(),
m,
m->GetDexFile(),
dex_cache,
class_loader,
- &m->GetClassDef(),
+ m->GetClassDef(),
m->GetCodeItem(),
m->GetDexMethodIndex(),
m,
return false;
}
}
- if ((class_def_->GetJavaAccessFlags() & kAccInterface) != 0) {
+ if ((class_def_.GetJavaAccessFlags() & kAccInterface) != 0) {
// Interface methods must be public and abstract (if default methods are disabled).
uint32_t kRequired = kAccPublic;
if ((method_access_flags_ & kRequired) != kRequired) {
return false;
}
- if ((class_def_->GetJavaAccessFlags() & kAccInterface) != 0) {
+ if ((class_def_.GetJavaAccessFlags() & kAccInterface) != 0) {
// Interfaces may always have static initializers for their fields. If we are running with
// default methods enabled we also allow other public, static, non-final methods to have code.
// Otherwise that is the only type of method allowed.
}
if (reference_class->IsInterface()) {
// TODO Can we verify anything else.
- if (class_idx == class_def_->class_idx_) {
+ if (class_idx == class_def_.class_idx_) {
Fail(VERIFY_ERROR_CLASS_CHANGE) << "Cannot invoke-super on self as interface";
return nullptr;
}
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
CompilerCallbacks* callbacks,
bool allow_soft_failures,
LogSeverity log_level,
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
const DexFile::CodeItem* code_item, ArtMethod* method,
uint32_t method_access_flags)
REQUIRES_SHARED(Locks::mutator_lock_);
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
const DexFile::CodeItem* code_item,
uint32_t method_idx,
ArtMethod* method,
static FailureData VerifyMethods(Thread* self,
ClassLinker* linker,
const DexFile* dex_file,
- const DexFile::ClassDef* class_def,
+ const DexFile::ClassDef& class_def,
ClassDataItemIterator* it,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
const DexFile* dex_file,
Handle<mirror::DexCache> dex_cache,
Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef* class_def_idx,
+ const DexFile::ClassDef& class_def_idx,
const DexFile::CodeItem* code_item,
ArtMethod* method,
uint32_t method_access_flags,
Handle<mirror::DexCache> dex_cache_ GUARDED_BY(Locks::mutator_lock_);
// The class loader for the declaring class of the method.
Handle<mirror::ClassLoader> class_loader_ GUARDED_BY(Locks::mutator_lock_);
- const DexFile::ClassDef* const class_def_; // The class def of the declaring class of the method.
+ const DexFile::ClassDef& class_def_; // The class def of the declaring class of the method.
const DexFile::CodeItem* const code_item_; // The code item containing the code for the method.
const RegType* declaring_class_; // Lazily computed reg type of the method's declaring class.
// Instruction widths and flags, one entry per code unit.