[antlr-interest] Got GCJ to compile antlr and java parser/tree parser :)

Ric Klaren klaren at cs.utwente.nl
Mon Sep 15 02:06:54 PDT 2003


Hey Terence,

On Sat, Sep 13, 2003 at 04:32:23PM -0700, Terence Parr wrote:
> Ok, it was a pain in the ass, but with the knowledge that Ric Klaren
> had gotten antlr to compile, I spent a few hours today trying things
> out myself.
>
> First, get ANTLR to compile.  Got it to compile out of the box:
>
> for each package dir in antlr:
>
> $ gcj --CLASSPATH=/home/parrt/org.antlr -c -g -O *.java
>
> then link:
>
> gcj -o /usr/local/bin/antlr --main=antlr.Tool -g *.o */*.o */*/*.o
>
> After running strip on executable, it's like 1.3M. :)  Nice.

Not to be annoying and stuff but why not ./configure --enable-gcj ; make
and move the binary from the basedir to where you want it ? ;)

> I tried to make a library and all that, but couldn't make it work so I
> resorted to telling it to compile antlr each time along with the parser
> from file.g.  No biggie.

I didn't try it yet on any java projects so did not encounter this. This is
probably due to the lack of a antlr-runtime.jar which probably should be
compiled in everytime. E.g. as we had it pre 2.7.2 with a antlrall.jar and
antlr.jar.

> Lots of things like this come out:
>
> warning: exception handler inside code that is being protected

Yup there's a lot of those no clue what it should mean, did not research
into it either.

What I did notice on redhat 9 was that the blackdown java did not work. The
Sun one was ok though.

> TIMING
>
> Java VM parsing jdk 1.4 source using time program:
>
> $ java Main /usr/local/java/java
> real    0m28.868s
> user    0m24.990s
> sys     0m0.420s
>
> GCJ compiled parser doing same thing:
>
> $ ./jparse /usr/local/java/java
> real    0m40.004s
> user    0m38.870s
> sys     0m0.470s
>
> [Note there are some problems parsing the source, but I haven't checked
> what the error in my grammar is]
>
> Yes, the GCJ version is SLOWER!  Could this be the garbage collector or
> slow IO library or something?

Very hard to say without profile.

Running antlr as a native binary is a bit faster than using the java
version btw (at least in my project).

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
  Xander: "Buffy, we need to do something *now*"
  Angel: "We need a distraction."
  Buffy: "Right."
  Angel: "What are you going to do?"
  Buffy: "I'm going to kill them all. That oughtta distract 'em..."


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list