[kaffe] CVS kaffe (dalibor): Fixed build with jit again

Kaffe CVS cvs-commits at kaffe.org
Thu Jul 15 09:09:03 PDT 2004


PatchSet 4975 
Date: 2004/07/15 14:44:02
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Fixed build with jit again

2004-07-15  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/kaffevm/jit/labels.c:
        (labelCount) Added.
        (newLabel) Add label names.
        (getInternalLabel) New function.

        * kaffe/kaffevm/jit/labels.h:
        (getInternalLabel) Added prototype.

        Reported by: Jerry Zhou <zhgjerry at eyou.com>

Members: 
	ChangeLog:1.2539->1.2540 
	kaffe/kaffevm/jit/labels.c:1.9->1.10 
	kaffe/kaffevm/jit/labels.h:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2539 kaffe/ChangeLog:1.2540
--- kaffe/ChangeLog:1.2539	Thu Jul 15 13:07:20 2004
+++ kaffe/ChangeLog	Thu Jul 15 14:44:02 2004
@@ -1,5 +1,17 @@
 2004-07-15  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/jit/labels.c:
+	(labelCount) Added.
+	(newLabel) Add label names.
+	(getInternalLabel) New function.
+
+        * kaffe/kaffevm/jit/labels.h:
+	(getInternalLabel) Added prototype.
+
+	Reported by: Jerry Zhou <zhgjerry at eyou.com>
+
+2004-07-15  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/external.c
 	(loadNativeLibrary2): Improve error message when library 
 	can't be found.
Index: kaffe/kaffe/kaffevm/jit/labels.c
diff -u kaffe/kaffe/kaffevm/jit/labels.c:1.9 kaffe/kaffe/kaffevm/jit/labels.c:1.10
--- kaffe/kaffe/kaffevm/jit/labels.c:1.9	Tue Jul  6 17:16:20 2004
+++ kaffe/kaffe/kaffevm/jit/labels.c	Thu Jul 15 14:44:05 2004
@@ -30,6 +30,10 @@
 label* lastLabel;
 label* currLabel;
 
+#if defined(KAFFE_VMDEBUG)
+static uint32 labelCount;
+#endif
+
 void
 resetLabels(void)
 {
@@ -167,10 +171,58 @@
 
 		/* Link elements into list */
 		for (i = 0; i < ALLOCLABELNR-1; i++) {
+#if defined(KAFFE_VMDEBUG)
+			sprintf(ret[i].name, "L%d", labelCount + i);
+#endif
+
 			ret[i].next = &ret[i+1];
 		}
 		ret[ALLOCLABELNR-1].next = 0;
 	}
 	currLabel = ret->next;
+#if defined(KAFFE_VMDEBUG)
+	labelCount += 1;
+#endif
 	return (ret);
+}
+
+label*
+getInternalLabel(label **lptr, uintp pc)
+{
+	label *curr, *retval = 0;
+
+	assert(lptr != 0);
+	
+	if( *lptr == 0 )
+	{
+		/* Start at the head of the list. */
+		*lptr = firstLabel;
+	}
+	curr = *lptr;
+	while( curr && (curr != currLabel) && !retval )
+	{
+		switch( curr->type & Ltomask )
+		{
+		case Linternal:
+			if( curr->to == pc )
+			{
+				*lptr = curr->next;
+				retval = curr;
+			}
+			break;
+		case Lcode:
+		  /* Commented out since codeInfo works
+		   * differently on jit and jit3.
+
+			if( INSNPC(curr->to) == pc )
+			{
+				*lptr = curr->next;
+				retval = curr;
+			}
+			break;
+		  */
+		}
+		curr = curr->next;
+	}
+	return( retval );
 }
Index: kaffe/kaffe/kaffevm/jit/labels.h
diff -u kaffe/kaffe/kaffevm/jit/labels.h:1.4 kaffe/kaffe/kaffevm/jit/labels.h:1.5
--- kaffe/kaffe/kaffevm/jit/labels.h:1.4	Sun Jun 17 16:39:09 2001
+++ kaffe/kaffe/kaffevm/jit/labels.h	Thu Jul 15 14:44:05 2004
@@ -46,6 +46,9 @@
 	uintp		to;
 	uintp		from;
 	int		type;
+#if defined(KAFFE_VMDEBUG)
+        char name[8];
+#endif
 } label;
 
 #define	ALLOCLABELNR	1024
@@ -55,5 +58,18 @@
 void linkLabels(struct codeinfo*, uintp);
 label* newLabel(void);
 void resetLabels(void);
+
+/**
+ * Iterate through the method internal labels that refer to the given native
+ * "pc" value.
+ *
+ * @param lptr The iteration variable, initialize *lptr to NULL to start at the
+ *   beginning of the list of labels.  The value of *lptr will then be changed
+ *   after subsequent calls until the end of the list is reached.
+ * @param pc The native PC value to search the "to" values for.
+ * @return A label matching the given "pc" or NULL if there are no more
+ *   internal labels found.
+ */
+label *getInternalLabel(label **lptr, uintp counter);
 
 #endif




More information about the kaffe mailing list