From 12ca7bdc57c4958b6d6079a3eb3737420c1bdde6 Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Mon, 24 Aug 2009 20:26:10 +0100 Subject: [PATCH] added factorvm ptrs to the rest of alien functions. (Left commented debug lines to remind me that these haven't been tested yet, and some are osx specific) --- vm/alien.cpp | 30 +++++++++++++++--------------- vm/alien.hpp | 10 +++++----- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/vm/alien.cpp b/vm/alien.cpp index 282f5c2fc9..9eb6da9784 100755 --- a/vm/alien.cpp +++ b/vm/alien.cpp @@ -224,10 +224,10 @@ char *factorvm::unbox_alien() return alien_offset(dpop()); } -VM_C_API char *unbox_alien() +VM_C_API char *unbox_alien(factorvm *myvm) { - printf("PHIL unbox_alien\n");fflush(stdout); - return vm->unbox_alien(); + //printf("PHIL unbox_alien %d %d\n",vm,myvm);fflush(stdout); + return VM_PTR->unbox_alien(); } /* make an alien and push */ @@ -251,10 +251,10 @@ void factorvm::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) +VM_C_API void to_value_struct(cell src, void *dest, cell size, factorvm *myvm) { - printf("PHIL to_value_struct\n"); - return vm->to_value_struct(src,dest,size); + //printf("PHIL to_value_struct %d %d\n",vm,myvm);fflush(stdout); + return VM_PTR->to_value_struct(src,dest,size); } /* for FFI callbacks receiving structs by value */ @@ -265,10 +265,10 @@ void factorvm::box_value_struct(void *src, cell size) dpush(tag(bytes)); } -VM_C_API void box_value_struct(void *src, cell size) +VM_C_API void box_value_struct(void *src, cell size,factorvm *myvm) { - printf("PHIL box_value_struct\n"); - return vm->box_value_struct(src,size); + //printf("PHIL box_value_struct %d %d\n",vm,myvm);fflush(stdout); + return VM_PTR->box_value_struct(src,size); } /* On some x86 OSes, structs <= 8 bytes are returned in registers. */ @@ -280,10 +280,10 @@ 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) +VM_C_API void box_small_struct(cell x, cell y, cell size, factorvm *myvm) { - printf("PHIL box_small_struct\n"); - return vm->box_small_struct(x,y,size); + //printf("PHIL box_small_struct %d %d\n",vm,myvm);fflush(stdout); + return VM_PTR->box_small_struct(x,y,size); } /* On OS X/PPC, complex numbers are returned in registers. */ @@ -297,10 +297,10 @@ 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) +VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, factorvm *myvm) { - printf("PHIL box_medium_struct\n"); - return vm->box_medium_struct(x1, x2, x3, x4, size); + //printf("PHIL box_medium_struct %d %d\n",vm,myvm);fflush(stdout); + return VM_PTR->box_medium_struct(x1, x2, x3, x4, size); } } diff --git a/vm/alien.hpp b/vm/alien.hpp index 327d791406..7b537146fd 100755 --- a/vm/alien.hpp +++ b/vm/alien.hpp @@ -37,11 +37,11 @@ PRIMITIVE(dlclose); PRIMITIVE(dll_validp); VM_C_API char *alien_offset(cell object, factorvm *vm); -VM_C_API char *unbox_alien(); +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); -VM_C_API void box_value_struct(void *src, cell size); -VM_C_API void box_small_struct(cell x, cell y, cell size); -VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size); +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); } -- 2.34.1