[kaffe] CVS kaffe (robilad): Replaced METHOD_CODE_START macro by setter and getter functions

Kaffe CVS cvs-commits at kaffe.org
Wed Feb 16 05:40:16 PST 2005


PatchSet 5557 
Date: 2005/02/16 13:35:15
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Replaced METHOD_CODE_START macro by setter and getter functions

2005-02-16  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/kaffevm/classMethod.h: (METHOD_CODE_START)
        Removed macro.

        * kaffe/kaffevm/classMethod.c (setMethodCodeStart)
        (getMethodCodeStart): New functions.

        * kaffe/kaffevm/methodCache.c (makeMethodInactive)
        (makeMethodActive),
        kaffe/kaffevm/intrp/methodcalls.c (engine_callMethod),
        kaffe/kaffevm/intrp/native-wrapper.c (engine_create_wrapper):
        Use new functions for setting and getting metthod code.

Members: 
	ChangeLog:1.3600->1.3601 
	kaffe/kaffevm/classMethod.c:1.134->1.135 
	kaffe/kaffevm/classMethod.h:1.76->1.77 
	kaffe/kaffevm/methodCache.c:1.10->1.11 
	kaffe/kaffevm/intrp/methodcalls.c:1.7->1.8 
	kaffe/kaffevm/intrp/native-wrapper.c:1.4->1.5 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3600 kaffe/ChangeLog:1.3601
--- kaffe/ChangeLog:1.3600	Wed Feb 16 12:45:49 2005
+++ kaffe/ChangeLog	Wed Feb 16 13:35:15 2005
@@ -1,5 +1,19 @@
 2005-02-16  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/classMethod.h: (METHOD_CODE_START) 
+	Removed macro.
+
+	* kaffe/kaffevm/classMethod.c (setMethodCodeStart) 
+	(getMethodCodeStart): New functions.
+
+	* kaffe/kaffevm/methodCache.c (makeMethodInactive) 
+	(makeMethodActive),
+	kaffe/kaffevm/intrp/methodcalls.c (engine_callMethod),
+	kaffe/kaffevm/intrp/native-wrapper.c (engine_create_wrapper): 
+	Use new functions for setting and getting metthod code.
+
+2005-02-16  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/support.c (lookupClassMethod): 
 	Split assert and clarified.
 
Index: kaffe/kaffe/kaffevm/classMethod.c
diff -u kaffe/kaffe/kaffevm/classMethod.c:1.134 kaffe/kaffe/kaffevm/classMethod.c:1.135
--- kaffe/kaffe/kaffevm/classMethod.c:1.134	Sun Feb  6 20:21:25 2005
+++ kaffe/kaffe/kaffevm/classMethod.c	Wed Feb 16 13:35:20 2005
@@ -1965,6 +1965,30 @@
 	return (false);
 }
 
+/**
+ * Get start of native code of a method
+ *
+ * @param method a method
+ * @return pointer to start of code
+ */
+struct _jitCodeHeader*
+getMethodCodeStart(Method * method) 
+{
+  return method->c.ncode.ncode_start;
+}
+
+/**
+ * Set start of native code of a method
+ *
+ * @param method a method
+ * @param start pointer to start of code
+ */
+void
+setMethodCodeStart(Method * method, struct _jitCodeHeader* start)
+{
+  method->c.ncode.ncode_start = start;
+}
+
 static
 bool
 buildDispatchTable(Hjava_lang_Class* class, errorInfo *einfo)
Index: kaffe/kaffe/kaffevm/classMethod.h
diff -u kaffe/kaffe/kaffevm/classMethod.h:1.76 kaffe/kaffe/kaffevm/classMethod.h:1.77
--- kaffe/kaffe/kaffevm/classMethod.h:1.76	Sun Jan 30 12:42:40 2005
+++ kaffe/kaffe/kaffevm/classMethod.h	Wed Feb 16 13:35:20 2005
@@ -208,7 +208,22 @@
 		(void*)&((M)->ncode) : \
 		&((M)->class->vtable->method[(M)->idx]))
 
-#define	METHOD_CODE_START(M)		((M)->c.ncode.ncode_start)
+/**
+ * Get start of native code of a method
+ *
+ * @param method a method
+ * @return pointer to start of code
+ */
+struct _jitCodeHeader* getMethodCodeStart(Method * method);
+
+/**
+ * Set start of native code of a method
+ *
+ * @param method a method
+ * @param start pointer to start of code
+ */
+void setMethodCodeStart(Method * method, struct _jitCodeHeader* start);
+
 #define	_SET_METHOD_NATIVECODE(M, C)	do {\
 	if ((M)->idx == -1) {\
 		(M)->ncode = (C);\
Index: kaffe/kaffe/kaffevm/methodCache.c
diff -u kaffe/kaffe/kaffevm/methodCache.c:1.10 kaffe/kaffe/kaffevm/methodCache.c:1.11
--- kaffe/kaffe/kaffevm/methodCache.c:1.10	Sat Jul 17 07:57:14 2004
+++ kaffe/kaffe/kaffevm/methodCache.c	Wed Feb 16 13:35:20 2005
@@ -97,7 +97,7 @@
 {
 	unsigned int idx;
 	methCacheEntry *entry;
-	void *pc_key = METHOD_CODE_START(meth);
+	void *pc_key = getMethodCodeStart(meth);
 
 #if defined(DUMPMETHODCACHESTATS)
 	static int f = 0;
@@ -133,7 +133,7 @@
 makeMethodInactive(Method* meth)
 {
 	methCacheEntry **entry;
-	void *pc_key = METHOD_CODE_START(meth);
+	void *pc_key = getMethodCodeStart(meth);
 
 	entry = &methCacheTable.hash[METHCACHEHASH(pc_key)]; 
 
Index: kaffe/kaffe/kaffevm/intrp/methodcalls.c
diff -u kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.7 kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.8
--- kaffe/kaffe/kaffevm/intrp/methodcalls.c:1.7	Fri Feb  4 10:36:14 2005
+++ kaffe/kaffe/kaffevm/intrp/methodcalls.c	Wed Feb 16 13:35:20 2005
@@ -97,11 +97,11 @@
 			if (func == NULL) {
 				throwError(&einfo);
 			}
-			METHOD_CODE_START(meth) = func;
+			setMethodCodeStart(meth, func);
 			meth->accflags |= ACC_TRANSLATED;
 		}
 
-		call->function = METHOD_CODE_START(meth);
+		call->function = getMethodCodeStart(meth);
 
 		if (meth->accflags & ACC_JNI)
 		{
Index: kaffe/kaffe/kaffevm/intrp/native-wrapper.c
diff -u kaffe/kaffe/kaffevm/intrp/native-wrapper.c:1.4 kaffe/kaffe/kaffevm/intrp/native-wrapper.c:1.5
--- kaffe/kaffe/kaffevm/intrp/native-wrapper.c:1.4	Sun Nov  7 02:22:45 2004
+++ kaffe/kaffe/kaffevm/intrp/native-wrapper.c	Wed Feb 16 13:35:20 2005
@@ -20,5 +20,5 @@
 void
 engine_create_wrapper (Method *meth, void *func)
 {
-	METHOD_CODE_START(meth) = func;
+	setMethodCodeStart(meth, func);
 }




More information about the kaffe mailing list