moved data_gc templates and inline functions to vm
parent
1b64155998
commit
be3a9f7f66
|
@ -22,7 +22,7 @@ void init_data_gc();
|
||||||
|
|
||||||
void gc();
|
void gc();
|
||||||
|
|
||||||
inline static bool collecting_accumulation_gen_p()
|
inline bool factorvm::collecting_accumulation_gen_p()
|
||||||
{
|
{
|
||||||
return ((data->have_aging_p()
|
return ((data->have_aging_p()
|
||||||
&& collecting_gen == data->aging()
|
&& collecting_gen == data->aging()
|
||||||
|
@ -30,6 +30,11 @@ inline static bool collecting_accumulation_gen_p()
|
||||||
|| collecting_gen == data->tenured());
|
|| collecting_gen == data->tenured());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool collecting_accumulation_gen_p()
|
||||||
|
{
|
||||||
|
return vm->collecting_accumulation_gen_p();
|
||||||
|
}
|
||||||
|
|
||||||
void copy_handle(cell *handle);
|
void copy_handle(cell *handle);
|
||||||
|
|
||||||
void garbage_collection(volatile cell gen,
|
void garbage_collection(volatile cell gen,
|
||||||
|
@ -41,7 +46,7 @@ allocation (which does not call GC because of possible roots in volatile
|
||||||
registers) does not run out of memory */
|
registers) does not run out of memory */
|
||||||
static const cell allot_buffer_zone = 1024;
|
static const cell allot_buffer_zone = 1024;
|
||||||
|
|
||||||
inline static object *allot_zone(zone *z, cell a)
|
inline object *factorvm::allot_zone(zone *z, cell a)
|
||||||
{
|
{
|
||||||
cell h = z->here;
|
cell h = z->here;
|
||||||
z->here = h + align8(a);
|
z->here = h + align8(a);
|
||||||
|
@ -50,11 +55,16 @@ inline static object *allot_zone(zone *z, cell a)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline object *allot_zone(zone *z, cell a)
|
||||||
|
{
|
||||||
|
return vm->allot_zone(z,a);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is up to the caller to fill in the object's fields in a meaningful
|
* It is up to the caller to fill in the object's fields in a meaningful
|
||||||
* fashion!
|
* fashion!
|
||||||
*/
|
*/
|
||||||
inline static object *allot_object(header header, cell size)
|
inline object *factorvm::allot_object(header header, cell size)
|
||||||
{
|
{
|
||||||
#ifdef GC_DEBUG
|
#ifdef GC_DEBUG
|
||||||
if(!gc_off)
|
if(!gc_off)
|
||||||
|
@ -105,9 +115,19 @@ inline static object *allot_object(header header, cell size)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T> T *allot(cell size)
|
inline object *allot_object(header header, cell size)
|
||||||
{
|
{
|
||||||
return (T *)allot_object(header(T::type_number),size);
|
return vm->allot_object(header,size);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TYPE> TYPE *factorvm::allot(cell size)
|
||||||
|
{
|
||||||
|
return (TYPE *)allot_object(header(TYPE::type_number),size);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename TYPE> TYPE *allot(cell size)
|
||||||
|
{
|
||||||
|
return vm->allot<TYPE>(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void copy_reachable_objects(cell scan, cell *end);
|
void copy_reachable_objects(cell scan, cell *end);
|
||||||
|
@ -120,7 +140,7 @@ PRIMITIVE(become);
|
||||||
|
|
||||||
extern bool growing_data_heap;
|
extern bool growing_data_heap;
|
||||||
|
|
||||||
inline static void check_data_pointer(object *pointer)
|
inline void factorvm::check_data_pointer(object *pointer)
|
||||||
{
|
{
|
||||||
#ifdef FACTOR_DEBUG
|
#ifdef FACTOR_DEBUG
|
||||||
if(!growing_data_heap)
|
if(!growing_data_heap)
|
||||||
|
@ -131,7 +151,12 @@ inline static void check_data_pointer(object *pointer)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static void check_tagged_pointer(cell tagged)
|
inline void check_data_pointer(object *pointer)
|
||||||
|
{
|
||||||
|
return vm->check_data_pointer(pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void factorvm::check_tagged_pointer(cell tagged)
|
||||||
{
|
{
|
||||||
#ifdef FACTOR_DEBUG
|
#ifdef FACTOR_DEBUG
|
||||||
if(!immediate_p(tagged))
|
if(!immediate_p(tagged))
|
||||||
|
@ -143,6 +168,11 @@ inline static void check_tagged_pointer(cell tagged)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void check_tagged_pointer(cell tagged)
|
||||||
|
{
|
||||||
|
return vm->check_tagged_pointer(tagged);
|
||||||
|
}
|
||||||
|
|
||||||
VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size);
|
VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,6 +186,13 @@ struct factorvm {
|
||||||
void clear_gc_stats();
|
void clear_gc_stats();
|
||||||
inline void vmprim_become();
|
inline void vmprim_become();
|
||||||
void inline_gc(cell *gc_roots_base, cell gc_roots_size);
|
void inline_gc(cell *gc_roots_base, cell gc_roots_size);
|
||||||
|
inline bool collecting_accumulation_gen_p();
|
||||||
|
inline object *allot_zone(zone *z, cell a);
|
||||||
|
inline object *allot_object(header header, cell size);
|
||||||
|
template <typename TYPE> TYPE *allot(cell size);
|
||||||
|
inline void check_data_pointer(object *pointer);
|
||||||
|
inline void check_tagged_pointer(cell tagged);
|
||||||
|
// next method here:
|
||||||
|
|
||||||
// local roots
|
// local roots
|
||||||
std::vector<cell> gc_locals;
|
std::vector<cell> gc_locals;
|
||||||
|
@ -544,7 +551,7 @@ struct factorvm {
|
||||||
void print_cell_hex_pad(cell x);
|
void print_cell_hex_pad(cell x);
|
||||||
void print_fixnum(fixnum x);
|
void print_fixnum(fixnum x);
|
||||||
cell read_cell_hex();
|
cell read_cell_hex();
|
||||||
// next method here:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue