Improve the DecimalFormat JNI.

We don't need two identical copies of the code for double and long; ICU uses
overloading, and we should take advantage of that. We can also improve the code
to remove unnecessary heap allocation, remove unnecessary temporary copies, and
only make JNI calls and ask for the attribute data when necessary.

I've also switched the code from the thread-unsafe strtok(3) to strtok_r(3).

I've also removed unnecessary temporary char[]s and copying in DecimalFormat.

I've also fixed another instance of the "if (doubleValue == longValue) longPath"
anti-pattern that gets -0.0 wrong. (It's also worth noting that caliper says
the difference between the double and long paths is very small, on the order
of 2us.)

(The new code takes about 20us per call compared to 60us for the old code,
measured on passion-eng.)
2 files changed