0.8.12.8: Really this time. Note to self: remeber to save the
[sbcl.git] / src / runtime / gc-common.c
index cdd1025..b266f42 100644 (file)
  */
 
 /*
- * GENerational Conservative Garbage Collector for SBCL x86
- */
-
-/*
- * This software is part of the SBCL system. See the README file for
- * more information.
- *
- * This software is derived from the CMU CL system, which was
- * written at Carnegie Mellon University and released into the
- * public domain. The software is in the public domain and is
- * provided with absolutely no warranty. See the COPYING and CREDITS
- * files for more information.
- */
-
-/*
  * For a review of garbage collection techniques (e.g. generational
  * GC) and terminology (e.g. "scavenging") see Paul R. Wilson,
  * "Uniprocessor Garbage Collection Techniques". As of 20000618, this
@@ -134,17 +119,12 @@ static int scav_lose(lispobj *where, lispobj object); /* forward decl */
 /* FIXME: Most calls end up going to some trouble to compute an
  * 'n_words' value for this function. The system might be a little
  * simpler if this function used an 'end' parameter instead. */
-#define PAGE_SIZE 4096
 void
 scavenge(lispobj *start, long n_words)
 {
     lispobj *end = start + n_words;
     lispobj *object_ptr;
     int n_words_scavenged;
-    if((((unsigned int)start & (PAGE_SIZE-1))==0) &&
-       (n_words>(PAGE_SIZE/4))) {
-               madvise(start, n_words*4, MADV_SEQUENTIAL|MADV_WILLNEED);
-    }
     for (object_ptr = start;
         object_ptr < end;
         object_ptr += n_words_scavenged) {
@@ -400,6 +380,7 @@ size_code_header(lispobj *where)
     return nwords;
 }
 
+#ifndef LISP_FEATURE_X86
 static int
 scav_return_pc_header(lispobj *where, lispobj object)
 {
@@ -408,6 +389,7 @@ scav_return_pc_header(lispobj *where, lispobj object)
         (unsigned long) object);
     return 0; /* bogus return value to satisfy static type checking */
 }
+#endif /* LISP_FEATURE_X86 */
 
 static lispobj
 trans_return_pc_header(lispobj object)
@@ -452,6 +434,7 @@ scav_closure_header(lispobj *where, lispobj object)
 }
 #endif
 
+#ifndef LISP_FEATURE_X86
 static int
 scav_fun_header(lispobj *where, lispobj object)
 {
@@ -460,6 +443,7 @@ scav_fun_header(lispobj *where, lispobj object)
         (unsigned long) object);
     return 0; /* bogus return value to satisfy static type checking */
 }
+#endif /* LISP_FEATURE_X86 */
 
 static lispobj
 trans_fun_header(lispobj object)
@@ -1808,3 +1792,25 @@ gc_init_tables(void)
     sizetab[INSTANCE_HEADER_WIDETAG] = size_boxed;
     sizetab[FDEFN_WIDETAG] = size_boxed;
 }
+
+\f
+/* Find the code object for the given pc, or return NULL on
+   failure. */
+lispobj *
+component_ptr_from_pc(lispobj *pc)
+{
+    lispobj *object = NULL;
+
+    if ( (object = search_read_only_space(pc)) )
+       ;
+    else if ( (object = search_static_space(pc)) )
+       ;
+    else
+       object = search_dynamic_space(pc);
+
+    if (object) /* if we found something */
+       if (widetag_of(*object) == CODE_HEADER_WIDETAG)
+           return(object);
+
+    return (NULL);
+}