decoration decoration
Stories

GROKLAW
When you want to know more...
decoration
For layout only
Home
Archives
Site Map
Search
About Groklaw
Awards
Legal Research
Timelines
ApplevSamsung
ApplevSamsung p.2
ArchiveExplorer
Autozone
Bilski
Cases
Cast: Lawyers
Comes v. MS
Contracts/Documents
Courts
DRM
Gordon v MS
GPL
Grokdoc
HTML How To
IPI v RH
IV v. Google
Legal Docs
Lodsys
MS Litigations
MSvB&N
News Picks
Novell v. MS
Novell-MS Deal
ODF/OOXML
OOXML Appeals
OraclevGoogle
Patents
ProjectMonterey
Psystar
Quote Database
Red Hat v SCO
Salus Book
SCEA v Hotz
SCO Appeals
SCO Bankruptcy
SCO Financials
SCO Overview
SCO v IBM
SCO v Novell
SCO:Soup2Nuts
SCOsource
Sean Daly
Software Patents
Switch to Linux
Transcripts
Unix Books

Gear

Groklaw Gear

Click here to send an email to the editor of this weblog.


You won't find me on Facebook


Donate

Donate Paypal


No Legal Advice

The information on Groklaw is not intended to constitute legal advice. While Mark is a lawyer and he has asked other lawyers and law students to contribute articles, all of these articles are offered to help educate, not to provide specific legal advice. They are not your lawyers.

Here's Groklaw's comments policy.


What's New

STORIES
No new stories

COMMENTS last 48 hrs
No new comments


Sponsors

Hosting:
hosted by ibiblio

On servers donated to ibiblio by AMD.

Webmaster
not really | 388 comments | Create New Account
Comments belong to whoever posts them. Please notify us of inappropriate comments.
True - n/t
Authored by: Gringo_ on Sunday, May 06 2012 @ 10:14 AM EDT

[ Reply to This | Parent | # ]

not really
Authored by: Anonymous on Sunday, May 06 2012 @ 10:19 AM EDT
The Dalvik bytecode is very different from the Java bytecode. The "converter" you're talking about ("dx") is actually a full compiler, but it just expects as input Java bytecodes instead of Java source code.

Any "compiler" is just a really fancy converter that does a lot of transformations between different representations, optimizations, and things like that. The Dalvik VM stores its temporary variables in "registers", so the compiler has to decide which variables to put in which registers, and add extra instructions to handle situation where it runs out of registers, etc. It makes lots of low-level decisions that are way too tedious for programmers to do by hand.

Note that there are a couple of reasons why it makes sense for "dx" to use Java bytecodes for its input format, instead of source code:

(1) They re-use the "front-end" of the Javac compiler, which already knows how to parse Java code. As Sun upgrades the language by adding new features into Javac, they can piggyback on those improvements (they only have to add the necessary back-end support to Dalvik, but not to their own compiler front-end, since they didn't write one). As it happens, Java bytecode for its stack-based VM architecture is a very reasonable intermediate representation for another compiler to start with (its not too far from the abstract syntax tree you end up with in a simple one-pass recursive-descent compiler).

(2) It will work with source languages other than Java! As long as they can run their code on a Java VM, their compiled .class files can probably be run through dx and then used on Android too (unless they require APIs that Android doesn't have). Even if there was no use-case for this at the time Dalvik was designed, it was a forward-thinking choice.

[ Reply to This | Parent | # ]

Groklaw © Copyright 2003-2013 Pamela Jones.
All trademarks and copyrights on this page are owned by their respective owners.
Comments are owned by the individual posters.

PJ's articles are licensed under a Creative Commons License. ( Details )