This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: resize method cache


Kresten pointed out that the method cache was the wrong size -- it
should be a power of 2.  This patch fixes it.

1999-11-18  Tom Tromey  <tromey@cygnus.com>

	* java/lang/natClass.cc (MCACHE_SIZE): Define as a power of 2
	minus 1.
	(method_cache): Made larger.

Tom

Index: java/lang/natClass.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v
retrieving revision 1.7
diff -u -r1.7 natClass.cc
--- natClass.cc	1999/11/04 19:47:01	1.7
+++ natClass.cc	1999/11/18 07:14:17
@@ -507,14 +507,16 @@
   return NULL;
 }
 
-#define MCACHE_SIZE 1013
+// NOTE: MCACHE_SIZE should be a power of 2 minus one.
+#define MCACHE_SIZE 1023
 
-struct _Jv_mcache {
+struct _Jv_mcache
+{
   jclass klass;
   _Jv_Method *method;
 };
 
-static _Jv_mcache method_cache[MCACHE_SIZE];
+static _Jv_mcache method_cache[MCACHE_SIZE + 1];
 
 static void *
 _Jv_FindMethodInCache (jclass klass,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]