[cmucl-commit] [git] CMU Common Lisp branch dynamic-stack-alloc created. snapshot-2011-10-1-gf7345b4

Raymond Toy rtoy at common-lisp.net
Mon Oct 3 03:11:46 CEST 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMU Common Lisp".

The branch, dynamic-stack-alloc has been created
        at  f7345b4a470baf7aa98722dab14cf28651a66457 (commit)

- Log -----------------------------------------------------------------
commit f7345b4a470baf7aa98722dab14cf28651a66457
Author: Raymond Toy <toy.raymond at gmail.com>
Date:   Sun Oct 2 18:11:26 2011 -0700

    Allow mmap to place the control stack anywhere and no longer mmap the
    signal alt stack; use an array like on other non-x86 architectures.
    
    lisp/validate.c:
    o Mmap the control stack anywhere instead of at a fixed address if
      CONTROL_STACK_START is not defined.
    
    lisp/x86-validate.h:
    o Don't define CONTROL_STACK_START for DARWIN (Mac OS X) so we don't
      mmap the control stack at a fixed place.
    o Don't define SIGNAL_STACK_START so we use a data array instead of a
      fixed mmap area.
    
    lisp/interrupt.c:
    o If SIGNAL_STACK_START is not defined, use the altstack array (even
      if on x86).
    
    lisp/Darwin-os.c:
    lisp/backtrace.c:
    lisp/gencgc.c:
    lisp/os-common.c:
    o Use control_stack instead of CONTROL_STACK_START.  (control_stack
      was already a defined C variable.)
    
    lisp/x86-assem.S:
    o Use control_stack if CONTROL_STACK_START is undefined.

diff --git a/lisp/Darwin-os.c b/lisp/Darwin-os.c
index 1304d10..db59d3d 100644
--- a/lisp/Darwin-os.c
+++ b/lisp/Darwin-os.c
@@ -450,7 +450,7 @@ valid_addr(os_vm_address_t addr)
 #ifndef GENCGC
 	|| in_range_p(addr, DYNAMIC_1_SPACE_START, dynamic_space_size)
 #endif
-	|| in_range_p(addr, CONTROL_STACK_START, control_stack_size)
+	|| in_range_p(addr, control_stack, control_stack_size)
 	|| in_range_p(addr, BINDING_STACK_START, binding_stack_size))
 	return TRUE;
     return FALSE;
