Re: exceptions & dataflow

jeremy@softway.com.au (Jeremy Fitzhardinge)
10 Feb 1998 01:44:15 -0500

          From comp.compilers

Related articles
[3 earlier articles]
Re: exceptions & dataflow jason@cygnus.com (Jason Merrill) (1998-02-08)
Re: exceptions & dataflow dlmoore@ix.netcom.com (David L Moore) (1998-02-08)
Re: exceptions & dataflow dlmoore@ix.netcom.com (David L Moore) (1998-02-09)
Re: exceptions & dataflow sergey@solyanik.com (Sergey Solyanik) (1998-02-10)
Re: exceptions & dataflow jason@cygnus.com (Jason Merrill) (1998-02-10)
Re: exceptions & dataflow mcdirmid@beaver.cs.washington.edu (1998-02-10)
Re: exceptions & dataflow jeremy@softway.com.au (1998-02-10)
Re: exceptions & dataflow jason@cygnus.com (Jason Merrill) (1998-02-12)
Re: exceptions & dataflow fjh@hydra.cs.mu.oz.au (Fergus Henderson) (1998-02-12)
Re: exceptions & dataflow chase@world.std.com (David Chase) (1998-02-12)
Re: exceptions & dataflow amitb@sasi.com (Amit Bhatnagar) (1998-02-12)
Re: exceptions & dataflow dlmoore@ix.netcom.com (David L Moore) (1998-02-14)
Re: exceptions & dataflow sergey@solyanik.com (Sergey Solyanik) (1998-02-14)
[1 later articles]
| List of all articles for this month |
From: jeremy@softway.com.au (Jeremy Fitzhardinge)
Newsgroups: comp.compilers
Date: 10 Feb 1998 01:44:15 -0500
Organization: Softway Pty Ltd
References: 98-02-025 98-02-027
Keywords: optimize, Java

"Sergey Solyanik" <sergey@solyanik.com> writes:
> In Java, hardware exceptions can ony happen in very controlled manner
> (e. g. to test for null). If your language contains pointers, things
> are much worse and you'd have to break basic block with essentially
> any pointer dereference when you cannot prove that location exists.


In Java the biggest complication exceptions create for optimisation is
asynchronous exceptions. Java defines a mechanism by which one thread
can send an exception up another thread's stack at any time.


A simple implementation would treat this something like a Unix signal,
which can interrupt the execution of any bytecode. Since the VM spec
disallows reordering of bytecodes with globally visible side-effects
(changing memory, for example), this can pretty much inhibit all
non-trivial optimisation.


A more subtle approach is to have sample points in generated JIT
code which checks for pending exceptions, and only process them when
convenient. This has to be done pretty regularly though, probably in
every basic block, which adds its own overhead.


Asynchronous exceptions were a terrible mistake for other reasons (they
introduce race-conditions in the try/catch/finally mechanism and all
code must expect any exception at any moment), they're being deprecated.
We're stuck with them for now, though.


J
--


Post a followup to this message

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