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. R.java file not being generated by eclipse plugin

Hi

Well  i am using Android SDK 1.0 with Eclipse plugin(0.8) in Eclipse
version 3.4.
get automatically generated. Its strange because i haven't changed any
settings or any file and it just started happening (seemingly)
automatically. The only change which i had made was in mail.xml file
in another project and I don't think it should affect the system wide
settings.

I tried restarting eclipse, resetting ADT and reinstalling SDK but to
no avail.

I also tried copying R.java file from another project to this file but
then it doesn't automatically change when i make any changes to layout
or strings etc.

Searching on google had no similar problem. The closest was of people
whose R.java was not getting updated but they corrected it by deleting
R.java and making some changes in xml files but mine doesn't get
generated in the first place!!


Any help would be much appreciated.

--~--~---------~--~----~------------~-------~--~----~

2. How many threads are created by android vm for each android application

Hi,

If my android application does not create any thread, how many thread
does it create to run my android application?
1. Paint thread?
2. Event Handling thread (key event)?
3. Main thread for my andriod?

Is that correct?

And if i have 2 android applications running, will there be 6 threads
altogether?..

Thank you.

--~--~---------~--~----~------------~-------~--~----~

3. IP address for G1 via USB?

4. Where can I find output of System.out.println?

5. Other languages keyboard layouts

6. Activity.setResult(RESULT_OK, intent) resulting in RESULT_CANCELED

7. IllegalArgumentException: column '_id' does not exist from SimpleCursorAdapter