On Oct 5, 11:28 am, DanH <[email protected]> wrote:
> In the bitmap scheme each stack entry/register has several bits
> assigned, one for each possible type that could conceivably reach it.
> If an object pointer is assigned then all the bits for that class
> hierarchy are set, and when flows combine the bitsets are "anded"
> together.  Thus the value that reaches a use automatically represents
> the classes valid at that point, taking into account the different
> flows.

Dalvik needs to keep more state than this around, because it needs to
keep track of what type of object is in each register that holds an
object.  The verifier is responsible for determining if method A is
allowed to access fields and methods in class B, so it needs to know
what type of object the code is operating on.  The register merge
procedure can actually involve searching for a common superclass.

I'm sort of curious now to see if there's a way to detect invalid
conversions and perform legal widening conversions with bitwise
operations.  I'm not sure it'd be a win over the table lookup, but it
creates the possibility of doing a whole bunch of registers in
parallel.  I'm not sure the relations are simple enough.  For example,
Dalvik is more picky than certain other VMs when it comes to the
contents of short integers (e.g. you could have a value of 1024 in a
"byte" in some VMs).

Dalvik tries to do all this ahead of time (via "dexopt") when the app
is first installed, which results in various limitations and re-verify
triggers when other parts of the system change.  This doesn't always
work, so it'll do the verification / register map generation on first
load if necessary.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to