]> gitweb.factorcode.org Git - factor.git/commitdiff
renamed factorvm to factor_vm
authorPhil Dawes <phil@phildawes.net>
Wed, 23 Sep 2009 18:05:46 +0000 (19:05 +0100)
committerPhil Dawes <phil@phildawes.net>
Thu, 24 Sep 2009 07:16:52 +0000 (08:16 +0100)
52 files changed:
vm/alien.cpp
vm/alien.hpp
vm/arrays.cpp
vm/bignum.cpp
vm/bignum.hpp
vm/booleans.cpp
vm/booleans.hpp
vm/byte_arrays.cpp
vm/callstack.cpp
vm/callstack.hpp
vm/code_block.cpp
vm/code_block.hpp
vm/code_gc.cpp
vm/code_gc.hpp
vm/code_heap.cpp
vm/code_heap.hpp
vm/contexts.cpp
vm/contexts.hpp
vm/data_gc.cpp
vm/data_gc.hpp
vm/data_heap.cpp
vm/debug.cpp
vm/dispatch.cpp
vm/errors.cpp
vm/factor.cpp
vm/image.cpp
vm/inline_cache.cpp
vm/inline_cache.hpp
vm/inlineimpls.hpp
vm/io.cpp
vm/jit.cpp
vm/jit.hpp
vm/mach_signal.cpp
vm/math.cpp
vm/math.hpp
vm/os-genunix.cpp
vm/os-macosx.mm
vm/os-unix.cpp
vm/os-unix.hpp
vm/os-windows-nt.cpp
vm/os-windows-nt.hpp
vm/os-windows.cpp
vm/profiler.cpp
vm/quotations.cpp
vm/quotations.hpp
vm/run.cpp
vm/strings.cpp
vm/tagged.hpp
vm/tuples.cpp
vm/vm-data.hpp
vm/vm.hpp
vm/words.cpp

index 32900e328c15ec07c6bc71f0264021b9267171f1..0242c12c9e9f160c8386d44620e57f0e68efd3b0 100755 (executable)
@@ -5,7 +5,7 @@ namespace factor
 
 /* gets the address of an object representing a C pointer, with the
 intention of storing the pointer across code which may potentially GC. */
-char *factorvm::pinned_alien_offset(cell obj)
+char *factor_vm::pinned_alien_offset(cell obj)
 {
        switch(tagged<object>(obj).type())
        {
@@ -25,7 +25,7 @@ char *factorvm::pinned_alien_offset(cell obj)
 }
 
 /* make an alien */
-cell factorvm::allot_alien(cell delegate_, cell displacement)
+cell factor_vm::allot_alien(cell delegate_, cell displacement)
 {
        gc_root<object> delegate(delegate_,this);
        gc_root<alien> new_alien(allot<alien>(sizeof(alien)),this);
@@ -46,7 +46,7 @@ cell factorvm::allot_alien(cell delegate_, cell displacement)
 }
 
 /* make an alien pointing at an offset of another alien */
-inline void factorvm::primitive_displaced_alien()
+inline void factor_vm::primitive_displaced_alien()
 {
        cell alien = dpop();
        cell displacement = to_cell(dpop());
@@ -76,7 +76,7 @@ PRIMITIVE(displaced_alien)
 
 /* address of an object representing a C pointer. Explicitly throw an error
 if the object is a byte array, as a sanity check. */
-inline void factorvm::primitive_alien_address()
+inline void factor_vm::primitive_alien_address()
 {
        box_unsigned_cell((cell)pinned_alien_offset(dpop()));
 }
@@ -87,7 +87,7 @@ PRIMITIVE(alien_address)
 }
 
 /* pop ( alien n ) from datastack, return alien's address plus n */
-void *factorvm::alien_pointer()
+void *factor_vm::alien_pointer()
 {
        fixnum offset = to_fixnum(dpop());
        return unbox_alien() + offset;
@@ -121,7 +121,7 @@ DEFINE_ALIEN_ACCESSOR(double,double,box_double,to_double)
 DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,pinned_alien_offset)
 
 /* open a native library and push a handle */
-inline void factorvm::primitive_dlopen()
+inline void factor_vm::primitive_dlopen()
 {
        gc_root<byte_array> path(dpop(),this);
        path.untag_check(this);
@@ -137,7 +137,7 @@ PRIMITIVE(dlopen)
 }
 
 /* look up a symbol in a native library */
-inline void factorvm::primitive_dlsym()
+inline void factor_vm::primitive_dlsym()
 {
        gc_root<object> library(dpop(),this);
        gc_root<byte_array> name(dpop(),this);
@@ -164,7 +164,7 @@ PRIMITIVE(dlsym)
 }
 
 /* close a native library handle */
-inline void factorvm::primitive_dlclose()
+inline void factor_vm::primitive_dlclose()
 {
        dll *d = untag_check<dll>(dpop());
        if(d->dll != NULL)
@@ -176,7 +176,7 @@ PRIMITIVE(dlclose)
        PRIMITIVE_GETVM()->primitive_dlclose();
 }
 
-inline void factorvm::primitive_dll_validp()
+inline void factor_vm::primitive_dll_validp()
 {
        cell library = dpop();
        if(library == F)
@@ -191,7 +191,7 @@ PRIMITIVE(dll_validp)
 }
 
 /* gets the address of an object representing a C pointer */
-char *factorvm::alien_offset(cell obj)
+char *factor_vm::alien_offset(cell obj)
 {
        switch(tagged<object>(obj).type())
        {
@@ -212,26 +212,26 @@ char *factorvm::alien_offset(cell obj)
        }
 }
 
-VM_C_API char *alien_offset(cell obj, factorvm *myvm)
+VM_C_API char *alien_offset(cell obj, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->alien_offset(obj);
 }
 
 /* pop an object representing a C pointer */
-char *factorvm::unbox_alien()
+char *factor_vm::unbox_alien()
 {
        return alien_offset(dpop());
 }
 
-VM_C_API char *unbox_alien(factorvm *myvm)
+VM_C_API char *unbox_alien(factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->unbox_alien();
 }
 
 /* make an alien and push */
-void factorvm::box_alien(void *ptr)
+void factor_vm::box_alien(void *ptr)
 {
        if(ptr == NULL)
                dpush(F);
@@ -239,40 +239,40 @@ void factorvm::box_alien(void *ptr)
                dpush(allot_alien(F,(cell)ptr));
 }
 
-VM_C_API void box_alien(void *ptr, factorvm *myvm)
+VM_C_API void box_alien(void *ptr, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_alien(ptr);
 }
 
 /* for FFI calls passing structs by value */
-void factorvm::to_value_struct(cell src, void *dest, cell size)
+void factor_vm::to_value_struct(cell src, void *dest, cell size)
 {
        memcpy(dest,alien_offset(src),size);
 }
 
-VM_C_API void to_value_struct(cell src, void *dest, cell size, factorvm *myvm)
+VM_C_API void to_value_struct(cell src, void *dest, cell size, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_value_struct(src,dest,size);
 }
 
 /* for FFI callbacks receiving structs by value */
-void factorvm::box_value_struct(void *src, cell size)
+void factor_vm::box_value_struct(void *src, cell size)
 {
        byte_array *bytes = allot_byte_array(size);
        memcpy(bytes->data<void>(),src,size);
        dpush(tag<byte_array>(bytes));
 }
 
-VM_C_API void box_value_struct(void *src, cell size,factorvm *myvm)
+VM_C_API void box_value_struct(void *src, cell size,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_value_struct(src,size);
 }
 
 /* On some x86 OSes, structs <= 8 bytes are returned in registers. */
-void factorvm::box_small_struct(cell x, cell y, cell size)
+void factor_vm::box_small_struct(cell x, cell y, cell size)
 {
        cell data[2];
        data[0] = x;
@@ -280,14 +280,14 @@ void factorvm::box_small_struct(cell x, cell y, cell size)
        box_value_struct(data,size);
 }
 
-VM_C_API void box_small_struct(cell x, cell y, cell size, factorvm *myvm)
+VM_C_API void box_small_struct(cell x, cell y, cell size, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_small_struct(x,y,size);
 }
 
 /* On OS X/PPC, complex numbers are returned in registers. */
-void factorvm::box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size)
+void factor_vm::box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size)
 {
        cell data[4];
        data[0] = x1;
@@ -297,13 +297,13 @@ void factorvm::box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size)
        box_value_struct(data,size);
 }
 
-VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, factorvm *myvm)
+VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_medium_struct(x1, x2, x3, x4, size);
 }
 
-inline void factorvm::primitive_vm_ptr()
+inline void factor_vm::primitive_vm_ptr()
 {
        box_alien(this);
 }
index ca3601f51e09a3da4153ed8568bc09fb72d23671..839143b9e0db3e1789e14c3389be27e2b7af5785 100755 (executable)
@@ -38,12 +38,12 @@ PRIMITIVE(dll_validp);
 
 PRIMITIVE(vm_ptr);
 
-VM_C_API char *alien_offset(cell object, factorvm *vm);
-VM_C_API char *unbox_alien(factorvm *vm);
-VM_C_API void box_alien(void *ptr, factorvm *vm);
-VM_C_API void to_value_struct(cell src, void *dest, cell size, factorvm *vm);
-VM_C_API void box_value_struct(void *src, cell size,factorvm *vm);
-VM_C_API void box_small_struct(cell x, cell y, cell size,factorvm *vm);
-VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size,factorvm *vm);
+VM_C_API char *alien_offset(cell object, factor_vm *vm);
+VM_C_API char *unbox_alien(factor_vm *vm);
+VM_C_API void box_alien(void *ptr, factor_vm *vm);
+VM_C_API void to_value_struct(cell src, void *dest, cell size, factor_vm *vm);
+VM_C_API void box_value_struct(void *src, cell size,factor_vm *vm);
+VM_C_API void box_small_struct(cell x, cell y, cell size,factor_vm *vm);
+VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size,factor_vm *vm);
 
 }
index 3305c37e7c85d799cb75ccc2688d6bba4e9c9b7e..aeae1d664fc5e3e7a4e004edd8cd0c14bf77e92b 100644 (file)
@@ -4,7 +4,7 @@ namespace factor
 {
 
 /* make a new array with an initial element */
-array *factorvm::allot_array(cell capacity, cell fill_)
+array *factor_vm::allot_array(cell capacity, cell fill_)
 {
        gc_root<object> fill(fill_,this);
        gc_root<array> new_array(allot_array_internal<array>(capacity),this);
@@ -24,7 +24,7 @@ array *factorvm::allot_array(cell capacity, cell fill_)
 }
 
 /* push a new array on the stack */
-inline void factorvm::primitive_array()
+inline void factor_vm::primitive_array()
 {
        cell initial = dpop();
        cell size = unbox_array_size();
@@ -36,7 +36,7 @@ PRIMITIVE(array)
        PRIMITIVE_GETVM()->primitive_array();
 }
 
-cell factorvm::allot_array_1(cell obj_)
+cell factor_vm::allot_array_1(cell obj_)
 {
        gc_root<object> obj(obj_,this);
        gc_root<array> a(allot_array_internal<array>(1),this);
@@ -44,7 +44,7 @@ cell factorvm::allot_array_1(cell obj_)
        return a.value();
 }
 
-cell factorvm::allot_array_2(cell v1_, cell v2_)
+cell factor_vm::allot_array_2(cell v1_, cell v2_)
 {
        gc_root<object> v1(v1_,this);
        gc_root<object> v2(v2_,this);
@@ -54,7 +54,7 @@ cell factorvm::allot_array_2(cell v1_, cell v2_)
        return a.value();
 }
 
-cell factorvm::allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_)
+cell factor_vm::allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_)
 {
        gc_root<object> v1(v1_,this);
        gc_root<object> v2(v2_,this);
@@ -68,7 +68,7 @@ cell factorvm::allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_)
        return a.value();
 }
 
