#include <sys/time.h>
#include <sys/resource.h>
#include <signal.h>
-#include "runtime.h"
#include "sbcl.h"
+#include "runtime.h"
#include "os.h"
#include "gc.h"
#include "gc-internal.h"
static void
zero_stack(void)
{
- u32 *ptr = (u32 *)current_control_stack_pointer;
+ lispobj *ptr = current_control_stack_pointer;
search:
do {
if (*ptr)
void *
gc_general_alloc(int bytes, int unboxed_p, int quick_p) {
lispobj *new=new_space_free_pointer;
- new_space_free_pointer+=(bytes/4);
+ new_space_free_pointer+=(bytes/N_WORD_BYTES);
return new;
}
user_time = tv_diff(&stop_rusage.ru_utime, &start_rusage.ru_utime);
system_time = tv_diff(&stop_rusage.ru_stime, &start_rusage.ru_stime);
-#if 0
- printf("Statistics:\n");
- printf("%10.2f sec of real time\n", real_time);
- printf("%10.2f sec of user time,\n", user_time);
- printf("%10.2f sec of system time.\n", system_time);
-#else
printf("Statistics: %10.2fs real, %10.2fs user, %10.2fs system.\n",
real_time, user_time, system_time);
-#endif
gc_rate = ((float) size_retained / (float) (1<<20)) / real_time;
/* before we scavenge the context. */
#ifdef reg_LIP
lip = *os_context_register_addr(context, reg_LIP);
- /* 0x7FFFFFFF or 0x7FFFFFFFFFFFFFFF ? */
- lip_offset = 0x7FFFFFFF;
+ /* 0x7FFFFFFF on 32-bit platforms;
+ 0x7FFFFFFFFFFFFFFF on 64-bit platforms */
+ lip_offset = (((unsigned long)1) << (N_WORD_BITS - 1)) - 1;
lip_register_pair = -1;
for (i = 0; i < (sizeof(boxed_registers) / sizeof(int)); i++) {
unsigned long reg;
== (char *)((unsigned long)(fdefn->raw_addr))) {
scavenge(where + 1, sizeof(struct fdefn)/sizeof(lispobj) - 1);
fdefn->raw_addr =
- (u32) ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
+ (u32) ((char *) LOW_WORD(fdefn->fun)) + FUN_RAW_ADDR_OFFSET;
return sizeof(struct fdefn) / sizeof(lispobj);
}
else
\f
/* vector-like objects */
-/* #define NWORDS(x,y) (CEILING((x),(y)) / (y)) */
-
static int
scav_vector(lispobj *where, lispobj object)
{
return WEAK_POINTER_NWORDS;
}
+\f
+lispobj *
+search_read_only_space(void *pointer)
+{
+ lispobj* start = (lispobj*)READ_ONLY_SPACE_START;
+ lispobj* end = (lispobj*)SymbolValue(READ_ONLY_SPACE_FREE_POINTER,0);
+ if ((pointer < (void *)start) || (pointer >= (void *)end))
+ return NULL;
+ return (search_space(start,
+ (((lispobj *)pointer)+2)-start,
+ (lispobj *)pointer));
+}
+
+lispobj *
+search_static_space(void *pointer)
+{
+ lispobj* start = (lispobj*)STATIC_SPACE_START;
+ lispobj* end = (lispobj*)SymbolValue(STATIC_SPACE_FREE_POINTER,0);
+ if ((pointer < (void *)start) || (pointer >= (void *)end))
+ return NULL;
+ return (search_space(start,
+ (((lispobj *)pointer)+2)-start,
+ (lispobj *)pointer));
+}
+lispobj *
+search_dynamic_space(void *pointer)
+{
+ lispobj *start = (lispobj *) current_dynamic_space;
+ lispobj *end = (lispobj *) dynamic_space_free_pointer;
+ if ((pointer < (void *)start) || (pointer >= (void *)end))
+ return NULL;
+ return (search_space(start,
+ (((lispobj *)pointer)+2)-start,
+ (lispobj *)pointer));
+}
\f
/* initialization. if gc_init can be moved to after core load, we could
* combine these two functions */