Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2009-05-17 18:24:04 -05:00
commit 1665a7d93b
2 changed files with 10 additions and 7 deletions

View File

@ -92,7 +92,9 @@ cell frame_executing(stack_frame *frame)
else
{
array *literals = untag<array>(compiled->literals);
return array_nth(literals,0);
cell executing = array_nth(literals,0);
check_data_pointer((object *)executing);
return executing;
}
}
@ -102,6 +104,7 @@ stack_frame *frame_successor(stack_frame *frame)
return (stack_frame *)((cell)frame - frame->size);
}
/* Allocates memory */
cell frame_scan(stack_frame *frame)
{
if(frame_type(frame) == QUOTATION_TYPE)
@ -133,12 +136,12 @@ struct stack_frame_counter {
struct stack_frame_accumulator {
cell index;
array *frames;
stack_frame_accumulator(cell count) : index(0), frames(allot_array_internal<array>(count)) {}
gc_root<array> frames;
stack_frame_accumulator(cell count) : index(0), frames(allot_array(count,F)) {}
void operator()(stack_frame *frame)
{
set_array_nth(frames,index++,frame_executing(frame));
set_array_nth(frames,index++,frame_scan(frame));
set_array_nth(frames.untagged(),index++,frame_executing(frame));
set_array_nth(frames.untagged(),index++,frame_scan(frame));
}
};
@ -154,7 +157,7 @@ PRIMITIVE(callstack_to_array)
stack_frame_accumulator accum(counter.count);
iterate_callstack_object(callstack.untagged(),accum);
dpush(tag<array>(accum.frames));
dpush(accum.frames.value());
}
stack_frame *innermost_stack_frame(callstack *stack)

View File

@ -12,7 +12,7 @@ DEFPUSHPOP(gc_local_,gc_locals)
template <typename T>
struct gc_root : public tagged<T>
{
void push() { gc_local_push((cell)this); }
void push() { check_tagged_pointer(tagged<T>::value()); gc_local_push((cell)this); }
explicit gc_root(cell value_) : tagged<T>(value_) { push(); }
explicit gc_root(T *value_) : tagged<T>(value_) { push(); }