This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
Patch: resize method cache
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: resize method cache
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 18 Nov 1999 00:19:45 -0700
- Reply-To: tromey at cygnus dot com
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,