moved callstack.hpp inline functions to vm.hpp
parent
9e23e41267
commit
fb9f9ac3d3
|
@ -33,24 +33,5 @@ template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator)
|
|||
}
|
||||
}
|
||||
|
||||
/* This is a little tricky. The iterator may allocate memory, so we
|
||||
keep the callstack in a GC root and use relative offsets */
|
||||
template<typename T> void factorvm::iterate_callstack_object(callstack *stack_, T &iterator)
|
||||
{
|
||||
gc_root<callstack> stack(stack_,vm);
|
||||
fixnum frame_offset = untag_fixnum(stack->length) - sizeof(stack_frame);
|
||||
|
||||
while(frame_offset >= 0)
|
||||
{
|
||||
stack_frame *frame = stack->frame_at(frame_offset);
|
||||
frame_offset -= frame->size;
|
||||
iterator(frame);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void iterate_callstack_object(callstack *stack_, T &iterator)
|
||||
{
|
||||
return vm->iterate_callstack_object(stack_,iterator);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ struct heap {
|
|||
heap_free_list free;
|
||||
};
|
||||
|
||||
//typedef void (*heap_iterator)(heap_block *compiled);
|
||||
typedef void (*heap_iterator)(heap_block *compiled);
|
||||
|
||||
void new_heap(heap *h, cell size);
|
||||
void build_free_list(heap *h, cell size);
|
||||
|
|
|
@ -10,6 +10,8 @@ bool in_code_heap_p(cell ptr);
|
|||
|
||||
void jit_compile_word(cell word, cell def, bool relocate);
|
||||
|
||||
typedef void (*code_heap_iterator)(code_block *compiled);
|
||||
|
||||
void iterate_code_heap(code_heap_iterator iter);
|
||||
|
||||
void copy_code_heap_roots();
|
||||
|
|
|
@ -60,13 +60,13 @@
|
|||
#include "tuples.hpp"
|
||||
#include "words.hpp"
|
||||
#include "math.hpp"
|
||||
#include "vm.hpp"
|
||||
#include "float_bits.hpp"
|
||||
#include "io.hpp"
|
||||
#include "code_gc.hpp"
|
||||
#include "code_heap.hpp"
|
||||
#include "image.hpp"
|
||||
#include "callstack.hpp"
|
||||
#include "vm.hpp"
|
||||
#include "alien.hpp"
|
||||
#include "jit.hpp"
|
||||
#include "quotations.hpp"
|
||||
|
|
23
vm/vm.hpp
23
vm/vm.hpp
|
@ -11,8 +11,6 @@ struct image_header;
|
|||
typedef u8 card;
|
||||
typedef u8 card_deck;
|
||||
|
||||
typedef void (*heap_iterator)(heap_block *compiled);
|
||||
typedef void (*code_heap_iterator)(code_block *compiled);
|
||||
|
||||
struct factorvm {
|
||||
|
||||
|
@ -1001,6 +999,27 @@ inline double bignum_to_float(cell tagged)
|
|||
return vm->bignum_to_float(tagged);
|
||||
}
|
||||
|
||||
//callstack.hpp
|
||||
/* This is a little tricky. The iterator may allocate memory, so we
|
||||
keep the callstack in a GC root and use relative offsets */
|
||||
template<typename T> void factorvm::iterate_callstack_object(callstack *stack_, T &iterator)
|
||||
{
|
||||
gc_root<callstack> stack(stack_,vm);
|
||||
fixnum frame_offset = untag_fixnum(stack->length) - sizeof(stack_frame);
|
||||
|
||||
while(frame_offset >= 0)
|
||||
{
|
||||
stack_frame *frame = stack->frame_at(frame_offset);
|
||||
frame_offset -= frame->size;
|
||||
iterator(frame);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T> void iterate_callstack_object(callstack *stack_, T &iterator)
|
||||
{
|
||||
return vm->iterate_callstack_object(stack_,iterator);
|
||||
}
|
||||
|
||||
// next method here:
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue