示例#1
0
文件: monodiet.c 项目: ANahr/mono
static void
process_images (void) {
	int old_count, new_count;
	GList *item, *vmethod;
	new_count = g_hash_table_size (type_table);
	new_count += g_hash_table_size (method_table);
	new_count += g_hash_table_size (field_table);
	do {
		old_count = new_count;
		if (verbose)
			g_print ("#processing type table: %d\n", old_count);
		g_list_free (worklist);
		worklist = NULL;
		g_hash_table_foreach (type_table, collect_type, NULL);
		for (item = worklist; item; item = item->next) {
			for (vmethod = virtual_methods; vmethod; vmethod = vmethod->next) {
				check_vmethods (item->data, vmethod->data);
			}
		}
		g_list_free (worklist);
		worklist = NULL;
		g_hash_table_foreach (type_table, collect_type, NULL);
		for (item = worklist; item; item = item->next) {
			handle_type (item->data, TYPE_BASIC);
		}
		new_count = g_hash_table_size (type_table);
		new_count += g_hash_table_size (method_table);
		new_count += g_hash_table_size (field_table);
	} while (old_count != new_count);
}
示例#2
0
DexMethod* find_collision_excepting(const DexMethod* except,
                                    const DexString* name,
                                    const DexProto* proto,
                                    const DexClass* cls,
                                    bool is_virtual,
                                    bool check_direct) {
  for (auto& method : cls->get_dmethods()) {
    if (match(name, proto, method) && method != except) return method;
  }
  for (auto& method : cls->get_vmethods()) {
    if (match(name, proto, method) && method != except) return method;
  }
  if (!is_virtual) return nullptr;

  auto super = type_class(cls->get_super_class());
  if (super) {
    auto method = resolve_virtual(super, name, proto);
    if (method && method != except) return method;
  }

  TypeVector children;
  get_all_children(cls->get_type(), children);
  for (const auto& child : children) {
    auto vmethod = check_vmethods(name, proto, child);
    if (vmethod && vmethod != except) return vmethod;
    if (check_direct) {
      auto dmethod = check_dmethods(name, proto, child);
      if (dmethod && dmethod != except) return dmethod;
    }
  }
  return nullptr;
}