难道Android的ART运行时有作为的Dalvik同样的方法限额的限制? [英] Does the Android ART runtime have the same method limit limitations as Dalvik?

查看:303
本文介绍了难道Android的ART运行时有作为的Dalvik同样的方法限额的限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

难道Android的ART运行时有作为的Dalvik同样的方法限额的限制? 目前,有64k的方法在主DEX文件的限制

Does the Android ART runtime have the same method limit limitations as Dalvik? Currently, there's a limit of 64k methods in the primary dex file

推荐答案

这个问题是不是与Dalvik的运行时间也没有DEX文件格式,但与当前的一组的的Dalvik说明。具体而言,各种方法调用的方法,这是这样的:

The issue is not with the Dalvik runtime nor the DEX file format, but with the current set of Dalvik instructions. Specifically, the various method invocation methods, which look like this:

invoke-kind {vC, vD, vE, vF, vG}, meth@BBBB

B: method reference index (16 bits)

您可以参考一个非常大的一些方法在DEX文件,但只能调用第一65536,因为这是所有的房间你在方法调用指令。

You can reference a very large number of methods in a DEX file, but you can only invoke the first 65536, because that's all the room you have in the method invocation instruction.

我想指出的是,限制是对的方法数的引用的,方法不是数字的定义的。如果您的DEX文件只有几个方法,但合起来叫70000不同的外部定义的方法,你会超出限制。

I'd like to point out that the limitation is on the number of methods referenced, not the number of methods defined. If your DEX file has only a few methods, but together they call 70,000 different externally-defined methods, you're going to exceed the limit.

要解决这个问题的方法之一是增加了采取更广泛的方法引用其他说明。所谓的巨型运codeS的办法实施,并在发布的Andr​​oid 4.0(ICS),但从未真正付诸行动,以及后来的removed从树。 (我偶尔看到这里的职位与DX引用巨型OPS,或者从开发商谁<一个错误信息href="http://stackoverflow.com/questions/12356902/extended-width-dalvik-byte$c$cs-missing-on-jellybean">stumbled在他们。)

One way to fix this is to add additional instructions that take wider method references. An approach called "jumbo opcodes" was implemented and released in Android 4.0 (ICS), but was never fully put into action, and was later removed from the tree. (I occasionally see posts here with error messages from "dx" that reference jumbo ops, or from developers who stumbled over them.)

请注意,这不是由<一个问题解决了href="https://www.facebook.com/notes/facebook-engineering/under-the-hood-dalvik-patch-for-facebook-for-android/10151345597798920">Facebook破解。这是由于一个固定大小的缓冲区持有类/方法/场的元数据。有没有一种方法,特定的限制那里。你可以有很多领域吹灭缓冲区。

Note this is not the problem solved by the Facebook hack. That's due to a fixed-size buffer for holding class/method/field meta-data. There's no method-specific limit there; you can blow out the buffer by having lots of fields.

我的理解是,现有技术中实现处理同一套的Dalvik做说明,这样的情况也不会例外。

My understanding is that the current implementation of ART handles the same set of instructions that Dalvik does, so the situation will be no different.

这篇关于难道Android的ART运行时有作为的Dalvik同样的方法限额的限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