Google I/O 2008 - Dalvik Virtual Machine Internals

By: Google Developers

715   16   168491

Uploaded on 06/03/2008

Dalvik VM Internals
Dan Bornstein (Google)

Dalvik — the virtual machine with the unusual name — runs your code on Android. Join us to learn about the motivation for its design and get some details about how it works. You'll also walk away with a few tips for how to write code that works well with the platform. Be prepared for a deep dive into technical details. Questions encouraged!

Comments (3):

By chubot    2017-09-20

This is a great post. I like how they walked through all the steps and especially the "perf" tool.

Ruby has a patch to do the same thing -- increase sharing by moving reference counts out of the object itself:

Index here:

http://www.rubyenterpriseedition.com/faq.html#what_is_this

First post in a long series:

http://izumi.plan99.net/blog/index.php/2007/07/25/making-rub...

I think these patches or something similar may have made it into Ruby 2.0:

http://patshaughnessy.net/2012/3/23/why-you-should-be-excite...

https://medium.com/@rcdexta/whats-the-deal-with-ruby-gc-and-...

The Dalvik VM (now replaced by ART) also did this to run on phones with 64 MiB of memory:

https://www.youtube.com/watch?v=ptjedOZEXPM

I think PHP might do it too. It feels like Python should be doing this as well.

Original Thread

By anonymous    2017-09-20

I can't find a reference, but I think Sun decided for the stack-based bytecode approach because it makes it easy to run the JVM on an architecture with few registers (e.g. IA32).

In Dalvik VM Internals from Google I/O 2008, the Dalvik creator Dan Bornstein gives the following arguments for choosing a register-based VM on slide 35 of the presentation slides:

Register Machine

Why?

  • avoid instruction dispatch
  • avoid unnecessary memory access
  • consume instruction stream efficiently (higher semantic density per instruction)

and on slide 36:

Register Machine

The stats

  • 30% fewer instructions
  • 35% fewer code units
  • 35% more bytes in the instructions stream
    • but we get to consume two at a time

According to Bornstein this is "a general expectation what you could find when you convert a set of class files to dex files".

The relevant part of the presentation video starts at 25:00.

Original Thread

Popular Videos 754

Submit Your Video

If you have some great dev videos to share, please fill out this form.