anyone interested in ThumbEE port of Dalvik?

437 views
Skip to first unread message

The Alchemist

unread,
Mar 1, 2010, 7:22:09 AM3/1/10
to android-porting
Hello everyone!

Short version:
I'm wondering if someone could clear up for me whether a Dalvik port
to ThumbEE would be of any benefit, especially when it comes to
startup application performance, before the JIT kicks in.

Longer version:
I am writing to get more informed opinions about ThumbEE / Jazelle RCT
port of Dalvik. Any thoughts? I got the idea from reading the
"Dalvik Porting" guide [1] and the ARM Cortex A8 documentation [2],
[3]. The documented instructions do some seemingly useful things [4]:

"""
New features provided by ThumbEE include automatic null pointer checks
on every load and store instruction, an instruction to perform an
array bounds check, access to registers r8-r15 (where the Jazelle/DBX
Java VM state is held), and special instructions that call a handler.
[39] Handlers are small sections of frequently called code, commonly
used to implement a feature of a high level language, such as
allocating memory for a new object. These changes come from
repurposing a handful of opcodes, and knowing the core is in the new
ThumbEE mode.
"""

Apparently, using/licensing Jazelle from ARM used to be a PITA, but I
get the impression ARM has learned from its mistakes and now the next-
gen Jazelle, Jazelle RCT / ThumbEE, is documented [2] and can be used
without licensing.

I get the impression that the Snapdragon / ARM chips in the Morotola
DROID and Nexus One have Jazelle RCT support, so they could really
benefit from ThumbEE instructions.

Thoughts, comments, feedback, rebuttals, etc. would all be greatly
appreciated.

Thank you!

[1] http://android.git.kernel.org/?p=platform/dalvik.git;a=blob_plain;f=docs/porting-guide.html;hb=HEAD
[2] http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0344c/ch16s04s04.html
[3] http://infocenter.arm.com/help/topic/com.arm.doc.ddi0344c/DDI0344C_cortex_a8_r2p0_trm.pdf
[4] http://en.wikipedia.org/wiki/ARM_architecture#Thumb_Execution_Environment_.28ThumbEE.29

fadden

unread,
Mar 1, 2010, 3:55:19 PM3/1/10
to android-porting
On Mar 1, 4:22 am, The Alchemist <kap4...@gmail.com> wrote:
> I'm wondering if someone could clear up for me whether a Dalvik port
> to ThumbEE would be of any benefit, especially when it comes to
> startup application performance, before the JIT kicks in.

Not likely. First, the meaning of a couple of existing Thumb2
instructions changes (note the "behavior of some instructions are
different" remark on your link [2]), so you either have to build for
Thumb2 or ThumbEE, and run the code in the correct mode. Second,
there's a 16-cycle flush-everything penalty on a mode switch, so you
need to minimize switching in and out (see the cycle count on ENTERX/
LEAVEX on that same page). Third, you have to switch out of ThumbEE
mode to run ARM code, which is what the interpreter is currently
written in.

So you'd need to rewrite the entire interpreter for ThumbEE, and then
either rebuild the rest of the VM and all libraries it uses for
Thumb2EE, or take the mode-switch penalty every time you want to call
a function written in C.

Going through all that to get free null-pointer checks doesn't make
much sense. On top of that, I don't think the Thumb2 instruction set
is the best choice for the interpreter. The interpreter uses the
"free" built-in shift fairly often, so the code won't get much
smaller, and you'll be executing more instructions. (The ARM
instruction setmatches up really well with this sort of thing.)

Reply all
Reply to author
Forward
0 new messages