1.0.27.30: minor octets.lisp cleanup
[sbcl.git] / src / runtime / gc-internal.h
index c9d1911..c1e0834 100644 (file)
 #include <genesis/simple-fun.h>
 
 /* disabling gc assertions made no discernable difference to GC speed,
- * last I tried it - dan 2003.12.21 */
+ * last I tried it - dan 2003.12.21
+ *
+ * And it's unsafe to do so while things like gc_assert(0 ==
+ * thread_mutex_lock(&allocation_lock)) exist. - MG 2009-01-13
+ */
 #if 1
 # define gc_assert(ex)                                                 \
 do {                                                                   \
@@ -72,12 +76,33 @@ NWORDS(unsigned long x, unsigned long n_bits)
 #define BOXED_PAGE_FLAG 1
 #define UNBOXED_PAGE_FLAG 2
 #define OPEN_REGION_PAGE_FLAG 4
+#define CODE_PAGE_FLAG        (BOXED_PAGE_FLAG|UNBOXED_PAGE_FLAG)
 
 #define ALLOC_BOXED 0
 #define ALLOC_UNBOXED 1
 #define ALLOC_QUICK 1
 
-void *gc_general_alloc(long nbytes,int unboxed_p,int quick_p);
+#ifdef LISP_FEATURE_GENCGC
+#include "gencgc-alloc-region.h"
+void *
+gc_alloc_with_region(long nbytes,int page_type_flag, struct alloc_region *my_region,
+                     int quick_p);
+static inline void *
+gc_general_alloc(long nbytes, int page_type_flag, int quick_p)
+{
+    struct alloc_region *my_region;
+    if (UNBOXED_PAGE_FLAG == page_type_flag) {
+        my_region = &unboxed_region;
+    } else if (BOXED_PAGE_FLAG & page_type_flag) {
+        my_region = &boxed_region;
+    } else {
+        lose("bad page type flag: %d", page_type_flag);
+    }
+    return gc_alloc_with_region(nbytes, page_type_flag, my_region, quick_p);
+}
+#else
+extern void *gc_general_alloc(long nbytes,int page_type_flag,int quick_p);
+#endif
 
 extern long (*scavtab[256])(lispobj *where, lispobj object);
 extern lispobj (*transother[256])(lispobj object);
@@ -96,6 +121,7 @@ lispobj  copy_large_unboxed_object(lispobj object, long nwords);
 lispobj  copy_unboxed_object(lispobj object, long nwords);
 lispobj  copy_large_object(lispobj object, long nwords);
 lispobj  copy_object(lispobj object, long nwords);
+lispobj  copy_code_object(lispobj object, long nwords);
 
 lispobj *search_read_only_space(void *pointer);
 lispobj *search_static_space(void *pointer);