Re: Re: Expression Compiler

Rémi Forax <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Le 08/11/2010 00:05, Mark Proctor a écrit :
> On 07/11/2010 21:21, Thomas Mahler wrote:
>> Hi Mark,
>>
>> The ASM examples contain a simple expression compiler that might be 
>> useful as a starting point.
>>
>> You might also have a look at my fun4j lisp compiler which uses the 
>> same approach:
>> http://www.fun4j.org/tutorial-assembler.html
> I notice fun4j is a literal translation of the source logic. I was 
> trying to produce an output that matched the Eclipse ASM bytecode 
> outline tool. However the bytecode there is optimised, >= is turned to 
> <, || and && have the statements organised to reduce unecessary goto's 
> and minimise statement executed.
>
> Is that kind of optimisation necessary, shouldn't the JVM be doing all 
> of that no matter how the bytecode is written? 

Some rewriting are necessary because by example there is no bytecode 
instruction for
the boolean not ('!') or because && et || are lazy in Java.

Removing unnecessary goto is a big win in the interpreter, but usually 
the JITs don't care.

Now, all JITs do optimizations by recognizing patterns. and all JIT 
benchmarks are
written in Java compiled with javac, so for perf you have no choice but 
to mimic javac.

> Also while I'm in the process of learning is it possible to stop the 
> tool from doing that, so I can more easily compare the bytecode I am 
> producing to that of a java compiler.
>
> Mark

>> Clojure also uses ASM as an AST compiler. It might be useful to have 
>> a look at it too!

Groovy, Jython or JRuby also use ASM.

>>
>> best regards,
>> Thomas

Rémi
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.