-inline void factorvm::primitive_resize_array()
+inline void factor_vm::primitive_resize_array()
 {
        array* a = untag_check<array>(dpop());
        cell capacity = unbox_array_size();
@@ -82,7 +82,7 @@ PRIMITIVE(resize_array)
 
 void growable_array::add(cell elt_)
 {
-       factorvm* myvm = elements.myvm;
+       factor_vm* myvm = elements.myvm;
        gc_root<object> elt(elt_,myvm);
        if(count == array_capacity(elements.untagged()))
                elements = myvm->reallot_array(elements.untagged(),count * 2);
@@ -92,7 +92,7 @@ void growable_array::add(cell elt_)
 
 void growable_array::trim()
 {
-       factorvm *myvm = elements.myvm;
+       factor_vm *myvm = elements.myvm;
        elements = myvm->reallot_array(elements.untagged(),count);
 }
 
index 0099aecc8a98b53aac36d723eb03315f3f70eb38..80bc58ce21a6a595e506e5c7bfc5dc32868fa1ec 100755 (executable)
@@ -60,7 +60,7 @@ namespace factor
 
 /* Exports */
 
-int factorvm::bignum_equal_p(bignum * x, bignum * y)
+int factor_vm::bignum_equal_p(bignum * x, bignum * y)
 {
        return
                ((BIGNUM_ZERO_P (x))
@@ -72,7 +72,7 @@ int factorvm::bignum_equal_p(bignum * x, bignum * y)
                        && (bignum_equal_p_unsigned (x, y))));
 }
 
-enum bignum_comparison factorvm::bignum_compare(bignum * x, bignum * y)
+enum bignum_comparison factor_vm::bignum_compare(bignum * x, bignum * y)
 {
        return
                ((BIGNUM_ZERO_P (x))
@@ -95,7 +95,7 @@ enum bignum_comparison factorvm::bignum_compare(bignum * x, bignum * y)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_add(bignum * x, bignum * y)
+bignum *factor_vm::bignum_add(bignum * x, bignum * y)
 {
        return
                ((BIGNUM_ZERO_P (x))
@@ -112,7 +112,7 @@ bignum *factorvm::bignum_add(bignum * x, bignum * y)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_subtract(bignum * x, bignum * y)
+bignum *factor_vm::bignum_subtract(bignum * x, bignum * y)
 {
        return
                ((BIGNUM_ZERO_P (x))
@@ -131,7 +131,7 @@ bignum *factorvm::bignum_subtract(bignum * x, bignum * y)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_multiply(bignum * x, bignum * y)
+bignum *factor_vm::bignum_multiply(bignum * x, bignum * y)
 {
        bignum_length_type x_length = (BIGNUM_LENGTH (x));
        bignum_length_type y_length = (BIGNUM_LENGTH (y));
@@ -163,7 +163,7 @@ bignum *factorvm::bignum_multiply(bignum * x, bignum * y)
 }
 
 /* allocates memory */
-void factorvm::bignum_divide(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder)
+void factor_vm::bignum_divide(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder)
 {
        if (BIGNUM_ZERO_P (denominator))
        {
@@ -234,7 +234,7 @@ void factorvm::bignum_divide(bignum * numerator, bignum * denominator, bignum *
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_quotient(bignum * numerator, bignum * denominator)
+bignum *factor_vm::bignum_quotient(bignum * numerator, bignum * denominator)
 {
        if (BIGNUM_ZERO_P (denominator))
        {
@@ -286,7 +286,7 @@ bignum *factorvm::bignum_quotient(bignum * numerator, bignum * denominator)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_remainder(bignum * numerator, bignum * denominator)
+bignum *factor_vm::bignum_remainder(bignum * numerator, bignum * denominator)
 {
        if (BIGNUM_ZERO_P (denominator))
                {
@@ -330,7 +330,7 @@ bignum *factorvm::bignum_remainder(bignum * numerator, bignum * denominator)
 }
 
 #define FOO_TO_BIGNUM(name,type,utype)                                 \
-bignum * factorvm::name##_to_bignum(type n)                            \
+bignum * factor_vm::name##_to_bignum(type n)                           \
 {                                                                      \
        int negative_p;                                                 \
        bignum_digit_type result_digits [BIGNUM_DIGITS_FOR(type)];      \
@@ -365,8 +365,9 @@ FOO_TO_BIGNUM(fixnum,fixnum,cell)
 FOO_TO_BIGNUM(long_long,s64,u64)
 FOO_TO_BIGNUM(ulong_long,u64,u64)
 
+
 #define BIGNUM_TO_FOO(name,type,utype)                                 \
-       type factorvm::bignum_to_##name(bignum * bignum)                \
+       type factor_vm::bignum_to_##name(bignum * bignum)               \
        {                                                               \
                if (BIGNUM_ZERO_P (bignum))                             \
                        return (0);                                     \
@@ -386,7 +387,7 @@ BIGNUM_TO_FOO(fixnum,fixnum,cell);
 BIGNUM_TO_FOO(long_long,s64,u64)
 BIGNUM_TO_FOO(ulong_long,u64,u64)
 
-double factorvm::bignum_to_double(bignum * bignum)
+double factor_vm::bignum_to_double(bignum * bignum)
 {
        if (BIGNUM_ZERO_P (bignum))
                return (0);
@@ -411,7 +412,7 @@ double factorvm::bignum_to_double(bignum * bignum)
 /* allocates memory */
 #define inf std::numeric_limits<double>::infinity()
 
-bignum *factorvm::double_to_bignum(double x)
+bignum *factor_vm::double_to_bignum(double x)
 {
        if (x == inf || x == -inf || x != x) return (BIGNUM_ZERO ());
        int exponent;
@@ -446,7 +447,7 @@ bignum *factorvm::double_to_bignum(double x)
 
 /* Comparisons */
 
-int factorvm::bignum_equal_p_unsigned(bignum * x, bignum * y)
+int factor_vm::bignum_equal_p_unsigned(bignum * x, bignum * y)
 {
        bignum_length_type length = (BIGNUM_LENGTH (x));
        if (length != (BIGNUM_LENGTH (y)))
@@ -463,7 +464,7 @@ int factorvm::bignum_equal_p_unsigned(bignum * x, bignum * y)
        }
 }
 
-enum bignum_comparison factorvm::bignum_compare_unsigned(bignum * x, bignum * y)
+enum bignum_comparison factor_vm::bignum_compare_unsigned(bignum * x, bignum * y)
 {
        bignum_length_type x_length = (BIGNUM_LENGTH (x));
        bignum_length_type y_length = (BIGNUM_LENGTH (y));
@@ -491,7 +492,7 @@ enum bignum_comparison factorvm::bignum_compare_unsigned(bignum * x, bignum * y)
 /* Addition */
 
 /* allocates memory */
-bignum *factorvm::bignum_add_unsigned(bignum * x, bignum * y, int negative_p)
+bignum *factor_vm::bignum_add_unsigned(bignum * x, bignum * y, int negative_p)
 {
        GC_BIGNUM(x); GC_BIGNUM(y);
 
@@ -558,7 +559,7 @@ bignum *factorvm::bignum_add_unsigned(bignum * x, bignum * y, int negative_p)
 /* Subtraction */
 
 /* allocates memory */
-bignum *factorvm::bignum_subtract_unsigned(bignum * x, bignum * y)
+bignum *factor_vm::bignum_subtract_unsigned(bignum * x, bignum * y)
 {
        GC_BIGNUM(x); GC_BIGNUM(y);
   
@@ -636,7 +637,7 @@ bignum *factorvm::bignum_subtract_unsigned(bignum * x, bignum * y)
    where R == BIGNUM_RADIX_ROOT */
 
 /* allocates memory */
-bignum *factorvm::bignum_multiply_unsigned(bignum * x, bignum * y, int negative_p)
+bignum *factor_vm::bignum_multiply_unsigned(bignum * x, bignum * y, int negative_p)
 {
        GC_BIGNUM(x); GC_BIGNUM(y);
 
@@ -707,7 +708,7 @@ bignum *factorvm::bignum_multiply_unsigned(bignum * x, bignum * y, int negative_
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit_type y, int negative_p)
+bignum *factor_vm::bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit_type y, int negative_p)
 {
        GC_BIGNUM(x);
   
@@ -721,7 +722,7 @@ bignum *factorvm::bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit
        return (bignum_trim (p));
 }
 
-void factorvm::bignum_destructive_add(bignum * bignum, bignum_digit_type n)
+void factor_vm::bignum_destructive_add(bignum * bignum, bignum_digit_type n)
 {
        bignum_digit_type * scan = (BIGNUM_START_PTR (bignum));
        bignum_digit_type digit;
@@ -744,7 +745,7 @@ void factorvm::bignum_destructive_add(bignum * bignum, bignum_digit_type n)
        }
 }
 
-void factorvm::bignum_destructive_scale_up(bignum * bignum, bignum_digit_type factor)
+void factor_vm::bignum_destructive_scale_up(bignum * bignum, bignum_digit_type factor)
 {
        bignum_digit_type carry = 0;
        bignum_digit_type * scan = (BIGNUM_START_PTR (bignum));
@@ -781,7 +782,7 @@ void factorvm::bignum_destructive_scale_up(bignum * bignum, bignum_digit_type fa
    section 4.3.1, "Multiple-Precision Arithmetic". */
 
 /* allocates memory */
-void factorvm::bignum_divide_unsigned_large_denominator(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder, int q_negative_p, int r_negative_p)
+void factor_vm::bignum_divide_unsigned_large_denominator(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder, int q_negative_p, int r_negative_p)
 {
        GC_BIGNUM(numerator); GC_BIGNUM(denominator);
   
@@ -838,7 +839,7 @@ void factorvm::bignum_divide_unsigned_large_denominator(bignum * numerator, bign
        return;
 }
 
-void factorvm::bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum * q)
+void factor_vm::bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum * q)
 {
        bignum_length_type u_length = (BIGNUM_LENGTH (u));
        bignum_length_type v_length = (BIGNUM_LENGTH (v));
@@ -912,7 +913,7 @@ void factorvm::bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum
 #undef qj
 }
 
-bignum_digit_type factorvm::bignum_divide_subtract(bignum_digit_type * v_start, bignum_digit_type * v_end, bignum_digit_type guess, bignum_digit_type * u_start)
+bignum_digit_type factor_vm::bignum_divide_subtract(bignum_digit_type * v_start, bignum_digit_type * v_end, bignum_digit_type guess, bignum_digit_type * u_start)
 {
        bignum_digit_type * v_scan = v_start;
        bignum_digit_type * u_scan = u_start;
@@ -988,7 +989,7 @@ bignum_digit_type factorvm::bignum_divide_subtract(bignum_digit_type * v_start,
 }
 
 /* allocates memory */
-void factorvm::bignum_divide_unsigned_medium_denominator(bignum * numerator,bignum_digit_type denominator, bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p)
+void factor_vm::bignum_divide_unsigned_medium_denominator(bignum * numerator,bignum_digit_type denominator, bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p)
 {
        GC_BIGNUM(numerator);
   
@@ -1046,7 +1047,7 @@ void factorvm::bignum_divide_unsigned_medium_denominator(bignum * numerator,bign
        return;
 }
 
-void factorvm::bignum_destructive_normalization(bignum * source, bignum * target, int shift_left)
+void factor_vm::bignum_destructive_normalization(bignum * source, bignum * target, int shift_left)
 {
        bignum_digit_type digit;
        bignum_digit_type * scan_source = (BIGNUM_START_PTR (source));
@@ -1069,7 +1070,7 @@ void factorvm::bignum_destructive_normalization(bignum * source, bignum * target
        return;
 }
 
-void factorvm::bignum_destructive_unnormalization(bignum * bignum, int shift_right)
+void factor_vm::bignum_destructive_unnormalization(bignum * bignum, int shift_right)
 {
        bignum_digit_type * start = (BIGNUM_START_PTR (bignum));
        bignum_digit_type * scan = (start + (BIGNUM_LENGTH (bignum)));
@@ -1115,7 +1116,7 @@ void factorvm::bignum_destructive_unnormalization(bignum * bignum, int shift_rig
        qn = (bignum_digit_divide_subtract (v1, v2, guess, (&u[j])));   \
 }
 
-bignum_digit_type factorvm::bignum_digit_divide(bignum_digit_type uh, bignum_digit_type ul, bignum_digit_type v, bignum_digit_type * q) /* return value */
+bignum_digit_type factor_vm::bignum_digit_divide(bignum_digit_type uh, bignum_digit_type ul, bignum_digit_type v, bignum_digit_type * q) /* return value */
 {
        bignum_digit_type guess;
        bignum_digit_type comparand;
@@ -1184,7 +1185,7 @@ bignum_digit_type factorvm::bignum_digit_divide(bignum_digit_type uh, bignum_dig
        }                                                       \
 }
 
-bignum_digit_type factorvm::bignum_digit_divide_subtract(bignum_digit_type v1, bignum_digit_type v2, bignum_digit_type guess, bignum_digit_type * u)
+bignum_digit_type factor_vm::bignum_digit_divide_subtract(bignum_digit_type v1, bignum_digit_type v2, bignum_digit_type guess, bignum_digit_type * u)
 {
        {
                bignum_digit_type product;
@@ -1218,7 +1219,7 @@ bignum_digit_type factorvm::bignum_digit_divide_subtract(bignum_digit_type v1, b
 #undef BDDS_ADD
 
 /* allocates memory */
-void factorvm::bignum_divide_unsigned_small_denominator(bignum * numerator, bignum_digit_type denominator, bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p)
+void factor_vm::bignum_divide_unsigned_small_denominator(bignum * numerator, bignum_digit_type denominator, bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p)
 {
        GC_BIGNUM(numerator);
   
@@ -1241,7 +1242,7 @@ void factorvm::bignum_divide_unsigned_small_denominator(bignum * numerator, bign
    (quotient_high < BIGNUM_RADIX_ROOT), after which it is easy to see
    that all digits are < BIGNUM_RADIX. */
 
-bignum_digit_type factorvm::bignum_destructive_scale_down(bignum * bignum, bignum_digit_type denominator)
+bignum_digit_type factor_vm::bignum_destructive_scale_down(bignum * bignum, bignum_digit_type denominator)
 {
        bignum_digit_type numerator;
        bignum_digit_type remainder = 0;
@@ -1264,7 +1265,7 @@ bignum_digit_type factorvm::bignum_destructive_scale_down(bignum * bignum, bignu
 }
 
 /* allocates memory */
-bignum * factorvm::bignum_remainder_unsigned_small_denominator(bignum * n, bignum_digit_type d, int negative_p)
+bignum * factor_vm::bignum_remainder_unsigned_small_denominator(bignum * n, bignum_digit_type d, int negative_p)
 {
        bignum_digit_type two_digits;
        bignum_digit_type * start = (BIGNUM_START_PTR (n));
@@ -1283,7 +1284,7 @@ bignum * factorvm::bignum_remainder_unsigned_small_denominator(bignum * n, bignu
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_digit_to_bignum(bignum_digit_type digit, int negative_p)
+bignum *factor_vm::bignum_digit_to_bignum(bignum_digit_type digit, int negative_p)
 {
        if (digit == 0)
                return (BIGNUM_ZERO ());
@@ -1296,7 +1297,7 @@ bignum *factorvm::bignum_digit_to_bignum(bignum_digit_type digit, int negative_p
 }
 
 /* allocates memory */
-bignum *factorvm::allot_bignum(bignum_length_type length, int negative_p)
+bignum *factor_vm::allot_bignum(bignum_length_type length, int negative_p)
 {
        BIGNUM_ASSERT ((length >= 0) || (length < BIGNUM_RADIX));
        bignum * result = allot_array_internal<bignum>(length + 1);
@@ -1305,7 +1306,7 @@ bignum *factorvm::allot_bignum(bignum_length_type length, int negative_p)
 }
 
 /* allocates memory */
-bignum * factorvm::allot_bignum_zeroed(bignum_length_type length, int negative_p)
+bignum * factor_vm::allot_bignum_zeroed(bignum_length_type length, int negative_p)
 {
        bignum * result = allot_bignum(length,negative_p);
        bignum_digit_type * scan = (BIGNUM_START_PTR (result));
@@ -1319,7 +1320,7 @@ bignum * factorvm::allot_bignum_zeroed(bignum_length_type length, int negative_p
 source = reallot_array(source,length + 1)
 
 /* allocates memory */
-bignum *factorvm::bignum_shorten_length(bignum * bignum, bignum_length_type length)
+bignum *factor_vm::bignum_shorten_length(bignum * bignum, bignum_length_type length)
 {
        bignum_length_type current_length = (BIGNUM_LENGTH (bignum));
        BIGNUM_ASSERT ((length >= 0) || (length <= current_length));
@@ -1332,7 +1333,7 @@ bignum *factorvm::bignum_shorten_length(bignum * bignum, bignum_length_type leng
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_trim(bignum * bignum)
+bignum *factor_vm::bignum_trim(bignum * bignum)
 {
        bignum_digit_type * start = (BIGNUM_START_PTR (bignum));
        bignum_digit_type * end = (start + (BIGNUM_LENGTH (bignum)));
@@ -1352,7 +1353,7 @@ bignum *factorvm::bignum_trim(bignum * bignum)
 /* Copying */
 
 /* allocates memory */
-bignum *factorvm::bignum_new_sign(bignum * x, int negative_p)
+bignum *factor_vm::bignum_new_sign(bignum * x, int negative_p)
 {
        GC_BIGNUM(x);
        bignum * result = (allot_bignum ((BIGNUM_LENGTH (x)), negative_p));
@@ -1362,7 +1363,7 @@ bignum *factorvm::bignum_new_sign(bignum * x, int negative_p)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_maybe_new_sign(bignum * x, int negative_p)
+bignum *factor_vm::bignum_maybe_new_sign(bignum * x, int negative_p)
 {
        if ((BIGNUM_NEGATIVE_P (x)) ? negative_p : (! negative_p))
                return (x);
@@ -1375,7 +1376,7 @@ bignum *factorvm::bignum_maybe_new_sign(bignum * x, int negative_p)
        }
 }
 
-void factorvm::bignum_destructive_copy(bignum * source, bignum * target)
+void factor_vm::bignum_destructive_copy(bignum * source, bignum * target)
 {
        bignum_digit_type * scan_source = (BIGNUM_START_PTR (source));
        bignum_digit_type * end_source =
@@ -1391,13 +1392,13 @@ void factorvm::bignum_destructive_copy(bignum * source, bignum * target)
  */
 
 /* allocates memory */
-bignum *factorvm::bignum_bitwise_not(bignum * x)
+bignum *factor_vm::bignum_bitwise_not(bignum * x)
 {
        return bignum_subtract(BIGNUM_ONE(1), x);
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_arithmetic_shift(bignum * arg1, fixnum n)
+bignum *factor_vm::bignum_arithmetic_shift(bignum * arg1, fixnum n)
 {
        if (BIGNUM_NEGATIVE_P(arg1) && n < 0)
                return bignum_bitwise_not(bignum_magnitude_ash(bignum_bitwise_not(arg1), n));
@@ -1410,7 +1411,7 @@ bignum *factorvm::bignum_arithmetic_shift(bignum * arg1, fixnum n)
 #define XOR_OP 2
 
 /* allocates memory */
-bignum *factorvm::bignum_bitwise_and(bignum * arg1, bignum * arg2)
+bignum *factor_vm::bignum_bitwise_and(bignum * arg1, bignum * arg2)
 {
        return(
                   (BIGNUM_NEGATIVE_P (arg1))
@@ -1424,7 +1425,7 @@ bignum *factorvm::bignum_bitwise_and(bignum * arg1, bignum * arg2)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_bitwise_ior(bignum * arg1, bignum * arg2)
+bignum *factor_vm::bignum_bitwise_ior(bignum * arg1, bignum * arg2)
 {
        return(
                   (BIGNUM_NEGATIVE_P (arg1))
@@ -1438,7 +1439,7 @@ bignum *factorvm::bignum_bitwise_ior(bignum * arg1, bignum * arg2)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_bitwise_xor(bignum * arg1, bignum * arg2)
+bignum *factor_vm::bignum_bitwise_xor(bignum * arg1, bignum * arg2)
 {
        return(
                   (BIGNUM_NEGATIVE_P (arg1))
@@ -1454,7 +1455,7 @@ bignum *factorvm::bignum_bitwise_xor(bignum * arg1, bignum * arg2)
 /* allocates memory */
 /* ash for the magnitude */
 /* assume arg1 is a big number, n is a long */
-bignum *factorvm::bignum_magnitude_ash(bignum * arg1, fixnum n)
+bignum *factor_vm::bignum_magnitude_ash(bignum * arg1, fixnum n)
 {
        GC_BIGNUM(arg1);
   
@@ -1515,7 +1516,7 @@ bignum *factorvm::bignum_magnitude_ash(bignum * arg1, fixnum n)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2)
+bignum *factor_vm::bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2)
 {
        GC_BIGNUM(arg1); GC_BIGNUM(arg2);
   
@@ -1549,7 +1550,7 @@ bignum *factorvm::bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_posneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
+bignum *factor_vm::bignum_posneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
 {
        GC_BIGNUM(arg1); GC_BIGNUM(arg2);
   
@@ -1601,7 +1602,7 @@ bignum *factorvm::bignum_posneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
 }
 
 /* allocates memory */
-bignum *factorvm::bignum_negneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
+bignum *factor_vm::bignum_negneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
 {
        GC_BIGNUM(arg1); GC_BIGNUM(arg2);
   
@@ -1660,7 +1661,7 @@ bignum *factorvm::bignum_negneg_bitwise_op(int op, bignum * arg1, bignum * arg2)
        return bignum_trim(result);
 }
 
-void factorvm::bignum_negate_magnitude(bignum * arg)
+void factor_vm::bignum_negate_magnitude(bignum * arg)
 {
        bignum_digit_type *scan;
        bignum_digit_type *end;
@@ -1688,7 +1689,7 @@ void factorvm::bignum_negate_magnitude(bignum * arg)
 }
 
 /* Allocates memory */
-bignum *factorvm::bignum_integer_length(bignum * x)
+bignum *factor_vm::bignum_integer_length(bignum * x)
 {
        GC_BIGNUM(x);
   
@@ -1709,14 +1710,14 @@ bignum *factorvm::bignum_integer_length(bignum * x)
 }
 
 /* Allocates memory */
-int factorvm::bignum_logbitp(int shift, bignum * arg)
+int factor_vm::bignum_logbitp(int shift, bignum * arg)
 {
        return((BIGNUM_NEGATIVE_P (arg)) 
                   ? !bignum_unsigned_logbitp (shift, bignum_bitwise_not (arg))
                   : bignum_unsigned_logbitp (shift,arg));
 }
 
-int factorvm::bignum_unsigned_logbitp(int shift, bignum * bignum)
+int factor_vm::bignum_unsigned_logbitp(int shift, bignum * bignum)
 {
        bignum_length_type len = (BIGNUM_LENGTH (bignum));
        int index = shift / BIGNUM_DIGIT_LENGTH;
@@ -1729,7 +1730,7 @@ int factorvm::bignum_unsigned_logbitp(int shift, bignum * bignum)
 }
 
 /* Allocates memory */
-bignum *factorvm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factorvm*), unsigned int radix, int negative_p)
+bignum *factor_vm::digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factor_vm*), unsigned int radix, int negative_p)
 {
        BIGNUM_ASSERT ((radix > 1) && (radix <= BIGNUM_RADIX_ROOT));
        if (n_digits == 0)
index ca04be376541dcaba477af296cc88cf7832c3571..7d230c3897cad52bc5a732306e9523feea2bd2be 100644 (file)
@@ -44,7 +44,7 @@ enum bignum_comparison
   bignum_comparison_greater = 1
 };
 
-struct factorvm;
-bignum * digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int,factorvm*), unsigned int radix, int negative_p);
+struct factor_vm;
+bignum * digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int,factor_vm*), unsigned int radix, int negative_p);
 
 }
index aa3f392b3e885d8bd494ce6db1f87b5815e42cc8..5e3cb038225c05b213460520437364bb3dcc4f32 100644 (file)
@@ -3,23 +3,23 @@
 namespace factor
 {
 
-void factorvm::box_boolean(bool value)
+void factor_vm::box_boolean(bool value)
 {
        dpush(value ? T : F);
 }
 
-VM_C_API void box_boolean(bool value, factorvm *myvm)
+VM_C_API void box_boolean(bool value, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_boolean(value);
 }
 
-bool factorvm::to_boolean(cell value)
+bool factor_vm::to_boolean(cell value)
 {
        return value != F;
 }
 
-VM_C_API bool to_boolean(cell value, factorvm *myvm)
+VM_C_API bool to_boolean(cell value, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_boolean(value);
index fb3991fc214493fb932c1deae2424767b3f03cae..88235122a3dc4e32ff21ea0d2fb32164acb16a0d 100644 (file)
@@ -1,7 +1,7 @@
 namespace factor
 {
 
-VM_C_API void box_boolean(bool value, factorvm *vm);
-VM_C_API bool to_boolean(cell value, factorvm *vm);
+VM_C_API void box_boolean(bool value, factor_vm *vm);
+VM_C_API bool to_boolean(cell value, factor_vm *vm);
 
 }
index 5a1744b374fbcfce2dd21cfa501dd919d267853d..82474e18c2fd67543801da6ac14e71f8e4a37ff8 100644 (file)
@@ -3,14 +3,14 @@
 namespace factor
 {
 
-byte_array *factorvm::allot_byte_array(cell size)
+byte_array *factor_vm::allot_byte_array(cell size)
 {
        byte_array *array = allot_array_internal<byte_array>(size);
        memset(array + 1,0,size);
        return array;
 }
 
-inline void factorvm::primitive_byte_array()
+inline void factor_vm::primitive_byte_array()
 {
        cell size = unbox_array_size();
        dpush(tag<byte_array>(allot_byte_array(size)));
@@ -21,7 +21,7 @@ PRIMITIVE(byte_array)
        PRIMITIVE_GETVM()->primitive_byte_array();
 }
 
-inline void factorvm::primitive_uninitialized_byte_array()
+inline void factor_vm::primitive_uninitialized_byte_array()
 {
        cell size = unbox_array_size();
        dpush(tag<byte_array>(allot_array_internal<byte_array>(size)));
@@ -32,7 +32,7 @@ PRIMITIVE(uninitialized_byte_array)
        PRIMITIVE_GETVM()->primitive_uninitialized_byte_array();
 }
 
-inline void factorvm::primitive_resize_byte_array()
+inline void factor_vm::primitive_resize_byte_array()
 {
        byte_array *array = untag_check<byte_array>(dpop());
        cell capacity = unbox_array_size();
@@ -47,7 +47,7 @@ PRIMITIVE(resize_byte_array)
 void growable_byte_array::append_bytes(void *elts, cell len)
 {
        cell new_size = count + len;
-       factorvm *myvm = elements.myvm;
+       factor_vm *myvm = elements.myvm;
        if(new_size >= array_capacity(elements.untagged()))
                elements = myvm->reallot_array(elements.untagged(),new_size * 2);
 
@@ -62,7 +62,7 @@ void growable_byte_array::append_byte_array(cell byte_array_)
 
        cell len = array_capacity(byte_array.untagged());
        cell new_size = count + len;
-       factorvm *myvm = elements.myvm;
+       factor_vm *myvm = elements.myvm;
        if(new_size >= array_capacity(elements.untagged()))
                elements = myvm->reallot_array(elements.untagged(),new_size * 2);
 
@@ -73,7 +73,7 @@ void growable_byte_array::append_byte_array(cell byte_array_)
 
 void growable_byte_array::trim()
 {
-       factorvm *myvm = elements.myvm;
+       factor_vm *myvm = elements.myvm;
        elements = myvm->reallot_array(elements.untagged(),count);
 }
 
index 1358ac59eacc7ac6310a7a786a61b3192802e0f0..445ebf88ee1a812e4b431f61511bb02a58b5af64 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-void factorvm::check_frame(stack_frame *frame)
+void factor_vm::check_frame(stack_frame *frame)
 {
 #ifdef FACTOR_DEBUG
        check_code_pointer((cell)frame->xt);
@@ -11,14 +11,14 @@ void factorvm::check_frame(stack_frame *frame)
 #endif
 }
 
-callstack *factorvm::allot_callstack(cell size)
+callstack *factor_vm::allot_callstack(cell size)
 {
        callstack *stack = allot<callstack>(callstack_size(size));
        stack->length = tag_fixnum(size);
        return stack;
 }
 
-stack_frame *factorvm::fix_callstack_top(stack_frame *top, stack_frame *bottom)
+stack_frame *factor_vm::fix_callstack_top(stack_frame *top, stack_frame *bottom)
 {
        stack_frame *frame = bottom - 1;
 
@@ -35,7 +35,7 @@ This means that if 'callstack' is called in tail position, we
 will have popped a necessary frame... however this word is only
 called by continuation implementation, and user code shouldn't
 be calling it at all, so we leave it as it is for now. */
-stack_frame *factorvm::capture_start()
+stack_frame *factor_vm::capture_start()
 {
        stack_frame *frame = stack_chain->callstack_bottom - 1;
        while(frame >= stack_chain->callstack_top
@@ -46,7 +46,7 @@ stack_frame *factorvm::capture_start()
        return frame + 1;
 }
 
-inline void factorvm::primitive_callstack()
+inline void factor_vm::primitive_callstack()
 {
        stack_frame *top = capture_start();
        stack_frame *bottom = stack_chain->callstack_bottom;
@@ -65,7 +65,7 @@ PRIMITIVE(callstack)
        PRIMITIVE_GETVM()->primitive_callstack();
 }
 
-inline void factorvm::primitive_set_callstack()
+inline void factor_vm::primitive_set_callstack()
 {
        callstack *stack = untag_check<callstack>(dpop());
 
@@ -83,18 +83,18 @@ PRIMITIVE(set_callstack)
        PRIMITIVE_GETVM()->primitive_set_callstack();
 }
 
-code_block *factorvm::frame_code(stack_frame *frame)
+code_block *factor_vm::frame_code(stack_frame *frame)
 {
        check_frame(frame);
        return (code_block *)frame->xt - 1;
 }
 
-cell factorvm::frame_type(stack_frame *frame)
+cell factor_vm::frame_type(stack_frame *frame)
 {
        return frame_code(frame)->type;
 }
 
-cell factorvm::frame_executing(stack_frame *frame)
+cell factor_vm::frame_executing(stack_frame *frame)
 {
        code_block *compiled = frame_code(frame);
        if(compiled->literals == F || !stack_traces_p())
@@ -108,14 +108,14 @@ cell factorvm::frame_executing(stack_frame *frame)
        }
 }
 
-stack_frame *factorvm::frame_successor(stack_frame *frame)
+stack_frame *factor_vm::frame_successor(stack_frame *frame)
 {
        check_frame(frame);
        return (stack_frame *)((cell)frame - frame->size);
 }
 
 /* Allocates memory */
-cell factorvm::frame_scan(stack_frame *frame)
+cell factor_vm::frame_scan(stack_frame *frame)
 {
        switch(frame_type(frame))
        {
@@ -147,9 +147,9 @@ namespace
 struct stack_frame_accumulator {
        growable_array frames;
 
-       stack_frame_accumulator(factorvm *vm) : frames(vm) {} 
+       stack_frame_accumulator(factor_vm *vm) : frames(vm) {} 
 
-       void operator()(stack_frame *frame, factorvm *myvm)
+       void operator()(stack_frame *frame, factor_vm *myvm)
        {
                gc_root<object> executing(myvm->frame_executing(frame),myvm);
                gc_root<object> scan(myvm->frame_scan(frame),myvm);
@@ -161,7 +161,7 @@ struct stack_frame_accumulator {
 
 }
 
-inline void factorvm::primitive_callstack_to_array()
+inline void factor_vm::primitive_callstack_to_array()
 {
        gc_root<callstack> callstack(dpop(),this);
 
@@ -177,7 +177,7 @@ PRIMITIVE(callstack_to_array)
        PRIMITIVE_GETVM()->primitive_callstack_to_array();
 }
 
-stack_frame *factorvm::innermost_stack_frame(callstack *stack)
+stack_frame *factor_vm::innermost_stack_frame(callstack *stack)
 {
        stack_frame *top = stack->top();
        stack_frame *bottom = stack->bottom();
@@ -189,7 +189,7 @@ stack_frame *factorvm::innermost_stack_frame(callstack *stack)
        return frame;
 }
 
-stack_frame *factorvm::innermost_stack_frame_quot(callstack *callstack)
+stack_frame *factor_vm::innermost_stack_frame_quot(callstack *callstack)
 {
        stack_frame *inner = innermost_stack_frame(callstack);
        tagged<quotation>(frame_executing(inner)).untag_check(this);
@@ -198,7 +198,7 @@ stack_frame *factorvm::innermost_stack_frame_quot(callstack *callstack)
 
 /* Some primitives implementing a limited form of callstack mutation.
 Used by the single stepper. */
-inline void factorvm::primitive_innermost_stack_frame_executing()
+inline void factor_vm::primitive_innermost_stack_frame_executing()
 {
        dpush(frame_executing(innermost_stack_frame(untag_check<callstack>(dpop()))));
 }
@@ -208,7 +208,7 @@ PRIMITIVE(innermost_stack_frame_executing)
        PRIMITIVE_GETVM()->primitive_innermost_stack_frame_executing();
 }
 
-inline void factorvm::primitive_innermost_stack_frame_scan()
+inline void factor_vm::primitive_innermost_stack_frame_scan()
 {
        dpush(frame_scan(innermost_stack_frame_quot(untag_check<callstack>(dpop()))));
 }
@@ -218,7 +218,7 @@ PRIMITIVE(innermost_stack_frame_scan)
        PRIMITIVE_GETVM()->primitive_innermost_stack_frame_scan();
 }
 
-inline void factorvm::primitive_set_innermost_stack_frame_quot()
+inline void factor_vm::primitive_set_innermost_stack_frame_quot()
 {
        gc_root<callstack> callstack(dpop(),this);
        gc_root<quotation> quot(dpop(),this);
@@ -240,12 +240,12 @@ PRIMITIVE(set_innermost_stack_frame_quot)
 }
 
 /* called before entry into Factor code. */
-void factorvm::save_callstack_bottom(stack_frame *callstack_bottom)
+void factor_vm::save_callstack_bottom(stack_frame *callstack_bottom)
 {
        stack_chain->callstack_bottom = callstack_bottom;
 }
 
-VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom, factorvm *myvm)
+VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->save_callstack_bottom(callstack_bottom);
index 0a6e8ff936088eb5c259ef8b43f8ae937bb6ea23..ae1e80ca9aedca460f74762aebef82770570e194 100755 (executable)
@@ -13,7 +13,7 @@ PRIMITIVE(innermost_stack_frame_executing);
 PRIMITIVE(innermost_stack_frame_scan);
 PRIMITIVE(set_innermost_stack_frame_quot);
 
-VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom,factorvm *vm);
+VM_ASM_API void save_callstack_bottom(stack_frame *callstack_bottom,factor_vm *vm);
 
 
 }
index c007ace39bd649df9e4264b8a78277266b6056d1..2251345af749970a3ea5af6b6cfeb69efea85bfa 100755 (executable)
@@ -3,27 +3,27 @@
 namespace factor
 {
 
-relocation_type factorvm::relocation_type_of(relocation_entry r)
+relocation_type factor_vm::relocation_type_of(relocation_entry r)
 {
        return (relocation_type)((r & 0xf0000000) >> 28);
 }
 
-relocation_class factorvm::relocation_class_of(relocation_entry r)
+relocation_class factor_vm::relocation_class_of(relocation_entry r)
 {
        return (relocation_class)((r & 0x0f000000) >> 24);
 }
 
-cell factorvm::relocation_offset_of(relocation_entry r)
+cell factor_vm::relocation_offset_of(relocation_entry r)
 {
        return (r & 0x00ffffff);
 }
 
-void factorvm::flush_icache_for(code_block *block)
+void factor_vm::flush_icache_for(code_block *block)
 {
        flush_icache((cell)block,block->size);
 }
 
-int factorvm::number_of_parameters(relocation_type type)
+int factor_vm::number_of_parameters(relocation_type type)
 {
        switch(type)
        {
@@ -48,7 +48,7 @@ int factorvm::number_of_parameters(relocation_type type)
        }
 }
 
-void *factorvm::object_xt(cell obj)
+void *factor_vm::object_xt(cell obj)
 {
        switch(tagged<object>(obj).type())
        {
@@ -62,7 +62,7 @@ void *factorvm::object_xt(cell obj)
        }
 }
 
-void *factorvm::xt_pic(word *w, cell tagged_quot)
+void *factor_vm::xt_pic(word *w, cell tagged_quot)
 {
        if(tagged_quot == F || max_pic_size == 0)
                return w->xt;
@@ -76,30 +76,30 @@ void *factorvm::xt_pic(word *w, cell tagged_quot)
        }
 }
 
-void *factorvm::word_xt_pic(word *w)
+void *factor_vm::word_xt_pic(word *w)
 {
        return xt_pic(w,w->pic_def);
 }
 
-void *factorvm::word_xt_pic_tail(word *w)
+void *factor_vm::word_xt_pic_tail(word *w)
 {
        return xt_pic(w,w->pic_tail_def);
 }
 
 /* References to undefined symbols are patched up to call this function on
 image load */
-void factorvm::undefined_symbol()
+void factor_vm::undefined_symbol()
 {
        general_error(ERROR_UNDEFINED_SYMBOL,F,F,NULL);
 }
 
-void undefined_symbol(factorvm *myvm)
+void undefined_symbol(factor_vm *myvm)
 {
        return myvm->undefined_symbol();
 }
 
 /* Look up an external library symbol referenced by a compiled code block */
-void *factorvm::get_rel_symbol(array *literals, cell index)
+void *factor_vm::get_rel_symbol(array *literals, cell index)
 {
        cell symbol = array_nth(literals,index);
        cell library = array_nth(literals,index + 1);
@@ -143,7 +143,7 @@ void *factorvm::get_rel_symbol(array *literals, cell index)
        }
 }
 
-cell factorvm::compute_relocation(relocation_entry rel, cell index, code_block *compiled)
+cell factor_vm::compute_relocation(relocation_entry rel, cell index, code_block *compiled)
 {
        array *literals = untag<array>(compiled->literals);
        cell offset = relocation_offset_of(rel) + (cell)compiled->xt();
@@ -187,7 +187,7 @@ cell factorvm::compute_relocation(relocation_entry rel, cell index, code_block *
 #undef ARG
 }
 
-void factorvm::iterate_relocations(code_block *compiled, relocation_iterator iter)
+void factor_vm::iterate_relocations(code_block *compiled, relocation_iterator iter)
 {
        if(compiled->relocation != F)
        {
@@ -206,14 +206,14 @@ void factorvm::iterate_relocations(code_block *compiled, relocation_iterator ite
 }
 
 /* Store a 32-bit value into a PowerPC LIS/ORI sequence */
-void factorvm::store_address_2_2(cell *ptr, cell value)
+void factor_vm::store_address_2_2(cell *ptr, cell value)
 {
        ptr[-1] = ((ptr[-1] & ~0xffff) | ((value >> 16) & 0xffff));
        ptr[ 0] = ((ptr[ 0] & ~0xffff) | (value & 0xffff));
 }
 
 /* Store a value into a bitfield of a PowerPC instruction */
-void factorvm::store_address_masked(cell *ptr, fixnum value, cell mask, fixnum shift)
+void factor_vm::store_address_masked(cell *ptr, fixnum value, cell mask, fixnum shift)
 {
        /* This is unaccurate but good enough */
        fixnum test = (fixnum)mask >> 1;
@@ -224,7 +224,7 @@ void factorvm::store_address_masked(cell *ptr, fixnum value, cell mask, fixnum s
 }
 
 /* Perform a fixup on a code block */
-void factorvm::store_address_in_code_block(cell klass, cell offset, fixnum absolute_value)
+void factor_vm::store_address_in_code_block(cell klass, cell offset, fixnum absolute_value)
 {
        fixnum relative_value = absolute_value - offset;
 
@@ -269,7 +269,7 @@ void factorvm::store_address_in_code_block(cell klass, cell offset, fixnum absol
        }
 }
 
-void factorvm::update_literal_references_step(relocation_entry rel, cell index, code_block *compiled)
+void factor_vm::update_literal_references_step(relocation_entry rel, cell index, code_block *compiled)
 {
        if(relocation_type_of(rel) == RT_IMMEDIATE)
        {
@@ -280,13 +280,13 @@ void factorvm::update_literal_references_step(relocation_entry rel, cell index,
        }
 }
 
-void update_literal_references_step(relocation_entry rel, cell index, code_block *compiled, factorvm *myvm)
+void update_literal_references_step(relocation_entry rel, cell index, code_block *compiled, factor_vm *myvm)
 {
        return myvm->update_literal_references_step(rel,index,compiled);
 }
 
 /* Update pointers to literals from compiled code. */
-void factorvm::update_literal_references(code_block *compiled)
+void factor_vm::update_literal_references(code_block *compiled)
 {
        if(!compiled->needs_fixup)
        {
@@ -297,7 +297,7 @@ void factorvm::update_literal_references(code_block *compiled)
 
 /* Copy all literals referenced from a code block to newspace. Only for
 aging and nursery collections */
-void factorvm::copy_literal_references(code_block *compiled)
+void factor_vm::copy_literal_references(code_block *compiled)
 {
        if(collecting_gen >= compiled->last_scan)
        {
@@ -320,13 +320,13 @@ void factorvm::copy_literal_references(code_block *compiled)
        }
 }
 
-void copy_literal_references(code_block *compiled, factorvm *myvm)
+void copy_literal_references(code_block *compiled, factor_vm *myvm)
 {
        return myvm->copy_literal_references(compiled);
 }
 
 /* Compute an address to store at a relocation */
-void factorvm::relocate_code_block_step(relocation_entry rel, cell index, code_block *compiled)
+void factor_vm::relocate_code_block_step(relocation_entry rel, cell index, code_block *compiled)
 {
 #ifdef FACTOR_DEBUG
        tagged<array>(compiled->literals).untag_check(this);
@@ -338,19 +338,19 @@ void factorvm::relocate_code_block_step(relocation_entry rel, cell index, code_b
                                    compute_relocation(rel,index,compiled));
 }
 
-void relocate_code_block_step(relocation_entry rel, cell index, code_block *compiled, factorvm *myvm)
+void relocate_code_block_step(relocation_entry rel, cell index, code_block *compiled, factor_vm *myvm)
 {
        return myvm->relocate_code_block_step(rel,index,compiled);
 }
 
-void factorvm::update_word_references_step(relocation_entry rel, cell index, code_block *compiled)
+void factor_vm::update_word_references_step(relocation_entry rel, cell index, code_block *compiled)
 {
        relocation_type type = relocation_type_of(rel);
        if(type == RT_XT || type == RT_XT_PIC || type == RT_XT_PIC_TAIL)
                relocate_code_block_step(rel,index,compiled);
 }
 
-void update_word_references_step(relocation_entry rel, cell index, code_block *compiled, factorvm *myvm)
+void update_word_references_step(relocation_entry rel, cell index, code_block *compiled, factor_vm *myvm)
 {
        return myvm->update_word_references_step(rel,index,compiled);
 }
@@ -359,7 +359,7 @@ void update_word_references_step(relocation_entry rel, cell index, code_block *c
 dlsyms, and words. For all other words in the code heap, we only need
 to update references to other words, without worrying about literals
 or dlsyms. */
-void factorvm::update_word_references(code_block *compiled)
+void factor_vm::update_word_references(code_block *compiled)
 {
        if(compiled->needs_fixup)
                relocate_code_block(compiled);
@@ -379,23 +379,23 @@ void factorvm::update_word_references(code_block *compiled)
        }
 }
 
-void update_word_references(code_block *compiled, factorvm *myvm)
+void update_word_references(code_block *compiled, factor_vm *myvm)
 {
        return myvm->update_word_references(compiled);
 }
 
-void factorvm::update_literal_and_word_references(code_block *compiled)
+void factor_vm::update_literal_and_word_references(code_block *compiled)
 {
        update_literal_references(compiled);
        update_word_references(compiled);
 }
 
-void update_literal_and_word_references(code_block *compiled, factorvm *myvm)
+void update_literal_and_word_references(code_block *compiled, factor_vm *myvm)
 {
        return myvm->update_literal_and_word_references(compiled);
 }
 
-void factorvm::check_code_address(cell address)
+void factor_vm::check_code_address(cell address)
 {
 #ifdef FACTOR_DEBUG
        assert(address >= code.seg->start && address < code.seg->end);
@@ -407,7 +407,7 @@ is added to the heap. */
 
 /* Mark all literals referenced from a word XT. Only for tenured
 collections */
-void factorvm::mark_code_block(code_block *compiled)
+void factor_vm::mark_code_block(code_block *compiled)
 {
        check_code_address((cell)compiled);
 
@@ -417,18 +417,18 @@ void factorvm::mark_code_block(code_block *compiled)
        copy_handle(&compiled->relocation);
 }
 
-void factorvm::mark_stack_frame_step(stack_frame *frame)
+void factor_vm::mark_stack_frame_step(stack_frame *frame)
 {
        mark_code_block(frame_code(frame));
 }
 
-void mark_stack_frame_step(stack_frame *frame, factorvm *myvm)
+void mark_stack_frame_step(stack_frame *frame, factor_vm *myvm)
 {
        return myvm->mark_stack_frame_step(frame);
 }
 
 /* Mark code blocks executing in currently active stack frames. */
-void factorvm::mark_active_blocks(context *stacks)
+void factor_vm::mark_active_blocks(context *stacks)
 {
        if(collecting_gen == data->tenured())
        {
@@ -439,7 +439,7 @@ void factorvm::mark_active_blocks(context *stacks)
        }
 }
 
-void factorvm::mark_object_code_block(object *object)
+void factor_vm::mark_object_code_block(object *object)
 {
        switch(object->h.hi_tag())
        {
@@ -469,7 +469,7 @@ void factorvm::mark_object_code_block(object *object)
 }
 
 /* Perform all fixups on a code block */
-void factorvm::relocate_code_block(code_block *compiled)
+void factor_vm::relocate_code_block(code_block *compiled)
 {
        compiled->last_scan = data->nursery();
        compiled->needs_fixup = false;
@@ -477,13 +477,13 @@ void factorvm::relocate_code_block(code_block *compiled)
        flush_icache_for(compiled);
 }
 
-void relocate_code_block(code_block *compiled, factorvm *myvm)
+void relocate_code_block(code_block *compiled, factor_vm *myvm)
 {
        return myvm->relocate_code_block(compiled);
 }
 
 /* Fixup labels. This is done at compile time, not image load time */
-void factorvm::fixup_labels(array *labels, code_block *compiled)
+void factor_vm::fixup_labels(array *labels, code_block *compiled)
 {
        cell i;
        cell size = array_capacity(labels);
@@ -501,7 +501,7 @@ void factorvm::fixup_labels(array *labels, code_block *compiled)
 }
 
 /* Might GC */
-code_block *factorvm::allot_code_block(cell size)
+code_block *factor_vm::allot_code_block(cell size)
 {
        heap_block *block = heap_allot(&code,size + sizeof(code_block));
 
@@ -529,7 +529,7 @@ code_block *factorvm::allot_code_block(cell size)
 }
 
 /* Might GC */
-code_block *factorvm::add_code_block(cell type, cell code_, cell labels_, cell relocation_, cell literals_)
+code_block *factor_vm::add_code_block(cell type, cell code_, cell labels_, cell relocation_, cell literals_)
 {
        gc_root<byte_array> code(code_,this);
        gc_root<object> labels(labels_,this);
index 60d1a127cd0fe3c76390b8f7b507a8de00eb1e0d..0a7e0e9cc8ccf4c62f7f8cdf81ada26bd4a08284 100644 (file)
@@ -62,14 +62,14 @@ static const cell rel_relative_arm_3_mask = 0xffffff;
 /* code relocation table consists of a table of entries for each fixup */
 typedef u32 relocation_entry;
 
-struct factorvm;
+struct factor_vm;
 
-typedef void (*relocation_iterator)(relocation_entry rel, cell index, code_block *compiled, factorvm *vm);
+typedef void (*relocation_iterator)(relocation_entry rel, cell index, code_block *compiled, factor_vm *vm);
 
 // callback functions
-void relocate_code_block(code_block *compiled, factorvm *myvm);
-void copy_literal_references(code_block *compiled, factorvm *myvm);
-void update_word_references(code_block *compiled, factorvm *myvm);
-void update_literal_and_word_references(code_block *compiled, factorvm *myvm);
+void relocate_code_block(code_block *compiled, factor_vm *myvm);
+void copy_literal_references(code_block *compiled, factor_vm *myvm);
+void update_word_references(code_block *compiled, factor_vm *myvm);
+void update_literal_and_word_references(code_block *compiled, factor_vm *myvm);
 
 }
index 45330dfbee5995b87c542bece85e907aed442b5a..1c372368dda1606abaf4e6c7b93b55560a21eecc 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-void factorvm::clear_free_list(heap *heap)
+void factor_vm::clear_free_list(heap *heap)
 {
        memset(&heap->free,0,sizeof(heap_free_list));
 }
@@ -11,7 +11,7 @@ void factorvm::clear_free_list(heap *heap)
 /* This malloc-style heap code is reasonably generic. Maybe in the future, it
 will be used for the data heap too, if we ever get incremental
 mark/sweep/compact GC. */
-void factorvm::new_heap(heap *heap, cell size)
+void factor_vm::new_heap(heap *heap, cell size)
 {
        heap->seg = alloc_segment(align_page(size));
        if(!heap->seg)
@@ -20,7 +20,7 @@ void factorvm::new_heap(heap *heap, cell size)
        clear_free_list(heap);
 }
 
-void factorvm::add_to_free_list(heap *heap, free_heap_block *block)
+void factor_vm::add_to_free_list(heap *heap, free_heap_block *block)
 {
        if(block->size < free_list_count * block_size_increment)
        {
@@ -39,7 +39,7 @@ void factorvm::add_to_free_list(heap *heap, free_heap_block *block)
 
 In the former case, we must add a large free block from compiling.base + size to
 compiling.limit. */
-void factorvm::build_free_list(heap *heap, cell size)
+void factor_vm::build_free_list(heap *heap, cell size)
 {
        heap_block *prev = NULL;
 
@@ -91,14 +91,14 @@ void factorvm::build_free_list(heap *heap, cell size)
 
 }
 
-void factorvm::assert_free_block(free_heap_block *block)
+void factor_vm::assert_free_block(free_heap_block *block)
 {
        if(block->status != B_FREE)
                critical_error("Invalid block in free list",(cell)block);
 }
 
                
-free_heap_block *factorvm::find_free_block(heap *heap, cell size)
+free_heap_block *factor_vm::find_free_block(heap *heap, cell size)
 {
        cell attempt = size;
 
@@ -138,7 +138,7 @@ free_heap_block *factorvm::find_free_block(heap *heap, cell size)
        return NULL;
 }
 
-free_heap_block *factorvm::split_free_block(heap *heap, free_heap_block *block, cell size)
+free_heap_block *factor_vm::split_free_block(heap *heap, free_heap_block *block, cell size)
 {
        if(block->size != size )
        {
@@ -155,7 +155,7 @@ free_heap_block *factorvm::split_free_block(heap *heap, free_heap_block *block,
 }
 
 /* Allocate a block of memory from the mark and sweep GC heap */
-heap_block *factorvm::heap_allot(heap *heap, cell size)
+heap_block *factor_vm::heap_allot(heap *heap, cell size)
 {
        size = (size + block_size_increment - 1) & ~(block_size_increment - 1);
 
@@ -172,13 +172,13 @@ heap_block *factorvm::heap_allot(heap *heap, cell size)
 }
 
 /* Deallocates a block manually */
-void factorvm::heap_free(heap *heap, heap_block *block)
+void factor_vm::heap_free(heap *heap, heap_block *block)
 {
        block->status = B_FREE;
        add_to_free_list(heap,(free_heap_block *)block);
 }
 
-void factorvm::mark_block(heap_block *block)
+void factor_vm::mark_block(heap_block *block)
 {
        /* If already marked, do nothing */
        switch(block->status)
@@ -196,7 +196,7 @@ void factorvm::mark_block(heap_block *block)
 
 /* If in the middle of code GC, we have to grow the heap, data GC restarts from
 scratch, so we have to unmark any marked blocks. */
-void factorvm::unmark_marked(heap *heap)
+void factor_vm::unmark_marked(heap *heap)
 {
        heap_block *scan = first_block(heap);
 
@@ -211,7 +211,7 @@ void factorvm::unmark_marked(heap *heap)
 
 /* After code GC, all referenced code blocks have status set to B_MARKED, so any
 which are allocated and not marked can be reclaimed. */
-void factorvm::free_unmarked(heap *heap, heap_iterator iter)
+void factor_vm::free_unmarked(heap *heap, heap_iterator iter)
 {
        clear_free_list(heap);
 
@@ -259,7 +259,7 @@ void factorvm::free_unmarked(heap *heap, heap_iterator iter)
 }
 
 /* Compute total sum of sizes of free blocks, and size of largest free block */
-void factorvm::heap_usage(heap *heap, cell *used, cell *total_free, cell *max_free)
+void factor_vm::heap_usage(heap *heap, cell *used, cell *total_free, cell *max_free)
 {
        *used = 0;
        *total_free = 0;
@@ -288,7 +288,7 @@ void factorvm::heap_usage(heap *heap, cell *used, cell *total_free, cell *max_fr
 }
 
 /* The size of the heap, not including the last block if it's free */
-cell factorvm::heap_size(heap *heap)
+cell factor_vm::heap_size(heap *heap)
 {
        heap_block *scan = first_block(heap);
 
@@ -304,7 +304,7 @@ cell factorvm::heap_size(heap *heap)
 }
 
 /* Compute where each block is going to go, after compaction */
-cell factorvm::compute_heap_forwarding(heap *heap, unordered_map<heap_block *,char *> &forwarding)
+cell factor_vm::compute_heap_forwarding(heap *heap, unordered_map<heap_block *,char *> &forwarding)
 {
        heap_block *scan = first_block(heap);
        char *address = (char *)first_block(heap);
@@ -325,7 +325,7 @@ cell factorvm::compute_heap_forwarding(heap *heap, unordered_map<heap_block *,ch
        return (cell)address - heap->seg->start;
 }
 
-void factorvm::compact_heap(heap *heap, unordered_map<heap_block *,char *> &forwarding)
+void factor_vm::compact_heap(heap *heap, unordered_map<heap_block *,char *> &forwarding)
 {
        heap_block *scan = first_block(heap);
 
index c59980dc30dad1725a5d854d59ac5d610e9107c0..d2cfba0cf4c29c1b11873e717c70db17cdc7514d 100755 (executable)
@@ -14,7 +14,7 @@ struct heap {
        heap_free_list free;
 };
 
-typedef void (*heap_iterator)(heap_block *compiled,factorvm *vm);
+typedef void (*heap_iterator)(heap_block *compiled,factor_vm *vm);
 
 inline static heap_block *next_block(heap *h, heap_block *block)
 {
index 19b28e06da627560e67460f887b82e25a00cd288..b2361d94ce84f8973404a0fc9d987e2299287efa 100755 (executable)
@@ -4,18 +4,18 @@ namespace factor
 {
 
 /* Allocate a code heap during startup */
-void factorvm::init_code_heap(cell size)
+void factor_vm::init_code_heap(cell size)
 {
        new_heap(&code,size);
 }
 
-bool factorvm::in_code_heap_p(cell ptr)
+bool factor_vm::in_code_heap_p(cell ptr)
 {
        return (ptr >= code.seg->start && ptr <= code.seg->end);
 }
 
 /* Compile a word definition with the non-optimizing compiler. Allocates memory */
-void factorvm::jit_compile_word(cell word_, cell def_, bool relocate)
+void factor_vm::jit_compile_word(cell word_, cell def_, bool relocate)
 {
        gc_root<word> word(word_,this);
        gc_root<quotation> def(def_,this);
@@ -29,7 +29,7 @@ void factorvm::jit_compile_word(cell word_, cell def_, bool relocate)
 }
 
 /* Apply a function to every code block */
-void factorvm::iterate_code_heap(code_heap_iterator iter)
+void factor_vm::iterate_code_heap(code_heap_iterator iter)
 {
        heap_block *scan = first_block(&code);
 
@@ -43,19 +43,19 @@ void factorvm::iterate_code_heap(code_heap_iterator iter)
 
 /* Copy literals referenced from all code blocks to newspace. Only for
 aging and nursery collections */
-void factorvm::copy_code_heap_roots()
+void factor_vm::copy_code_heap_roots()
 {
        iterate_code_heap(factor::copy_literal_references);
 }
 
 /* Update pointers to words referenced from all code blocks. Only after
 defining a new word. */
-void factorvm::update_code_heap_words()
+void factor_vm::update_code_heap_words()
 {
        iterate_code_heap(factor::update_word_references);
 }
 
-inline void factorvm::primitive_modify_code_heap()
+inline void factor_vm::primitive_modify_code_heap()
 {
        gc_root<array> alist(dpop(),this);
 
@@ -112,7 +112,7 @@ PRIMITIVE(modify_code_heap)
 }
 
 /* Push the free space and total size of the code heap */
-inline void factorvm::primitive_code_room()
+inline void factor_vm::primitive_code_room()
 {
        cell used, total_free, max_free;
        heap_usage(&code,&used,&total_free,&max_free);
@@ -127,12 +127,12 @@ PRIMITIVE(code_room)
        PRIMITIVE_GETVM()->primitive_code_room();
 }
 
-code_block *factorvm::forward_xt(code_block *compiled)
+code_block *factor_vm::forward_xt(code_block *compiled)
 {
        return (code_block *)forwarding[compiled];
 }
 
-void factorvm::forward_frame_xt(stack_frame *frame)
+void factor_vm::forward_frame_xt(stack_frame *frame)
 {
        cell offset = (cell)FRAME_RETURN_ADDRESS(frame) - (cell)frame_code(frame);
        code_block *forwarded = forward_xt(frame_code(frame));
@@ -140,12 +140,12 @@ void factorvm::forward_frame_xt(stack_frame *frame)
        FRAME_RETURN_ADDRESS(frame) = (void *)((cell)forwarded + offset);
 }
 
-void forward_frame_xt(stack_frame *frame,factorvm *myvm)
+void forward_frame_xt(stack_frame *frame,factor_vm *myvm)
 {
        return myvm->forward_frame_xt(frame);
 }
 
-void factorvm::forward_object_xts()
+void factor_vm::forward_object_xts()
 {
        begin_scan();
 
@@ -188,7 +188,7 @@ void factorvm::forward_object_xts()
 }
 
 /* Set the XT fields now that the heap has been compacted */
-void factorvm::fixup_object_xts()
+void factor_vm::fixup_object_xts()
 {
        begin_scan();
 
@@ -220,7 +220,7 @@ void factorvm::fixup_object_xts()
 since it makes several passes over the code and data heaps, but we only ever
 do this before saving a deployed image and exiting, so performaance is not
 critical here */
-void factorvm::compact_code_heap()
+void factor_vm::compact_code_heap()
 {
        /* Free all unreachable code blocks */
        gc();
index a357699591b9bae7a86a425ecd6583c5541b7331..709ec85f955e720883cfb59ab3a8636c849caf66 100755 (executable)
@@ -1,7 +1,7 @@
 namespace factor
 {
-struct factorvm;
-typedef void (*code_heap_iterator)(code_block *compiled,factorvm *myvm);
+struct factor_vm;
+typedef void (*code_heap_iterator)(code_block *compiled,factor_vm *myvm);
 
 PRIMITIVE(modify_code_heap);
 PRIMITIVE(code_room);
index 65046e346aca9b2548f44cc144cd17b38158ef3d..6e821552edcee561da84d37f1ce5e86b8bea9585 100644 (file)
@@ -3,19 +3,19 @@
 namespace factor
 {
 
-void factorvm::reset_datastack()
+void factor_vm::reset_datastack()
 {
        ds = ds_bot - sizeof(cell);
 }
 
-void factorvm::reset_retainstack()
+void factor_vm::reset_retainstack()
 {
        rs = rs_bot - sizeof(cell);
 }
 
 static const cell stack_reserved = (64 * sizeof(cell));
 
-void factorvm::fix_stacks()
+void factor_vm::fix_stacks()
 {
        if(ds + sizeof(cell) < ds_bot || ds + stack_reserved >= ds_top) reset_datastack();
        if(rs + sizeof(cell) < rs_bot || rs + stack_reserved >= rs_top) reset_retainstack();
@@ -23,7 +23,7 @@ void factorvm::fix_stacks()
 
 /* called before entry into foreign C code. Note that ds and rs might
 be stored in registers, so callbacks must save and restore the correct values */
-void factorvm::save_stacks()
+void factor_vm::save_stacks()
 {
        if(stack_chain)
        {
@@ -32,7 +32,7 @@ void factorvm::save_stacks()
        }
 }
 
-context *factorvm::alloc_context()
+context *factor_vm::alloc_context()
 {
        context *new_context;
 
@@ -51,14 +51,14 @@ context *factorvm::alloc_context()
        return new_context;
 }
 
-void factorvm::dealloc_context(context *old_context)
+void factor_vm::dealloc_context(context *old_context)
 {
        old_context->next = unused_contexts;
        unused_contexts = old_context;
 }
 
 /* called on entry into a compiled callback */
-void factorvm::nest_stacks()
+void factor_vm::nest_stacks()
 {
        context *new_context = alloc_context();
 
@@ -89,14 +89,14 @@ void factorvm::nest_stacks()
        reset_retainstack();
 }
 
-void nest_stacks(factorvm *myvm)
+void nest_stacks(factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->nest_stacks();
 }
 
 /* called when leaving a compiled callback */
-void factorvm::unnest_stacks()
+void factor_vm::unnest_stacks()
 {
        ds = stack_chain->datastack_save;
        rs = stack_chain->retainstack_save;
@@ -110,14 +110,14 @@ void factorvm::unnest_stacks()
        dealloc_context(old_stacks);
 }
 
-void unnest_stacks(factorvm *myvm)
+void unnest_stacks(factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->unnest_stacks();
 }
 
 /* called on startup */
-void factorvm::init_stacks(cell ds_size_, cell rs_size_)
+void factor_vm::init_stacks(cell ds_size_, cell rs_size_)
 {
        ds_size = ds_size_;
        rs_size = rs_size_;
@@ -125,7 +125,7 @@ void factorvm::init_stacks(cell ds_size_, cell rs_size_)
        unused_contexts = NULL;
 }
 
-bool factorvm::stack_to_array(cell bottom, cell top)
+bool factor_vm::stack_to_array(cell bottom, cell top)
 {
        fixnum depth = (fixnum)(top - bottom + sizeof(cell));
 
@@ -140,7 +140,7 @@ bool factorvm::stack_to_array(cell bottom, cell top)
        }
 }
 
-inline void factorvm::primitive_datastack()
+inline void factor_vm::primitive_datastack()
 {
        if(!stack_to_array(ds_bot,ds))
                general_error(ERROR_DS_UNDERFLOW,F,F,NULL);
@@ -151,7 +151,7 @@ PRIMITIVE(datastack)
        PRIMITIVE_GETVM()->primitive_datastack();
 }
 
-inline void factorvm::primitive_retainstack()
+inline void factor_vm::primitive_retainstack()
 {
        if(!stack_to_array(rs_bot,rs))
                general_error(ERROR_RS_UNDERFLOW,F,F,NULL);
@@ -163,14 +163,14 @@ PRIMITIVE(retainstack)
 }
 
 /* returns pointer to top of stack */
-cell factorvm::array_to_stack(array *array, cell bottom)
+cell factor_vm::array_to_stack(array *array, cell bottom)
 {
        cell depth = array_capacity(array) * sizeof(cell);
        memcpy((void*)bottom,array + 1,depth);
        return bottom + depth - sizeof(cell);
 }
 
-inline void factorvm::primitive_set_datastack()
+inline void factor_vm::primitive_set_datastack()
 {
        ds = array_to_stack(untag_check<array>(dpop()),ds_bot);
 }
@@ -180,7 +180,7 @@ PRIMITIVE(set_datastack)
        PRIMITIVE_GETVM()->primitive_set_datastack();
 }
 
-inline void factorvm::primitive_set_retainstack()
+inline void factor_vm::primitive_set_retainstack()
 {
        rs = array_to_stack(untag_check<array>(dpop()),rs_bot);
 }
@@ -191,7 +191,7 @@ PRIMITIVE(set_retainstack)
 }
 
 /* Used to implement call( */
-inline void factorvm::primitive_check_datastack()
+inline void factor_vm::primitive_check_datastack()
 {
        fixnum out = to_fixnum(dpop());
        fixnum in = to_fixnum(dpop());
index 060b15fad770dc4eaa910b6f5f20a813c7136ea5..fae451f02cb5453532edc82bfde32d4d8fb25cc7 100644 (file)
@@ -50,9 +50,9 @@ PRIMITIVE(set_datastack);
 PRIMITIVE(set_retainstack);
 PRIMITIVE(check_datastack);
 
-struct factorvm;
-VM_C_API void nest_stacks(factorvm *vm);
-VM_C_API void unnest_stacks(factorvm *vm);
+struct factor_vm;
+VM_C_API void nest_stacks(factor_vm *vm);
+VM_C_API void unnest_stacks(factor_vm *vm);
 
 }
 
index 333fe5c67dfa9e8e7640e83bc1181a935a1eecb7..8766cc8c7c60a744d0ad69c8efc3763c55350eaf 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-void factorvm::init_data_gc()
+void factor_vm::init_data_gc()
 {
        performing_gc = false;
        last_code_heap_scan = data->nursery();
@@ -11,7 +11,7 @@ void factorvm::init_data_gc()
 }
 
 /* Given a pointer to oldspace, copy it to newspace */
-object *factorvm::copy_untagged_object_impl(object *pointer, cell size)
+object *factor_vm::copy_untagged_object_impl(object *pointer, cell size)
 {
        if(newspace->here + size >= newspace->end)
                longjmp(gc_jmp,1);
@@ -25,14 +25,14 @@ object *factorvm::copy_untagged_object_impl(object *pointer, cell size)
        return newpointer;
 }
 
-object *factorvm::copy_object_impl(object *untagged)
+object *factor_vm::copy_object_impl(object *untagged)
 {
        object *newpointer = copy_untagged_object_impl(untagged,untagged_object_size(untagged));
        untagged->h.forward_to(newpointer);
        return newpointer;
 }
 
-bool factorvm::should_copy_p(object *untagged)
+bool factor_vm::should_copy_p(object *untagged)
 {
        if(in_zone(newspace,untagged))
                return false;
@@ -50,7 +50,7 @@ bool factorvm::should_copy_p(object *untagged)
 }
 
 /* Follow a chain of forwarding pointers */
-object *factorvm::resolve_forwarding(object *untagged)
+object *factor_vm::resolve_forwarding(object *untagged)
 {
        check_data_pointer(untagged);
 
@@ -68,7 +68,7 @@ object *factorvm::resolve_forwarding(object *untagged)
        }
 }
 
-template <typename TYPE> TYPE *factorvm::copy_untagged_object(TYPE *untagged)
+template <typename TYPE> TYPE *factor_vm::copy_untagged_object(TYPE *untagged)
 {
        check_data_pointer(untagged);
 
@@ -83,12 +83,12 @@ template <typename TYPE> TYPE *factorvm::copy_untagged_object(TYPE *untagged)
        return untagged;
 }
 
-cell factorvm::copy_object(cell pointer)
+cell factor_vm::copy_object(cell pointer)
 {
        return RETAG(copy_untagged_object(untag<object>(pointer)),TAG(pointer));
 }
 
-void factorvm::copy_handle(cell *handle)
+void factor_vm::copy_handle(cell *handle)
 {
        cell pointer = *handle;
 
@@ -102,7 +102,7 @@ void factorvm::copy_handle(cell *handle)
 }
 
 /* Scan all the objects in the card */
-void factorvm::copy_card(card *ptr, cell gen, cell here)
+void factor_vm::copy_card(card *ptr, cell gen, cell here)
 {
        cell card_scan = card_to_addr(ptr) + card_offset(ptr);
        cell card_end = card_to_addr(ptr + 1);
@@ -115,7 +115,7 @@ void factorvm::copy_card(card *ptr, cell gen, cell here)
        cards_scanned++;
 }
 
-void factorvm::copy_card_deck(card_deck *deck, cell gen, card mask, card unmask)
+void factor_vm::copy_card_deck(card_deck *deck, cell gen, card mask, card unmask)
 {
        card *first_card = deck_to_card(deck);
        card *last_card = deck_to_card(deck + 1);
@@ -147,7 +147,7 @@ void factorvm::copy_card_deck(card_deck *deck, cell gen, card mask, card unmask)
 }
 
 /* Copy all newspace objects referenced from marked cards to the destination */
-void factorvm::copy_gen_cards(cell gen)
+void factor_vm::copy_gen_cards(cell gen)
 {
        card_deck *first_deck = addr_to_deck(data->generations[gen].start);
        card_deck *last_deck = addr_to_deck(data->generations[gen].end);
@@ -214,7 +214,7 @@ void factorvm::copy_gen_cards(cell gen)
 
 /* Scan cards in all generations older than the one being collected, copying
 old->new references */
-void factorvm::copy_cards()
+void factor_vm::copy_cards()
 {
        u64 start = current_micros();
 
@@ -226,7 +226,7 @@ void factorvm::copy_cards()
 }
 
 /* Copy all tagged pointers in a range of memory */
-void factorvm::copy_stack_elements(segment *region, cell top)
+void factor_vm::copy_stack_elements(segment *region, cell top)
 {
        cell ptr = region->start;
 
@@ -234,7 +234,7 @@ void factorvm::copy_stack_elements(segment *region, cell top)
                copy_handle((cell*)ptr);
 }
 
-void factorvm::copy_registered_locals()
+void factor_vm::copy_registered_locals()
 {
        std::vector<cell>::const_iterator iter = gc_locals.begin();
        std::vector<cell>::const_iterator end = gc_locals.end();
@@ -243,7 +243,7 @@ void factorvm::copy_registered_locals()
                copy_handle((cell *)(*iter));
 }
 
-void factorvm::copy_registered_bignums()
+void factor_vm::copy_registered_bignums()
 {
        std::vector<cell>::const_iterator iter = gc_bignums.begin();
        std::vector<cell>::const_iterator end = gc_bignums.end();
@@ -267,7 +267,7 @@ void factorvm::copy_registered_bignums()
 
 /* Copy roots over at the start of GC, namely various constants, stacks,
 the user environment and extra roots registered by local_roots.hpp */
-void factorvm::copy_roots()
+void factor_vm::copy_roots()
 {
        copy_handle(&T);
        copy_handle(&bignum_zero);
@@ -301,7 +301,7 @@ void factorvm::copy_roots()
                copy_handle(&userenv[i]);
 }
 
-cell factorvm::copy_next_from_nursery(cell scan)
+cell factor_vm::copy_next_from_nursery(cell scan)
 {
        cell *obj = (cell *)scan;
        cell *end = (cell *)(scan + binary_payload_start((object *)scan));
@@ -329,7 +329,7 @@ cell factorvm::copy_next_from_nursery(cell scan)
        return scan + untagged_object_size((object *)scan);
 }
 
-cell factorvm::copy_next_from_aging(cell scan)
+cell factor_vm::copy_next_from_aging(cell scan)
 {
        cell *obj = (cell *)scan;
        cell *end = (cell *)(scan + binary_payload_start((object *)scan));
@@ -361,7 +361,7 @@ cell factorvm::copy_next_from_aging(cell scan)
        return scan + untagged_object_size((object *)scan);
 }
 
-cell factorvm::copy_next_from_tenured(cell scan)
+cell factor_vm::copy_next_from_tenured(cell scan)
 {
        cell *obj = (cell *)scan;
        cell *end = (cell *)(scan + binary_payload_start((object *)scan));
@@ -391,7 +391,7 @@ cell factorvm::copy_next_from_tenured(cell scan)
        return scan + untagged_object_size((object *)scan);
 }
 
-void factorvm::copy_reachable_objects(cell scan, cell *end)
+void factor_vm::copy_reachable_objects(cell scan, cell *end)
 {
        if(collecting_gen == data->nursery())
        {
@@ -411,7 +411,7 @@ void factorvm::copy_reachable_objects(cell scan, cell *end)
 }
 
 /* Prepare to start copying reachable objects into an unused zone */
-void factorvm::begin_gc(cell requested_bytes)
+void factor_vm::begin_gc(cell requested_bytes)
 {
        if(growing_data_heap)
        {
@@ -444,7 +444,7 @@ void factorvm::begin_gc(cell requested_bytes)
        }
 }
 
-void factorvm::end_gc(cell gc_elapsed)
+void factor_vm::end_gc(cell gc_elapsed)
 {
        gc_stats *s = &stats[collecting_gen];
 
@@ -485,7 +485,7 @@ void factorvm::end_gc(cell gc_elapsed)
 /* Collect gen and all younger generations.
 If growing_data_heap_ is true, we must grow the data heap to such a size that
 an allocation of requested_bytes won't fail */
-void factorvm::garbage_collection(cell gen,bool growing_data_heap_,cell requested_bytes)
+void factor_vm::garbage_collection(cell gen,bool growing_data_heap_,cell requested_bytes)
 {
        if(gc_off)
        {
@@ -563,12 +563,12 @@ void factorvm::garbage_collection(cell gen,bool growing_data_heap_,cell requeste
        performing_gc = false;
 }
 
-void factorvm::gc()
+void factor_vm::gc()
 {
        garbage_collection(data->tenured(),false,0);
 }
 
-inline void factorvm::primitive_gc()
+inline void factor_vm::primitive_gc()
 {
        gc();
 }
@@ -578,7 +578,7 @@ PRIMITIVE(gc)
        PRIMITIVE_GETVM()->primitive_gc();
 }
 
-inline void factorvm::primitive_gc_stats()
+inline void factor_vm::primitive_gc_stats()
 {
        growable_array result(this);
 
@@ -613,7 +613,7 @@ PRIMITIVE(gc_stats)
        PRIMITIVE_GETVM()->primitive_gc_stats();
 }
 
-void factorvm::clear_gc_stats()
+void factor_vm::clear_gc_stats()
 {
        for(cell i = 0; i < max_gen_count; i++)
                memset(&stats[i],0,sizeof(gc_stats));
@@ -624,7 +624,7 @@ void factorvm::clear_gc_stats()
        code_heap_scans = 0;
 }
 
-inline void factorvm::primitive_clear_gc_stats()
+inline void factor_vm::primitive_clear_gc_stats()
 {
        clear_gc_stats();
 }
@@ -636,7 +636,7 @@ PRIMITIVE(clear_gc_stats)
 
 /* classes.tuple uses this to reshape tuples; tools.deploy.shaker uses this
    to coalesce equal but distinct quotations and wrappers. */
-inline void factorvm::primitive_become()
+inline void factor_vm::primitive_become()
 {
        array *new_objects = untag_check<array>(dpop());
        array *old_objects = untag_check<array>(dpop());
@@ -670,7 +670,7 @@ PRIMITIVE(become)
        PRIMITIVE_GETVM()->primitive_become();
 }
 
-void factorvm::inline_gc(cell *gc_roots_base, cell gc_roots_size)
+void factor_vm::inline_gc(cell *gc_roots_base, cell gc_roots_size)
 {
        for(cell i = 0; i < gc_roots_size; i++)
                gc_locals.push_back((cell)&gc_roots_base[i]);
@@ -681,7 +681,7 @@ void factorvm::inline_gc(cell *gc_roots_base, cell gc_roots_size)
                gc_locals.pop_back();
 }
 
-VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factorvm *myvm)
+VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm)
 {
        ASSERTVM();
        VM_PTR->inline_gc(gc_roots_base,gc_roots_size);
index 84c824d779ab21ecd0aa935f9d711366f02b94cb..411c4d19fe2383a82319b756a4fe3114b9c4267f 100755 (executable)
@@ -19,7 +19,7 @@ PRIMITIVE(gc);
 PRIMITIVE(gc_stats);
 PRIMITIVE(clear_gc_stats);
 PRIMITIVE(become);
-struct factorvm;
-VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factorvm *myvm);
+struct factor_vm;
+VM_ASM_API void inline_gc(cell *gc_roots_base, cell gc_roots_size, factor_vm *myvm);
 
 }
index d880b8544cd66f7562449794992d1b2c87d6901b..72bc9c5d8490d93afedffc0c74302edf00da703d 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-cell factorvm::init_zone(zone *z, cell size, cell start)
+cell factor_vm::init_zone(zone *z, cell size, cell start)
 {
        z->size = size;
        z->start = z->here = start;
@@ -11,7 +11,7 @@ cell factorvm::init_zone(zone *z, cell size, cell start)
        return z->end;
 }
 
-void factorvm::init_card_decks()
+void factor_vm::init_card_decks()
 {
        cell start = align(data->seg->start,deck_size);
        allot_markers_offset = (cell)data->allot_markers - (start >> card_bits);
@@ -19,7 +19,7 @@ void factorvm::init_card_decks()
        decks_offset = (cell)data->decks - (start >> deck_bits);
 }
 
-data_heap *factorvm::alloc_data_heap(cell gens, cell young_size,cell aging_size,cell tenured_size)
+data_heap *factor_vm::alloc_data_heap(cell gens, cell young_size,cell aging_size,cell tenured_size)
 {
        young_size = align(young_size,deck_size);
        aging_size = align(aging_size,deck_size);
@@ -83,7 +83,7 @@ data_heap *factorvm::alloc_data_heap(cell gens, cell young_size,cell aging_size,
        return data;
 }
 
-data_heap *factorvm::grow_data_heap(data_heap *data, cell requested_bytes)
+data_heap *factor_vm::grow_data_heap(data_heap *data, cell requested_bytes)
 {
        cell new_tenured_size = (data->tenured_size * 2) + requested_bytes;
 
@@ -93,7 +93,7 @@ data_heap *factorvm::grow_data_heap(data_heap *data, cell requested_bytes)
                new_tenured_size);
 }
 
-void factorvm::dealloc_data_heap(data_heap *data)
+void factor_vm::dealloc_data_heap(data_heap *data)
 {
        dealloc_segment(data->seg);
        free(data->generations);
@@ -104,7 +104,7 @@ void factorvm::dealloc_data_heap(data_heap *data)
        free(data);
 }
 
-void factorvm::clear_cards(cell from, cell to)
+void factor_vm::clear_cards(cell from, cell to)
 {
        /* NOTE: reverse order due to heap layout. */
        card *first_card = addr_to_card(data->generations[to].start);
@@ -112,7 +112,7 @@ void factorvm::clear_cards(cell from, cell to)
        memset(first_card,0,last_card - first_card);
 }
 
-void factorvm::clear_decks(cell from, cell to)
+void factor_vm::clear_decks(cell from, cell to)
 {
        /* NOTE: reverse order due to heap layout. */
        card_deck *first_deck = addr_to_deck(data->generations[to].start);
@@ -120,7 +120,7 @@ void factorvm::clear_decks(cell from, cell to)
        memset(first_deck,0,last_deck - first_deck);
 }
 
-void factorvm::clear_allot_markers(cell from, cell to)
+void factor_vm::clear_allot_markers(cell from, cell to)
 {
        /* NOTE: reverse order due to heap layout. */
        card *first_card = addr_to_allot_marker((object *)data->generations[to].start);
@@ -128,7 +128,7 @@ void factorvm::clear_allot_markers(cell from, cell to)
        memset(first_card,invalid_allot_marker,last_card - first_card);
 }
 
-void factorvm::reset_generation(cell i)
+void factor_vm::reset_generation(cell i)
 {
        zone *z = (i == data->nursery() ? &nursery : &data->generations[i]);
 
@@ -139,7 +139,7 @@ void factorvm::reset_generation(cell i)
 
 /* After garbage collection, any generations which are now empty need to have
 their allocation pointers and cards reset. */
-void factorvm::reset_generations(cell from, cell to)
+void factor_vm::reset_generations(cell from, cell to)
 {
        cell i;
        for(i = from; i <= to; i++)
@@ -150,7 +150,7 @@ void factorvm::reset_generations(cell from, cell to)
        clear_allot_markers(from,to);
 }
 
-void factorvm::set_data_heap(data_heap *data_)
+void factor_vm::set_data_heap(data_heap *data_)
 {
        data = data_;
        nursery = data->generations[data->nursery()];
@@ -160,7 +160,7 @@ void factorvm::set_data_heap(data_heap *data_)
        clear_allot_markers(data->nursery(),data->tenured());
 }
 
-void factorvm::init_data_heap(cell gens,cell young_size,cell aging_size,cell tenured_size,bool secure_gc_)
+void factor_vm::init_data_heap(cell gens,cell young_size,cell aging_size,cell tenured_size,bool secure_gc_)
 {
        set_data_heap(alloc_data_heap(gens,young_size,aging_size,tenured_size));
        secure_gc = secure_gc_;
@@ -168,7 +168,7 @@ void factorvm::init_data_heap(cell gens,cell young_size,cell aging_size,cell ten
 }
 
 /* Size of the object pointed to by a tagged pointer */
-cell factorvm::object_size(cell tagged)
+cell factor_vm::object_size(cell tagged)
 {
        if(immediate_p(tagged))
                return 0;
@@ -177,13 +177,13 @@ cell factorvm::object_size(cell tagged)
 }
 
 /* Size of the object pointed to by an untagged pointer */
-cell factorvm::untagged_object_size(object *pointer)
+cell factor_vm::untagged_object_size(object *pointer)
 {
        return align8(unaligned_object_size(pointer));
 }
 
 /* Size of the data area of an object pointed to by an untagged pointer */
-cell factorvm::unaligned_object_size(object *pointer)
+cell factor_vm::unaligned_object_size(object *pointer)
 {
        switch(pointer->h.hi_tag())
        {
@@ -217,7 +217,7 @@ cell factorvm::unaligned_object_size(object *pointer)
        }
 }
 
-inline void factorvm::primitive_size()
+inline void factor_vm::primitive_size()
 {
        box_unsigned_cell(object_size(dpop()));
 }
@@ -230,7 +230,7 @@ PRIMITIVE(size)
 /* The number of cells from the start of the object which should be scanned by
 the GC. Some types have a binary payload at the end (string, word, DLL) which
 we ignore. */
-cell factorvm::binary_payload_start(object *pointer)
+cell factor_vm::binary_payload_start(object *pointer)
 {
        switch(pointer->h.hi_tag())
        {
@@ -265,7 +265,7 @@ cell factorvm::binary_payload_start(object *pointer)
 }
 
 /* Push memory usage statistics in data heap */
-inline void factorvm::primitive_data_room()
+inline void factor_vm::primitive_data_room()
 {
        dpush(tag_fixnum((data->cards_end - data->cards) >> 10));
        dpush(tag_fixnum((data->decks_end - data->decks) >> 10));
@@ -290,18 +290,18 @@ PRIMITIVE(data_room)
 }
 
 /* Disables GC and activates next-object ( -- obj ) primitive */
-void factorvm::begin_scan()
+void factor_vm::begin_scan()
 {
        heap_scan_ptr = data->generations[data->tenured()].start;
        gc_off = true;
 }
 
-void factorvm::end_scan()
+void factor_vm::end_scan()
 {
        gc_off = false;
 }
 
-inline void factorvm::primitive_begin_scan()
+inline void factor_vm::primitive_begin_scan()
 {
        begin_scan();
 }
@@ -311,7 +311,7 @@ PRIMITIVE(begin_scan)
        PRIMITIVE_GETVM()->primitive_begin_scan();
 }
 
-cell factorvm::next_object()
+cell factor_vm::next_object()
 {
        if(!gc_off)
                general_error(ERROR_HEAP_SCAN,F,F,NULL);
@@ -325,7 +325,7 @@ cell factorvm::next_object()
 }
 
 /* Push object at heap scan cursor and advance; pushes f when done */
-inline void factorvm::primitive_next_object()
+inline void factor_vm::primitive_next_object()
 {
        dpush(next_object());
 }
@@ -336,7 +336,7 @@ PRIMITIVE(next_object)
 }
 
 /* Re-enables GC */
-inline void factorvm::primitive_end_scan()
+inline void factor_vm::primitive_end_scan()
 {
        gc_off = false;
 }
@@ -346,7 +346,7 @@ PRIMITIVE(end_scan)
        PRIMITIVE_GETVM()->primitive_end_scan();
 }
 
-template<typename TYPE> void factorvm::each_object(TYPE &functor)
+template<typename TYPE> void factor_vm::each_object(TYPE &functor)
 {
        begin_scan();
        cell obj;
@@ -366,13 +366,13 @@ struct word_counter {
 
 struct word_accumulator {
        growable_array words;
-       word_accumulator(int count,factorvm *vm) : words(vm,count) {}
+       word_accumulator(int count,factor_vm *vm) : words(vm,count) {}
        void operator()(tagged<object> obj) { if(obj.type_p(WORD_TYPE)) words.add(obj.value()); }
 };
 
 }
 
-cell factorvm::find_all_words()
+cell factor_vm::find_all_words()
 {
        word_counter counter;
        each_object(counter);
index 1a862060dcf97279726d8735959a6fe7369c482c..2b8264ee414f2b212d397f42d8ae2c59b8e0f23d 100755 (executable)
@@ -3,14 +3,14 @@
 namespace factor
 {
 
-void factorvm::print_chars(string* str)
+void factor_vm::print_chars(string* str)
 {
        cell i;
        for(i = 0; i < string_capacity(str); i++)
                putchar(string_nth(str,i));
 }
 
-void factorvm::print_word(word* word, cell nesting)
+void factor_vm::print_word(word* word, cell nesting)
 {
        if(tagged<object>(word->vocabulary).type_p(STRING_TYPE))
        {
@@ -28,14 +28,14 @@ void factorvm::print_word(word* word, cell nesting)
        }
 }
 
-void factorvm::print_factor_string(string* str)
+void factor_vm::print_factor_string(string* str)
 {
        putchar('"');
        print_chars(str);
        putchar('"');
 }
 
-void factorvm::print_array(array* array, cell nesting)
+void factor_vm::print_array(array* array, cell nesting)
 {
        cell length = array_capacity(array);
        cell i;
@@ -59,7 +59,7 @@ void factorvm::print_array(array* array, cell nesting)
                print_string("...");
 }
 
-void factorvm::print_tuple(tuple *tuple, cell nesting)
+void factor_vm::print_tuple(tuple *tuple, cell nesting)
 {
        tuple_layout *layout = untag<tuple_layout>(tuple->layout);
        cell length = to_fixnum(layout->size);
@@ -88,7 +88,7 @@ void factorvm::print_tuple(tuple *tuple, cell nesting)
                print_string("...");
 }
 
-void factorvm::print_nested_obj(cell obj, fixnum nesting)
+void factor_vm::print_nested_obj(cell obj, fixnum nesting)
 {
        if(nesting <= 0 && !full_output)
        {
@@ -138,12 +138,12 @@ void factorvm::print_nested_obj(cell obj, fixnum nesting)
        }
 }
 
-void factorvm::print_obj(cell obj)
+void factor_vm::print_obj(cell obj)
 {
        print_nested_obj(obj,10);
 }
 
-void factorvm::print_objects(cell *start, cell *end)
+void factor_vm::print_objects(cell *start, cell *end)
 {
        for(; start <= end; start++)
        {
@@ -152,19 +152,19 @@ void factorvm::print_objects(cell *start, cell *end)
        }
 }
 
-void factorvm::print_datastack()
+void factor_vm::print_datastack()
 {
        print_string("==== DATA STACK:\n");
        print_objects((cell *)ds_bot,(cell *)ds);
 }
 
-void factorvm::print_retainstack()
+void factor_vm::print_retainstack()
 {
        print_string("==== RETAIN STACK:\n");
        print_objects((cell *)rs_bot,(cell *)rs);
 }
 
-void factorvm::print_stack_frame(stack_frame *frame)
+void factor_vm::print_stack_frame(stack_frame *frame)
 {
        print_obj(frame_executing(frame));
        print_string("\n");
@@ -181,12 +181,12 @@ void factorvm::print_stack_frame(stack_frame *frame)
        print_string("\n");
 }
 
-void print_stack_frame(stack_frame *frame, factorvm *myvm)
+void print_stack_frame(stack_frame *frame, factor_vm *myvm)
 {
        return myvm->print_stack_frame(frame);
 }
 
-void factorvm::print_callstack()
+void factor_vm::print_callstack()
 {
        print_string("==== CALL STACK:\n");
        cell bottom = (cell)stack_chain->callstack_bottom;
@@ -194,7 +194,7 @@ void factorvm::print_callstack()
        iterate_callstack(top,bottom,factor::print_stack_frame);
 }
 
-void factorvm::dump_cell(cell x)
+void factor_vm::dump_cell(cell x)
 {
        print_cell_hex_pad(x); print_string(": ");
        x = *(cell *)x;
@@ -202,7 +202,7 @@ void factorvm::dump_cell(cell x)
        nl();
 }
 
-void factorvm::dump_memory(cell from, cell to)
+void factor_vm::dump_memory(cell from, cell to)
 {
        from = UNTAG(from);
 
@@ -210,14 +210,14 @@ void factorvm::dump_memory(cell from, cell to)
                dump_cell(from);
 }
 
-void factorvm::dump_zone(zone *z)
+void factor_vm::dump_zone(zone *z)
 {
        print_string("Start="); print_cell(z->start);
        print_string(", size="); print_cell(z->size);
        print_string(", here="); print_cell(z->here - z->start); nl();
 }
 
-void factorvm::dump_generations()
+void factor_vm::dump_generations()
 {
        cell i;
 
@@ -243,7 +243,7 @@ void factorvm::dump_generations()
        nl();
 }
 
-void factorvm::dump_objects(cell type)
+void factor_vm::dump_objects(cell type)
 {
        gc();
        begin_scan();
@@ -264,7 +264,7 @@ void factorvm::dump_objects(cell type)
 }
 
 
-void factorvm::find_data_references_step(cell *scan)
+void factor_vm::find_data_references_step(cell *scan)
 {
        if(look_for == *scan)
        {
@@ -275,12 +275,12 @@ void factorvm::find_data_references_step(cell *scan)
        }
 }
 
-void find_data_references_step(cell *scan,factorvm *myvm)
+void find_data_references_step(cell *scan,factor_vm *myvm)
 {
        return myvm->find_data_references_step(scan);
 }
 
-void factorvm::find_data_references(cell look_for_)
+void factor_vm::find_data_references(cell look_for_)
 {
        look_for = look_for_;
 
@@ -293,7 +293,7 @@ void factorvm::find_data_references(cell look_for_)
 }
 
 /* Dump all code blocks for debugging */
-void factorvm::dump_code_heap()
+void factor_vm::dump_code_heap()
 {
        cell reloc_size = 0, literal_size = 0;
 
@@ -333,7 +333,7 @@ void factorvm::dump_code_heap()
        print_cell(literal_size); print_string(" bytes of literal data\n");
 }
 
-void factorvm::factorbug()
+void factor_vm::factorbug()
 {
        if(fep_disabled)
        {
@@ -477,7 +477,7 @@ void factorvm::factorbug()
        }
 }
 
-inline void factorvm::primitive_die()
+inline void factor_vm::primitive_die()
 {
        print_string("The die word was called by the library. Unless you called it yourself,\n");
        print_string("you have triggered a bug in Factor. Please report.\n");
index 632561f3a0f70d6512a7ac3eb6490a3a17ea520e..96d77c75927dfc41cbeb1cb34ed71e338b98e816 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-cell factorvm::search_lookup_alist(cell table, cell klass)
+cell factor_vm::search_lookup_alist(cell table, cell klass)
 {
        array *elements = untag<array>(table);
        fixnum index = array_capacity(elements) - 2;
@@ -18,7 +18,7 @@ cell factorvm::search_lookup_alist(cell table, cell klass)
        return F;
 }
 
-cell factorvm::search_lookup_hash(cell table, cell klass, cell hashcode)
+cell factor_vm::search_lookup_hash(cell table, cell klass, cell hashcode)
 {
        array *buckets = untag<array>(table);
        cell bucket = array_nth(buckets,hashcode & (array_capacity(buckets) - 1));
@@ -28,19 +28,19 @@ cell factorvm::search_lookup_hash(cell table, cell klass, cell hashcode)
                return search_lookup_alist(bucket,klass);
 }
 
-cell factorvm::nth_superclass(tuple_layout *layout, fixnum echelon)
+cell factor_vm::nth_superclass(tuple_layout *layout, fixnum echelon)
 {
        cell *ptr = (cell *)(layout + 1);
        return ptr[echelon * 2];
 }
 
-cell factorvm::nth_hashcode(tuple_layout *layout, fixnum echelon)
+cell factor_vm::nth_hashcode(tuple_layout *layout, fixnum echelon)
 {
        cell *ptr = (cell *)(layout + 1);
        return ptr[echelon * 2 + 1];
 }
 
-cell factorvm::lookup_tuple_method(cell obj, cell methods)
+cell factor_vm::lookup_tuple_method(cell obj, cell methods)
 {
        tuple_layout *layout = untag<tuple_layout>(untag<tuple>(obj)->layout);
 
@@ -72,7 +72,7 @@ cell factorvm::lookup_tuple_method(cell obj, cell methods)
        return F;
 }
 
-cell factorvm::lookup_hi_tag_method(cell obj, cell methods)
+cell factor_vm::lookup_hi_tag_method(cell obj, cell methods)
 {
        array *hi_tag_methods = untag<array>(methods);
        cell tag = untag<object>(obj)->h.hi_tag() - HEADER_TYPE;
@@ -82,7 +82,7 @@ cell factorvm::lookup_hi_tag_method(cell obj, cell methods)
        return array_nth(hi_tag_methods,tag);
 }
 
-cell factorvm::lookup_hairy_method(cell obj, cell methods)
+cell factor_vm::lookup_hairy_method(cell obj, cell methods)
 {
        cell method = array_nth(untag<array>(methods),TAG(obj));
        if(tagged<object>(method).type_p(WORD_TYPE))
@@ -104,7 +104,7 @@ cell factorvm::lookup_hairy_method(cell obj, cell methods)
        }
 }
 
-cell factorvm::lookup_method(cell obj, cell methods)
+cell factor_vm::lookup_method(cell obj, cell methods)
 {
        cell tag = TAG(obj);
        if(tag == TUPLE_TYPE || tag == OBJECT_TYPE)
@@ -113,7 +113,7 @@ cell factorvm::lookup_method(cell obj, cell methods)
                return array_nth(untag<array>(methods),TAG(obj));
 }
 
-inline void factorvm::primitive_lookup_method()
+inline void factor_vm::primitive_lookup_method()
 {
        cell methods = dpop();
        cell obj = dpop();
@@ -125,7 +125,7 @@ PRIMITIVE(lookup_method)
        PRIMITIVE_GETVM()->primitive_lookup_method();
 }
 
-cell factorvm::object_class(cell obj)
+cell factor_vm::object_class(cell obj)
 {
        switch(TAG(obj))
        {
@@ -138,13 +138,13 @@ cell factorvm::object_class(cell obj)
        }
 }
 
-cell factorvm::method_cache_hashcode(cell klass, array *array)
+cell factor_vm::method_cache_hashcode(cell klass, array *array)
 {
        cell capacity = (array_capacity(array) >> 1) - 1;
        return ((klass >> TAG_BITS) & capacity) << 1;
 }
 
-void factorvm::update_method_cache(cell cache, cell klass, cell method)
+void factor_vm::update_method_cache(cell cache, cell klass, cell method)
 {
        array *cache_elements = untag<array>(cache);
        cell hashcode = method_cache_hashcode(klass,cache_elements);
@@ -152,7 +152,7 @@ void factorvm::update_method_cache(cell cache, cell klass, cell method)
        set_array_nth(cache_elements,hashcode + 1,method);
 }
 
-inline void factorvm::primitive_mega_cache_miss()
+inline void factor_vm::primitive_mega_cache_miss()
 {
        megamorphic_cache_misses++;
 
@@ -174,7 +174,7 @@ PRIMITIVE(mega_cache_miss)
        PRIMITIVE_GETVM()->primitive_mega_cache_miss();
 }
 
-inline void factorvm::primitive_reset_dispatch_stats()
+inline void factor_vm::primitive_reset_dispatch_stats()
 {
        megamorphic_cache_hits = megamorphic_cache_misses = 0;
 }
@@ -184,7 +184,7 @@ PRIMITIVE(reset_dispatch_stats)
        PRIMITIVE_GETVM()->primitive_reset_dispatch_stats();
 }
 
-inline void factorvm::primitive_dispatch_stats()
+inline void factor_vm::primitive_dispatch_stats()
 {
        growable_array stats(this);
        stats.add(allot_cell(megamorphic_cache_hits));
index c4eb549c9fe4c063558ad691514cf44f8ac2b2e2..4d9d06f7e2ce57f59c07387ddc2d498cfbcfeb8a 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-void factorvm::out_of_memory()
+void factor_vm::out_of_memory()
 {
        print_string("Out of memory\n\n");
        dump_generations();
@@ -17,7 +17,7 @@ void fatal_error(const char* msg, cell tagged)
        exit(1);
 }
 
-void factorvm::critical_error(const char* msg, cell tagged)
+void factor_vm::critical_error(const char* msg, cell tagged)
 {
        print_string("You have triggered a bug in Factor. Please report.\n");
        print_string("critical_error: "); print_string(msg);
@@ -25,7 +25,7 @@ void factorvm::critical_error(const char* msg, cell tagged)
        factorbug();
 }
 
-void factorvm::throw_error(cell error, stack_frame *callstack_top)
+void factor_vm::throw_error(cell error, stack_frame *callstack_top)
 {
        /* If the error handler is set, we rewind any C stack frames and
        pass the error to user-space. */
@@ -70,25 +70,25 @@ void factorvm::throw_error(cell error, stack_frame *callstack_top)
        }
 }
 
-void factorvm::general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *callstack_top)
+void factor_vm::general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *callstack_top)
 {
        throw_error(allot_array_4(userenv[ERROR_ENV],
                tag_fixnum(error),arg1,arg2),callstack_top);
 }
 
-void factorvm::type_error(cell type, cell tagged)
+void factor_vm::type_error(cell type, cell tagged)
 {
        general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
 }
 
-void factorvm::not_implemented_error()
+void factor_vm::not_implemented_error()
 {
        general_error(ERROR_NOT_IMPLEMENTED,F,F,NULL);
 }
 
 /* Test if 'fault' is in the guard page at the top or bottom (depending on
 offset being 0 or -1) of area+area_size */
-bool factorvm::in_page(cell fault, cell area, cell area_size, int offset)
+bool factor_vm::in_page(cell fault, cell area, cell area_size, int offset)
 {
        int pagesize = getpagesize();
        area += area_size;
@@ -97,7 +97,7 @@ bool factorvm::in_page(cell fault, cell area, cell area_size, int offset)
        return fault >= area && fault <= area + pagesize;
 }
 
-void factorvm::memory_protection_error(cell addr, stack_frame *native_stack)
+void factor_vm::memory_protection_error(cell addr, stack_frame *native_stack)
 {
        if(in_page(addr, ds_bot, 0, -1))
                general_error(ERROR_DS_UNDERFLOW,F,F,native_stack);
@@ -113,22 +113,22 @@ void factorvm::memory_protection_error(cell addr, stack_frame *native_stack)
                general_error(ERROR_MEMORY,allot_cell(addr),F,native_stack);
 }
 
-void factorvm::signal_error(int signal, stack_frame *native_stack)
+void factor_vm::signal_error(int signal, stack_frame *native_stack)
 {
        general_error(ERROR_SIGNAL,tag_fixnum(signal),F,native_stack);
 }
 
-void factorvm::divide_by_zero_error()
+void factor_vm::divide_by_zero_error()
 {
        general_error(ERROR_DIVIDE_BY_ZERO,F,F,NULL);
 }
 
-void factorvm::fp_trap_error(unsigned int fpu_status, stack_frame *signal_callstack_top)
+void factor_vm::fp_trap_error(unsigned int fpu_status, stack_frame *signal_callstack_top)
 {
        general_error(ERROR_FP_TRAP,tag_fixnum(fpu_status),F,signal_callstack_top);
 }
 
-inline void factorvm::primitive_call_clear()
+inline void factor_vm::primitive_call_clear()
 {
        throw_impl(dpop(),stack_chain->callstack_bottom,this);
 }
@@ -139,7 +139,7 @@ PRIMITIVE(call_clear)
 }
 
 /* For testing purposes */
-inline void factorvm::primitive_unimplemented()
+inline void factor_vm::primitive_unimplemented()
 {
        not_implemented_error();
 }
@@ -149,7 +149,7 @@ PRIMITIVE(unimplemented)
        PRIMITIVE_GETVM()->primitive_unimplemented();
 }
 
-void factorvm::memory_signal_handler_impl()
+void factor_vm::memory_signal_handler_impl()
 {
        memory_protection_error(signal_fault_addr,signal_callstack_top);
 }
@@ -159,7 +159,7 @@ void memory_signal_handler_impl()
        SIGNAL_VM_PTR()->memory_signal_handler_impl();
 }
 
-void factorvm::misc_signal_handler_impl()
+void factor_vm::misc_signal_handler_impl()
 {
        signal_error(signal_number,signal_callstack_top);
 }
@@ -169,7 +169,7 @@ void misc_signal_handler_impl()
        SIGNAL_VM_PTR()->misc_signal_handler_impl();
 }
 
-void factorvm::fp_signal_handler_impl()
+void factor_vm::fp_signal_handler_impl()
 {
        fp_trap_error(signal_fpu_status,signal_callstack_top);
 }
index 8fa9869e239c0ee01d022aa3cd2a165bf96c7627..b7e5c3c6720a2c0db03284611bc510c115f7f432 100755 (executable)
@@ -3,14 +3,14 @@
 namespace factor
 {
 
-factorvm *vm;
+factor_vm *vm;
 
 void init_globals()
 {
        init_platform_globals();
 }
 
-void factorvm::default_parameters(vm_parameters *p)
+void factor_vm::default_parameters(vm_parameters *p)
 {
        p->image_path = NULL;
 
@@ -54,7 +54,7 @@ void factorvm::default_parameters(vm_parameters *p)
        p->stack_traces = true;
 }
 
-bool factorvm::factor_arg(const vm_char* str, const vm_char* arg, cell* value)
+bool factor_vm::factor_arg(const vm_char* str, const vm_char* arg, cell* value)
 {
        int val;
        if(SSCANF(str,arg,&val) > 0)
@@ -66,7 +66,7 @@ bool factorvm::factor_arg(const vm_char* str, const vm_char* arg, cell* value)
                return false;
 }
 
-void factorvm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv)
+void factor_vm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv)
 {
        default_parameters(p);
        p->executable_path = argv[0];
@@ -92,7 +92,7 @@ void factorvm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **a
 }
 
 /* Do some initialization that we do once only */
-void factorvm::do_stage1_init()
+void factor_vm::do_stage1_init()
 {
        print_string("*** Stage 2 early init... ");
        fflush(stdout);
@@ -104,7 +104,7 @@ void factorvm::do_stage1_init()
        fflush(stdout);
 }
 
-void factorvm::init_factor(vm_parameters *p)
+void factor_vm::init_factor(vm_parameters *p)
 {
        /* Kilobytes */
        p->ds_size = align_page(p->ds_size << 10);
@@ -161,7 +161,7 @@ void factorvm::init_factor(vm_parameters *p)
 }
 
 /* May allocate memory */
-void factorvm::pass_args_to_factor(int argc, vm_char **argv)
+void factor_vm::pass_args_to_factor(int argc, vm_char **argv)
 {
        growable_array args(this);
        int i;
@@ -174,7 +174,7 @@ void factorvm::pass_args_to_factor(int argc, vm_char **argv)
        userenv[ARGS_ENV] = args.elements.value();
 }
 
-void factorvm::start_factor(vm_parameters *p)
+void factor_vm::start_factor(vm_parameters *p)
 {
        if(p->fep) factorbug();
 
@@ -183,30 +183,30 @@ void factorvm::start_factor(vm_parameters *p)
        unnest_stacks();
 }
 
-char *factorvm::factor_eval_string(char *string)
+char *factor_vm::factor_eval_string(char *string)
 {
        char *(*callback)(char *) = (char *(*)(char *))alien_offset(userenv[EVAL_CALLBACK_ENV]);
        return callback(string);
 }
 
-void factorvm::factor_eval_free(char *result)
+void factor_vm::factor_eval_free(char *result)
 {
        free(result);
 }
 
-void factorvm::factor_yield()
+void factor_vm::factor_yield()
 {
        void (*callback)() = (void (*)())alien_offset(userenv[YIELD_CALLBACK_ENV]);
        callback();
 }
 
-void factorvm::factor_sleep(long us)
+void factor_vm::factor_sleep(long us)
 {
        void (*callback)(long) = (void (*)(long))alien_offset(userenv[SLEEP_CALLBACK_ENV]);
        callback(us);
 }
 
-void factorvm::start_standalone_factor(int argc, vm_char **argv)
+void factor_vm::start_standalone_factor(int argc, vm_char **argv)
 {
        vm_parameters p;
        default_parameters(&p);
@@ -223,7 +223,7 @@ struct startargs {
 
 void* start_standalone_factor_thread(void *arg) 
 {
-       factorvm *newvm = new factorvm;
+       factor_vm *newvm = new factor_vm;
        register_vm_with_thread(newvm);
        startargs *args = (startargs*) arg;
        newvm->start_standalone_factor(args->argc, args->argv);
@@ -232,7 +232,7 @@ void* start_standalone_factor_thread(void *arg)
 
 VM_C_API void start_standalone_factor(int argc, vm_char **argv)
 {
-       factorvm *newvm = new factorvm;
+       factor_vm *newvm = new factor_vm;
        vm = newvm;
        register_vm_with_thread(newvm);
        return newvm->start_standalone_factor(argc,argv);
index dba87f908f73c45df3f62bfe3f50aea4acaac513..61b0de1b2af791ac52c5dc331fd2aaf8fb10a194 100755 (executable)
@@ -4,7 +4,7 @@ namespace factor
 {
 
 /* Certain special objects in the image are known to the runtime */
-void factorvm::init_objects(image_header *h)
+void factor_vm::init_objects(image_header *h)
 {
        memcpy(userenv,h->userenv,sizeof(userenv));
 
@@ -14,7 +14,7 @@ void factorvm::init_objects(image_header *h)
        bignum_neg_one = h->bignum_neg_one;
 }
 
-void factorvm::load_data_heap(FILE *file, image_header *h, vm_parameters *p)
+void factor_vm::load_data_heap(FILE *file, image_header *h, vm_parameters *p)
 {
        cell good_size = h->data_size + (1 << 20);
 
@@ -47,7 +47,7 @@ void factorvm::load_data_heap(FILE *file, image_header *h, vm_parameters *p)
        data_relocation_base = h->data_relocation_base;
 }
 
-void factorvm::load_code_heap(FILE *file, image_header *h, vm_parameters *p)
+void factor_vm::load_code_heap(FILE *file, image_header *h, vm_parameters *p)
 {
        if(h->code_size > p->code_size)
                fatal_error("Code heap too small to fit image",h->code_size);
@@ -73,7 +73,7 @@ void factorvm::load_code_heap(FILE *file, image_header *h, vm_parameters *p)
 }
 
 /* Save the current image to disk */
-bool factorvm::save_image(const vm_char *filename)
+bool factor_vm::save_image(const vm_char *filename)
 {
        FILE* file;
        image_header h;
@@ -118,7 +118,7 @@ bool factorvm::save_image(const vm_char *filename)
        return ok;
 }
 
-inline void factorvm::primitive_save_image()
+inline void factor_vm::primitive_save_image()
 {
        /* do a full GC to push everything into tenured space */
        gc();
@@ -133,7 +133,7 @@ PRIMITIVE(save_image)
        PRIMITIVE_GETVM()->primitive_save_image();
 }
 
-inline void factorvm::primitive_save_image_and_exit()
+inline void factor_vm::primitive_save_image_and_exit()
 {
        /* We unbox this before doing anything else. This is the only point
        where we might throw an error, so we have to throw an error here since
@@ -164,7 +164,7 @@ PRIMITIVE(save_image_and_exit)
        PRIMITIVE_GETVM()->primitive_save_image_and_exit();
 }
 
-void factorvm::data_fixup(cell *cell)
+void factor_vm::data_fixup(cell *cell)
 {
        if(immediate_p(*cell))
                return;
@@ -173,19 +173,19 @@ void factorvm::data_fixup(cell *cell)
        *cell += (tenured->start - data_relocation_base);
 }
 
-void data_fixup(cell *cell, factorvm *myvm)
+void data_fixup(cell *cell, factor_vm *myvm)
 {
        return myvm->data_fixup(cell);
 }
 
-template <typename TYPE> void factorvm::code_fixup(TYPE **handle)
+template <typename TYPE> void factor_vm::code_fixup(TYPE **handle)
 {
        TYPE *ptr = *handle;
        TYPE *new_ptr = (TYPE *)(((cell)ptr) + (code.seg->start - code_relocation_base));
        *handle = new_ptr;
 }
 
-void factorvm::fixup_word(word *word)
+void factor_vm::fixup_word(word *word)
 {
        if(word->code)
                code_fixup(&word->code);
@@ -194,7 +194,7 @@ void factorvm::fixup_word(word *word)
        code_fixup(&word->xt);
 }
 
-void factorvm::fixup_quotation(quotation *quot)
+void factor_vm::fixup_quotation(quotation *quot)
 {
        if(quot->code)
        {
@@ -205,29 +205,29 @@ void factorvm::fixup_quotation(quotation *quot)
                quot->xt = (void *)lazy_jit_compile;
 }
 
-void factorvm::fixup_alien(alien *d)
+void factor_vm::fixup_alien(alien *d)
 {
        d->expired = T;
 }
 
-void factorvm::fixup_stack_frame(stack_frame *frame)
+void factor_vm::fixup_stack_frame(stack_frame *frame)
 {
        code_fixup(&frame->xt);
        code_fixup(&FRAME_RETURN_ADDRESS(frame));
 }
 
-void fixup_stack_frame(stack_frame *frame, factorvm *myvm)
+void fixup_stack_frame(stack_frame *frame, factor_vm *myvm)
 {
        return myvm->fixup_stack_frame(frame);
 }
 
-void factorvm::fixup_callstack_object(callstack *stack)
+void factor_vm::fixup_callstack_object(callstack *stack)
 {
        iterate_callstack_object(stack,factor::fixup_stack_frame);
 }
 
 /* Initialize an object in a newly-loaded image */
-void factorvm::relocate_object(object *object)
+void factor_vm::relocate_object(object *object)
 {
        cell hi_tag = object->h.hi_tag();
        
@@ -272,7 +272,7 @@ void factorvm::relocate_object(object *object)
 
 /* Since the image might have been saved with a different base address than
 where it is loaded, we need to fix up pointers in the image. */
-void factorvm::relocate_data()
+void factor_vm::relocate_data()
 {
        cell relocating;
 
@@ -297,7 +297,7 @@ void factorvm::relocate_data()
        }
 }
 
-void factorvm::fixup_code_block(code_block *compiled)
+void factor_vm::fixup_code_block(code_block *compiled)
 {
        /* relocate literal table data */
        data_fixup(&compiled->relocation);
@@ -306,19 +306,19 @@ void factorvm::fixup_code_block(code_block *compiled)
        relocate_code_block(compiled);
 }
 
-void fixup_code_block(code_block *compiled, factorvm *myvm)
+void fixup_code_block(code_block *compiled, factor_vm *myvm)
 {
        return myvm->fixup_code_block(compiled);
 }
 
-void factorvm::relocate_code()
+void factor_vm::relocate_code()
 {
        iterate_code_heap(factor::fixup_code_block);
 }
 
 /* Read an image file from disk, only done once during startup */
 /* This function also initializes the data and code heaps */
-void factorvm::load_image(vm_parameters *p)
+void factor_vm::load_image(vm_parameters *p)
 {
        FILE *file = OPEN_READ(p->image_path);
        if(file == NULL)
index 16ca0fe211ec362af1657080a6a310bc39769c5f..99c563882a4537352e70c72dde2346fa55aa6d8b 100755 (executable)
@@ -3,12 +3,12 @@
 namespace factor
 {
 
-void factorvm::init_inline_caching(int max_size)
+void factor_vm::init_inline_caching(int max_size)
 {
        max_pic_size = max_size;
 }
 
-void factorvm::deallocate_inline_cache(cell return_address)
+void factor_vm::deallocate_inline_cache(cell return_address)
 {
        /* Find the call target. */
        void *old_xt = get_call_target(return_address);
@@ -29,7 +29,7 @@ void factorvm::deallocate_inline_cache(cell return_address)
 
 /* Figure out what kind of type check the PIC needs based on the methods
 it contains */
-cell factorvm::determine_inline_cache_type(array *cache_entries)
+cell factor_vm::determine_inline_cache_type(array *cache_entries)
 {
        bool seen_hi_tag = false, seen_tuple = false;
 
@@ -66,7 +66,7 @@ cell factorvm::determine_inline_cache_type(array *cache_entries)
        return 0;
 }
 
-void factorvm::update_pic_count(cell type)
+void factor_vm::update_pic_count(cell type)
 {
        pic_counts[type - PIC_TAG]++;
 }
@@ -74,7 +74,7 @@ void factorvm::update_pic_count(cell type)
 struct inline_cache_jit : public jit {
        fixnum index;
 
-       inline_cache_jit(cell generic_word_,factorvm *vm) : jit(PIC_TYPE,generic_word_,vm) {};
+       inline_cache_jit(cell generic_word_,factor_vm *vm) : jit(PIC_TYPE,generic_word_,vm) {};
 
        void emit_check(cell klass);
        void compile_inline_cache(fixnum index,
@@ -138,7 +138,7 @@ void inline_cache_jit::compile_inline_cache(fixnum index,
        word_special(myvm->userenv[tail_call_p ? PIC_MISS_TAIL_WORD : PIC_MISS_WORD]);
 }
 
-code_block *factorvm::compile_inline_cache(fixnum index,cell generic_word_,cell methods_,cell cache_entries_,bool tail_call_p)
+code_block *factor_vm::compile_inline_cache(fixnum index,cell generic_word_,cell methods_,cell cache_entries_,bool tail_call_p)
 {
        gc_root<word> generic_word(generic_word_,this);
        gc_root<array> methods(methods_,this);
@@ -156,18 +156,18 @@ code_block *factorvm::compile_inline_cache(fixnum index,cell generic_word_,cell
 }
 
 /* A generic word's definition performs general method lookup. Allocates memory */
-void *factorvm::megamorphic_call_stub(cell generic_word)
+void *factor_vm::megamorphic_call_stub(cell generic_word)
 {
        return untag<word>(generic_word)->xt;
 }
 
-cell factorvm::inline_cache_size(cell cache_entries)
+cell factor_vm::inline_cache_size(cell cache_entries)
 {
        return array_capacity(untag_check<array>(cache_entries)) / 2;
 }
 
 /* Allocates memory */
-cell factorvm::add_inline_cache_entry(cell cache_entries_, cell klass_, cell method_)
+cell factor_vm::add_inline_cache_entry(cell cache_entries_, cell klass_, cell method_)
 {
        gc_root<array> cache_entries(cache_entries_,this);
        gc_root<object> klass(klass_,this);
@@ -180,7 +180,7 @@ cell factorvm::add_inline_cache_entry(cell cache_entries_, cell klass_, cell met
        return new_cache_entries.value();
 }
 
-void factorvm::update_pic_transitions(cell pic_size)
+void factor_vm::update_pic_transitions(cell pic_size)
 {
        if(pic_size == max_pic_size)
                pic_to_mega_transitions++;
@@ -192,7 +192,7 @@ void factorvm::update_pic_transitions(cell pic_size)
 
 /* The cache_entries parameter is either f (on cold call site) or an array (on cache miss).
 Called from assembly with the actual return address */
-void *factorvm::inline_cache_miss(cell return_address)
+void *factor_vm::inline_cache_miss(cell return_address)
 {
        check_code_pointer(return_address);
 
@@ -244,13 +244,13 @@ void *factorvm::inline_cache_miss(cell return_address)
        return xt;
 }
 
-VM_C_API void *inline_cache_miss(cell return_address, factorvm *myvm)
+VM_C_API void *inline_cache_miss(cell return_address, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->inline_cache_miss(return_address);
 }
 
-inline void factorvm::primitive_reset_inline_cache_stats()
+inline void factor_vm::primitive_reset_inline_cache_stats()
 {
        cold_call_to_ic_transitions = ic_to_pic_transitions = pic_to_mega_transitions = 0;
        cell i;
@@ -262,7 +262,7 @@ PRIMITIVE(reset_inline_cache_stats)
        PRIMITIVE_GETVM()->primitive_reset_inline_cache_stats();
 }
 
-inline void factorvm::primitive_inline_cache_stats()
+inline void factor_vm::primitive_inline_cache_stats()
 {
        growable_array stats(this);
        stats.add(allot_cell(cold_call_to_ic_transitions));
index 02ac43dce8f39bf78e3db58867423845a0edce40..4292adcd9d175923aab36454316654656fc348e7 100644 (file)
@@ -5,6 +5,6 @@ PRIMITIVE(inline_cache_stats);
 PRIMITIVE(inline_cache_miss);
 PRIMITIVE(inline_cache_miss_tail);
 
-VM_C_API void *inline_cache_miss(cell return_address, factorvm *vm);
+VM_C_API void *inline_cache_miss(cell return_address, factor_vm *vm);
 
 }
index 6d218bf8b302ead2b909fdf200ef92645a5fe165..600629608ee51a2ef1ff9d46063cdd8997771167 100644 (file)
@@ -6,58 +6,58 @@ namespace factor
 
 // segments.hpp
 
-inline cell factorvm::align_page(cell a)
+inline cell factor_vm::align_page(cell a)
 {
        return align(a,getpagesize());
 }
 
 // write_barrier.hpp
 
-inline card *factorvm::addr_to_card(cell a)
+inline card *factor_vm::addr_to_card(cell a)
 {
        return (card*)(((cell)(a) >> card_bits) + cards_offset);
 }
 
-inline cell factorvm::card_to_addr(card *c)
+inline cell factor_vm::card_to_addr(card *c)
 {
        return ((cell)c - cards_offset) << card_bits;
 }
 
-inline cell factorvm::card_offset(card *c)
+inline cell factor_vm::card_offset(card *c)
 {
        return *(c - (cell)data->cards + (cell)data->allot_markers);
 }
 
-inline card_deck *factorvm::addr_to_deck(cell a)
+inline card_deck *factor_vm::addr_to_deck(cell a)
 {
        return (card_deck *)(((cell)a >> deck_bits) + decks_offset);
 }
 
-inline cell factorvm::deck_to_addr(card_deck *c)
+inline cell factor_vm::deck_to_addr(card_deck *c)
 {
        return ((cell)c - decks_offset) << deck_bits;
 }
 
-inline card *factorvm::deck_to_card(card_deck *d)
+inline card *factor_vm::deck_to_card(card_deck *d)
 {
        return (card *)((((cell)d - decks_offset) << (deck_bits - card_bits)) + cards_offset);
 }
 
-inline card *factorvm::addr_to_allot_marker(object *a)
+inline card *factor_vm::addr_to_allot_marker(object *a)
 {
        return (card *)(((cell)a >> card_bits) + allot_markers_offset);
 }
 
 /* the write barrier must be called any time we are potentially storing a
 pointer from an older generation to a younger one */
-inline void factorvm::write_barrier(object *obj)
+inline void factor_vm::write_barrier(object *obj)
 {
        *addr_to_card((cell)obj) = card_mark_mask;
        *addr_to_deck((cell)obj) = card_mark_mask;
 }
 
 /* we need to remember the first object allocated in the card */
-inline void factorvm::allot_barrier(object *address)
+inline void factor_vm::allot_barrier(object *address)
 {
        card *ptr = addr_to_allot_marker(address);
        if(*ptr == invalid_allot_marker)
@@ -65,7 +65,7 @@ inline void factorvm::allot_barrier(object *address)
 }
 
 //data_gc.hpp
-inline bool factorvm::collecting_accumulation_gen_p()
+inline bool factor_vm::collecting_accumulation_gen_p()
 {
        return ((data->have_aging_p()
                && collecting_gen == data->aging()
@@ -73,7 +73,7 @@ inline bool factorvm::collecting_accumulation_gen_p()
                || collecting_gen == data->tenured());
 }
 
-inline object *factorvm::allot_zone(zone *z, cell a)
+inline object *factor_vm::allot_zone(zone *z, cell a)
 {
        cell h = z->here;
        z->here = h + align8(a);
@@ -86,7 +86,7 @@ inline object *factorvm::allot_zone(zone *z, cell a)
  * It is up to the caller to fill in the object's fields in a meaningful
  * fashion!
  */
-inline object *factorvm::allot_object(header header, cell size)
+inline object *factor_vm::allot_object(header header, cell size)
 {
 #ifdef GC_DEBUG
        if(!gc_off)
@@ -137,12 +137,12 @@ inline object *factorvm::allot_object(header header, cell size)
        return obj;
 }
 
-template<typename TYPE> TYPE *factorvm::allot(cell size)
+template<typename TYPE> TYPE *factor_vm::allot(cell size)
 {
        return (TYPE *)allot_object(header(TYPE::type_number),size);
 }
 
-inline void factorvm::check_data_pointer(object *pointer)
+inline void factor_vm::check_data_pointer(object *pointer)
 {
 #ifdef FACTOR_DEBUG
        if(!growing_data_heap)
@@ -153,7 +153,7 @@ inline void factorvm::check_data_pointer(object *pointer)
 #endif
 }
 
-inline void factorvm::check_tagged_pointer(cell tagged)
+inline void factor_vm::check_tagged_pointer(cell tagged)
 {
 #ifdef FACTOR_DEBUG
        if(!immediate_p(tagged))
@@ -169,12 +169,12 @@ inline void factorvm::check_tagged_pointer(cell tagged)
 template <typename TYPE>
 struct gc_root : public tagged<TYPE>
 {
-       factorvm *myvm;
+       factor_vm *myvm;
 
        void push() { myvm->check_tagged_pointer(tagged<TYPE>::value()); myvm->gc_locals.push_back((cell)this); }
        
-       explicit gc_root(cell value_,factorvm *vm) : tagged<TYPE>(value_),myvm(vm) { push(); }
-       explicit gc_root(TYPE *value_, factorvm *vm) : tagged<TYPE>(value_),myvm(vm) { push(); }
+       explicit gc_root(cell value_,factor_vm *vm) : tagged<TYPE>(value_),myvm(vm) { push(); }
+       explicit gc_root(TYPE *value_, factor_vm *vm) : tagged<TYPE>(value_),myvm(vm) { push(); }
 
        const gc_root<TYPE>& operator=(const TYPE *x) { tagged<TYPE>::operator=(x); return *this; }
        const gc_root<TYPE>& operator=(const cell &x) { tagged<TYPE>::operator=(x); return *this; }
@@ -191,8 +191,8 @@ struct gc_root : public tagged<TYPE>
 struct gc_bignum
 {
        bignum **addr;
-       factorvm *myvm;
-       gc_bignum(bignum **addr_, factorvm *vm) : addr(addr_), myvm(vm) {
+       factor_vm *myvm;
+       gc_bignum(bignum **addr_, factor_vm *vm) : addr(addr_), myvm(vm) {
                if(*addr_)
                        myvm->check_data_pointer(*addr_);
                myvm->gc_bignums.push_back((cell)addr);
@@ -209,19 +209,19 @@ struct gc_bignum
 #define GC_BIGNUM(x) gc_bignum x##__gc_root(&x,this)
 
 //generic_arrays.hpp
-template <typename TYPE> TYPE *factorvm::allot_array_internal(cell capacity)
+template <typename TYPE> TYPE *factor_vm::allot_array_internal(cell capacity)
 {
        TYPE *array = allot<TYPE>(array_size<TYPE>(capacity));
        array->capacity = tag_fixnum(capacity);
        return array;
 }
 
-template <typename TYPE> bool factorvm::reallot_array_in_place_p(TYPE *array, cell capacity)
+template <typename TYPE> bool factor_vm::reallot_array_in_place_p(TYPE *array, cell capacity)
 {
        return in_zone(&nursery,array) && capacity <= array_capacity(array);
 }
 
-template <typename TYPE> TYPE *factorvm::reallot_array(TYPE *array_, cell capacity)
+template <typename TYPE> TYPE *factor_vm::reallot_array(TYPE *array_, cell capacity)
 {
        gc_root<TYPE> array(array_,this);
 
@@ -247,7 +247,7 @@ template <typename TYPE> TYPE *factorvm::reallot_array(TYPE *array_, cell capaci
 }
 
 //arrays.hpp
-inline void factorvm::set_array_nth(array *array, cell slot, cell value)
+inline void factor_vm::set_array_nth(array *array, cell slot, cell value)
 {
 #ifdef FACTOR_DEBUG
        assert(slot < array_capacity(array));
@@ -262,7 +262,7 @@ struct growable_array {
        cell count;
        gc_root<array> elements;
 
-       growable_array(factorvm *myvm, cell capacity = 10) : count(0), elements(myvm->allot_array(capacity,F),myvm) {}
+       growable_array(factor_vm *myvm, cell capacity = 10) : count(0), elements(myvm->allot_array(capacity,F),myvm) {}
 
        void add(cell elt);
        void trim();
@@ -273,7 +273,7 @@ struct growable_byte_array {
        cell count;
        gc_root<byte_array> elements;
 
-       growable_byte_array(factorvm *myvm,cell capacity = 40) : count(0), elements(myvm->allot_byte_array(capacity),myvm) { }
+       growable_byte_array(factor_vm *myvm,cell capacity = 40) : count(0), elements(myvm->allot_byte_array(capacity),myvm) { }
 
        void append_bytes(void *elts, cell len);
        void append_byte_array(cell elts);
@@ -282,7 +282,7 @@ struct growable_byte_array {
 };
 
 //math.hpp
-inline cell factorvm::allot_integer(fixnum x)
+inline cell factor_vm::allot_integer(fixnum x)
 {
        if(x < fixnum_min || x > fixnum_max)
                return tag<bignum>(fixnum_to_bignum(x));
@@ -290,7 +290,7 @@ inline cell factorvm::allot_integer(fixnum x)
                return tag_fixnum(x);
 }
 
-inline cell factorvm::allot_cell(cell x)
+inline cell factor_vm::allot_cell(cell x)
 {
        if(x > (cell)fixnum_max)
                return tag<bignum>(cell_to_bignum(x));
@@ -298,39 +298,39 @@ inline cell factorvm::allot_cell(cell x)
                return tag_fixnum(x);
 }
 
-inline cell factorvm::allot_float(double n)
+inline cell factor_vm::allot_float(double n)
 {
        boxed_float *flo = allot<boxed_float>(sizeof(boxed_float));
        flo->n = n;
        return tag(flo);
 }
 
-inline bignum *factorvm::float_to_bignum(cell tagged)
+inline bignum *factor_vm::float_to_bignum(cell tagged)
 {
        return double_to_bignum(untag_float(tagged));
 }
 
-inline double factorvm::bignum_to_float(cell tagged)
+inline double factor_vm::bignum_to_float(cell tagged)
 {
        return bignum_to_double(untag<bignum>(tagged));
 }
 
-inline double factorvm::untag_float(cell tagged)
+inline double factor_vm::untag_float(cell tagged)
 {
        return untag<boxed_float>(tagged)->n;
 }
 
-inline double factorvm::untag_float_check(cell tagged)
+inline double factor_vm::untag_float_check(cell tagged)
 {
        return untag_check<boxed_float>(tagged)->n;
 }
 
-inline fixnum factorvm::float_to_fixnum(cell tagged)
+inline fixnum factor_vm::float_to_fixnum(cell tagged)
 {
        return (fixnum)untag_float(tagged);
 }
 
-inline double factorvm::fixnum_to_float(cell tagged)
+inline double factor_vm::fixnum_to_float(cell tagged)
 {
        return (double)untag_fixnum(tagged);
 }
@@ -338,7 +338,7 @@ inline double factorvm::fixnum_to_float(cell 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 TYPE> void factorvm::iterate_callstack_object(callstack *stack_, TYPE &iterator)
+template<typename TYPE> void factor_vm::iterate_callstack_object(callstack *stack_, TYPE &iterator)
 {
        gc_root<callstack> stack(stack_,this);
        fixnum frame_offset = untag_fixnum(stack->length) - sizeof(stack_frame);
@@ -352,13 +352,13 @@ template<typename TYPE> void factorvm::iterate_callstack_object(callstack *stack
 }
 
 //booleans.hpp
-inline cell factorvm::tag_boolean(cell untagged)
+inline cell factor_vm::tag_boolean(cell untagged)
 {
        return (untagged ? T : F);
 }
 
 // callstack.hpp
-template<typename TYPE> void factorvm::iterate_callstack(cell top, cell bottom, TYPE &iterator)
+template<typename TYPE> void factor_vm::iterate_callstack(cell top, cell bottom, TYPE &iterator)
 {
        stack_frame *frame = (stack_frame *)bottom - 1;
 
@@ -373,8 +373,8 @@ template<typename TYPE> void factorvm::iterate_callstack(cell top, cell bottom,
 /* Every object has a regular representation in the runtime, which makes GC
 much simpler. Every slot of the object until binary_payload_start is a pointer
 to some other object. */
-struct factorvm;
-inline void factorvm::do_slots(cell obj, void (* iter)(cell *,factorvm*))
+struct factor_vm;
+inline void factor_vm::do_slots(cell obj, void (* iter)(cell *,factor_vm*))
 {
        cell scan = obj;
        cell payload_start = binary_payload_start((object *)obj);
@@ -391,7 +391,7 @@ inline void factorvm::do_slots(cell obj, void (* iter)(cell *,factorvm*))
 
 // code_heap.hpp
 
-inline void factorvm::check_code_pointer(cell ptr)
+inline void factor_vm::check_code_pointer(cell ptr)
 {
 #ifdef FACTOR_DEBUG
        assert(in_code_heap_p(ptr));
index fed0fa60d98bb16e4d177f00eb3cecb09658fe1f..1ec9cf2cb6339d457315034f0ec0049e5ff8bdf1 100755 (executable)
--- a/vm/io.cpp
+++ b/vm/io.cpp
@@ -14,14 +14,14 @@ The Factor library provides platform-specific code for Unix and Windows
 with many more capabilities so these words are not usually used in
 normal operation. */
 
-void factorvm::init_c_io()
+void factor_vm::init_c_io()
 {
        userenv[STDIN_ENV] = allot_alien(F,(cell)stdin);
        userenv[STDOUT_ENV] = allot_alien(F,(cell)stdout);
        userenv[STDERR_ENV] = allot_alien(F,(cell)stderr);
 }
 
-void factorvm::io_error()
+void factor_vm::io_error()
 {
 #ifndef WINCE
        if(errno == EINTR)
@@ -31,7 +31,7 @@ void factorvm::io_error()
        general_error(ERROR_IO,tag_fixnum(errno),F,NULL);
 }
 
-inline void factorvm::primitive_fopen()
+inline void factor_vm::primitive_fopen()
 {
        gc_root<byte_array> mode(dpop(),this);
        gc_root<byte_array> path(dpop(),this);
@@ -57,7 +57,7 @@ PRIMITIVE(fopen)
        PRIMITIVE_GETVM()->primitive_fopen();
 }
 
-inline void factorvm::primitive_fgetc()
+inline void factor_vm::primitive_fgetc()
 {
        FILE *file = (FILE *)unbox_alien();
 
@@ -87,7 +87,7 @@ PRIMITIVE(fgetc)
        PRIMITIVE_GETVM()->primitive_fgetc();
 }
 
-inline void factorvm::primitive_fread()
+inline void factor_vm::primitive_fread()
 {
        FILE *file = (FILE *)unbox_alien();
        fixnum size = unbox_array_size();
@@ -132,7 +132,7 @@ PRIMITIVE(fread)
        PRIMITIVE_GETVM()->primitive_fread();
 }
 
-inline void factorvm::primitive_fputc()
+inline void factor_vm::primitive_fputc()
 {
        FILE *file = (FILE *)unbox_alien();
        fixnum ch = to_fixnum(dpop());
@@ -155,7 +155,7 @@ PRIMITIVE(fputc)
        PRIMITIVE_GETVM()->primitive_fputc();
 }
 
-inline void factorvm::primitive_fwrite()
+inline void factor_vm::primitive_fwrite()
 {
        FILE *file = (FILE *)unbox_alien();
        byte_array *text = untag_check<byte_array>(dpop());
@@ -189,7 +189,7 @@ PRIMITIVE(fwrite)
        PRIMITIVE_GETVM()->primitive_fwrite();
 }
 
-inline void factorvm::primitive_fseek()
+inline void factor_vm::primitive_fseek()
 {
        int whence = to_fixnum(dpop());
        FILE *file = (FILE *)unbox_alien();
@@ -219,7 +219,7 @@ PRIMITIVE(fseek)
        PRIMITIVE_GETVM()->primitive_fseek();
 }
 
-inline void factorvm::primitive_fflush()
+inline void factor_vm::primitive_fflush()
 {
        FILE *file = (FILE *)unbox_alien();
        for(;;)
@@ -236,7 +236,7 @@ PRIMITIVE(fflush)
        PRIMITIVE_GETVM()->primitive_fflush();
 }
 
-inline void factorvm::primitive_fclose()
+inline void factor_vm::primitive_fclose()
 {
        FILE *file = (FILE *)unbox_alien();
        for(;;)
index cdb5acace374e63e9b5277e0b3becddf1153522d..597575fcfdcbdf43767fc759970085800d91dc9e 100644 (file)
@@ -10,7 +10,7 @@ namespace factor
 - polymorphic inline caches (inline_cache.cpp) */
 
 /* Allocates memory */
-jit::jit(cell type_, cell owner_, factorvm *vm)
+jit::jit(cell type_, cell owner_, factor_vm *vm)
        : type(type_),
          owner(owner_,vm),
          code(vm),
index a44f359ffe3632c2017a22f3ee496f2739a3c484..1004da96366a9f4909a74074d362adb548aed91e 100644 (file)
@@ -10,9 +10,9 @@ struct jit {
        bool computing_offset_p;
        fixnum position;
        cell offset;
-       factorvm *myvm;
+       factor_vm *myvm;
 
-       jit(cell jit_type, cell owner, factorvm *vm);
+       jit(cell jit_type, cell owner, factor_vm *vm);
        void compute_position(cell offset);
 
        void emit_relocation(cell code_template);
index 9cf792e68b20d8faf1624936ac137aa09262017c..261f0fb6543f6039f1b52c7b0191430c1cdb92e8 100644 (file)
@@ -28,7 +28,7 @@ http://www.wodeveloper.com/omniLists/macosx-dev/2000/June/msg00137.html */
 /* Modify a suspended thread's thread_state so that when the thread resumes
 executing, the call frame of the current C primitive (if any) is rewound, and
 the appropriate Factor error is thrown from the top-most Factor frame. */
-void factorvm::call_fault_handler(
+void factor_vm::call_fault_handler(
     exception_type_t exception,
     exception_data_type_t code,
        MACH_EXC_STATE_TYPE *exc_state,
index c14d1dd96957afef52221eceabc1e897fb3dfe41..61ec096c591ee1a1f43f067ba21e4dbae9a1d519 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-inline void factorvm::primitive_bignum_to_fixnum()
+inline void factor_vm::primitive_bignum_to_fixnum()
 {
        drepl(tag_fixnum(bignum_to_fixnum(untag<bignum>(dpeek()))));
 }
@@ -13,7 +13,7 @@ PRIMITIVE(bignum_to_fixnum)
        PRIMITIVE_GETVM()->primitive_bignum_to_fixnum();
 }
 
-inline void factorvm::primitive_float_to_fixnum()
+inline void factor_vm::primitive_float_to_fixnum()
 {
        drepl(tag_fixnum(float_to_fixnum(dpeek())));
 }
@@ -25,7 +25,7 @@ PRIMITIVE(float_to_fixnum)
 
 /* Division can only overflow when we are dividing the most negative fixnum
 by -1. */
-inline void factorvm::primitive_fixnum_divint()
+inline void factor_vm::primitive_fixnum_divint()
 {
        fixnum y = untag_fixnum(dpop()); \
        fixnum x = untag_fixnum(dpeek());
@@ -41,7 +41,7 @@ PRIMITIVE(fixnum_divint)
        PRIMITIVE_GETVM()->primitive_fixnum_divint();
 }
 
-inline void factorvm::primitive_fixnum_divmod()
+inline void factor_vm::primitive_fixnum_divmod()
 {
        cell y = ((cell *)ds)[0];
        cell x = ((cell *)ds)[-1];
@@ -66,22 +66,22 @@ PRIMITIVE(fixnum_divmod)
  * If we're shifting right by n bits, we won't overflow as long as none of the
  * high WORD_SIZE-TAG_BITS-n bits are set.
  */
-inline fixnum factorvm::sign_mask(fixnum x)
+inline fixnum factor_vm::sign_mask(fixnum x)
 {
        return x >> (WORD_SIZE - 1);
 }
 
-inline fixnum factorvm::branchless_max(fixnum x, fixnum y)
+inline fixnum factor_vm::branchless_max(fixnum x, fixnum y)
 {
        return (x - ((x - y) & sign_mask(x - y)));
 }
 
-inline fixnum factorvm::branchless_abs(fixnum x)
+inline fixnum factor_vm::branchless_abs(fixnum x)
 {
        return (x ^ sign_mask(x)) - sign_mask(x);
 }
 
-inline void factorvm::primitive_fixnum_shift()
+inline void factor_vm::primitive_fixnum_shift()
 {
        fixnum y = untag_fixnum(dpop());
        fixnum x = untag_fixnum(dpeek());
@@ -113,7 +113,7 @@ PRIMITIVE(fixnum_shift)
        PRIMITIVE_GETVM()->primitive_fixnum_shift();
 }
 
-inline void factorvm::primitive_fixnum_to_bignum()
+inline void factor_vm::primitive_fixnum_to_bignum()
 {
        drepl(tag<bignum>(fixnum_to_bignum(untag_fixnum(dpeek()))));
 }
@@ -123,7 +123,7 @@ PRIMITIVE(fixnum_to_bignum)
        PRIMITIVE_GETVM()->primitive_fixnum_to_bignum();
 }
 
-inline void factorvm::primitive_float_to_bignum()
+inline void factor_vm::primitive_float_to_bignum()
 {
        drepl(tag<bignum>(float_to_bignum(dpeek())));
 }
@@ -137,7 +137,7 @@ PRIMITIVE(float_to_bignum)
        bignum * y = untag<bignum>(dpop()); \
        bignum * x = untag<bignum>(dpop());
 
-inline void factorvm::primitive_bignum_eq()
+inline void factor_vm::primitive_bignum_eq()
 {
        POP_BIGNUMS(x,y);
        box_boolean(bignum_equal_p(x,y));
@@ -148,7 +148,7 @@ PRIMITIVE(bignum_eq)
        PRIMITIVE_GETVM()->primitive_bignum_eq();
 }
 
-inline void factorvm::primitive_bignum_add()
+inline void factor_vm::primitive_bignum_add()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_add(x,y)));
@@ -159,7 +159,7 @@ PRIMITIVE(bignum_add)
        PRIMITIVE_GETVM()->primitive_bignum_add();
 }
 
-inline void factorvm::primitive_bignum_subtract()
+inline void factor_vm::primitive_bignum_subtract()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_subtract(x,y)));
@@ -170,7 +170,7 @@ PRIMITIVE(bignum_subtract)
        PRIMITIVE_GETVM()->primitive_bignum_subtract();
 }
 
-inline void factorvm::primitive_bignum_multiply()
+inline void factor_vm::primitive_bignum_multiply()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_multiply(x,y)));
@@ -181,7 +181,7 @@ PRIMITIVE(bignum_multiply)
        PRIMITIVE_GETVM()->primitive_bignum_multiply();
 }
 
-inline void factorvm::primitive_bignum_divint()
+inline void factor_vm::primitive_bignum_divint()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_quotient(x,y)));
@@ -192,7 +192,7 @@ PRIMITIVE(bignum_divint)
        PRIMITIVE_GETVM()->primitive_bignum_divint();
 }
 
-inline void factorvm::primitive_bignum_divmod()
+inline void factor_vm::primitive_bignum_divmod()
 {
        bignum *q, *r;
        POP_BIGNUMS(x,y);
@@ -206,7 +206,7 @@ PRIMITIVE(bignum_divmod)
        PRIMITIVE_GETVM()->primitive_bignum_divmod();
 }
 
-inline void factorvm::primitive_bignum_mod()
+inline void factor_vm::primitive_bignum_mod()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_remainder(x,y)));
@@ -217,7 +217,7 @@ PRIMITIVE(bignum_mod)
        PRIMITIVE_GETVM()->primitive_bignum_mod();
 }
 
-inline void factorvm::primitive_bignum_and()
+inline void factor_vm::primitive_bignum_and()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_bitwise_and(x,y)));
@@ -228,7 +228,7 @@ PRIMITIVE(bignum_and)
        PRIMITIVE_GETVM()->primitive_bignum_and();
 }
 
-inline void factorvm::primitive_bignum_or()
+inline void factor_vm::primitive_bignum_or()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_bitwise_ior(x,y)));
@@ -239,7 +239,7 @@ PRIMITIVE(bignum_or)
        PRIMITIVE_GETVM()->primitive_bignum_or();
 }
 
-inline void factorvm::primitive_bignum_xor()
+inline void factor_vm::primitive_bignum_xor()
 {
        POP_BIGNUMS(x,y);
        dpush(tag<bignum>(bignum_bitwise_xor(x,y)));
@@ -250,7 +250,7 @@ PRIMITIVE(bignum_xor)
        PRIMITIVE_GETVM()->primitive_bignum_xor();
 }
 
-inline void factorvm::primitive_bignum_shift()
+inline void factor_vm::primitive_bignum_shift()
 {
        fixnum y = untag_fixnum(dpop());
         bignum* x = untag<bignum>(dpop());
@@ -262,7 +262,7 @@ PRIMITIVE(bignum_shift)
        PRIMITIVE_GETVM()->primitive_bignum_shift();
 }
 
-inline void factorvm::primitive_bignum_less()
+inline void factor_vm::primitive_bignum_less()
 {
        POP_BIGNUMS(x,y);
        box_boolean(bignum_compare(x,y) == bignum_comparison_less);
@@ -273,7 +273,7 @@ PRIMITIVE(bignum_less)
        PRIMITIVE_GETVM()->primitive_bignum_less();
 }
 
-inline void factorvm::primitive_bignum_lesseq()
+inline void factor_vm::primitive_bignum_lesseq()
 {
        POP_BIGNUMS(x,y);
        box_boolean(bignum_compare(x,y) != bignum_comparison_greater);
@@ -284,7 +284,7 @@ PRIMITIVE(bignum_lesseq)
        PRIMITIVE_GETVM()->primitive_bignum_lesseq();
 }
 
-inline void factorvm::primitive_bignum_greater()
+inline void factor_vm::primitive_bignum_greater()
 {
        POP_BIGNUMS(x,y);
        box_boolean(bignum_compare(x,y) == bignum_comparison_greater);
@@ -295,7 +295,7 @@ PRIMITIVE(bignum_greater)
        PRIMITIVE_GETVM()->primitive_bignum_greater();
 }
 
-inline void factorvm::primitive_bignum_greatereq()
+inline void factor_vm::primitive_bignum_greatereq()
 {
        POP_BIGNUMS(x,y);
        box_boolean(bignum_compare(x,y) != bignum_comparison_less);
@@ -306,7 +306,7 @@ PRIMITIVE(bignum_greatereq)
        PRIMITIVE_GETVM()->primitive_bignum_greatereq();
 }
 
-inline void factorvm::primitive_bignum_not()
+inline void factor_vm::primitive_bignum_not()
 {
        drepl(tag<bignum>(bignum_bitwise_not(untag<bignum>(dpeek()))));
 }
@@ -316,7 +316,7 @@ PRIMITIVE(bignum_not)
        PRIMITIVE_GETVM()->primitive_bignum_not();
 }
 
-inline void factorvm::primitive_bignum_bitp()
+inline void factor_vm::primitive_bignum_bitp()
 {
        fixnum bit = to_fixnum(dpop());
        bignum *x = untag<bignum>(dpop());
@@ -328,7 +328,7 @@ PRIMITIVE(bignum_bitp)
        PRIMITIVE_GETVM()->primitive_bignum_bitp();
 }
 
-inline void factorvm::primitive_bignum_log2()
+inline void factor_vm::primitive_bignum_log2()
 {
        drepl(tag<bignum>(bignum_integer_length(untag<bignum>(dpeek()))));
 }
@@ -338,18 +338,18 @@ PRIMITIVE(bignum_log2)
        PRIMITIVE_GETVM()->primitive_bignum_log2();
 }
 
-unsigned int factorvm::bignum_producer(unsigned int digit)
+unsigned int factor_vm::bignum_producer(unsigned int digit)
 {
        unsigned char *ptr = (unsigned char *)alien_offset(dpeek());
        return *(ptr + digit);
 }
 
-unsigned int bignum_producer(unsigned int digit, factorvm *myvm)
+unsigned int bignum_producer(unsigned int digit, factor_vm *myvm)
 {
        return myvm->bignum_producer(digit);
 }
 
-inline void factorvm::primitive_byte_array_to_bignum()
+inline void factor_vm::primitive_byte_array_to_bignum()
 {
        cell n_digits = array_capacity(untag_check<byte_array>(dpeek()));
        bignum * result = digit_stream_to_bignum(n_digits,factor::bignum_producer,0x100,0);
@@ -361,7 +361,7 @@ PRIMITIVE(byte_array_to_bignum)
        PRIMITIVE_GETVM()->primitive_byte_array_to_bignum();
 }
 
-cell factorvm::unbox_array_size()
+cell factor_vm::unbox_array_size()
 {
        switch(tagged<object>(dpeek()).type())
        {
@@ -394,7 +394,7 @@ cell factorvm::unbox_array_size()
        return 0; /* can't happen */
 }
 
-inline void factorvm::primitive_fixnum_to_float()
+inline void factor_vm::primitive_fixnum_to_float()
 {
        drepl(allot_float(fixnum_to_float(dpeek())));
 }
@@ -404,7 +404,7 @@ PRIMITIVE(fixnum_to_float)
        PRIMITIVE_GETVM()->primitive_fixnum_to_float();
 }
 
-inline void factorvm::primitive_bignum_to_float()
+inline void factor_vm::primitive_bignum_to_float()
 {
        drepl(allot_float(bignum_to_float(dpeek())));
 }
@@ -414,7 +414,7 @@ PRIMITIVE(bignum_to_float)
        PRIMITIVE_GETVM()->primitive_bignum_to_float();
 }
 
-inline void factorvm::primitive_str_to_float()
+inline void factor_vm::primitive_str_to_float()
 {
        byte_array *bytes = untag_check<byte_array>(dpeek());
        cell capacity = array_capacity(bytes);
@@ -433,7 +433,7 @@ PRIMITIVE(str_to_float)
        PRIMITIVE_GETVM()->primitive_str_to_float();
 }
 
-inline void factorvm::primitive_float_to_str()
+inline void factor_vm::primitive_float_to_str()
 {
        byte_array *array = allot_byte_array(33);
        snprintf((char *)(array + 1),32,"%.16g",untag_float_check(dpop()));
@@ -449,7 +449,7 @@ PRIMITIVE(float_to_str)
        double y = untag_float(dpop()); \
        double x = untag_float(dpop());
 
-inline void factorvm::primitive_float_eq()
+inline void factor_vm::primitive_float_eq()
 {
        POP_FLOATS(x,y);
        box_boolean(x == y);
@@ -460,7 +460,7 @@ PRIMITIVE(float_eq)
        PRIMITIVE_GETVM()->primitive_float_eq();
 }
 
-inline void factorvm::primitive_float_add()
+inline void factor_vm::primitive_float_add()
 {
        POP_FLOATS(x,y);
        box_double(x + y);
@@ -471,7 +471,7 @@ PRIMITIVE(float_add)
        PRIMITIVE_GETVM()->primitive_float_add();
 }
 
-inline void factorvm::primitive_float_subtract()
+inline void factor_vm::primitive_float_subtract()
 {
        POP_FLOATS(x,y);
        box_double(x - y);
@@ -482,7 +482,7 @@ PRIMITIVE(float_subtract)
        PRIMITIVE_GETVM()->primitive_float_subtract();
 }
 
-inline void factorvm::primitive_float_multiply()
+inline void factor_vm::primitive_float_multiply()
 {
        POP_FLOATS(x,y);
        box_double(x * y);
@@ -493,7 +493,7 @@ PRIMITIVE(float_multiply)
        PRIMITIVE_GETVM()->primitive_float_multiply();
 }
 
-inline void factorvm::primitive_float_divfloat()
+inline void factor_vm::primitive_float_divfloat()
 {
        POP_FLOATS(x,y);
        box_double(x / y);
@@ -504,7 +504,7 @@ PRIMITIVE(float_divfloat)
        PRIMITIVE_GETVM()->primitive_float_divfloat();
 }
 
-inline void factorvm::primitive_float_mod()
+inline void factor_vm::primitive_float_mod()
 {
        POP_FLOATS(x,y);
        box_double(fmod(x,y));
@@ -515,7 +515,7 @@ PRIMITIVE(float_mod)
        PRIMITIVE_GETVM()->primitive_float_mod();
 }
 
-inline void factorvm::primitive_float_less()
+inline void factor_vm::primitive_float_less()
 {
        POP_FLOATS(x,y);
        box_boolean(x < y);
@@ -526,7 +526,7 @@ PRIMITIVE(float_less)
        PRIMITIVE_GETVM()->primitive_float_less();
 }
 
-inline void factorvm::primitive_float_lesseq()
+inline void factor_vm::primitive_float_lesseq()
 {
        POP_FLOATS(x,y);
        box_boolean(x <= y);
@@ -537,7 +537,7 @@ PRIMITIVE(float_lesseq)
        PRIMITIVE_GETVM()->primitive_float_lesseq();
 }
 
-inline void factorvm::primitive_float_greater()
+inline void factor_vm::primitive_float_greater()
 {
        POP_FLOATS(x,y);
        box_boolean(x > y);
@@ -548,7 +548,7 @@ PRIMITIVE(float_greater)
        PRIMITIVE_GETVM()->primitive_float_greater();
 }
 
-inline void factorvm::primitive_float_greatereq()
+inline void factor_vm::primitive_float_greatereq()
 {
        POP_FLOATS(x,y);
        box_boolean(x >= y);
@@ -559,7 +559,7 @@ PRIMITIVE(float_greatereq)
        PRIMITIVE_GETVM()->primitive_float_greatereq();
 }
 
-inline void factorvm::primitive_float_bits()
+inline void factor_vm::primitive_float_bits()
 {
        box_unsigned_4(float_bits(untag_float_check(dpop())));
 }
@@ -569,7 +569,7 @@ PRIMITIVE(float_bits)
        PRIMITIVE_GETVM()->primitive_float_bits();
 }
 
-inline void factorvm::primitive_bits_float()
+inline void factor_vm::primitive_bits_float()
 {
        box_float(bits_float(to_cell(dpop())));
 }
@@ -579,7 +579,7 @@ PRIMITIVE(bits_float)
        PRIMITIVE_GETVM()->primitive_bits_float();
 }
 
-inline void factorvm::primitive_double_bits()
+inline void factor_vm::primitive_double_bits()
 {
        box_unsigned_8(double_bits(untag_float_check(dpop())));
 }
@@ -589,7 +589,7 @@ PRIMITIVE(double_bits)
        PRIMITIVE_GETVM()->primitive_double_bits();
 }
 
-inline void factorvm::primitive_bits_double()
+inline void factor_vm::primitive_bits_double()
 {
        box_double(bits_double(to_unsigned_8(dpop())));
 }
@@ -599,7 +599,7 @@ PRIMITIVE(bits_double)
        PRIMITIVE_GETVM()->primitive_bits_double();
 }
 
-fixnum factorvm::to_fixnum(cell tagged)
+fixnum factor_vm::to_fixnum(cell tagged)
 {
        switch(TAG(tagged))
        {
@@ -613,112 +613,112 @@ fixnum factorvm::to_fixnum(cell tagged)
        }
 }
 
-VM_C_API fixnum to_fixnum(cell tagged,factorvm *myvm)
+VM_C_API fixnum to_fixnum(cell tagged,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_fixnum(tagged);
 }
 
-cell factorvm::to_cell(cell tagged)
+cell factor_vm::to_cell(cell tagged)
 {
        return (cell)to_fixnum(tagged);
 }
 
-VM_C_API cell to_cell(cell tagged, factorvm *myvm)
+VM_C_API cell to_cell(cell tagged, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_cell(tagged);
 }
 
-void factorvm::box_signed_1(s8 n)
+void factor_vm::box_signed_1(s8 n)
 {
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_signed_1(s8 n,factorvm *myvm)
+VM_C_API void box_signed_1(s8 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_signed_1(n);
 }
 
-void factorvm::box_unsigned_1(u8 n)
+void factor_vm::box_unsigned_1(u8 n)
 {
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_unsigned_1(u8 n,factorvm *myvm)
+VM_C_API void box_unsigned_1(u8 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_unsigned_1(n);
 }
 
-void factorvm::box_signed_2(s16 n)
+void factor_vm::box_signed_2(s16 n)
 {
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_signed_2(s16 n,factorvm *myvm)
+VM_C_API void box_signed_2(s16 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_signed_2(n);
 }
 
-void factorvm::box_unsigned_2(u16 n)
+void factor_vm::box_unsigned_2(u16 n)
 {
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_unsigned_2(u16 n,factorvm *myvm)
+VM_C_API void box_unsigned_2(u16 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_unsigned_2(n);
 }
 
-void factorvm::box_signed_4(s32 n)
+void factor_vm::box_signed_4(s32 n)
 {
        dpush(allot_integer(n));
 }
 
-VM_C_API void box_signed_4(s32 n,factorvm *myvm)
+VM_C_API void box_signed_4(s32 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_signed_4(n);
 }
 
-void factorvm::box_unsigned_4(u32 n)
+void factor_vm::box_unsigned_4(u32 n)
 {
        dpush(allot_cell(n));
 }
 
-VM_C_API void box_unsigned_4(u32 n,factorvm *myvm)
+VM_C_API void box_unsigned_4(u32 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_unsigned_4(n);
 }
 
-void factorvm::box_signed_cell(fixnum integer)
+void factor_vm::box_signed_cell(fixnum integer)
 {
        dpush(allot_integer(integer));
 }
 
-VM_C_API void box_signed_cell(fixnum integer,factorvm *myvm)
+VM_C_API void box_signed_cell(fixnum integer,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_signed_cell(integer);
 }
 
-void factorvm::box_unsigned_cell(cell cell)
+void factor_vm::box_unsigned_cell(cell cell)
 {
        dpush(allot_cell(cell));
 }
 
-VM_C_API void box_unsigned_cell(cell cell,factorvm *myvm)
+VM_C_API void box_unsigned_cell(cell cell,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_unsigned_cell(cell);
 }
 
-void factorvm::box_signed_8(s64 n)
+void factor_vm::box_signed_8(s64 n)
 {
        if(n < fixnum_min || n > fixnum_max)
                dpush(tag<bignum>(long_long_to_bignum(n)));
@@ -726,13 +726,13 @@ void factorvm::box_signed_8(s64 n)
                dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_signed_8(s64 n,factorvm *myvm)
+VM_C_API void box_signed_8(s64 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_signed_8(n);
 }
 
-s64 factorvm::to_signed_8(cell obj)
+s64 factor_vm::to_signed_8(cell obj)
 {
        switch(tagged<object>(obj).type())
        {
@@ -746,13 +746,13 @@ s64 factorvm::to_signed_8(cell obj)
        }
 }
 
-VM_C_API s64 to_signed_8(cell obj,factorvm *myvm)
+VM_C_API s64 to_signed_8(cell obj,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_signed_8(obj);
 }
 
-void factorvm::box_unsigned_8(u64 n)
+void factor_vm::box_unsigned_8(u64 n)
 {
        if(n > (u64)fixnum_max)
                dpush(tag<bignum>(ulong_long_to_bignum(n)));
@@ -760,13 +760,13 @@ void factorvm::box_unsigned_8(u64 n)
                dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_unsigned_8(u64 n,factorvm *myvm)
+VM_C_API void box_unsigned_8(u64 n,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_unsigned_8(n);
 }
 
-u64 factorvm::to_unsigned_8(cell obj)
+u64 factor_vm::to_unsigned_8(cell obj)
 {
        switch(tagged<object>(obj).type())
        {
@@ -780,51 +780,51 @@ u64 factorvm::to_unsigned_8(cell obj)
        }
 }
 
-VM_C_API u64 to_unsigned_8(cell obj,factorvm *myvm)
+VM_C_API u64 to_unsigned_8(cell obj,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_unsigned_8(obj);
 }
  
-void factorvm::box_float(float flo)
+void factor_vm::box_float(float flo)
 {
         dpush(allot_float(flo));
 }
 
-VM_C_API void box_float(float flo, factorvm *myvm)
+VM_C_API void box_float(float flo, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_float(flo);
 }
 
-float factorvm::to_float(cell value)
+float factor_vm::to_float(cell value)
 {
        return untag_float_check(value);
 }
 
-VM_C_API float to_float(cell value,factorvm *myvm)
+VM_C_API float to_float(cell value,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_float(value);
 }
 
-void factorvm::box_double(double flo)
+void factor_vm::box_double(double flo)
 {
         dpush(allot_float(flo));
 }
 
-VM_C_API void box_double(double flo,factorvm *myvm)
+VM_C_API void box_double(double flo,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->box_double(flo);
 }
 
-double factorvm::to_double(cell value)
+double factor_vm::to_double(cell value)
 {
        return untag_float_check(value);
 }
 
-VM_C_API double to_double(cell value,factorvm *myvm)
+VM_C_API double to_double(cell value,factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->to_double(value);
@@ -832,29 +832,29 @@ VM_C_API double to_double(cell value,factorvm *myvm)
 
 /* The fixnum+, fixnum- and fixnum* primitives are defined in cpu_*.S. On
 overflow, they call these functions. */
-inline void factorvm::overflow_fixnum_add(fixnum x, fixnum y)
+inline void factor_vm::overflow_fixnum_add(fixnum x, fixnum y)
 {
        drepl(tag<bignum>(fixnum_to_bignum(
                untag_fixnum(x) + untag_fixnum(y))));
 }
 
-VM_ASM_API_OVERFLOW void overflow_fixnum_add(fixnum x, fixnum y, factorvm *myvm)
+VM_ASM_API_OVERFLOW void overflow_fixnum_add(fixnum x, fixnum y, factor_vm *myvm)
 {
        PRIMITIVE_OVERFLOW_GETVM()->overflow_fixnum_add(x,y);
 }
 
-inline void factorvm::overflow_fixnum_subtract(fixnum x, fixnum y)
+inline void factor_vm::overflow_fixnum_subtract(fixnum x, fixnum y)
 {
        drepl(tag<bignum>(fixnum_to_bignum(
                untag_fixnum(x) - untag_fixnum(y))));
 }
 
-VM_ASM_API_OVERFLOW void overflow_fixnum_subtract(fixnum x, fixnum y, factorvm *myvm)
+VM_ASM_API_OVERFLOW void overflow_fixnum_subtract(fixnum x, fixnum y, factor_vm *myvm)
 {
        PRIMITIVE_OVERFLOW_GETVM()->overflow_fixnum_subtract(x,y);
 }
 
-inline void factorvm::overflow_fixnum_multiply(fixnum x, fixnum y)
+inline void factor_vm::overflow_fixnum_multiply(fixnum x, fixnum y)
 {
        bignum *bx = fixnum_to_bignum(x);
        GC_BIGNUM(bx);
@@ -863,7 +863,7 @@ inline void factorvm::overflow_fixnum_multiply(fixnum x, fixnum y)
        drepl(tag<bignum>(bignum_multiply(bx,by)));
 }
 
-VM_ASM_API_OVERFLOW void overflow_fixnum_multiply(fixnum x, fixnum y, factorvm *myvm)
+VM_ASM_API_OVERFLOW void overflow_fixnum_multiply(fixnum x, fixnum y, factor_vm *myvm)
 {
        PRIMITIVE_OVERFLOW_GETVM()->overflow_fixnum_multiply(x,y);
 }
index 5e6121afb236fd74e7a762e5b99aa0e4e16359e3..a82a9a95803adf4d871ffcf15e4910b7ef05fa82 100644 (file)
@@ -61,30 +61,30 @@ PRIMITIVE(bits_float);
 PRIMITIVE(double_bits);
 PRIMITIVE(bits_double);
 
-VM_C_API void box_float(float flo, factorvm *vm);
-VM_C_API float to_float(cell value, factorvm *vm);
-VM_C_API void box_double(double flo, factorvm *vm);
-VM_C_API double to_double(cell value, factorvm *vm);
+VM_C_API void box_float(float flo, factor_vm *vm);
+VM_C_API float to_float(cell value, factor_vm *vm);
+VM_C_API void box_double(double flo, factor_vm *vm);
+VM_C_API double to_double(cell value, factor_vm *vm);
 
-VM_C_API void box_signed_1(s8 n, factorvm *vm);
-VM_C_API void box_unsigned_1(u8 n, factorvm *vm);
-VM_C_API void box_signed_2(s16 n, factorvm *vm);
-VM_C_API void box_unsigned_2(u16 n, factorvm *vm);
-VM_C_API void box_signed_4(s32 n, factorvm *vm);
-VM_C_API void box_unsigned_4(u32 n, factorvm *vm);
-VM_C_API void box_signed_cell(fixnum integer, factorvm *vm);
-VM_C_API void box_unsigned_cell(cell cell, factorvm *vm);
-VM_C_API void box_signed_8(s64 n, factorvm *vm);
-VM_C_API void box_unsigned_8(u64 n, factorvm *vm);
+VM_C_API void box_signed_1(s8 n, factor_vm *vm);
+VM_C_API void box_unsigned_1(u8 n, factor_vm *vm);
+VM_C_API void box_signed_2(s16 n, factor_vm *vm);
+VM_C_API void box_unsigned_2(u16 n, factor_vm *vm);
+VM_C_API void box_signed_4(s32 n, factor_vm *vm);
+VM_C_API void box_unsigned_4(u32 n, factor_vm *vm);
+VM_C_API void box_signed_cell(fixnum integer, factor_vm *vm);
+VM_C_API void box_unsigned_cell(cell cell, factor_vm *vm);
+VM_C_API void box_signed_8(s64 n, factor_vm *vm);
+VM_C_API void box_unsigned_8(u64 n, factor_vm *vm);
 
-VM_C_API s64 to_signed_8(cell obj, factorvm *vm);
-VM_C_API u64 to_unsigned_8(cell obj, factorvm *vm);
+VM_C_API s64 to_signed_8(cell obj, factor_vm *vm);
+VM_C_API u64 to_unsigned_8(cell obj, factor_vm *vm);
 
-VM_C_API fixnum to_fixnum(cell tagged, factorvm *vm);
-VM_C_API cell to_cell(cell tagged, factorvm *vm);
+VM_C_API fixnum to_fixnum(cell tagged, factor_vm *vm);
+VM_C_API cell to_cell(cell tagged, factor_vm *vm);
 
-VM_ASM_API_OVERFLOW void overflow_fixnum_add(fixnum x, fixnum y, factorvm *vm);
-VM_ASM_API_OVERFLOW void overflow_fixnum_subtract(fixnum x, fixnum y, factorvm *vm);
-VM_ASM_API_OVERFLOW void overflow_fixnum_multiply(fixnum x, fixnum y, factorvm *vm);
+VM_ASM_API_OVERFLOW void overflow_fixnum_add(fixnum x, fixnum y, factor_vm *vm);
+VM_ASM_API_OVERFLOW void overflow_fixnum_subtract(fixnum x, fixnum y, factor_vm *vm);
+VM_ASM_API_OVERFLOW void overflow_fixnum_multiply(fixnum x, fixnum y, factor_vm *vm);
 
 }
index 6540d8d19613bf5d6bb8feeb1af3a383ad66c897..7f2429e46aa1656eee0e81c59157e8c388286a7d 100644 (file)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-void factorvm::c_to_factor_toplevel(cell quot)
+void factor_vm::c_to_factor_toplevel(cell quot)
 {
        c_to_factor(quot,this);
 }
index 872e0b8b48b2984f98d8c64a53798e31dd2950e9..3aa001774bcbc7e813a89d4f0011d2af801bb2ec 100644 (file)
@@ -5,7 +5,7 @@
 namespace factor
 {
 
-void factorvm::c_to_factor_toplevel(cell quot)
+void factor_vm::c_to_factor_toplevel(cell quot)
 {
        for(;;)
        {
index 3652d346588d66e38ed28412c9ec3da33227ab89..e9e26240cd4e130df53b53b5a128f3444a23a1f7 100644 (file)
@@ -27,14 +27,14 @@ void init_platform_globals()
 
 }
 
-void register_vm_with_thread(factorvm *vm)
+void register_vm_with_thread(factor_vm *vm)
 {
        pthread_setspecific(tlsKey,vm);
 }
 
-factorvm *tls_vm()
+factor_vm *tls_vm()
 {
-       return (factorvm*)pthread_getspecific(tlsKey);
+       return (factor_vm*)pthread_getspecific(tlsKey);
 }
 
 static void *null_dll;
@@ -51,24 +51,24 @@ void sleep_micros(cell usec)
        usleep(usec);
 }
 
-void factorvm::init_ffi()
+void factor_vm::init_ffi()
 {
        /* NULL_DLL is "libfactor.dylib" for OS X and NULL for generic unix */
        null_dll = dlopen(NULL_DLL,RTLD_LAZY);
 }
 
-void factorvm::ffi_dlopen(dll *dll)
+void factor_vm::ffi_dlopen(dll *dll)
 {
        dll->dll = dlopen(alien_offset(dll->path), RTLD_LAZY);
 }
 
-void *factorvm::ffi_dlsym(dll *dll, symbol_char *symbol)
+void *factor_vm::ffi_dlsym(dll *dll, symbol_char *symbol)
 {
        void *handle = (dll == NULL ? null_dll : dll->dll);
        return dlsym(handle,symbol);
 }
 
-void factorvm::ffi_dlclose(dll *dll)
+void factor_vm::ffi_dlclose(dll *dll)
 {
        if(dlclose(dll->dll))
                general_error(ERROR_FFI,F,F,NULL);
@@ -77,7 +77,7 @@ void factorvm::ffi_dlclose(dll *dll)
 
 
 
-inline void factorvm::primitive_existsp()
+inline void factor_vm::primitive_existsp()
 {
        struct stat sb;
        char *path = (char *)(untag_check<byte_array>(dpop()) + 1);
@@ -89,7 +89,7 @@ PRIMITIVE(existsp)
        PRIMITIVE_GETVM()->primitive_existsp();
 }
 
-segment *factorvm::alloc_segment(cell size)
+segment *factor_vm::alloc_segment(cell size)
 {
        int pagesize = getpagesize();
 
@@ -128,7 +128,7 @@ void dealloc_segment(segment *block)
        free(block);
 }
   
-stack_frame *factorvm::uap_stack_pointer(void *uap)
+stack_frame *factor_vm::uap_stack_pointer(void *uap)
 {
        /* There is a race condition here, but in practice a signal
        delivered during stack frame setup/teardown or while transitioning
@@ -146,7 +146,7 @@ stack_frame *factorvm::uap_stack_pointer(void *uap)
 }
 
 
-void factorvm::memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
+void factor_vm::memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
        signal_fault_addr = (cell)siginfo->si_addr;
        signal_callstack_top = uap_stack_pointer(uap);
@@ -158,7 +158,7 @@ void memory_signal_handler(int signal, siginfo_t *siginfo, void *uap)
        SIGNAL_VM_PTR()->memory_signal_handler(signal,siginfo,uap);
 }
 
-void factorvm::misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
+void factor_vm::misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
        signal_number = signal;
        signal_callstack_top = uap_stack_pointer(uap);
@@ -170,7 +170,7 @@ void misc_signal_handler(int signal, siginfo_t *siginfo, void *uap)
        SIGNAL_VM_PTR()->misc_signal_handler(signal,siginfo,uap);
 }
 
-void factorvm::fpe_signal_handler(int signal, siginfo_t *siginfo, void *uap)
+void factor_vm::fpe_signal_handler(int signal, siginfo_t *siginfo, void *uap)
 {
        signal_number = signal;
        signal_callstack_top = uap_stack_pointer(uap);
index 5f84106f97899aee5ced6616d26d511cbbe11d6a..6ef539ab8bcad44bc0d84da411e0d4a9507c7af7 100644 (file)
@@ -55,8 +55,8 @@ s64 current_micros();
 void sleep_micros(cell usec);
 
 void init_platform_globals();
-struct factorvm;
-void register_vm_with_thread(factorvm *vm);
-factorvm *tls_vm();
+struct factor_vm;
+void register_vm_with_thread(factor_vm *vm);
+factor_vm *tls_vm();
 void open_console();
 }
index 250a3334e6eb0ec12b3e28c59af4e0fa91f02d32..2ac619dabc24c7594a1678cadd125ddf5543c095 100755 (executable)
@@ -15,15 +15,15 @@ void init_platform_globals()
                fatal_error("TlsAlloc failed - out of indexes",0);
 }
 
-void register_vm_with_thread(factorvm *vm)
+void register_vm_with_thread(factor_vm *vm)
 {
        if (! TlsSetValue(dwTlsIndex, vm))
                fatal_error("TlsSetValue failed",0);
 }
 
-factorvm *tls_vm()
+factor_vm *tls_vm()
 {
-       return (factorvm*)TlsGetValue(dwTlsIndex);
+       return (factor_vm*)TlsGetValue(dwTlsIndex);
 }
 
 s64 current_micros()
@@ -34,7 +34,7 @@ s64 current_micros()
                - EPOCH_OFFSET) / 10;
 }
 
-LONG factorvm::exception_handler(PEXCEPTION_POINTERS pe)
+LONG factor_vm::exception_handler(PEXCEPTION_POINTERS pe)
 {
        PEXCEPTION_RECORD e = (PEXCEPTION_RECORD)pe->ExceptionRecord;
        CONTEXT *c = (CONTEXT*)pe->ContextRecord;
@@ -87,7 +87,7 @@ FACTOR_STDCALL LONG exception_handler(PEXCEPTION_POINTERS pe)
 
 bool handler_added = 0;
 
-void factorvm::c_to_factor_toplevel(cell quot)
+void factor_vm::c_to_factor_toplevel(cell quot)
 {
        if(!handler_added){
                if(!AddVectoredExceptionHandler(0, (PVECTORED_EXCEPTION_HANDLER)factor::exception_handler))
@@ -98,7 +98,7 @@ void factorvm::c_to_factor_toplevel(cell quot)
        RemoveVectoredExceptionHandler((void *)factor::exception_handler);
 }
 
-void factorvm::open_console()
+void factor_vm::open_console()
 {
 }
 
index 366348a898abecde06338f61ba9c7f8831afa122..b02006f9d2349f467de0ca871b8251094266418a 100755 (executable)
@@ -31,8 +31,8 @@ typedef HANDLE THREADHANDLE;
 THREADHANDLE start_thread(void *(*start_routine)(void *),void *args);
 
 void init_platform_globals();
-struct factorvm;
-void register_vm_with_thread(factorvm *vm);
-factorvm *tls_vm();
+struct factor_vm;
+void register_vm_with_thread(factor_vm *vm);
+factor_vm *tls_vm();
 
 }
index 419be13f42d184c7108f8b8045a6d0f2f72e9ce4..4e06c0efb96179b34c9e989afb471ad749f01a9f 100644 (file)
@@ -5,30 +5,30 @@ namespace factor
 
 HMODULE hFactorDll;
 
-void factorvm::init_ffi()
+void factor_vm::init_ffi()
 {
        hFactorDll = GetModuleHandle(FACTOR_DLL);
        if(!hFactorDll)
                fatal_error("GetModuleHandle(\"" FACTOR_DLL_NAME "\") failed", 0);
 }
 
-void factorvm::ffi_dlopen(dll *dll)
+void factor_vm::ffi_dlopen(dll *dll)
 {
        dll->dll = LoadLibraryEx((WCHAR *)alien_offset(dll->path), NULL, 0);
 }
 
-void *factorvm::ffi_dlsym(dll *dll, symbol_char *symbol)
+void *factor_vm::ffi_dlsym(dll *dll, symbol_char *symbol)
 {
        return (void *)GetProcAddress(dll ? (HMODULE)dll->dll : hFactorDll, symbol);
 }
 
-void factorvm::ffi_dlclose(dll *dll)
+void factor_vm::ffi_dlclose(dll *dll)
 {
        FreeLibrary((HMODULE)dll->dll);
        dll->dll = NULL;
 }
 
-bool factorvm::windows_stat(vm_char *path)
+bool factor_vm::windows_stat(vm_char *path)
 {
        BY_HANDLE_FILE_INFORMATION bhfi;
        HANDLE h = CreateFileW(path,
@@ -56,14 +56,14 @@ bool factorvm::windows_stat(vm_char *path)
        return ret;
 }
 
-void factorvm::windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length)
+void factor_vm::windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length)
 {
        snwprintf(temp_path, length-1, L"%s.image", full_path); 
        temp_path[length - 1] = 0;
 }
 
 /* You must free() this yourself. */
-const vm_char *factorvm::default_image_path()
+const vm_char *factor_vm::default_image_path()
 {
        vm_char full_path[MAX_UNICODE_PATH];
        vm_char *ptr;
@@ -82,7 +82,7 @@ const vm_char *factorvm::default_image_path()
 }
 
 /* You must free() this yourself. */
-const vm_char *factorvm::vm_executable_path()
+const vm_char *factor_vm::vm_executable_path()
 {
        vm_char full_path[MAX_UNICODE_PATH];
        if(!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH))
@@ -90,7 +90,7 @@ const vm_char *factorvm::vm_executable_path()
        return safe_strdup(full_path);
 }
 
-inline void factorvm::primitive_existsp()
+inline void factor_vm::primitive_existsp()
 {
        vm_char *path = untag_check<byte_array>(dpop())->data<vm_char>();
        box_boolean(windows_stat(path));
@@ -101,7 +101,7 @@ PRIMITIVE(existsp)
        PRIMITIVE_GETVM()->primitive_existsp();
 }
 
-segment *factorvm::alloc_segment(cell size)
+segment *factor_vm::alloc_segment(cell size)
 {
        char *mem;
        DWORD ignore;
@@ -126,7 +126,7 @@ segment *factorvm::alloc_segment(cell size)
        return block;
 }
 
-void factorvm::dealloc_segment(segment *block)
+void factor_vm::dealloc_segment(segment *block)
 {
        SYSTEM_INFO si;
        GetSystemInfo(&si);
@@ -135,7 +135,7 @@ void factorvm::dealloc_segment(segment *block)
        free(block);
 }
 
-long factorvm::getpagesize()
+long factor_vm::getpagesize()
 {
        static long g_pagesize = 0;
        if (! g_pagesize)
@@ -147,7 +147,7 @@ long factorvm::getpagesize()
        return g_pagesize;
 }
 
-void factorvm::sleep_micros(u64 usec)
+void factor_vm::sleep_micros(u64 usec)
 {
        Sleep((DWORD)(usec / 1000));
 }
index 4c4266c76e77db6b6b40afe27053fcd35aa0c646..cd99c9f27c26c37a17620760edac5e20d38c5128 100755 (executable)
@@ -3,13 +3,13 @@
 namespace factor
 {
 
-void factorvm::init_profiler()
+void factor_vm::init_profiler()
 {
        profiling_p = false;
 }
 
 /* Allocates memory */
-code_block *factorvm::compile_profiling_stub(cell word_)
+code_block *factor_vm::compile_profiling_stub(cell word_)
 {
        gc_root<word> word(word_,this);
 
@@ -20,7 +20,7 @@ code_block *factorvm::compile_profiling_stub(cell word_)
 }
 
 /* Allocates memory */
-void factorvm::set_profiling(bool profiling)
+void factor_vm::set_profiling(bool profiling)
 {
        if(profiling == profiling_p)
                return;
@@ -47,7 +47,7 @@ void factorvm::set_profiling(bool profiling)
        iterate_code_heap(factor::relocate_code_block);
 }
 
-inline void factorvm::primitive_profiling()
+inline void factor_vm::primitive_profiling()
 {
        set_profiling(to_boolean(dpop()));
 }
index f1745cd81013948f20343dd959d81f6036afc157..d6774692e9cfd244d6ba2ae1aa0146ebbecd1226 100755 (executable)
@@ -265,7 +265,7 @@ void quotation_jit::iterate_quotation()
        }
 }
 
-void factorvm::set_quot_xt(quotation *quot, code_block *code)
+void factor_vm::set_quot_xt(quotation *quot, code_block *code)
 {
        if(code->type != QUOTATION_TYPE)
                critical_error("Bad param to set_quot_xt",(cell)code);
@@ -275,7 +275,7 @@ void factorvm::set_quot_xt(quotation *quot, code_block *code)
 }
 
 /* Allocates memory */
-void factorvm::jit_compile(cell quot_, bool relocating)
+void factor_vm::jit_compile(cell quot_, bool relocating)
 {
        gc_root<quotation> quot(quot_,this);
        if(quot->code) return;
@@ -289,7 +289,7 @@ void factorvm::jit_compile(cell quot_, bool relocating)
        if(relocating) relocate_code_block(compiled);
 }
 
-inline void factorvm::primitive_jit_compile()
+inline void factor_vm::primitive_jit_compile()
 {
        jit_compile(dpop(),true);
 }
@@ -300,7 +300,7 @@ PRIMITIVE(jit_compile)
 }
 
 /* push a new quotation on the stack */
-inline void factorvm::primitive_array_to_quotation()
+inline void factor_vm::primitive_array_to_quotation()
 {
        quotation *quot = allot<quotation>(sizeof(quotation));
        quot->array = dpeek();
@@ -316,7 +316,7 @@ PRIMITIVE(array_to_quotation)
        PRIMITIVE_GETVM()->primitive_array_to_quotation();
 }
 
-inline void factorvm::primitive_quotation_xt()
+inline void factor_vm::primitive_quotation_xt()
 {
        quotation *quot = untag_check<quotation>(dpeek());
        drepl(allot_cell((cell)quot->xt));
@@ -327,7 +327,7 @@ PRIMITIVE(quotation_xt)
        PRIMITIVE_GETVM()->primitive_quotation_xt();
 }
 
-void factorvm::compile_all_words()
+void factor_vm::compile_all_words()
 {
        gc_root<array> words(find_all_words(),this);
 
@@ -348,7 +348,7 @@ void factorvm::compile_all_words()
 }
 
 /* Allocates memory */
-fixnum factorvm::quot_code_offset_to_scan(cell quot_, cell offset)
+fixnum factor_vm::quot_code_offset_to_scan(cell quot_, cell offset)
 {
        gc_root<quotation> quot(quot_,this);
        gc_root<array> array(quot->array,this);
@@ -360,7 +360,7 @@ fixnum factorvm::quot_code_offset_to_scan(cell quot_, cell offset)
        return compiler.get_position();
 }
 
-cell factorvm::lazy_jit_compile_impl(cell quot_, stack_frame *stack)
+cell factor_vm::lazy_jit_compile_impl(cell quot_, stack_frame *stack)
 {
        gc_root<quotation> quot(quot_,this);
        stack_chain->callstack_top = stack;
@@ -368,13 +368,13 @@ cell factorvm::lazy_jit_compile_impl(cell quot_, stack_frame *stack)
        return quot.value();
 }
 
-VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factorvm *myvm)
+VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack, factor_vm *myvm)
 {
        ASSERTVM();
        return VM_PTR->lazy_jit_compile_impl(quot_,stack);
 }
 
-inline void factorvm::primitive_quot_compiled_p()
+inline void factor_vm::primitive_quot_compiled_p()
 {
        tagged<quotation> quot(dpop());
        quot.untag_check(this);
index ae24a522f9c1ce0e9316111a2fc43abae6bcf3a3..b21884a35bfc8c4601f6c538e20421fd6bf09537 100755 (executable)
@@ -5,7 +5,7 @@ struct quotation_jit : public jit {
        gc_root<array> elements;
        bool compiling, relocate;
 
-       quotation_jit(cell quot, bool compiling_, bool relocate_, factorvm *vm)
+       quotation_jit(cell quot, bool compiling_, bool relocate_, factor_vm *vm)
                : jit(QUOTATION_TYPE,quot,vm),
                  elements(owner.as<quotation>().untagged()->array,vm),
                  compiling(compiling_),
@@ -27,7 +27,7 @@ PRIMITIVE(jit_compile);
 PRIMITIVE(array_to_quotation);
 PRIMITIVE(quotation_xt);
 
-VM_ASM_API cell lazy_jit_compile_impl(cell quot, stack_frame *stack, factorvm *myvm);
+VM_ASM_API cell lazy_jit_compile_impl(cell quot, stack_frame *stack, factor_vm *myvm);
 
 PRIMITIVE(quot_compiled_p);
 
index a964fad9144e8bec7af77efa0fb9477f8a1f071d..2f162e3acef53a0dbf312c1938bc50f6a961106a 100755 (executable)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-inline void factorvm::primitive_getenv()
+inline void factor_vm::primitive_getenv()
 {
        fixnum e = untag_fixnum(dpeek());
        drepl(userenv[e]);
@@ -14,7 +14,7 @@ PRIMITIVE(getenv)
        PRIMITIVE_GETVM()->primitive_getenv();
 }
 
-inline void factorvm::primitive_setenv()
+inline void factor_vm::primitive_setenv()
 {
        fixnum e = untag_fixnum(dpop());
        cell value = dpop();
@@ -26,7 +26,7 @@ PRIMITIVE(setenv)
        PRIMITIVE_GETVM()->primitive_setenv();
 }
 
-inline void factorvm::primitive_exit()
+inline void factor_vm::primitive_exit()
 {
        exit(to_fixnum(dpop()));
 }
@@ -36,7 +36,7 @@ PRIMITIVE(exit)
        PRIMITIVE_GETVM()->primitive_exit();
 }
 
-inline void factorvm::primitive_micros()
+inline void factor_vm::primitive_micros()
 {
        box_unsigned_8(current_micros());
 }
@@ -46,7 +46,7 @@ PRIMITIVE(micros)
        PRIMITIVE_GETVM()->primitive_micros();
 }
 
-inline void factorvm::primitive_sleep()
+inline void factor_vm::primitive_sleep()
 {
        sleep_micros(to_cell(dpop()));
 }
@@ -56,7 +56,7 @@ PRIMITIVE(sleep)
        PRIMITIVE_GETVM()->primitive_sleep();
 }
 
-inline void factorvm::primitive_set_slot()
+inline void factor_vm::primitive_set_slot()
 {
        fixnum slot = untag_fixnum(dpop());
        object *obj = untag<object>(dpop());
@@ -71,7 +71,7 @@ PRIMITIVE(set_slot)
        PRIMITIVE_GETVM()->primitive_set_slot();
 }
 
-inline void factorvm::primitive_load_locals()
+inline void factor_vm::primitive_load_locals()
 {
        fixnum count = untag_fixnum(dpop());
        memcpy((cell *)(rs + sizeof(cell)),(cell *)(ds - sizeof(cell) * (count - 1)),sizeof(cell) * count);
@@ -84,7 +84,7 @@ PRIMITIVE(load_locals)
        PRIMITIVE_GETVM()->primitive_load_locals();
 }
 
-cell factorvm::clone_object(cell obj_)
+cell factor_vm::clone_object(cell obj_)
 {
        gc_root<object> obj(obj_,this);
 
@@ -99,7 +99,7 @@ cell factorvm::clone_object(cell obj_)
        }
 }
 
-inline void factorvm::primitive_clone()
+inline void factor_vm::primitive_clone()
 {
        drepl(clone_object(dpeek()));
 }
index 5c0a8865134ee3071dba2caf005194b84f60bf2a..912706024ee9fadaa06132def4d72549b1dfac7a 100644 (file)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-cell factorvm::string_nth(string* str, cell index)
+cell factor_vm::string_nth(string* str, cell index)
 {
        /* If high bit is set, the most significant 16 bits of the char
        come from the aux vector. The least significant bit of the
@@ -22,12 +22,12 @@ cell factorvm::string_nth(string* str, cell index)
        }
 }
 
-void factorvm::set_string_nth_fast(string *str, cell index, cell ch)
+void factor_vm::set_string_nth_fast(string *str, cell index, cell ch)
 {
        str->data()[index] = ch;
 }
 
-void factorvm::set_string_nth_slow(string *str_, cell index, cell ch)
+void factor_vm::set_string_nth_slow(string *str_, cell index, cell ch)
 {
        gc_root<string> str(str_,this);
 
@@ -55,7 +55,7 @@ void factorvm::set_string_nth_slow(string *str_, cell index, cell ch)
 }
 
 /* allocates memory */
-void factorvm::set_string_nth(string *str, cell index, cell ch)
+void factor_vm::set_string_nth(string *str, cell index, cell ch)
 {
        if(ch <= 0x7f)
                set_string_nth_fast(str,index,ch);
@@ -64,7 +64,7 @@ void factorvm::set_string_nth(string *str, cell index, cell ch)
 }
 
 /* Allocates memory */
-string *factorvm::allot_string_internal(cell capacity)
+string *factor_vm::allot_string_internal(cell capacity)
 {
        string *str = allot<string>(string_size(capacity));
 
@@ -76,7 +76,7 @@ string *factorvm::allot_string_internal(cell capacity)
 }
 
 /* Allocates memory */
-void factorvm::fill_string(string *str_, cell start, cell capacity, cell fill)
+void factor_vm::fill_string(string *str_, cell start, cell capacity, cell fill)
 {
        gc_root<string> str(str_,this);
 
@@ -92,14 +92,14 @@ void factorvm::fill_string(string *str_, cell start, cell capacity, cell fill)
 }
 
 /* Allocates memory */
-string *factorvm::allot_string(cell capacity, cell fill)
+string *factor_vm::allot_string(cell capacity, cell fill)
 {
        gc_root<string> str(allot_string_internal(capacity),this);
        fill_string(str.untagged(),0,capacity,fill);
        return str.untagged();
 }
 
-inline void factorvm::primitive_string()
+inline void factor_vm::primitive_string()
 {
        cell initial = to_cell(dpop());
        cell length = unbox_array_size();
@@ -111,14 +111,14 @@ PRIMITIVE(string)
        PRIMITIVE_GETVM()->primitive_string();
 }
 
-bool factorvm::reallot_string_in_place_p(string *str, cell capacity)
+bool factor_vm::reallot_string_in_place_p(string *str, cell capacity)
 {
        return in_zone(&nursery,str)
                && (str->aux == F || in_zone(&nursery,untag<byte_array>(str->aux)))
                && capacity <= string_capacity(str);
 }
 
-string* factorvm::reallot_string(string *str_, cell capacity)
+string* factor_vm::reallot_string(string *str_, cell capacity)
 {
        gc_root<string> str(str_,this);
 
@@ -160,7 +160,7 @@ string* factorvm::reallot_string(string *str_, cell capacity)
        }
 }
 
-inline void factorvm::primitive_resize_string()
+inline void factor_vm::primitive_resize_string()
 {
        string* str = untag_check<string>(dpop());
        cell capacity = unbox_array_size();
@@ -172,7 +172,7 @@ PRIMITIVE(resize_string)
        PRIMITIVE_GETVM()->primitive_resize_string();
 }
 
-inline void factorvm::primitive_string_nth()
+inline void factor_vm::primitive_string_nth()
 {
        string *str = untag<string>(dpop());
        cell index = untag_fixnum(dpop());
@@ -184,7 +184,7 @@ PRIMITIVE(string_nth)
        PRIMITIVE_GETVM()->primitive_string_nth();
 }
 
-inline void factorvm::primitive_set_string_nth_fast()
+inline void factor_vm::primitive_set_string_nth_fast()
 {
        string *str = untag<string>(dpop());
        cell index = untag_fixnum(dpop());
@@ -197,7 +197,7 @@ PRIMITIVE(set_string_nth_fast)
        PRIMITIVE_GETVM()->primitive_set_string_nth_fast();
 }
 
-inline void factorvm::primitive_set_string_nth_slow()
+inline void factor_vm::primitive_set_string_nth_slow()
 {
        string *str = untag<string>(dpop());
        cell index = untag_fixnum(dpop());
index 8eb492a140c387c4c1d1606ea982b847c6acf4c2..5f3075699a4fb980015d9a237592c7e8d1c859d2 100755 (executable)
@@ -29,7 +29,7 @@ struct tagged
 
        bool type_p(cell type_) const { return type() == type_; }
 
-       TYPE *untag_check(factorvm *myvm) const {
+       TYPE *untag_check(factor_vm *myvm) const {
                if(TYPE::type_number != TYPE_COUNT && !type_p(TYPE::type_number))
                        myvm->type_error(TYPE::type_number,value_);
                return untagged();
@@ -59,12 +59,12 @@ struct tagged
        template<typename X> tagged<X> as() { return tagged<X>(value_); }
 };
 
-template <typename TYPE> TYPE *factorvm::untag_check(cell value)
+template <typename TYPE> TYPE *factor_vm::untag_check(cell value)
 {
        return tagged<TYPE>(value).untag_check(this);
 }
 
-template <typename TYPE> TYPE *factorvm::untag(cell value)
+template <typename TYPE> TYPE *factor_vm::untag(cell value)
 {
        return tagged<TYPE>(value).untagged();
 }
index 77fd01a5cebfd819e63e5ff8f48c8557e4875144..a89265f70991c3502e61a45cb354e9e7e52513ee 100644 (file)
@@ -4,7 +4,7 @@ namespace factor
 {
 
 /* push a new tuple on the stack */
-tuple *factorvm::allot_tuple(cell layout_)
+tuple *factor_vm::allot_tuple(cell layout_)
 {
        gc_root<tuple_layout> layout(layout_,this);
        gc_root<tuple> t(allot<tuple>(tuple_size(layout.untagged())),this);
@@ -12,7 +12,7 @@ tuple *factorvm::allot_tuple(cell layout_)
        return t.untagged();
 }
 
-inline void factorvm::primitive_tuple()
+inline void factor_vm::primitive_tuple()
 {
        gc_root<tuple_layout> layout(dpop(),this);
        tuple *t = allot_tuple(layout.value());
@@ -29,7 +29,7 @@ PRIMITIVE(tuple)
 }
 
 /* push a new tuple on the stack, filling its slots from the stack */
-inline void factorvm::primitive_tuple_boa()
+inline void factor_vm::primitive_tuple_boa()
 {
        gc_root<tuple_layout> layout(dpop(),this);
        gc_root<tuple> t(allot_tuple(layout.value()),this);
index f5ecdc5f62228ee327981c561ef4411d8d967438..f4faf5b46b697ce95687899d87e599a7f4f03a98 100644 (file)
@@ -1,7 +1,7 @@
 namespace factor
 {
 
-struct factorvmdata {
+struct factor_vm_data {
        // if you change this struct, also change vm.factor k--------
        context *stack_chain; 
        zone nursery; /* new objects are allocated here */
@@ -101,7 +101,7 @@ struct factorvmdata {
        cell pic_to_mega_transitions;
        cell pic_counts[4];  /* PIC_TAG, PIC_HI_TAG, PIC_TUPLE, PIC_HI_TAG_TUPLE */
 
-       factorvmdata() 
+       factor_vm_data() 
                : profiling_p(false),
                  secure_gc(false),
                  gc_off(false),
index d3e22396894a0a318f5a433941b140e7b6b9ddd9..282f48b41e5c0f9944f2d112ee23771febc00040 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-struct factorvm : factorvmdata {
+struct factor_vm : factor_vm_data {
 
        // segments
        inline cell align_page(cell a);
@@ -124,7 +124,7 @@ struct factorvm : factorvmdata {
        bignum *bignum_integer_length(bignum * x);
        int bignum_logbitp(int shift, bignum * arg);
        int bignum_unsigned_logbitp(int shift, bignum * bignum);
-       bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factorvm *), unsigned int radix, int negative_p);
+       bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factor_vm *), unsigned int radix, int negative_p);
 
        //data_heap
        cell init_zone(zone *z, cell size, cell start);
@@ -494,7 +494,7 @@ struct factorvm : factorvmdata {
        inline void primitive_set_innermost_stack_frame_quot();
        void save_callstack_bottom(stack_frame *callstack_bottom);
        template<typename T> void iterate_callstack(cell top, cell bottom, T &iterator);
-       inline void do_slots(cell obj, void (* iter)(cell *,factorvm*));
+       inline void do_slots(cell obj, void (* iter)(cell *,factor_vm*));
 
        //alien
        char *pinned_alien_offset(cell obj);
@@ -617,7 +617,7 @@ struct factorvm : factorvmdata {
 
 #ifdef FACTOR_SINGLE_THREADED_SINGLETON
 /* calls are dispatched using the singleton vm ptr */
-  extern factorvm *vm;
+  extern factor_vm *vm;
   #define PRIMITIVE_GETVM() vm
   #define PRIMITIVE_OVERFLOW_GETVM() vm
   #define VM_PTR vm
@@ -627,9 +627,9 @@ struct factorvm : factorvmdata {
 
 #ifdef FACTOR_SINGLE_THREADED_TESTING
 /* calls are dispatched as per multithreaded, but checked against singleton */
-  extern factorvm *vm;
+  extern factor_vm *vm;
   #define ASSERTVM() assert(vm==myvm)
-  #define PRIMITIVE_GETVM() ((factorvm*)myvm)
+  #define PRIMITIVE_GETVM() ((factor_vm*)myvm)
   #define PRIMITIVE_OVERFLOW_GETVM() ASSERTVM(); myvm
   #define VM_PTR myvm
   #define SIGNAL_VM_PTR() tls_vm()
@@ -645,8 +645,8 @@ struct factorvm : factorvmdata {
 #endif
 
 #ifdef FACTOR_REENTRANT
-  #define PRIMITIVE_GETVM() ((factorvm*)myvm)
-  #define PRIMITIVE_OVERFLOW_GETVM() ((factorvm*)myvm)
+  #define PRIMITIVE_GETVM() ((factor_vm*)myvm)
+  #define PRIMITIVE_OVERFLOW_GETVM() ((factor_vm*)myvm)
   #define VM_PTR myvm
   #define ASSERTVM() 
   #define SIGNAL_VM_PTR() tls_vm()
index 5ef229cbd992b42a98a783defd631451f3d6d0a6..f5215b78a8e9a2a50572150924c0eba43ecad1ce 100644 (file)
@@ -3,7 +3,7 @@
 namespace factor
 {
 
-word *factorvm::allot_word(cell vocab_, cell name_)
+word *factor_vm::allot_word(cell vocab_, cell name_)
 {
        gc_root<object> vocab(vocab_,this);
        gc_root<object> name(name_,this);
@@ -32,7 +32,7 @@ word *factorvm::allot_word(cell vocab_, cell name_)
 }
 
 /* <word> ( name vocabulary -- word ) */
-inline void factorvm::primitive_word()
+inline void factor_vm::primitive_word()
 {
        cell vocab = dpop();
        cell name = dpop();
@@ -45,7 +45,7 @@ PRIMITIVE(word)
 }
 
 /* word-xt ( word -- start end ) */
-inline void factorvm::primitive_word_xt()
+inline void factor_vm::primitive_word_xt()
 {
        word *w = untag_check<word>(dpop());
        code_block *code = (profiling_p ? w->profiling : w->code);
@@ -59,7 +59,7 @@ PRIMITIVE(word_xt)
 }
 
 /* Allocates memory */
-void factorvm::update_word_xt(cell w_)
+void factor_vm::update_word_xt(cell w_)
 {
        gc_root<word> w(w_,this);
 
@@ -74,7 +74,7 @@ void factorvm::update_word_xt(cell w_)
                w->xt = w->code->xt();
 }
 
-inline void factorvm::primitive_optimized_p()
+inline void factor_vm::primitive_optimized_p()
 {
        drepl(tag_boolean(word_optimized_p(untag_check<word>(dpeek()))));
 }
@@ -84,7 +84,7 @@ PRIMITIVE(optimized_p)
        PRIMITIVE_GETVM()->primitive_optimized_p();
 }
 
-inline void factorvm::primitive_wrapper()
+inline void factor_vm::primitive_wrapper()
 {
        wrapper *new_wrapper = allot<wrapper>(sizeof(wrapper));
        new_wrapper->object = dpeek();