#include <strings.h>
#include <errno.h>
+#include "sbcl.h"
#include "runtime.h"
#include "os.h"
-#include "sbcl.h"
#include "globals.h"
#include "validate.h"
#include "interrupt.h"
#include "purify.h"
#include "interr.h"
+#include "fixnump.h"
#include "gc.h"
#include "gc-internal.h"
#include "thread.h"
#define PRINTNOISE
-#if defined(LISP_FEATURE_X86)
-/* again, what's so special about the x86 that this is differently
- * visible there than on other platforms? -dan 20010125
+#if defined(LISP_FEATURE_GENCGC)
+/* this is another artifact of the poor integration between gencgc and
+ * the rest of the runtime: on cheney gc there is a global
+ * dynamic_space_free_pointer which is valid whenever foreign function
+ * call is active, but in gencgc there's no such variable and we have
+ * to keep our own
*/
static lispobj *dynamic_space_free_pointer;
#endif
} *later_blocks = NULL;
static int later_count = 0;
-#define CEILING(x,y) (((x) + ((y) - 1)) & (~((y) - 1)))
-#define NWORDS(x,y) (CEILING((x),(y)) / (y))
-
/* FIXME: Shouldn't this be defined in sbcl.h? See also notes in
* cheneygc.c */
#endif
}
-static inline newspace_alloc(int nwords, int constantp)
+static inline lispobj *
+newspace_alloc(int nwords, int constantp)
{
lispobj *ret;
nwords=CEILING(nwords,2);
/* Is it plausible cons? */
if ((is_lisp_pointer(start_addr[0])
|| ((start_addr[0] & 3) == 0) /* fixnum */
- || (widetag_of(start_addr[0]) == BASE_CHAR_WIDETAG)
+ || (widetag_of(start_addr[0]) == CHARACTER_WIDETAG)
|| (widetag_of(start_addr[0]) == UNBOUND_MARKER_WIDETAG))
&& (is_lisp_pointer(start_addr[1])
|| ((start_addr[1] & 3) == 0) /* fixnum */
- || (widetag_of(start_addr[1]) == BASE_CHAR_WIDETAG)
+ || (widetag_of(start_addr[1]) == CHARACTER_WIDETAG)
|| (widetag_of(start_addr[1]) == UNBOUND_MARKER_WIDETAG))) {
break;
} else {
}
switch (widetag_of(start_addr[0])) {
case UNBOUND_MARKER_WIDETAG:
- case BASE_CHAR_WIDETAG:
+ case CHARACTER_WIDETAG:
if (pointer_filter_verbose) {
fprintf(stderr,"*Wo3: %x %x %x\n", (unsigned int) pointer,
(unsigned int) start_addr, *start_addr);
pscav_later(&new->debug_info, 1);
/* FIXME: why would this be a fixnum? */
- if (!(new->trace_table_offset & (EVEN_FIXNUM_LOWTAG|ODD_FIXNUM_LOWTAG)))
+ /* "why" is a hard word, but apparently for compiled functions the
+ trace_table_offset contains the length of the instructions, as
+ a fixnum. See CODE-INST-AREA-LENGTH in
+ src/compiler/target-disassem.lisp. -- CSR, 2004-01-08 */
+ if (!(fixnump(new->trace_table_offset)))
#if 0
pscav(&new->trace_table_offset, 1, 0);
#else
struct cons *old, *new, *orig;
int length;
- orig = newspace_alloc(0,constant);
+ orig = (struct cons *) newspace_alloc(0,constant);
length = 0;
do {
case SIMPLE_BASE_STRING_WIDETAG:
vector = (struct vector *)addr;
- count = CEILING(NWORDS(fixnum_value(vector->length)+1,4)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length)+1,8)+2,2);
break;
case SIMPLE_BIT_VECTOR_WIDETAG:
vector = (struct vector *)addr;
- count = CEILING(NWORDS(fixnum_value(vector->length),32)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length),1)+2,2);
break;
case SIMPLE_ARRAY_UNSIGNED_BYTE_2_WIDETAG:
vector = (struct vector *)addr;
- count = CEILING(NWORDS(fixnum_value(vector->length),16)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length),2)+2,2);
break;
case SIMPLE_ARRAY_UNSIGNED_BYTE_4_WIDETAG:
vector = (struct vector *)addr;
- count = CEILING(NWORDS(fixnum_value(vector->length),8)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length),4)+2,2);
break;
case SIMPLE_ARRAY_UNSIGNED_BYTE_8_WIDETAG:
case SIMPLE_ARRAY_UNSIGNED_BYTE_7_WIDETAG:
#endif
vector = (struct vector *)addr;
- count = CEILING(NWORDS(fixnum_value(vector->length),4)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length),8)+2,2);
break;
case SIMPLE_ARRAY_UNSIGNED_BYTE_16_WIDETAG:
case SIMPLE_ARRAY_UNSIGNED_BYTE_15_WIDETAG:
#endif
vector = (struct vector *)addr;
- count = CEILING(NWORDS(fixnum_value(vector->length),2)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length),16)+2,2);
break;
case SIMPLE_ARRAY_UNSIGNED_BYTE_32_WIDETAG:
case SIMPLE_ARRAY_UNSIGNED_BYTE_31_WIDETAG:
#endif
vector = (struct vector *)addr;
- count = CEILING(fixnum_value(vector->length)+2,2);
+ count = CEILING(NWORDS(fixnum_value(vector->length),32)+2,2);
+ break;
+
+#if N_WORD_BITS == 64
+ case SIMPLE_ARRAY_UNSIGNED_BYTE_64_WIDETAG:
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG
+ case SIMPLE_ARRAY_SIGNED_BYTE_61_WIDETAG:
+ case SIMPLE_ARRAY_UNSIGNED_BYTE_60_WIDETAG:
+#endif
+#ifdef SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG
+ case SIMPLE_ARRAY_SIGNED_BYTE_64_WIDETAG:
+ case SIMPLE_ARRAY_UNSIGNED_BYTE_63_WIDETAG:
+#endif
+ vector = (struct vector *)addr;
+ count = CEILING(NWORDS(fixnum_value(vector->length),64)+2,2);
break;
+#endif
case SIMPLE_ARRAY_SINGLE_FLOAT_WIDETAG:
vector = (struct vector *)addr;
fflush(stdout);
#endif
+#if (defined(LISP_FEATURE_GENCGC) && defined(LISP_FEATURE_X86))
/* note this expects only one thread to be active. We'd have to
* stop all the others in the same way as GC does if we wanted
* PURIFY to work when >1 thread exists */
setup_i386_stack_scav(((&static_roots)-2),
((void *)all_threads->control_stack_end));
-
+#endif
+
pscav(&static_roots, 1, 0);
pscav(&read_only_roots, 1, 1);
SetSymbolValue(READ_ONLY_SPACE_FREE_POINTER, (lispobj)read_only_free,0);
SetSymbolValue(STATIC_SPACE_FREE_POINTER, (lispobj)static_free,0);
-#if !defined(LISP_FEATURE_X86)
+#if !defined(ALLOCATION_POINTER)
dynamic_space_free_pointer = current_dynamic_space;
set_auto_gc_trigger(bytes_consed_between_gcs);
#else