porting dalvik doesn't needs emulator?

by xliu » Wed, 07 Jul 2010 00:00:49 GMT


Sponsored Links
 Hi list,

we are planing to port dalvikvm to a new cpu.  we're worry about
emulator issue because clearly qemu doesn't support own homebrew cpu.
so i took a dirty investigation on the relationship between qemu-
emulator-dalvik.  could you go through my sum up and give me some
comments?

The role of emulator in dalvik
applications storing in android system in the form of apk(android
package). actually it's a zip archive with some metadata. it contains
a file named classes.dex. the file is compact to save storage.
however, dex file can not execute directly after memory-mapped. it
needs to transform to ODEX file, which O means "optimized" here.

i think the name of ODEX is a little misleading since the phrase
contains 3 purposes, while "optimization" is only one of them.
  i) realignment and byte-swapping.
  ii) verification  dex code
  iii) optimization

There're at least 3 different ways to get odex job done. i iterate
them in chronicle order:
  i)[build-time] The building system does it ahead of time.
  ii)[install-time] The system installer does it when an application
is first added(to device).
  iii)[run-time] The VM does it "just in time"

It is the #1 choice needs the emulator, which will communicate with
underlying QEMU. as doc said, The building system use a hairy process
that involves the emulator , force JIT optimization of all relevant
dex files and then extract the result from dalvik-cache. i don't know
the exact meaning of "hairy" here. but i found the hairy process in
android source. it is android/build/tools/dexpreopt/dexpreopt.py. The
python script will spawn the emulator in shell form(no GUI like
attachment), secretely run dexopt on it with dex files, and pull
optimized results from emulator. In default, android building system
performs dexpreopt for system-level java programs instead of
applications. i also notices that it forbid the dexpreopt on Mac OSX,
as the comments said in android/build/core/product_config.mk

# Hack to make the linux build servers use dexpreopt.
# OSX is still a little flaky.

so i think we can skip choice #1 and leave dalvik perform dex-odex at
install-time or runtime. it's clear that #2 and #3 occurs on real
device. no emulator need.



-- 



porting dalvik doesn't needs emulator?

by fadden » Thu, 08 Jul 2010 06:19:02 GMT


 


You are correct -- the emulator only matters for "user" builds, where
the build system launches the emulator to run dexopt.  You don't need
it for your porting work.  You could even do the dexpreopt step with a
real device if you don't mind having one plugged into the build
machine.

dalvik/docs/porting-guide.html should explain all you need.

-- 


Sponsored Links


Other Threads

1. g1 developer firmware update

this might be a stupid question... but ill ask anyway :)

i received my g1 developer phone today
when i run my software it warns me that i'm developing with sdk 1.1
and my phone runs 1.0

is there any official update source?
(searching the net brought only some strange homebrew solutions)

thanks in advance
michael
--~--~---------~--~----~------------~-------~--~----~

2. Android prebuilt toolchain does not work with busybox

Dear all:

I am a newbie in the Kernel land.  I would like to use the prebuilt
toolchain included in the Android release to build BUSYBOX.  I have
lots of compilation error, and I need help.

I understand that I could use CodeSourcery toolchain to build the
busybox, and create a rootfs for the kernel.

Do you think it makes sense to carry two different tool sets, and
switch it back and forward during the development?
Also, is it safe to do this if a new toolchain is being released?

I am a bit confused, and need help badly.
Neil

My target:
TARGET=ARM926EJ
Host=Linux Centos5


--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: 

3. Syncing contacts with Gmail contacts group don't work properly

4. Can Dev Phone bought in US be used in India?

5. Gtalk client implememtation

6. Music player got crashed in android running on beagle

7. How often does gmail sync on the G1?