Fix code heap compaction bug

db4
Slava Pestov 2008-03-16 00:17:05 -05:00
parent ed7af26003
commit 20ed8ab9a2
2 changed files with 9 additions and 2 deletions

View File

@ -375,6 +375,8 @@ void forward_object_xts(void)
F_WORD *word = untag_object(obj); F_WORD *word = untag_object(obj);
word->code = forward_xt(word->code); word->code = forward_xt(word->code);
if(word->profiling)
word->profiling = forward_xt(word->profiling);
} }
else if(type_of(obj) == QUOTATION_TYPE) else if(type_of(obj) == QUOTATION_TYPE)
{ {

View File

@ -263,13 +263,18 @@ DEFPUSHPOP(root_,extra_roots)
#define REGISTER_UNTAGGED(obj) root_push(obj ? tag_object(obj) : 0) #define REGISTER_UNTAGGED(obj) root_push(obj ? tag_object(obj) : 0)
#define UNREGISTER_UNTAGGED(obj) obj = untag_object(root_pop()) #define UNREGISTER_UNTAGGED(obj) obj = untag_object(root_pop())
INLINE bool in_data_heap_p(CELL ptr)
{
return (ptr >= data_heap->segment->start
&& ptr <= data_heap->segment->end);
}
/* We ignore strings which point outside the data heap, but we might be given /* We ignore strings which point outside the data heap, but we might be given
a char* which points inside the data heap, in which case it is a root, for a char* which points inside the data heap, in which case it is a root, for
example if we call unbox_char_string() the result is placed in a byte array */ example if we call unbox_char_string() the result is placed in a byte array */
INLINE bool root_push_alien(const void *ptr) INLINE bool root_push_alien(const void *ptr)
{ {
if((CELL)ptr > data_heap->segment->start if(in_data_heap_p((CELL)ptr))
&& (CELL)ptr < data_heap->segment->end)
{ {
F_BYTE_ARRAY *objptr = ((F_BYTE_ARRAY *)ptr) - 1; F_BYTE_ARRAY *objptr = ((F_BYTE_ARRAY *)ptr) - 1;
if(objptr->header == tag_header(BYTE_ARRAY_TYPE)) if(objptr->header == tag_header(BYTE_ARRAY_TYPE))