mirror::IfTable* iftable = GetDeclaringClass()->GetIfTable();
for (size_t i = 0; i < iftable->Count() && result == nullptr; i++) {
mirror::Class* interface = iftable->GetInterface(i);
- for (size_t j = 0; j < interface->NumVirtualMethods(); ++j) {
- ArtMethod* interface_method = interface->GetVirtualMethod(j, pointer_size);
- if (HasSameNameAndSignature(interface_method->GetInterfaceMethodIfProxy(sizeof(void*)))) {
- result = interface_method;
+ for (ArtMethod& interface_method : interface->GetVirtualMethods(pointer_size)) {
+ if (HasSameNameAndSignature(interface_method.GetInterfaceMethodIfProxy(pointer_size))) {
+ result = &interface_method;
break;
}
}
}
}
DCHECK(result == nullptr ||
- GetInterfaceMethodIfProxy(sizeof(void*))->HasSameNameAndSignature(
- result->GetInterfaceMethodIfProxy(sizeof(void*))));
+ GetInterfaceMethodIfProxy(pointer_size)->HasSameNameAndSignature(
+ result->GetInterfaceMethodIfProxy(pointer_size)));
return result;
}
// We're invoking a virtual method directly (thanks to sharpening), compute the oat_method_index
// by search for its position in the declared virtual methods.
oat_method_index = declaring_class->NumDirectMethods();
- size_t end = declaring_class->NumVirtualMethods();
bool found_virtual = false;
- for (size_t i = 0; i < end; i++) {
+ for (ArtMethod& art_method : declaring_class->GetVirtualMethods(image_pointer_size_)) {
// Check method index instead of identity in case of duplicate method definitions.
- if (method->GetDexMethodIndex() ==
- declaring_class->GetVirtualMethod(i, image_pointer_size_)->GetDexMethodIndex()) {
+ if (method->GetDexMethodIndex() == art_method.GetDexMethodIndex()) {
found_virtual = true;
break;
}
void ClassLinker::ResolveClassExceptionHandlerTypes(const DexFile& dex_file,
Handle<mirror::Class> klass) {
- for (size_t i = 0; i < klass->NumDirectMethods(); i++) {
- ResolveMethodExceptionHandlerTypes(dex_file, klass->GetDirectMethod(i, image_pointer_size_));
- }
- for (size_t i = 0; i < klass->NumVirtualMethods(); i++) {
- ResolveMethodExceptionHandlerTypes(dex_file, klass->GetVirtualMethod(i, image_pointer_size_));
+ for (ArtMethod& method : klass->GetMethods(image_pointer_size_)) {
+ ResolveMethodExceptionHandlerTypes(dex_file, &method);
}
}
return error;
}
- size_t direct_method_count = c->NumDirectMethods();
- size_t virtual_method_count = c->NumVirtualMethods();
-
- expandBufAdd4BE(pReply, direct_method_count + virtual_method_count);
+ expandBufAdd4BE(pReply, c->NumMethods());
auto* cl = Runtime::Current()->GetClassLinker();
auto ptr_size = cl->GetImagePointerSize();
- for (size_t i = 0; i < direct_method_count + virtual_method_count; ++i) {
- ArtMethod* m = i < direct_method_count ?
- c->GetDirectMethod(i, ptr_size) : c->GetVirtualMethod(i - direct_method_count, ptr_size);
- expandBufAddMethodId(pReply, ToMethodId(m));
- expandBufAddUtf8String(pReply, m->GetInterfaceMethodIfProxy(sizeof(void*))->GetName());
+ for (ArtMethod& m : c->GetMethods(ptr_size)) {
+ expandBufAddMethodId(pReply, ToMethodId(&m));
+ expandBufAddUtf8String(pReply, m.GetInterfaceMethodIfProxy(sizeof(void*))->GetName());
expandBufAddUtf8String(pReply,
- m->GetInterfaceMethodIfProxy(sizeof(void*))->GetSignature().ToString());
+ m.GetInterfaceMethodIfProxy(sizeof(void*))->GetSignature().ToString());
if (with_generic) {
const char* generic_signature = "";
expandBufAddUtf8String(pReply, generic_signature);
}
- expandBufAdd4BE(pReply, MangleAccessFlags(m->GetAccessFlags()));
+ expandBufAdd4BE(pReply, MangleAccessFlags(m.GetAccessFlags()));
}
return JDWP::ERR_NONE;
}
// We need the class to be resolved to install/uninstall stubs. Otherwise its methods
// could not be initialized or linked with regards to class inheritance.
} else {
- for (size_t i = 0, e = klass->NumDirectMethods(); i < e; i++) {
- InstallStubsForMethod(klass->GetDirectMethod(i, sizeof(void*)));
- }
- for (size_t i = 0, e = klass->NumVirtualMethods(); i < e; i++) {
- InstallStubsForMethod(klass->GetVirtualMethod(i, sizeof(void*)));
+ for (ArtMethod& method : klass->GetMethods(sizeof(void*))) {
+ InstallStubsForMethod(&method);
}
}
}