removed some global functions from alien.cpp

db4
Phil Dawes 2009-08-17 21:37:18 +01:00
parent 551a800d2f
commit 7f70b6320c
2 changed files with 4 additions and 15 deletions

View File

@ -24,11 +24,6 @@ char *factorvm::pinned_alien_offset(cell obj)
} }
} }
char *pinned_alien_offset(cell obj)
{
return vm->pinned_alien_offset(obj);
}
/* make an alien */ /* make an alien */
cell factorvm::allot_alien(cell delegate_, cell displacement) cell factorvm::allot_alien(cell delegate_, cell displacement)
{ {
@ -50,11 +45,6 @@ cell factorvm::allot_alien(cell delegate_, cell displacement)
return new_alien.value(); return new_alien.value();
} }
cell allot_alien(cell delegate_, cell displacement)
{
return vm->allot_alien(delegate_,displacement);
}
/* make an alien pointing at an offset of another alien */ /* make an alien pointing at an offset of another alien */
inline void factorvm::vmprim_displaced_alien() inline void factorvm::vmprim_displaced_alien()
{ {
@ -108,15 +98,16 @@ void *alien_pointer()
return vm->alien_pointer(); return vm->alien_pointer();
} }
/* define words to read/write values at an alien address */ /* define words to read/write values at an alien address */
#define DEFINE_ALIEN_ACCESSOR(name,type,boxer,to) \ #define DEFINE_ALIEN_ACCESSOR(name,type,boxer,to) \
PRIMITIVE(alien_##name) \ PRIMITIVE(alien_##name) \
{ \ { \
boxer(*(type*)alien_pointer()); \ boxer(*(type*)PRIMITIVE_GETVM()->alien_pointer()); \
} \ } \
PRIMITIVE(set_alien_##name) \ PRIMITIVE(set_alien_##name) \
{ \ { \
type *ptr = (type *)alien_pointer(); \ type *ptr = (type *)PRIMITIVE_GETVM()->alien_pointer(); \
type value = to(dpop()); \ type value = to(dpop()); \
*ptr = value; \ *ptr = value; \
} }
@ -133,7 +124,7 @@ DEFINE_ALIEN_ACCESSOR(signed_1,s8,box_signed_1,to_fixnum)
DEFINE_ALIEN_ACCESSOR(unsigned_1,u8,box_unsigned_1,to_cell) DEFINE_ALIEN_ACCESSOR(unsigned_1,u8,box_unsigned_1,to_cell)
DEFINE_ALIEN_ACCESSOR(float,float,box_float,to_float) DEFINE_ALIEN_ACCESSOR(float,float,box_float,to_float)
DEFINE_ALIEN_ACCESSOR(double,double,box_double,to_double) DEFINE_ALIEN_ACCESSOR(double,double,box_double,to_double)
DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,pinned_alien_offset) DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,PRIMITIVE_GETVM()->pinned_alien_offset)
/* open a native library and push a handle */ /* open a native library and push a handle */
inline void factorvm::vmprim_dlopen() inline void factorvm::vmprim_dlopen()

2
vm/alien.hpp Normal file → Executable file
View File

@ -1,8 +1,6 @@
namespace factor namespace factor
{ {
cell allot_alien(cell delegate, cell displacement);
PRIMITIVE(displaced_alien); PRIMITIVE(displaced_alien);
PRIMITIVE(alien_address); PRIMITIVE(alien_address);