[kaffe] CVS kaffe (robilad): Split arraycopy into a java part for error checking and a native part for real w

Kaffe CVS cvs-commits at kaffe.org
Sun Jan 2 22:49:31 PST 2005


PatchSet 5748 
Date: 2005/01/03 06:44:03
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Split arraycopy into a java part for error checking and a native part for real work

2005-01-03  Dalibor Topic  <robilad at kaffe.org>

        * libraries/javalib/java/lang/System.java (arraycopy): Moved error
        checking code from native part of the method into java part of
        method's implementation. Improved exception messages.
        (arraycopy0) Renamed native part of the method accordingly.

        * test/internal/java/lang/System.java: Updated for new arraycopy
        implementation.

        * libraries/clib/native/System.c (java_lang_System_arraycopy):
        Renamed to java_lang_System_arraycopy0.

        * libraries/javalib/Klasses.jar.bootstrap: Regenerated.

Members: 
	ChangeLog:1.3292->1.3293 
	libraries/clib/native/System.c:1.63->1.64 
	libraries/javalib/Klasses.jar.bootstrap:1.80->1.81 
	libraries/javalib/java/lang/System.java:1.43->1.44 
	test/internal/java/lang/System.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3292 kaffe/ChangeLog:1.3293
--- kaffe/ChangeLog:1.3292	Sun Jan  2 19:03:30 2005
+++ kaffe/ChangeLog	Mon Jan  3 06:44:03 2005
@@ -1,3 +1,18 @@
+2005-01-03  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/java/lang/System.java (arraycopy): Moved error
+	checking code from native part of the method into java part of 
+	method's implementation. Improved exception messages.
+	(arraycopy0) Renamed native part of the method accordingly.
+
+	* test/internal/java/lang/System.java: Updated for new arraycopy
+	implementation.
+
+	* libraries/clib/native/System.c (java_lang_System_arraycopy):
+	Renamed to java_lang_System_arraycopy0.
+
+	* libraries/javalib/Klasses.jar.bootstrap: Regenerated.
+	
 2005-01-02  Guilhem Lavaux  <guilhem at kaffe.org>
 
 	* kaffe/kaffevm/systems/unix-pthreads/lock-impl.c
Index: kaffe/libraries/clib/native/System.c
diff -u kaffe/libraries/clib/native/System.c:1.63 kaffe/libraries/clib/native/System.c:1.64
--- kaffe/libraries/clib/native/System.c:1.63	Tue Dec 21 05:49:58 2004
+++ kaffe/libraries/clib/native/System.c	Mon Jan  3 06:44:06 2005
@@ -153,7 +153,7 @@
 }
 
 void
-java_lang_System_arraycopy(struct Hjava_lang_Object* src, jint srcpos,
+java_lang_System_arraycopy0(struct Hjava_lang_Object* src, jint srcpos,
 			   struct Hjava_lang_Object* dst, jint dstpos,
 			   jint len) {
 	char* in; 	 
@@ -162,50 +162,8 @@
 	Hjava_lang_Class* sclass; 	 
 	Hjava_lang_Class* dclass;
 
-	if (src==0 || dst==0) {
-		throwException (NullPointerException);
-	}
-
-	if (len == 0) { 	 
-		return; 	 
-	} 	 
-
 	sclass = OBJECT_CLASS(src); 	 
 	dclass = OBJECT_CLASS(dst);
-
-	/* Must be arrays */ 	 
-	if (!CLASS_IS_ARRAY(sclass)) {
-		Hjava_lang_Throwable* asexc;
-		const char *type = CLASS_CNAME(sclass);
-		char *b;
-#define _FORMAT "source not an array `%s'"
-		b = checkPtr(KMALLOC(strlen(type)+strlen(_FORMAT)));
-		sprintf(b, _FORMAT, type);
-#undef _FORMAT
-		asexc = ArrayStoreException(b);
-		KFREE(b);
-		throwException(asexc);
-	}
-
-	if(!CLASS_IS_ARRAY(dclass)) { 	 
-		Hjava_lang_Throwable* asexc;
-		const char *type = CLASS_CNAME(dclass);
-		char *b;
-#define _FORMAT "destination not an array `%s'"
-		b = checkPtr(KMALLOC(strlen(type)+strlen(_FORMAT)));
-		sprintf(b, _FORMAT, type);
-#undef _FORMAT
-		asexc = ArrayStoreException(b);
-		KFREE(b);
-		throwException(asexc);
-	} 	 
-
-	/* Make sure we'll keep in the array boundaries */ 	 
-	if ((srcpos < 0 || srcpos + len > ARRAY_SIZE(src)) || 	 
-	    (dstpos < 0 || dstpos + len > ARRAY_SIZE(dst)) || 	 
-	    (len < 0)) { 	 
-		throwException (ArrayIndexOutOfBoundsException);
-	}
 
 	sclass = CLASS_ELEMENT_TYPE(sclass); 	 
 	dclass = CLASS_ELEMENT_TYPE(dclass); 	 
Index: kaffe/libraries/javalib/Klasses.jar.bootstrap
cvs rdiff: failed to read diff file header /tmp/cvsKEgR85 for Klasses.jar.bootstrap,v: end of file
system command returned non-zero exit status: 1: aborting




More information about the kaffe mailing list