javac: ending positions generation and DiagnosticListener

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Dec 6 13:42:08 PST 2013


Hi, Per,

If you can donate the class, that would be great (lawyers permitting)
but even if not, the suggestion of such a class is a good one.

Knowing your work on the javac Scope class, I can almost guess the
implementation without reading the code!

-- Jon

On 12/06/2013 01:41 PM, Per Bothner wrote:
> It is of course possible to implement the 'end-pos-table' much
> more compactly.  Currently, it uses a Map<JCTree, Integer> (see
> class SimpleEndPosTable in JavacParser.java).  This is of course
> very space-inefficient, as it requires an Integer object and
> a Map.Entry object for each entry.
>
> Kawa has a class IntHashTable which maps Object to int in an
> optimized fashion, with no per-entry allocation:
> https://sourceware.org/viewvc/kawa/trunk/gnu/kawa/util/IntHashTable.java?view=co&revision=7567&content-type=text%2Fplain 
>
>
> This code was written by Charles Turner (as a Google Summer of Code 
> student),
> based on my design/suggestions.  The Kawa project (led by me) would be 
> happy
> to donate this class as a much-more efficient re-implementation of
> SimpleEndPosTable.  (If there is interest, as a courtesy I'll check 
> with Charles.)
>
> The code could probably be simplified a bit, as long as we don't
> care about general deletions, though replaceTree needs special handling.



More information about the compiler-dev mailing list