[antlr-interest] how to do exceptions quickly

Terence Parr parrt at cs.usfca.edu
Tue Apr 17 11:25:31 PDT 2007


Hi,

I had a long conversation at Google last night with Neal Gafter, the  
guy who built the javac compiler when he was at Sun. He told me that  
exceptions can be made to execute very quickly.  The only thing you  
have to avoid is the actual exception object creation which has to do  
all of the expensive stack trace creation and so on.  He says that  
the actual throwing of the exception itself is not a problem.  This  
might be something to look at later to see if it goes quickly,  
because it results in cleaner backtracking code.  Anyway, we can  
create some singleton objects, which will solve the problem.  Hooray!

Anyway, this might be useful to people in general.  I thought was  
pass along this interesting trick.

He confirmed that -target jsr14 should be okay for us to use generics  
in the antler tool and generate 1.4 compatible.class files.  He is  
the author of all that, so I believe. ;)

Ter


More information about the antlr-interest mailing list