[XOM-interest] StackOverflowError compiling XOM

Elliotte Harold elharo at metalab.unc.edu
Mon Jan 12 21:26:54 EST 2009


I've now checked in a patch I hope will improve matters with this class 
and function. In brief the getCombiningClass method now looks like this:

     private static int getCombiningClass(int character) {

         if (character <= 0x2ff) return 
CANONICAL_COMBINING_CLASS_NOT_REORDERED;
         if (character <= 0x314) return CANONICAL_COMBINING_CLASS_ABOVE;
         if (character <= 0x315) return 
CANONICAL_COMBINING_CLASS_ABOVE_RIGHT;
         if (character <= 0x319) return CANONICAL_COMBINING_CLASS_BELOW;
         if (character <= 0x31a) return 
CANONICAL_COMBINING_CLASS_ABOVE_RIGHT;
         if (character <= 0x31b) return 
CANONICAL_COMBINING_CLASS_ATTACHED_ABOVE_RIGHT;
         if (character <= 0x320) return CANONICAL_COMBINING_CLASS_BELOW;
         // ...

The result is that there are now only about as third as many lines of 
code and even fewer operations. Furthermore, the tests are ordered by 
code point so strings containing only Latin characters should be very fast.

If there's demand fro improving this still further, there are some table 
lookup tricks I can play. However, first I'd like to know if this 
improves matters for folks who were having trouble with the older, 
larger code. I'll try and check and see if Clover can handle this myself.


Longer term, I'd like to integrate the code generation into the build 
process. I'd also love to see a lot more unit tests for the various 
cases. The testing now is far from exhaustive.

-- 
Elliotte Rusty Harold  elharo at metalab.unc.edu
Refactoring HTML Just Published!
http://www.amazon.com/exec/obidos/ISBN=0321503635/ref=nosim/cafeaulaitA


More information about the XOM-interest mailing list