[cmucl-cvs] [git] CMU Common Lisp branch dynamic-stack-alloc updated. 905107407b190f0bf1de0f5c90c3a588bd907dcf

Alex Goncharov agoncharov at common-lisp.net
Thu Oct 6 03:48:50 UTC 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 updated
       via  905107407b190f0bf1de0f5c90c3a588bd907dcf (commit)
      from  808706413ed9702874c33a45c9e95a53a4bd7683 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 905107407b190f0bf1de0f5c90c3a588bd907dcf
Author: Alex Goncharov <alex-goncharov at comcast.net>
Date:   Wed Oct 5 23:48:37 2011 -0400

    Try git; cleanup changes; not sure if all of them will live long.

diff --git a/lisp/FreeBSD-os.c b/lisp/FreeBSD-os.c
index d3549d5..28017eb 100644
--- a/lisp/FreeBSD-os.c
+++ b/lisp/FreeBSD-os.c
@@ -208,7 +208,8 @@ os_protect(os_vm_address_t address, os_vm_size_t length, os_vm_prot_t prot)
 
 
 static boolean
-in_range_p(os_vm_address_t a, lispobj sbeg, size_t slen)
+/* in_range_p(os_vm_address_t a, lispobj sbeg, size_t slen) */
+in_range_p(os_vm_address_t a, os_vm_address_t sbeg, size_t slen)
 {
     char *beg = (char *) sbeg;
     char *end = (char *) sbeg + slen;
@@ -220,20 +221,14 @@ in_range_p(os_vm_address_t a, lispobj sbeg, size_t slen)
 boolean
 valid_addr(os_vm_address_t addr)
 {
-    os_vm_address_t newaddr;
-
-    newaddr = os_trunc_to_page(addr);
-
-    if (in_range_p(addr, READ_ONLY_SPACE_START, read_only_space_size)
-	|| in_range_p(addr, STATIC_SPACE_START, static_space_size)
-	|| in_range_p(addr, DYNAMIC_0_SPACE_START, dynamic_space_size)
+    return (in_range_p(addr, READ_ONLY_SPACE_START, read_only_space_size) ||
+            in_range_p(addr, STATIC_SPACE_START, static_space_size) ||
+            in_range_p(addr, DYNAMIC_0_SPACE_START, dynamic_space_size) ||
 #ifndef GENCGC
-	|| in_range_p(addr, DYNAMIC_1_SPACE_START, dynamic_space_size)
+            in_range_p(addr, DYNAMIC_1_SPACE_START, dynamic_space_size) ||
 #endif
-	|| in_range_p(addr, control_stack, control_stack_size)
-	|| in_range_p(addr, binding_stack, binding_stack_size))
-	return TRUE;
-    return FALSE;
+            in_range_p(addr, (os_vm_address_t) control_stack, control_stack_size) ||
+            in_range_p(addr, (os_vm_address_t) binding_stack, binding_stack_size));
 }
 
 
diff --git a/lisp/FreeBSD-os.h b/lisp/FreeBSD-os.h
index 7150316..f85bd57 100644
--- a/lisp/FreeBSD-os.h
+++ b/lisp/FreeBSD-os.h
@@ -10,13 +10,13 @@
 #ifndef _FREEBSD_OS_H_
 #define _FREEBSD_OS_H_
 
+#include <sys/types.h>
 #include <sys/mman.h>
-
 #include <osreldate.h>
 #include <signal.h>
 #include <ucontext.h>
 
-typedef void *os_vm_address_t;
+typedef caddr_t os_vm_address_t;
 typedef size_t os_vm_size_t;
 typedef off_t os_vm_offset_t;
 typedef int os_vm_prot_t;
diff --git a/lisp/coreparse.c b/lisp/coreparse.c
index cf1ee43..9fe2a55 100644
--- a/lisp/coreparse.c
+++ b/lisp/coreparse.c
@@ -63,16 +63,16 @@ process_directory(int fd, long *ptr, int count)
 	  case STATIC_SPACE_ID:
 	      static_space = (lispobj *) addr;
               if (len >= static_space_size) {
-                  fprintf(stderr, "Error:  Static space size (%d) exceeds allocated space (%d)!\n",
-                          len, static_space_size);
+                  fprintf(stderr, "Error:  Static space size (%ld) exceeds allocated space (%lu)!\n",
+                          (long) len, (unsigned long) static_space_size);
                   exit(1);
               }
 	      break;
 	  case READ_ONLY_SPACE_ID:
 	      /* Don't care about read only space */
               if (len >= read_only_space_size) {
-                  fprintf(stderr, "Error:  Read only space size (%d) exceeds allocated space (%d)!\n",
-                          len, read_only_space_size);
+                  fprintf(stderr, "Error:  Read only space size (%ld) exceeds allocated space (%lu)!\n",
+                          (long) len, (unsigned long) read_only_space_size);
                   exit(1);
               }
 	      break;
diff --git a/lisp/gencgc.c b/lisp/gencgc.c
index c21385e..ce02d6a 100644
--- a/lisp/gencgc.c
+++ b/lisp/gencgc.c
@@ -1979,9 +1979,8 @@ new_space_p(lispobj obj)
 static inline boolean
 dynamic_space_p(lispobj obj)
 {
-    lispobj end = DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE;
-
-    return (obj >= DYNAMIC_0_SPACE_START) && (obj < end);
+  lispobj end = (lispobj) DYNAMIC_0_SPACE_START + DYNAMIC_SPACE_SIZE;
+  return (obj >= (lispobj) DYNAMIC_0_SPACE_START) && (obj < end);
 }
 
 static inline boolean
@@ -1989,7 +1988,7 @@ static_space_p(lispobj obj)
 {
     lispobj end = SymbolValue(STATIC_SPACE_FREE_POINTER);
 
-    return (obj >= STATIC_SPACE_START) && (obj < end);
+    return (obj >= (lispobj) STATIC_SPACE_START) && (obj < end);
 }
 
 static inline boolean
@@ -1997,23 +1996,25 @@ read_only_space_p(lispobj obj)
 {
     lispobj end = SymbolValue(READ_ONLY_SPACE_FREE_POINTER);
 
-    return (obj >= READ_ONLY_SPACE_START) && (obj < end);
+    return (obj >= (lispobj) READ_ONLY_SPACE_START) && (obj < end);
 }
 
 static inline boolean
 control_stack_space_p(lispobj obj)
 {
-    lispobj end = (char*) control_stack + control_stack_size;
+    lispobj *ptr = (lispobj *) obj;
+    char *end = (char*) control_stack + control_stack_size;
 
-    return (obj >= control_stack) && (obj < end);
+    return (ptr >= control_stack) && (ptr < (lispobj *) end);
 }
 
 static inline boolean
 binding_stack_space_p(lispobj obj)
 {
-    lispobj end = (char*) binding_stack + binding_stack_size;
+    lispobj *ptr = (lispobj *) obj;
+    char *end = (char*) binding_stack + binding_stack_size;
 
-    return (obj >= binding_stack) && (obj < end);
+    return (ptr >= binding_stack) && (ptr < (lispobj *) end);
 }
     
 static inline boolean
@@ -6867,9 +6868,8 @@ void
 verify_space(lispobj * start, size_t words)
 {
     int dynamic_space = (find_page_index((void *) start) != -1);
-    unsigned long readonly_space =
-	(READ_ONLY_SPACE_START <= (unsigned long) start
-	 && (unsigned long) start < SymbolValue(READ_ONLY_SPACE_FREE_POINTER));
+    unsigned long readonly_space = ((unsigned long) READ_ONLY_SPACE_START <= (unsigned long) start &&
+                                    (unsigned long) start < (unsigned long) SymbolValue(READ_ONLY_SPACE_FREE_POINTER));
 
     while (words > 0) {
 	size_t count = 1;
@@ -6877,10 +6877,8 @@ verify_space(lispobj * start, size_t words)
 
 	if (Pointerp(thing)) {
 	    int page_index = find_page_index((void *) thing);
-	    int to_readonly_space = (READ_ONLY_SPACE_START <= thing &&
-				     thing <
-
-				     SymbolValue(READ_ONLY_SPACE_FREE_POINTER));
+	    int to_readonly_space = ((unsigned long) READ_ONLY_SPACE_START <= thing &&
+				     (unsigned long) thing < (unsigned long) SymbolValue(READ_ONLY_SPACE_FREE_POINTER));
 	    unsigned long to_static_space =
 		((unsigned long) static_space <= thing
 
@@ -7924,7 +7922,7 @@ void
 gencgc_pickup_dynamic(void)
 {
     int page = 0;
-    unsigned long addr = DYNAMIC_0_SPACE_START;
+    unsigned long addr = (unsigned long) DYNAMIC_0_SPACE_START;
     unsigned long alloc_ptr = (unsigned long) get_alloc_pointer();
 
     /* Initialise the first region. */
diff --git a/lisp/globals.h b/lisp/globals.h
index bfd8c6d..b18dd57 100644
--- a/lisp/globals.h
+++ b/lisp/globals.h
@@ -30,7 +30,7 @@ extern lispobj *binding_stack;
 extern unsigned long read_only_space_size;
 extern unsigned long binding_stack_size;
 extern unsigned long static_space_size;
-extern unsigned long control_stack_size;
+extern unsigned long control_stack_size; /* in characters */
 
 #if (defined(i386) || defined(__x86_64))
 extern lispobj *control_stack_end;
diff --git a/lisp/lisp.h b/lisp/lisp.h
index 9b48af7..f802594 100644
--- a/lisp/lisp.h
+++ b/lisp/lisp.h
@@ -39,14 +39,11 @@ typedef u32 lispobj;
 #define FALSE 0
 #endif
 
-#define SymbolValue(sym) \
-    (((struct symbol *)((sym)-type_OtherPointer))->value)
-#define SetSymbolValue(sym,val) \
-    (((struct symbol *)((sym)-type_OtherPointer))->value = (val))
+#define SymbolValue(sym) (((struct symbol *)((sym)-type_OtherPointer))->value)
+#define SetSymbolValue(sym,val) (((struct symbol *)((sym)-type_OtherPointer))->value = (val))
 
 /* This only words for static symbols. */
-#define SymbolFunction(sym) \
-    (((struct fdefn *)(SymbolValue(sym)-type_OtherPointer))->function)
+#define SymbolFunction(sym) (((struct fdefn *)(SymbolValue(sym)-type_OtherPointer))->function)
 
 typedef enum {AUTO, X87, SSE2} fpu_mode_t;
 
diff --git a/lisp/x86-arch.c b/lisp/x86-arch.c
index 474fb87..c0d3e75 100644
--- a/lisp/x86-arch.c
+++ b/lisp/x86-arch.c
@@ -520,7 +520,11 @@ arch_make_lazy_linkage(long linkage_entry)
 long
 arch_linkage_entry(unsigned long retaddr)
 {
+#if defined __FreeBSD__  
+  return (((os_vm_address_t) retaddr - 5) - FOREIGN_LINKAGE_SPACE_START) / LinkageEntrySize;
+#else    
     return ((retaddr - 5) - FOREIGN_LINKAGE_SPACE_START) / LinkageEntrySize;
+#endif    
 }
 #endif /* LINKAGE_TABLE */
 
diff --git a/lisp/x86-validate.h b/lisp/x86-validate.h
index 4eb56b0..f086d01 100644
--- a/lisp/x86-validate.h
+++ b/lisp/x86-validate.h
@@ -21,8 +21,6 @@
  *	0x10000000->0x20000000  256M Read-Only Space.
  *	0x20000000->0x28000000  128M Reserved for shared libraries.
  *	0x28000000->0x38000000  256M Static Space.
- *	0x38000000->0x40000000  128M Binding stack growing up.
- *	0x40000000->0x48000000  128M Control stack growing down.
  *	0x48000000->0xB0000000 1664M Dynamic Space.
  *      0xB0000000->0xB1000000       Foreign Linkage Table
  *	0xE0000000->            256M C stack - Alien stack.
@@ -68,27 +66,25 @@
  */
 
 #ifdef __FreeBSD__
-#define READ_ONLY_SPACE_START   (0x10000000)
-#define READ_ONLY_SPACE_SIZE    (0x0ffff000)	/* 256MB - 1 page */
+#define READ_ONLY_SPACE_START	((os_vm_address_t) 0x10000000)
+#define READ_ONLY_SPACE_SIZE    ((os_vm_size_t) 0x0ffff000)	/* 256MB - 1 page */
 
-#define STATIC_SPACE_START	(0x28f00000)
-#define STATIC_SPACE_SIZE	(0x0f0ff000)	/* 241MB - 1 page */
+#define STATIC_SPACE_START	((os_vm_address_t) 0x28f00000)
+#define STATIC_SPACE_SIZE	((os_vm_size_t) 0x0f0ff000)	/* 241MB - 1 page */
 
-#define BINDING_STACK_SIZE	(0x07fff000)	/* 128MB - 1 page */
-#define CONTROL_STACK_SIZE	0x07fd8000	/* 128MB - SIGSTKSZ */
-#define SIGNAL_STACK_START	0x47fd8000
-#define SIGNAL_STACK_SIZE	SIGSTKSZ
+#define BINDING_STACK_SIZE	((os_vm_size_t) 0x07fff000)	/* 128MB - 1 page */
+#define CONTROL_STACK_SIZE	((os_vm_size_t) 0x07fd8000)	/* 128MB - SIGSTKSZ */
 
-#define DYNAMIC_0_SPACE_START	(0x48000000UL)
+#define DYNAMIC_0_SPACE_START	((os_vm_address_t) 0x48000000UL)
 #ifdef GENCGC
-#define DYNAMIC_SPACE_SIZE	(0x78000000UL)	/* May be up to 1.7 GB */
+#define DYNAMIC_SPACE_SIZE	((os_vm_size_t) 0x78000000UL)	/* May be up to 1.7 GB */
 #else
-#define DYNAMIC_SPACE_SIZE	(0x04000000UL)	/* 64MB */
+#define DYNAMIC_SPACE_SIZE	((os_vm_size_t) 0x04000000UL)	/* 64MB */
 #endif
-#define DEFAULT_DYNAMIC_SPACE_SIZE	(0x20000000UL)	/* 512MB */
+#define DEFAULT_DYNAMIC_SPACE_SIZE	((os_vm_size_t) 0x20000000UL)	/* 512MB */
 #ifdef LINKAGE_TABLE
-#define FOREIGN_LINKAGE_SPACE_START ((unsigned long) LinkageSpaceStart)
-#define FOREIGN_LINKAGE_SPACE_SIZE (0x100000UL)	/* 1MB */
+#define FOREIGN_LINKAGE_SPACE_START	((os_vm_address_t) LinkageSpaceStart)
+#define FOREIGN_LINKAGE_SPACE_SIZE	((os_vm_size_t) 0x100000UL)	/* 1MB */
 #endif
 #endif /* __FreeBSD__ */
 

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

Summary of changes:
 lisp/FreeBSD-os.c   |   21 ++++++++-------------
 lisp/FreeBSD-os.h   |    4 ++--
 lisp/coreparse.c    |    8 ++++----
 lisp/gencgc.c       |   32 +++++++++++++++-----------------
 lisp/globals.h      |    2 +-
 lisp/lisp.h         |    9 +++------
 lisp/x86-arch.c     |    4 ++++
 lisp/x86-validate.h |   28 ++++++++++++----------------
 8 files changed, 49 insertions(+), 59 deletions(-)


hooks/post-receive
-- 
CMU Common Lisp




More information about the cmucl-cvs mailing list