On Feb 29, 2008, at 8:51 AM, Rémi Forax wrote:
> No, i prefer patching the current OpenJDK lib or use alternatives when
> the current API doesn't fit my needs.

Yes, please, do contribute patches into the OpenJDK.

On Feb 29, 2008, at 8:19 AM, Charles Oliver Nutter wrote:
>
>
> - java.util.regex can't handle alternations over arbitrarily large  
> input
> without blowing the stack. It also can't handle our (Ruby's)
> byte[]-based strings. So we switched first to JRegex, which doesn't
> recurse, and then to Joni, a bytecode-based port of Oniguruma.

The OpenJDK regex is a tree-walking interpreter, and needs to be  
updated in a future release to a Gnu-style backtracking bytecode  
engine.  This is not an architectural problem, but an implementation  
weakness in the first release.

> - java.math.BigInteger has a grossly inefficient implementation of
> doubleValue, which we need. So we're looking at the JScience library's
> LargeInteger instead.

Yes, it is grossly inefficient, but it just needs a little love and  
attention.  If it's just an implementation problem, don't pitch it,  
patch it!

Surely there's a reasonable way to get what you want immediately,  
something like:
> BigInteger bigi = ...;
> int scale = Math.max(0, bigi.bitLength() - 63);
> long val = bigi.shiftRight(scale).longValue();
> (check for overflow by examining scale and val)
>
> long bits = Double.doubleToRawLongBits((double)val);
> bits += scale << (64-12);   // patch exponent field
> double result = longBitsToDouble(bits);

That could be a utility routine in the JRuby runtime, and later a  
patch to OpenJDK.

-- John

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to jvm-languages@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to