[kaffe] SPEC JVM98 Failure with current CVS Sources

Helmer Krämer hkraemer@freenet.de
Thu, 3 Oct 2002 22:04:42 +0200


This is a multi-part message in MIME format.

--Multipart_Thu__3_Oct_2002_22:04:42_+0200_08af7ed0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Thu, 3 Oct 2002 11:55:00 -0700 (PDT)
Dalibor Topic <robilad@yahoo.com> wrote:

> Hi Kevin,
> 
> --- "Kevin D. Kissell" <kevink@mips.com> wrote:
> > The new build from CVS (with my MIPS patch)
> > passes all the regression tests, including the new
> > CatchLimits.class.save test, but it fails the SPEC
> > JVM98 _200_check sanity check, on the 
> > testObjectArray test, blowing out with:
> > 
> > java.lang.ArrayStoreException: not arrays
> > 
> > This arose from an invocation of 
> > java.lang.system.arraycopy() by the SPEC code.
> > I'd provide the whole exception backtrace, but
> > the applet console window doesn't allow me to
> > cut and paste to an Xterm. :-(  I hope that this
> > clue would be enough to tell someone who had
> > made relevant mods between 1.0.7 and today
> > where they should re-check their work.
> 
> It was me who made the modification. I merged in the
> pure java System.arraycopy from pocketlinux as it was
> pure java and faster on small cases than the native
> method invocation. It made a noticeable difference on
> the SciMark benchmark.
> 
> In the new code, instanceof destination array is used
> to check the type of the array, and call the according
> copy loop. I assume that we are mishandling the case
> where destination is null, and the check fails for all
> types.
> 
> Could you confirm that by replacing the throw clause
> by a few System.err.println calls with dst and src in
> libraries/javalib/java/lang/System.java in method
> arraycopy? 

I guess the problem is that System.arraycopy
doesn't verify that dst and src are both !=
null before figuring out how to copy the array.

According to the api spec, System.arraycopy is
supposed to throw a NullPointerException when
either src or dst are null, so something like
the attached patch should make kaffe pass the
test.

Greetings,
Helmer
--Multipart_Thu__3_Oct_2002_22:04:42_+0200_08af7ed0
Content-Type: application/octet-stream;
 name="java-lang-system.patch"
Content-Disposition: attachment;
 filename="java-lang-system.patch"
Content-Transfer-Encoding: base64

SW5kZXg6IGxpYnJhcmllcy9qYXZhbGliL2phdmEvbGFuZy9TeXN0ZW0uamF2YQo9PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
ClJDUyBmaWxlOiAvY3ZzL2thZmZlL2thZmZlL2xpYnJhcmllcy9qYXZhbGliL2phdmEvbGFuZy9T
eXN0ZW0uamF2YSx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4yNQpkaWZmIC13IC11IC1yMS4yNSBT
eXN0ZW0uamF2YQotLS0gbGlicmFyaWVzL2phdmFsaWIvamF2YS9sYW5nL1N5c3RlbS5qYXZhCTIx
IEF1ZyAyMDAyIDE2OjQ4OjI4IC0wMDAwCTEuMjUKKysrIGxpYnJhcmllcy9qYXZhbGliL2phdmEv
bGFuZy9TeXN0ZW0uamF2YQkzIE9jdCAyMDAyIDE5OjU1OjM0IC0wMDAwCkBAIC04Niw2ICs4Niw5
IEBACiAKIHB1YmxpYyBzdGF0aWMgdm9pZCBhcnJheWNvcHkoT2JqZWN0IHNyYywgaW50IHNyY19w
b3NpdGlvbiwgT2JqZWN0IGRzdCwgaW50IGRzdF9wb3NpdGlvbiwgaW50IGxlbmd0aCkgewogCisJ
aWYoc3JjPT1udWxsIHx8IGRzdD09bnVsbCkKKwkJdGhyb3cgbmV3IE51bGxQb2ludGVyRXhjZXB0
aW9uKCk7CisKIAlpZiAoZHN0IGluc3RhbmNlb2YgT2JqZWN0W10pIHsKIAkJT2JqZWN0W10gZCA9
IChPYmplY3RbXSlkc3Q7CiAJCU9iamVjdFtdIHMgPSAoT2JqZWN0W10pc3JjOwo=

--Multipart_Thu__3_Oct_2002_22:04:42_+0200_08af7ed0--