Re: Is Java useful for writing (C/C++) compiler

"Jonathan Barker" <jandk@easynet.co.uk>
20 Apr 2000 01:34:39 -0400

          From comp.compilers

Related articles
Is Java useful for writing (C/C++) compiler vdbent@mail.com (Kees & Annette van der Bent) (2000-04-16)
Re: Is Java useful for writing (C/C++) compiler patrykz@ilion.eu.org (Patryk Zadarnowski) (2000-04-16)
Re: Is Java useful for writing (C/C++) compiler rsherry@home.com (Robert Sherry) (2000-04-17)
Re: Is Java useful for writing (C/C++) compiler pmb@dina.kvl.dk (Peter Bertelsen) (2000-04-17)
Re: Is Java useful for writing (C/C++) compiler gram@ull.mjolner.dk (Flemming Gram Christensen) (2000-04-20)
Re: Is Java useful for writing (C/C++) compiler iank@bearcave.com (2000-04-20)
Re: Is Java useful for writing (C/C++) compiler jandk@easynet.co.uk (Jonathan Barker) (2000-04-20)
Re: Is Java useful for writing (C/C++) compiler dale@cs.rmit.edu.au (dale) (2000-04-21)
Re: Is Java useful for writing (C/C++) compiler dvdeug@x8b4e53cd.dhcp.okstate.edu (2000-04-21)
Re: Is Java useful for writing (C/C++) compiler nr@labrador.eecs.harvard.edu (2000-04-25)
Re: Is Java useful for writing (C/C++) compiler jandk@easynet.co.uk (Jonathan Barker) (2000-04-25)
Re: Is Java useful for writing (C/C++) compiler bobduff@world.std.com (Robert A Duff) (2000-04-25)
Re: Is Java useful for writing (C/C++) compiler guerby@acm.org (Laurent Guerby) (2000-04-26)
[1 later articles]
| List of all articles for this month |

From: "Jonathan Barker" <jandk@easynet.co.uk>
Newsgroups: comp.compilers
Date: 20 Apr 2000 01:34:39 -0400
Organization: [posted via Easynet Ltd]
References: 00-04-125 00-04-128 00-04-134
Keywords: Java, C

Peter Bertelsen <pmb@dina.kvl.dk> wrote in message
> > ... that do 99% of work in a single tight but large loop with
> > longjumps all over the place (to handle exceptions and interrupts.)
>
> What do longjumps have to do with Java? Java directly supports
> exceptions, e.g. for handling arithmetic errors.


Exceptions have to be implemented somehow, don't they? The Java
language specification tells us the syntax and semantics of
exceptions, but it doesn't tell us how that translates into native
object code.


Obviously, performance depends on how often exceptions occur. It takes
time to unwind the stack, especially in a language like Java or
C++. We can't simply perform a jump and set the stack pointer... Since
the stack trace cannot possibly be known at compile-time (except in
the simplest cases), the run-time library (or VM) must search each
frame, executing "finally" clauses and finalising objects until it
finds a handler for the exception.


Thus, if you rely on exceptions for flow of control in a critical loop,
it is clear that performance will suffer.


  > My guess is that, even with JIT JVM, the performance is killed by
> > the required bounds checking on the register file.
>
> Assuming that your 'register file' is implemented as an array of fixed
> size, such bounds checking could be eliminated in an optimizing JVM or
> ahead-of-time compiler (producing native code).


Perhaps so, but my guess is that most Java bounds checking cannot be
eliminated at all. Of course, it can't be done in general. Does anyone
have any stats on the proportion of bounds checks which can be
statically eliminated in practice?


Jonathan


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.