added vm-ptr primitive

db4
Phil Dawes 2009-09-02 10:43:21 +01:00
parent 0470b7d2c5
commit 2e50da6beb
5 changed files with 16 additions and 0 deletions

View File

@ -103,6 +103,7 @@ bootstrapping? on
"words"
"vectors"
"vectors.private"
"vm"
} [ create-vocab drop ] each
! Builtin classes
@ -518,6 +519,7 @@ tuple
{ "inline-cache-stats" "generic.single" (( -- stats )) }
{ "optimized?" "words" (( word -- ? )) }
{ "quot-compiled?" "quotations" (( quot -- ? )) }
{ "vm-ptr" "vm" (( -- ptr )) }
} [ [ first3 ] dip swap make-primitive ] each-index
! Bump build number

View File

@ -303,4 +303,14 @@ VM_C_API void box_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size, f
return VM_PTR->box_medium_struct(x1, x2, x3, x4, size);
}
inline void factorvm::vmprim_vm_ptr()
{
box_alien(this);
}
PRIMITIVE(vm_ptr)
{
PRIMITIVE_GETVM()->vmprim_vm_ptr();
}
}

View File

@ -36,6 +36,8 @@ PRIMITIVE(dlsym);
PRIMITIVE(dlclose);
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);

View File

@ -162,6 +162,7 @@ const primitive_type primitives[] = {
primitive_inline_cache_stats,
primitive_optimized_p,
primitive_quot_compiled_p,
primitive_vm_ptr,
};
}

View File

@ -585,6 +585,7 @@ struct factorvm {
inline void vmprim_dlsym();
inline void vmprim_dlclose();
inline void vmprim_dll_validp();
inline void vmprim_vm_ptr();
char *alien_offset(cell obj);
char *unbox_alien();
void box_alien(void *ptr);