]> gitweb.factorcode.org Git - factor.git/commitdiff
converted box_* integer functions to use vm (x86 windows)
authorPhil Dawes <phil@phildawes.net>
Sat, 22 Aug 2009 09:50:52 +0000 (10:50 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:33 +0000 (08:16 +0100)
vm/alien.cpp
vm/math.cpp
vm/math.hpp

index da33c01df17587852e24b90c9e2d6b0bd697311b..e2298630e1d96096a248f71e9348fb3f4362879d 100755 (executable)
@@ -103,12 +103,14 @@ void *alien_pointer()
 #define DEFINE_ALIEN_ACCESSOR(name,type,boxer,to) \
        PRIMITIVE(alien_##name) \
        { \
-               boxer(*(type*)PRIMITIVE_GETVM()->alien_pointer());      \
+               factorvm *myvm = PRIMITIVE_GETVM(); \
+               myvm->boxer(*(type*)myvm->alien_pointer());     \
        } \
        PRIMITIVE(set_alien_##name) \
        { \
-               type *ptr = (type *)PRIMITIVE_GETVM()->alien_pointer(); \
-               type value = PRIMITIVE_GETVM()->to(dpop()); \
+               factorvm *myvm = PRIMITIVE_GETVM(); \
+               type *ptr = (type *)myvm->alien_pointer(); \
+               type value = myvm->to(dpop()); \
                *ptr = value; \
        }
 
index 1bb8f0abe51decdd0d8190c6dcde2552a9735815..e6e1abf80a45e389158074e8f117625c28a09f70 100755 (executable)
@@ -638,9 +638,10 @@ void factorvm::box_signed_1(s8 n)
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_signed_1(s8 n)
+VM_C_API void box_signed_1(s8 n,factorvm *myvm)
 {
-       return vm->box_signed_1(n);
+       ASSERTVM();
+       return VM_PTR->box_signed_1(n);
 }
 
 void factorvm::box_unsigned_1(u8 n)
@@ -648,9 +649,10 @@ void factorvm::box_unsigned_1(u8 n)
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_unsigned_1(u8 n)
+VM_C_API void box_unsigned_1(u8 n,factorvm *myvm)
 {
-       return vm->box_unsigned_1(n);
+       ASSERTVM();
+       return VM_PTR->box_unsigned_1(n);
 }
 
 void factorvm::box_signed_2(s16 n)
@@ -658,9 +660,10 @@ void factorvm::box_signed_2(s16 n)
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_signed_2(s16 n)
+VM_C_API void box_signed_2(s16 n,factorvm *myvm)
 {
-       return vm->box_signed_2(n);
+       ASSERTVM();
+       return VM_PTR->box_signed_2(n);
 }
 
 void factorvm::box_unsigned_2(u16 n)
@@ -668,9 +671,10 @@ void factorvm::box_unsigned_2(u16 n)
        dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_unsigned_2(u16 n)
+VM_C_API void box_unsigned_2(u16 n,factorvm *myvm)
 {
-       return vm->box_unsigned_2(n);
+       ASSERTVM();
+       return VM_PTR->box_unsigned_2(n);
 }
 
 void factorvm::box_signed_4(s32 n)
@@ -678,9 +682,10 @@ void factorvm::box_signed_4(s32 n)
        dpush(allot_integer(n));
 }
 
-VM_C_API void box_signed_4(s32 n)
+VM_C_API void box_signed_4(s32 n,factorvm *myvm)
 {
-       return vm->box_signed_4(n);
+       ASSERTVM();
+       return VM_PTR->box_signed_4(n);
 }
 
 void factorvm::box_unsigned_4(u32 n)
@@ -688,9 +693,10 @@ void factorvm::box_unsigned_4(u32 n)
        dpush(allot_cell(n));
 }
 
-VM_C_API void box_unsigned_4(u32 n)
+VM_C_API void box_unsigned_4(u32 n,factorvm *myvm)
 {
-       return vm->box_unsigned_4(n);
+       ASSERTVM();
+       return VM_PTR->box_unsigned_4(n);
 }
 
 void factorvm::box_signed_cell(fixnum integer)
@@ -698,9 +704,10 @@ void factorvm::box_signed_cell(fixnum integer)
        dpush(allot_integer(integer));
 }
 
-VM_C_API void box_signed_cell(fixnum integer)
+VM_C_API void box_signed_cell(fixnum integer,factorvm *myvm)
 {
-       return vm->box_signed_cell(integer);
+       ASSERTVM();
+       return VM_PTR->box_signed_cell(integer);
 }
 
 void factorvm::box_unsigned_cell(cell cell)
@@ -708,9 +715,10 @@ void factorvm::box_unsigned_cell(cell cell)
        dpush(allot_cell(cell));
 }
 
-VM_C_API void box_unsigned_cell(cell cell)
+VM_C_API void box_unsigned_cell(cell cell,factorvm *myvm)
 {
-       return vm->box_unsigned_cell(cell);
+       ASSERTVM();
+       return VM_PTR->box_unsigned_cell(cell);
 }
 
 void factorvm::box_signed_8(s64 n)
@@ -721,9 +729,10 @@ void factorvm::box_signed_8(s64 n)
                dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_signed_8(s64 n)
+VM_C_API void box_signed_8(s64 n,factorvm *myvm)
 {
-       return vm->box_signed_8(n);
+       ASSERTVM();
+       return VM_PTR->box_signed_8(n);
 }
 
 s64 factorvm::to_signed_8(cell obj)
@@ -754,9 +763,10 @@ void factorvm::box_unsigned_8(u64 n)
                dpush(tag_fixnum(n));
 }
 
-VM_C_API void box_unsigned_8(u64 n)
+VM_C_API void box_unsigned_8(u64 n,factorvm *myvm)
 {
-       return vm->box_unsigned_8(n);
+       ASSERTVM();
+       return VM_PTR->box_unsigned_8(n);
 }
 
 u64 factorvm::to_unsigned_8(cell obj)
index 8affd8edd28dfd029085328b7b9bc2410e1b914d..11c43a01a10aeb169c5fe4257f8a6d801f2d9c88 100644 (file)
@@ -65,16 +65,16 @@ VM_C_API float to_float(cell value, factorvm *vm);
 VM_C_API void box_double(double flo);
 VM_C_API double to_double(cell value, factorvm *vm);
 
-VM_C_API void box_signed_1(s8 n);
-VM_C_API void box_unsigned_1(u8 n);
-VM_C_API void box_signed_2(s16 n);
-VM_C_API void box_unsigned_2(u16 n);
-VM_C_API void box_signed_4(s32 n);
-VM_C_API void box_unsigned_4(u32 n);
-VM_C_API void box_signed_cell(fixnum integer);
-VM_C_API void box_unsigned_cell(cell cell);
-VM_C_API void box_signed_8(s64 n);
-VM_C_API void box_unsigned_8(u64 n);
+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 s64 to_signed_8(cell obj, factorvm *vm);
 VM_C_API u64 to_unsigned_8(cell obj, factorvm *vm);