[kaffe] CVS kaffe (guilhem): Integer overflow fix in System.arraycopy

Michael Franz mvfranz at gmail.com
Sun Apr 3 19:15:40 PDT 2005


I was at the NY JAVASIG [1] last week and one of the things that Sun
did to improved performance in JDK 5.0 was to optimise
System.arraycopy (I assume it is a native method).  Any idea how fast
the Kaffe implementation is.

Michael

1.http://www.javasig.com/

On Apr 3, 2005 3:48 PM, Kaffe CVS <cvs-commits at kaffe.org> wrote:
> PatchSet 5657
> Date: 2005/04/03 20:43:28
> Author: guilhem
> Branch: HEAD
> Tag: (none)
> Log:
> Integer overflow fix in System.arraycopy
> 
> 2005-04-03  Guilhem Lavaux  <guilhem at kaffe.org>,
>         Mark Wielaard <mark at klomp.org>
> 
>         * libraries/javalib/java/lang/System.java
>         (arraycopy): Cast to long to prevent integer overflow.
> 
> Members:
>         ChangeLog:1.3827->1.3828
>         libraries/javalib/java/lang/System.java:1.45->1.46
> 
> Index: kaffe/ChangeLog
> diff -u kaffe/ChangeLog:1.3827 kaffe/ChangeLog:1.3828
> --- kaffe/ChangeLog:1.3827      Sun Apr  3 19:20:25 2005
> +++ kaffe/ChangeLog     Sun Apr  3 20:43:28 2005
> @@ -1,3 +1,9 @@
> +2005-04-03  Guilhem Lavaux  <guilhem at kaffe.org>,
> +       Mark Wielaard <mark at klomp.org>
> +
> +       * libraries/javalib/java/lang/System.java
> +       (arraycopy): Cast to long to prevent integer overflow.
> +
>  2005-04-03  Dalibor Topic  <robilad at kaffe.org>
> 
>         * config/ia64/hpux/config.frag,
> Index: kaffe/libraries/javalib/java/lang/System.java
> diff -u kaffe/libraries/javalib/java/lang/System.java:1.45 kaffe/libraries/javalib/java/lang/System.java:1.46
> --- kaffe/libraries/javalib/java/lang/System.java:1.45  Wed Jan  5 20:06:43 2005
> +++ kaffe/libraries/javalib/java/lang/System.java       Sun Apr  3 20:43:31 2005
> @@ -79,7 +79,7 @@
> 
>      final int src_length = Array.getLength(src);
> 
> -    if (src_position + length > src_length)
> +    if ((long)src_position + (long)length > (long)src_length)
>         throw new ArrayIndexOutOfBoundsException("src_position + length > src.length: " + src_position + " + " + length + " > " + src_length);
> 
>      if (dst_position < 0)
> @@ -87,7 +87,7 @@
> 
>      final int dst_length = Array.getLength(dst);
> 
> -    if (dst_position + length > dst_length)
> +    if ((long)dst_position + (long)length > (long)dst_length)
>         throw new ArrayIndexOutOfBoundsException("dst_position + length > dst.length: " + dst_position + " + " + length + " > " + dst_length);
> 
>      if (length < 0)
> 
> _______________________________________________
> kaffe mailing list
> kaffe at kaffe.org
> http://kaffe.org/cgi-bin/mailman/listinfo/kaffe
>




More information about the kaffe mailing list