[kaffe] CVS kaffe (guilhem): Detect stack size using getrlimit.

Kaffe CVS cvs-commits at kaffe.org
Wed Apr 21 09:02:02 PDT 2004


PatchSet 4672 
Date: 2004/04/21 15:57:53
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
Detect stack size using getrlimit.

        * kaffe/kaffevm/soft.c
        (soft_multianewarray): Fixed array dimension checking for the
        interpreter mode.

        * kaffe/kaffevm/thread.c: Use the stack size from getrlimit if
        it is available.

        * configure.ac: Check for getrlimit.

        * config/config.h.in, configure: Regenerated.

Members: 
	ChangeLog:1.2248->1.2249 
	configure:1.309->1.310 
	configure.ac:1.9->1.10 
	config/config.h.in:1.97->1.98 
	kaffe/kaffevm/soft.c:1.61->1.62 
	kaffe/kaffevm/thread.c:1.60->1.61 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.2248 kaffe/ChangeLog:1.2249
--- kaffe/ChangeLog:1.2248	Wed Apr 21 14:59:05 2004
+++ kaffe/ChangeLog	Wed Apr 21 15:57:53 2004
@@ -1,3 +1,16 @@
+2004-04-21  Guilhem Lavaux <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/soft.c
+	(soft_multianewarray): Fixed array dimension checking for the 
+	interpreter mode.
+
+	* kaffe/kaffevm/thread.c: Use the stack size from getrlimit if
+	it is available.
+
+	* configure.ac: Check for getrlimit.
+
+	* config/config.h.in, configure: Regenerated.
+
 2004-04-21  Dalibor Topic <robilad at kaffe.org>
 
         * libraries/javalib/java/util/zip/CheckedInputStream.java,
Index: kaffe/configure
diff -u kaffe/configure:1.309 kaffe/configure:1.310
--- kaffe/configure:1.309	Thu Apr 15 20:58:09 2004
+++ kaffe/configure	Wed Apr 21 15:57:54 2004
@@ -49857,7 +49857,8 @@
 
 
 
-for ac_func in sbrk valloc memalign mallopt
+
+for ac_func in sbrk valloc memalign mallopt getrlimit
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
 echo "$as_me:$LINENO: checking for $ac_func" >&5
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.9 kaffe/configure.ac:1.10
--- kaffe/configure.ac:1.9	Thu Apr 15 20:58:13 2004
+++ kaffe/configure.ac	Wed Apr 21 15:57:59 2004
@@ -1329,7 +1329,7 @@
 AC_CHECK_FUNCS([fcntl ioctl])
 AC_CHECK_FUNCS([alarm setitimer])
 AC_CHECK_FUNCS([sigprocmask sigsetmask sigemptyset sigaddset signal sigaction])
-AC_CHECK_FUNCS([sbrk valloc memalign mallopt])
+AC_CHECK_FUNCS([sbrk valloc memalign mallopt getrlimit])
 AC_CHECK_FUNCS([madvise])
 AC_CHECK_FUNCS([waitpid kill fork execve execvp])
 AC_CHECK_FUNCS([sync fsync ftruncate])
Index: kaffe/config/config.h.in
diff -u kaffe/config/config.h.in:1.97 kaffe/config/config.h.in:1.98
--- kaffe/config/config.h.in:1.97	Wed Apr 14 19:39:45 2004
+++ kaffe/config/config.h.in	Wed Apr 21 15:57:59 2004
@@ -129,6 +129,9 @@
 /* Define to 1 if you have the `getpagesize' function. */
 #undef HAVE_GETPAGESIZE
 
+/* Define to 1 if you have the `getrlimit' function. */
+#undef HAVE_GETRLIMIT
+
 /* Define to 1 if you have the `getrusage' function. */
 #undef HAVE_GETRUSAGE
 
Index: kaffe/kaffe/kaffevm/soft.c
diff -u kaffe/kaffe/kaffevm/soft.c:1.61 kaffe/kaffe/kaffevm/soft.c:1.62
--- kaffe/kaffe/kaffevm/soft.c:1.61	Sun Apr 18 13:57:27 2004
+++ kaffe/kaffe/kaffevm/soft.c	Wed Apr 21 15:58:00 2004
@@ -135,7 +135,7 @@
 	int i;
 	int* arraydims;
 
-        if (dims < MAXDIMS) {
+        if (dims < MAXDIMS-1) {
 		arraydims = array;
 	}
 	else {
Index: kaffe/kaffe/kaffevm/thread.c
diff -u kaffe/kaffe/kaffevm/thread.c:1.60 kaffe/kaffe/kaffevm/thread.c:1.61
--- kaffe/kaffe/kaffevm/thread.c:1.60	Sat Apr  3 02:57:43 2004
+++ kaffe/kaffe/kaffevm/thread.c	Wed Apr 21 15:58:00 2004
@@ -681,6 +681,7 @@
 initNativeThreads(int nativestacksize)
 {
 	threadData *thread_data;
+	int stackSize;
 
 	DBG(INIT, dprintf("initNativeThreads(0x%x)\n", nativestacksize); )
 
@@ -714,7 +715,20 @@
 	 * Since everything is stored in the threadData struct now, we can simply
 	 * attach a faked java.lang.Thread instance later on.
 	 */
-	jthread_createfirst(MAINSTACKSIZE, (unsigned char)java_lang_Thread_NORM_PRIORITY, 0);
+#ifdef HAVE_GETRLIMIT
+	{
+		struct rlimit rl;
+		
+		if (getrlimit(RLIMIT_STACK, &rl) < 0)
+			stackSize = MAINSTACKSIZE;
+		else
+			stackSize = (rl.rlim_max == RLIM_INFINITY) ? rl.rlim_cur : rl.rlim_max;
+	}
+#else
+	stackSize = MAINSTACKSIZE;
+#endif
+	DBG(INIT, dprintf("Detected stackSize %d\n", stackSize); )
+	jthread_createfirst(stackSize, (unsigned char)java_lang_Thread_NORM_PRIORITY, 0);
 
 	/*
 	 * initialize some things that are absolutely necessary:




More information about the kaffe mailing list