#define CEILING(x,y) (((x) + ((y) - 1)) & (~((y) - 1)))
#define NWORDS(x,y) (CEILING((x),(y)) / (y))
+/* FIXME: (1) Shouldn't this be defined in sbcl.h? (2) Shouldn't it
+ * be in the same units as FDEFN_RAW_ADDR_OFFSET? (This is measured
+ * in words, that's measured in bytes. Gotta love CMU CL..) */
#ifdef sparc
-#define RAW_ADDR_OFFSET 0
+#define FUN_RAW_ADDR_OFFSET 0
#else
-#define RAW_ADDR_OFFSET (6*sizeof(lispobj) - type_FunctionPointer)
+#define FUN_RAW_ADDR_OFFSET (6*sizeof(lispobj) - type_FunPointer)
#endif
\f
static boolean
/* Check that the object pointed to is consistent with the pointer
* low tag. */
switch (LowtagOf((lispobj)pointer)) {
- case type_FunctionPointer:
+ case type_FunPointer:
/* Start_addr should be the enclosing code object, or a closure
* header. */
switch (TypeOf(*start_addr)) {
break;
case type_ClosureHeader:
case type_FuncallableInstanceHeader:
- case type_ByteCodeFunction:
- case type_ByteCodeClosure:
- if ((int)pointer != ((int)start_addr+type_FunctionPointer)) {
+ if ((int)pointer != ((int)start_addr+type_FunPointer)) {
if (pointer_filter_verbose) {
fprintf(stderr,"*Wf2: %x %x %x\n", (unsigned int) pointer,
(unsigned int) start_addr, *start_addr);
/* only pointed to by function pointers? */
case type_ClosureHeader:
case type_FuncallableInstanceHeader:
- case type_ByteCodeFunction:
- case type_ByteCodeClosure:
if (pointer_filter_verbose) {
fprintf(stderr,"*Wo4: %x %x %x\n", (unsigned int) pointer,
(unsigned int) start_addr, *start_addr);
/* Scavenge the function. */
fdefn = (struct fdefn *)new;
- oldfn = fdefn->function;
- pscav(&fdefn->function, 1, 0);
- if ((char *)oldfn + RAW_ADDR_OFFSET == fdefn->raw_addr)
- fdefn->raw_addr = (char *)fdefn->function + RAW_ADDR_OFFSET;
+ oldfn = fdefn->fun;
+ pscav(&fdefn->fun, 1, 0);
+ if ((char *)oldfn + FUN_RAW_ADDR_OFFSET == fdefn->raw_addr)
+ fdefn->raw_addr = (char *)fdefn->fun + FUN_RAW_ADDR_OFFSET;
return result;
}
unsigned displacement = (unsigned)new_code - (unsigned)old_code;
struct vector *fixups_vector;
- /* Byte compiled code has no fixups. The trace table offset will be
- * a fixnum if it's x86 compiled code - check. */
- if (new_code->trace_table_offset & 0x3)
- return;
-
- /* Else it's x86 machine code. */
ncode_words = fixnum_value(new_code->code_size);
nheader_words = HeaderValue(*(lispobj *)new_code);
nwords = ncode_words + nheader_words;
/* Put in forwarding pointers for all the functions. */
for (func = code->entry_points;
func != NIL;
- func = ((struct function *)native_pointer(func))->next) {
+ func = ((struct simple_fun *)native_pointer(func))->next) {
- gc_assert(LowtagOf(func) == type_FunctionPointer);
+ gc_assert(LowtagOf(func) == type_FunPointer);
*(lispobj *)native_pointer(func) = result + (func - thing);
}
pscav(&new->entry_points, 1, 1);
for (func = new->entry_points;
func != NIL;
- func = ((struct function *)native_pointer(func))->next) {
- gc_assert(LowtagOf(func) == type_FunctionPointer);
+ func = ((struct simple_fun *)native_pointer(func))->next) {
+ gc_assert(LowtagOf(func) == type_FunPointer);
gc_assert(!dynamic_pointer_p(func));
#ifdef __i386__
- /* Temporarly convert the self pointer to a real function
- pointer. */
- ((struct function *)native_pointer(func))->self -= RAW_ADDR_OFFSET;
+ /* Temporarly convert the self pointer to a real function pointer. */
+ ((struct simple_fun *)native_pointer(func))->self
+ -= FUN_RAW_ADDR_OFFSET;
#endif
- pscav(&((struct function *)native_pointer(func))->self, 2, 1);
+ pscav(&((struct simple_fun *)native_pointer(func))->self, 2, 1);
#ifdef __i386__
- ((struct function *)native_pointer(func))->self += RAW_ADDR_OFFSET;
+ ((struct simple_fun *)native_pointer(func))->self
+ += FUN_RAW_ADDR_OFFSET;
#endif
- pscav_later(&((struct function *)native_pointer(func))->name, 3);
+ pscav_later(&((struct simple_fun *)native_pointer(func))->name, 3);
}
return result;
{
int nwords;
lispobj code, *new, *old, result;
- struct function *function;
+ struct simple_fun *function;
/* Thing can either be a function header, a closure function
* header, a closure, or a funcallable-instance. If it's a closure
* Otherwise we have to do something strange, 'cause it is buried
* inside a code object. */
- if (TypeOf(header) == type_FunctionHeader ||
- TypeOf(header) == type_ClosureFunctionHeader) {
+ if (TypeOf(header) == type_SimpleFunHeader ||
+ TypeOf(header) == type_ClosureFunHeader) {
/* We can only end up here if the code object has not been
* scavenged, because if it had been scavenged, forwarding pointers
* would have been left behind for all the entry points. */
- function = (struct function *)native_pointer(thing);
+ function = (struct simple_fun *)native_pointer(thing);
code =
(native_pointer(thing) -
(HeaderValue(function->header)*sizeof(lispobj))) |
{
boolean fix_func;
- fix_func = ((char *)(fdefn->function+RAW_ADDR_OFFSET) == fdefn->raw_addr);
+ fix_func = ((char *)(fdefn->fun+FUN_RAW_ADDR_OFFSET) == fdefn->raw_addr);
pscav(&fdefn->name, 1, 1);
- pscav(&fdefn->function, 1, 0);
+ pscav(&fdefn->fun, 1, 0);
if (fix_func)
- fdefn->raw_addr = (char *)(fdefn->function + RAW_ADDR_OFFSET);
+ fdefn->raw_addr = (char *)(fdefn->fun + FUN_RAW_ADDR_OFFSET);
return sizeof(struct fdefn) / sizeof(lispobj);
}
pscav(&code->entry_points, 1, 1);
for (func = code->entry_points;
func != NIL;
- func = ((struct function *)native_pointer(func))->next) {
- gc_assert(LowtagOf(func) == type_FunctionPointer);
+ func = ((struct simple_fun *)native_pointer(func))->next) {
+ gc_assert(LowtagOf(func) == type_FunPointer);
gc_assert(!dynamic_pointer_p(func));
#ifdef __i386__
/* Temporarly convert the self pointer to a real function
* pointer. */
- ((struct function *)native_pointer(func))->self -= RAW_ADDR_OFFSET;
+ ((struct simple_fun *)native_pointer(func))->self
+ -= FUN_RAW_ADDR_OFFSET;
#endif
- pscav(&((struct function *)native_pointer(func))->self, 2, 1);
+ pscav(&((struct simple_fun *)native_pointer(func))->self, 2, 1);
#ifdef __i386__
- ((struct function *)native_pointer(func))->self += RAW_ADDR_OFFSET;
+ ((struct simple_fun *)native_pointer(func))->self
+ += FUN_RAW_ADDR_OFFSET;
#endif
- pscav_later(&((struct function *)native_pointer(func))->name, 3);
+ pscav_later(&((struct simple_fun *)native_pointer(func))->name, 3);
}
return CEILING(nwords,2);
else {
/* Nope, copy the object. */
switch (LowtagOf(thing)) {
- case type_FunctionPointer:
+ case type_FunPointer:
thing = ptrans_func(thing, header);
break;
#endif
break;
- case type_FunctionHeader:
- case type_ClosureFunctionHeader:
+ case type_SimpleFunHeader:
+ case type_ClosureFunHeader:
case type_ReturnPcHeader:
/* We should never hit any of these, 'cause they occur
* buried in the middle of code objects. */
#ifdef __i386__
case type_ClosureHeader:
case type_FuncallableInstanceHeader:
- case type_ByteCodeFunction:
- case type_ByteCodeClosure:
/* The function self pointer needs special care on the
* x86 because it is the real entry point. */
{
- lispobj fun = ((struct closure *)addr)->function
- - RAW_ADDR_OFFSET;
+ lispobj fun = ((struct closure *)addr)->fun
+ - FUN_RAW_ADDR_OFFSET;
pscav(&fun, 1, constant);
- ((struct closure *)addr)->function = fun + RAW_ADDR_OFFSET;
+ ((struct closure *)addr)->fun = fun + FUN_RAW_ADDR_OFFSET;
}
count = 2;
break;