]> gitweb.factorcode.org Git - factor.git/commitdiff
moved data_gc templates and inline functions to vm
authorPhil Dawes <phil@phildawes.net>
Mon, 17 Aug 2009 20:37:10 +0000 (21:37 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:22 +0000 (08:16 +0100)
vm/data_gc.hpp [changed mode: 0644->0755]
vm/vm.hpp

old mode 100644 (file)
new mode 100755 (executable)
index 334ad5a..995d539
@@ -22,7 +22,7 @@ void init_data_gc();
 
 void gc();
 
-inline static bool collecting_accumulation_gen_p()
+inline bool factorvm::collecting_accumulation_gen_p()
 {
        return ((data->have_aging_p()
                && collecting_gen == data->aging()
@@ -30,6 +30,11 @@ inline static bool collecting_accumulation_gen_p()
                || collecting_gen == data->tenured());
 }
 
+inline bool collecting_accumulation_gen_p()
+{
+       return vm->collecting_accumulation_gen_p();
+}
+
 void copy_handle(cell *handle);
 
 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 */
 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;
        z->here = h + align8(a);
@@ -50,11 +55,16 @@ inline static object *allot_zone(zone *z, cell a)
        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
  * fashion!
  */
-inline static object *allot_object(header header, cell size)
+inline object *factorvm::allot_object(header header, cell size)
 {
 #ifdef GC_DEBUG
        if(!gc_off)
@@ -105,9 +115,19 @@ inline static object *allot_object(header header, cell size)
        return obj;
 }
 
-template<typename T> T *allot(cell size)
+inline object *allot_object(header header, cell size)
+{
+       return vm->allot_object(header,size);
+}
+
+template<typename TYPE> TYPE *factorvm::allot(cell size)
 {
-       return (T *)allot_object(header(T::type_number),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);
@@ -120,7 +140,7 @@ PRIMITIVE(become);
 
 extern bool growing_data_heap;
 
-inline static void check_data_pointer(object *pointer)
+inline void factorvm::check_data_pointer(object *pointer)
 {
 #ifdef FACTOR_DEBUG
        if(!growing_data_heap)
@@ -131,7 +151,12 @@ inline static void check_data_pointer(object *pointer)
 #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
        if(!immediate_p(tagged))
@@ -143,6 +168,11 @@ inline static void check_tagged_pointer(cell tagged)
 #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);
 
 }
index b0dc17d4e8626206eb605139230481a0b0eaac85..bcbf2fe6bf8aaee501d8908546267facf46c40d4 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -186,6 +186,13 @@ struct factorvm {
        void clear_gc_stats();
        inline void vmprim_become();
        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
        std::vector<cell> gc_locals;
@@ -544,7 +551,7 @@ struct factorvm {
        void print_cell_hex_pad(cell x);
        void print_fixnum(fixnum x);
        cell read_cell_hex();
-       // next method here:
+