Backport BigDecimal performance patches

Dr Andrew John Hughes ahughes at redhat.com
Fri Nov 5 06:24:32 PDT 2010


On 12:34 Thu 04 Nov     , Joe Darcy wrote:
> Andrew Haley wrote:
> > This is a backport of the BigDecimal performance rewrite.
> > http://cr.openjdk.java.net/~aph/6622432-openjdk6-webrev/
> >
> > rev 397 : 6622432: RFE: Performance improvements to java.math.BigDecimal
> > Reviewed-by: darcy
> > rev 398 : 6850606: Regression from JDK 1.6.0_12
> > Summary: The returned result from multiply should be constructed by using valueOf to take care of the INFLATED case.
> > Reviewed-by: darcy
> > rev 399 : 6876282: BigDecimal's divide(BigDecimal bd, RoundingFormat r) produces incorrect result
> > Reviewed-by: darcy
> >
> > The patches didn't quite apply cleanly, but once I fixed them up by hand
> > there were no regressions of either the JCK or JTreg.
> >
> > Given that 2000 lines of patch is rather hard to read, I have attached
> > a diff between the patched jdk6 and the current jdk7 tree.
> >
> > OK for jdk6?
> >
> >   
> 
> Hi Andrew.
> 
> I approve this backport in principle, but need to look over the diffs 
> more closely before giving the final okay.  There were some spec changes 
> in BigInteger/BigDecimal in JDK 7; you seem to have correctly adjusted 
> the patches for OpenJDK 6, but I just want to verify that.
> 
> Thanks for including the diff against JDK 7; that is a big aid in 
> reviewing :-)
> 
> -Joe

FWIW, the changes Andrew has backported:

changeset:   1794:98558a60c555
user:        darcy
date:        Wed Oct 21 09:53:23 2009 -0700
summary:     6560935: BigInteger.modPow() throws ArithmeticException for negative exponent

changeset:   1785:0dd3d16e8183
user:        darcy
date:        Tue Oct 20 09:51:28 2009 -0700
summary:     6371401: java.math.BigInteger.shift(Integer.MIN_VALUE) throws StackOverflowError

changeset:   1246:8d2efec31d78
user:        xlu
date:        Sun May 24 16:29:57 2009 -0700
summary:     6622432: RFE: Performance improvements to java.math.BigDecimal

don't include the spec. changes, which do appear in the jdk7 diff he supplied.  They seem to
have occurred prior to OpenJDK entering Mercurial with b24.  See:

http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/0/src/share/classes/java/math/BigInteger.java

and were then reverted in OpenJDK6:

changeset:   2:39e8fe7a0af1
tag:         jdk6-b00
user:        ohair
date:        Fri Jan 30 16:05:57 2009 -0800
summary:     6755277: All initial changes to jdk7 to create openjdk 6 build 0

http://hg.openjdk.java.net/jdk6/jdk6/jdk/diff/39e8fe7a0af1/src/share/classes/java/math/BigInteger.java

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8


More information about the jdk6-dev mailing list