[kaffe] CVS kaffe (robilad): kaffe/kaffevm/classMethod.h (getPrimitiveClassFromSignature):

Kaffe CVS cvs-commits at kaffe.org
Mon Oct 22 06:39:59 PDT 2007


PatchSet 7585 
Date: 2007/10/22 13:38:54
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
2007-10-22  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/kaffevm/classMethod.h (getPrimitiveClassFromSignature):
        Added prototype.

        * kaffe/kaffevm/itypes.c (getPrimitiveClassFromSignature):
        New function.
        (classFromSig) Delegate to getPrimitiveClassFromSignature
        for primitive types.

Members: 
	ChangeLog:1.5082->1.5083 
	kaffe/kaffevm/classMethod.h:1.95->1.96 
	kaffe/kaffevm/itypes.c:1.41->1.42 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5082 kaffe/ChangeLog:1.5083
--- kaffe/ChangeLog:1.5082	Mon Oct 22 11:57:34 2007
+++ kaffe/ChangeLog	Mon Oct 22 13:38:54 2007
@@ -1,5 +1,15 @@
 2007-10-22  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/classMethod.h (getPrimitiveClassFromSignature):
+	Added prototype.
+
+	* kaffe/kaffevm/itypes.c (getPrimitiveClassFromSignature):
+	New function.
+	(classFromSig) Delegate to getPrimitiveClassFromSignature
+	for primitive types.
+
+2007-10-22  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/itypes.c (classFromSig): Don't post
 	VerifyError here, throw it in the calling function.
 	(getClassFromSignaturePart) Post VerifyError if call 
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.95 kaffe/kaffe/kaffevm/classMethod.h:1.96
--- kaffe/kaffe/kaffevm/classMethod.h:1.95	Sat Sep 22 17:36:13 2007
+++ kaffe/kaffe/kaffevm/classMethod.h	Mon Oct 22 13:38:54 2007
@@ -701,6 +701,7 @@
 int			sizeofSigMethod(Method *, bool);
 int			sizeofSigClass(Hjava_lang_Class*, bool);
 void			establishMethod(Method*);
+Hjava_lang_Class*	getPrimitiveClassFromSignature(const char);
 Hjava_lang_Class*	getClassFromSignature(const char*, Hjava_lang_ClassLoader*, errorInfo*);
 Hjava_lang_Class*	getClassFromSignaturePart(const char*, Hjava_lang_ClassLoader*, errorInfo*);
 int			countArgsInSignature(const char *);
Index: kaffe/kaffe/kaffevm/itypes.c
diff -u kaffe/kaffe/kaffevm/itypes.c:1.41 kaffe/kaffe/kaffevm/itypes.c:1.42
--- kaffe/kaffe/kaffevm/itypes.c:1.41	Mon Oct 22 11:57:36 2007
+++ kaffe/kaffe/kaffevm/itypes.c	Mon Oct 22 13:38:54 2007
@@ -164,15 +164,6 @@
 	const char* end;
 
 	switch (*(*strp)++) {
-	case 'V': return (voidClass);
-	case 'I': return (intClass);
-	case 'Z': return (booleanClass);
-	case 'S': return (shortClass);
-	case 'B': return (byteClass);
-	case 'C': return (charClass);
-	case 'F': return (floatClass);
-	case 'D': return (doubleClass);
-	case 'J': return (longClass);
 	case '[': return (lookupArray(classFromSig(strp, loader, einfo),
 				      einfo));
 	case 'L':
@@ -193,8 +184,7 @@
 		return(cl);
 
 	default:
-		/* malformed signature */
-		return (NULL);
+		return getPrimitiveClassFromSignature(*(*(strp)-1));
 	}
 }
 
@@ -242,4 +232,29 @@
 	/* Otherwise, post an exception message. */
 	postException(einfo, JAVA_LANG(VerifyError));
 	return (NULL);
+}
+
+/**
+ * Return a primitive class for a given signature.
+ *
+ * @param sig signature (V,I,Z,S,B,C,F,D,J)
+ *
+ * @return primitive class corresponding to signature, otherwise NULL.
+ */
+Hjava_lang_Class*
+getPrimitiveClassFromSignature(const char sig)
+{
+	switch(sig) {
+	case 'V': return (voidClass);
+	case 'I': return (intClass);
+	case 'Z': return (booleanClass);
+	case 'S': return (shortClass);
+	case 'B': return (byteClass);
+	case 'C': return (charClass);
+	case 'F': return (floatClass);
+	case 'D': return (doubleClass);
+	case 'J': return (longClass);
+	default:
+		return NULL;
+	}
 }




More information about the kaffe mailing list