diff --git a/lisp/backtrace.c b/lisp/backtrace.c
index cb9cd8c..1cf1301 100644
--- a/lisp/backtrace.c
+++ b/lisp/backtrace.c
@@ -253,7 +253,7 @@ backtrace(int nframes)
 static int
 stack_pointer_p(unsigned long p)
 {
-    return (p < CONTROL_STACK_START + control_stack_size
+    return (p < (unsigned long) ((char *) control_stack + control_stack_size)
 	    && p > (unsigned long) &p && (p & 3) == 0);
 }
 
diff --git a/lisp/gencgc.c b/lisp/gencgc.c
index 423cc9c..7b6b008 100644
--- a/lisp/gencgc.c
+++ b/lisp/gencgc.c
@@ -168,7 +168,7 @@ check_escaped_stack_object(lispobj * where, lispobj obj)
 
     if (Pointerp(obj)
 	&& (p = (void *) PTR(obj),
-	    (p >= (void *) CONTROL_STACK_START
+	    (p >= (void *) control_stack
 	     && p < (void *) control_stack_end))) {
 	char *space;
 
@@ -197,7 +197,7 @@ check_escaped_stack_object(lispobj * where, lispobj obj)
 	    lose("Escaped stack-allocated object 0x%08lx at %p in %s\n",
 		 (unsigned long) obj, where, space);
 #ifndef i386
-	else if ((where >= (lispobj *) CONTROL_STACK_START
+	else if ((where >= (lispobj *) control_stack
 		  && where < (lispobj *) (control_stack_end))
 		 || (space == NULL)) {
 	    /* Do nothing if it the reference is from the control stack,
@@ -2003,9 +2003,9 @@ read_only_space_p(lispobj obj)
 static inline boolean
 control_stack_space_p(lispobj obj)
 {
-    lispobj end = CONTROL_STACK_START + control_stack_size;
+    lispobj end = (char*) control_stack + control_stack_size;
 
-    return (obj >= CONTROL_STACK_START) && (obj < end);
+    return (obj >= control_stack) && (obj < end);
 }
 
 static inline boolean
diff --git a/lisp/interrupt.c b/lisp/interrupt.c
index 39a2d87..5183172 100644
--- a/lisp/interrupt.c
+++ b/lisp/interrupt.c
@@ -396,7 +396,7 @@ interrupt_maybe_gc(HANDLER_ARGS)
 * Noise to install handlers.                                     *
 \****************************************************************/
 
-#if !(defined(i386) || defined(__x86_64))
+#if !defined(SIGNAL_STACK_START) || !(defined(i386) || defined(__x86_64))
 #define SIGNAL_STACK_SIZE SIGSTKSZ
 static char altstack[SIGNAL_STACK_SIZE];
 #endif
@@ -422,7 +422,7 @@ interrupt_install_low_level_handler(int signal, void handler(HANDLER_ARGS))
     if (signal == PROTECTION_VIOLATION_SIGNAL) {
 	stack_t sigstack;
 
-#if (defined( i386 ) || defined(__x86_64))
+#if defined(SIGNAL_STACK_START) && (defined( i386 ) || defined(__x86_64))
 	sigstack.ss_sp = (void *) SIGNAL_STACK_START;
 #else
 	sigstack.ss_sp = (void *) altstack;
diff --git a/lisp/os-common.c b/lisp/os-common.c
index e6684b2..176cd61 100644
--- a/lisp/os-common.c
+++ b/lisp/os-common.c
@@ -426,12 +426,12 @@ guard_zones(char **yellow_start, char **red_start)
 {
 #if (defined(i386) || defined(__x86_64))
     if (os_stack_grows_down()) {
-	char *end = (char *) CONTROL_STACK_START;
+	char *end = (char *) control_stack;
 
 	*red_start = end;
 	*yellow_start = *red_start + RED_ZONE_SIZE;
     } else {
-	char *end = (char *) CONTROL_STACK_START + control_stack_size;
+	char *end = (char *) control_stack + control_stack_size;
 
 	*red_start = end - RED_ZONE_SIZE;
 	*yellow_start = *red_start - YELLOW_ZONE_SIZE;
@@ -443,7 +443,7 @@ guard_zones(char **yellow_start, char **red_start)
      * control stack area.
      */
 
-    char *end = (char *) CONTROL_STACK_START + control_stack_size;
+    char *end = (char *) control_stack + control_stack_size;
 
     *red_start = end - RED_ZONE_SIZE;
     *yellow_start = *red_start - YELLOW_ZONE_SIZE;
diff --git a/lisp/validate.c b/lisp/validate.c
index efe7273..f5fd135 100644
--- a/lisp/validate.c
+++ b/lisp/validate.c
@@ -95,12 +95,17 @@ validate(void)
 #endif
 
     /* Control Stack */
+
+#if defined(CONTROL_STACK_START)
     control_stack = (lispobj *) CONTROL_STACK_START;
+    ensure_space(control_stack, control_stack_size);
+#else
+    control_stack = (lispobj *) os_allocate(control_stack_size);
+#endif
 #if (defined(i386) || defined(__x86_64))
-    control_stack_end = (lispobj *) (CONTROL_STACK_START + control_stack_size);
+    control_stack_end = (lispobj *) ((char*) control_stack + control_stack_size);
 #endif
-    ensure_space(control_stack, control_stack_size);
-
+    
 #ifdef SIGNAL_STACK_START
     ensure_space((lispobj *) SIGNAL_STACK_START, SIGNAL_STACK_SIZE);
 #endif
diff --git a/lisp/x86-assem.S b/lisp/x86-assem.S
index 178e913..211b17c 100644
--- a/lisp/x86-assem.S
+++ b/lisp/x86-assem.S
@@ -205,7 +205,11 @@ npx_save_done:
 	movl	%eax, GNAME(foreign_function_call_active)
 
 	movl	%esp,%ebx	# remember current stack
+#if defined(CONTROL_STACK_START)
 	cmpl	$CONTROL_STACK_START,%esp
+#else
+	cmpl	GNAME(control_stack),%esp
+#endif
 	jbe	ChangeToLispStack
 	cmpl	GNAME(control_stack_end), %esp
 	jbe	OnLispStack
diff --git a/lisp/x86-validate.h b/lisp/x86-validate.h
index c49ea50..e3a2319 100644
--- a/lisp/x86-validate.h
+++ b/lisp/x86-validate.h
@@ -131,7 +131,9 @@
 #define BINDING_STACK_START	(0x38000000)
 #define BINDING_STACK_SIZE	(0x07fff000)	/* 128MB - 1 page */
 
+#if !defined(DARWIN)
 #define CONTROL_STACK_START	(0x40000000)
+#endif
 #if defined(DARWIN)
 /*
  * According to /usr/include/sys/signal.h, MINSIGSTKSZ is 32K and
@@ -139,7 +141,9 @@
  */
 #define CONTROL_STACK_SIZE	(0x07fdf000)	/* 128MB - SIGSTKSZ - 1 page */
 
+#if 0
 #define SIGNAL_STACK_START	(0x47fe0000)    /* One page past the end of the control stack */
+#endif
 #define SIGNAL_STACK_SIZE	SIGSTKSZ
 #else
 #define CONTROL_STACK_SIZE	(0x07fd8000)	/* 128MB - SIGSTKSZ */

-----------------------------------------------------------------------


hooks/post-receive
-- 
CMU Common Lisp


More information about the cmucl-commit mailing list