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. update view when AsyncTask finished in a service

Hari

I have an activity which starts a service. In the service there is a
network lookup in an AsyncTask. Results from the lookup are saved to a
database.

The activity queries to database and shows the newest entries. But at
the very first run the database is empty, so there is nothing to show.
In this case I would like to show a progress dialog to the user while
the network lookup is taking place. I would like to dismiss the
progress dialog when the first lookup is finished.

Is there a way to access the progress dialog created in the activity
from the service? Or how to do it?

-- 

2. Setting up Eclipse to build NDK using Sequoyah

I am trying to set up Eclipse so that it can build my NDK piece.  I
have installed Sequoyah, and added the Native Support.  However, when
I build the project I get the error:

**** Build of configuration Default for project HelloJni ****

(Cannot run program "bash": Launching failed)

Can anyone tell me what I am doing wrong?

Thanks.

-- 

3. HTC auto zoom on HTML input fields

4. Is Samsung Galaxy Tab NOT a large screen from application developer's point of view?

5. External Storage File Creation Problem

6. multiple images in a one single image

7. getting sensor information from native code (C or C++)