vm ptr passed to untag_check

db4
Phil Dawes 2009-08-17 21:37:15 +01:00
parent e2993558a8
commit 82e1ea7110
7 changed files with 14 additions and 16 deletions

View File

@ -139,7 +139,7 @@ DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,pinned_alien_offset)
inline void factorvm::vmprim_dlopen() inline void factorvm::vmprim_dlopen()
{ {
gc_root<byte_array> path(dpop(),this); gc_root<byte_array> path(dpop(),this);
path.untag_check(); path.untag_check(this);
gc_root<dll> library(allot<dll>(sizeof(dll)),this); gc_root<dll> library(allot<dll>(sizeof(dll)),this);
library->path = path.value(); library->path = path.value();
ffi_dlopen(library.untagged()); ffi_dlopen(library.untagged());
@ -156,7 +156,7 @@ inline void factorvm::vmprim_dlsym()
{ {
gc_root<object> library(dpop(),this); gc_root<object> library(dpop(),this);
gc_root<byte_array> name(dpop(),this); gc_root<byte_array> name(dpop(),this);
name.untag_check(); name.untag_check(this);
symbol_char *sym = name->data<symbol_char>(); symbol_char *sym = name->data<symbol_char>();

View File

@ -242,7 +242,7 @@ stack_frame *innermost_stack_frame(callstack *stack)
stack_frame *factorvm::innermost_stack_frame_quot(callstack *callstack) stack_frame *factorvm::innermost_stack_frame_quot(callstack *callstack)
{ {
stack_frame *inner = innermost_stack_frame(callstack); stack_frame *inner = innermost_stack_frame(callstack);
tagged<quotation>(frame_executing(inner)).untag_check(); tagged<quotation>(frame_executing(inner)).untag_check(this);
return inner; return inner;
} }
@ -278,8 +278,8 @@ inline void factorvm::vmprim_set_innermost_stack_frame_quot()
gc_root<callstack> callstack(dpop(),this); gc_root<callstack> callstack(dpop(),this);
gc_root<quotation> quot(dpop(),this); gc_root<quotation> quot(dpop(),this);
callstack.untag_check(); callstack.untag_check(this);
quot.untag_check(); quot.untag_check(this);
jit_compile(quot.value(),true); jit_compile(quot.value(),true);

View File

@ -146,7 +146,7 @@ inline void factorvm::vmprim_save_image()
gc(); gc();
gc_root<byte_array> path(dpop(),this); gc_root<byte_array> path(dpop(),this);
path.untag_check(); path.untag_check(this);
save_image((vm_char *)(path.untagged() + 1)); save_image((vm_char *)(path.untagged() + 1));
} }
@ -161,7 +161,7 @@ inline void factorvm::vmprim_save_image_and_exit()
where we might throw an error, so we have to throw an error here since where we might throw an error, so we have to throw an error here since
later steps destroy the current image. */ later steps destroy the current image. */
gc_root<byte_array> path(dpop(),this); gc_root<byte_array> path(dpop(),this);
path.untag_check(); path.untag_check(this);
/* strip out userenv data which is set on startup anyway */ /* strip out userenv data which is set on startup anyway */
for(cell i = 0; i < USER_ENV; i++) for(cell i = 0; i < USER_ENV; i++)

View File

@ -1,11 +1,9 @@
namespace factor namespace factor
{ {
// I've had to copy inline implementations here to make dependencies work. Hopefully this can be better factored // I've had to copy inline implementations here to make dependencies work. Am hoping to move this code back into include files
// once the rest of the reentrant changes are done. -PD // once the rest of the reentrant changes are done. -PD
//tagged.hpp
// write_barrier.hpp // write_barrier.hpp
inline card *factorvm::addr_to_card(cell a) inline card *factorvm::addr_to_card(cell a)

View File

@ -45,8 +45,8 @@ inline void factorvm::vmprim_fopen()
{ {
gc_root<byte_array> mode(dpop(),this); gc_root<byte_array> mode(dpop(),this);
gc_root<byte_array> path(dpop(),this); gc_root<byte_array> path(dpop(),this);
mode.untag_check(); mode.untag_check(this);
path.untag_check(); path.untag_check(this);
for(;;) for(;;)
{ {

View File

@ -396,7 +396,7 @@ VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack)
inline void factorvm::vmprim_quot_compiled_p() inline void factorvm::vmprim_quot_compiled_p()
{ {
tagged<quotation> quot(dpop()); tagged<quotation> quot(dpop());
quot.untag_check(); quot.untag_check(this);
dpush(tag_boolean(quot->code != NULL)); dpush(tag_boolean(quot->code != NULL));
} }

View File

@ -29,9 +29,9 @@ struct tagged
bool type_p(cell type_) const { return type() == type_; } bool type_p(cell type_) const { return type() == type_; }
TYPE *untag_check() const { TYPE *untag_check(factorvm *myvm) const {
if(TYPE::type_number != TYPE_COUNT && !type_p(TYPE::type_number)) if(TYPE::type_number != TYPE_COUNT && !type_p(TYPE::type_number))
type_error(TYPE::type_number,value_); myvm->type_error(TYPE::type_number,value_);
return untagged(); return untagged();
} }
@ -61,7 +61,7 @@ struct tagged
template <typename TYPE> TYPE *factorvm::untag_check(cell value) template <typename TYPE> TYPE *factorvm::untag_check(cell value)
{ {
return tagged<TYPE>(value).untag_check(); return tagged<TYPE>(value).untag_check(this);
} }
template <typename TYPE> TYPE *untag_check(cell value) template <typename TYPE> TYPE *untag_check(cell value)