From 82e1ea71109a8d456a8272ee1e4adb4edc599cc2 Mon Sep 17 00:00:00 2001 From: Phil Dawes Date: Mon, 17 Aug 2009 21:37:15 +0100 Subject: [PATCH] vm ptr passed to untag_check --- vm/alien.cpp | 4 ++-- vm/callstack.cpp | 6 +++--- vm/image.cpp | 4 ++-- vm/inlineimpls.hpp | 4 +--- vm/io.cpp | 4 ++-- vm/quotations.cpp | 2 +- vm/tagged.hpp | 6 +++--- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/vm/alien.cpp b/vm/alien.cpp index 0419e3cec3..ffd49f60b0 100755 --- a/vm/alien.cpp +++ b/vm/alien.cpp @@ -139,7 +139,7 @@ DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,pinned_alien_offset) inline void factorvm::vmprim_dlopen() { gc_root path(dpop(),this); - path.untag_check(); + path.untag_check(this); gc_root library(allot(sizeof(dll)),this); library->path = path.value(); ffi_dlopen(library.untagged()); @@ -156,7 +156,7 @@ inline void factorvm::vmprim_dlsym() { gc_root library(dpop(),this); gc_root name(dpop(),this); - name.untag_check(); + name.untag_check(this); symbol_char *sym = name->data(); diff --git a/vm/callstack.cpp b/vm/callstack.cpp index 8df438206c..c330e38064 100755 --- a/vm/callstack.cpp +++ b/vm/callstack.cpp @@ -242,7 +242,7 @@ stack_frame *innermost_stack_frame(callstack *stack) stack_frame *factorvm::innermost_stack_frame_quot(callstack *callstack) { stack_frame *inner = innermost_stack_frame(callstack); - tagged(frame_executing(inner)).untag_check(); + tagged(frame_executing(inner)).untag_check(this); return inner; } @@ -278,8 +278,8 @@ inline void factorvm::vmprim_set_innermost_stack_frame_quot() gc_root callstack(dpop(),this); gc_root quot(dpop(),this); - callstack.untag_check(); - quot.untag_check(); + callstack.untag_check(this); + quot.untag_check(this); jit_compile(quot.value(),true); diff --git a/vm/image.cpp b/vm/image.cpp index b8e89d5fcb..5ceefdfeb4 100755 --- a/vm/image.cpp +++ b/vm/image.cpp @@ -146,7 +146,7 @@ inline void factorvm::vmprim_save_image() gc(); gc_root path(dpop(),this); - path.untag_check(); + path.untag_check(this); 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 later steps destroy the current image. */ gc_root path(dpop(),this); - path.untag_check(); + path.untag_check(this); /* strip out userenv data which is set on startup anyway */ for(cell i = 0; i < USER_ENV; i++) diff --git a/vm/inlineimpls.hpp b/vm/inlineimpls.hpp index 8885c09404..b7aaacbc58 100644 --- a/vm/inlineimpls.hpp +++ b/vm/inlineimpls.hpp @@ -1,11 +1,9 @@ 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 -//tagged.hpp - // write_barrier.hpp inline card *factorvm::addr_to_card(cell a) diff --git a/vm/io.cpp b/vm/io.cpp index 93ae005b6a..cfbafda907 100755 --- a/vm/io.cpp +++ b/vm/io.cpp @@ -45,8 +45,8 @@ inline void factorvm::vmprim_fopen() { gc_root mode(dpop(),this); gc_root path(dpop(),this); - mode.untag_check(); - path.untag_check(); + mode.untag_check(this); + path.untag_check(this); for(;;) { diff --git a/vm/quotations.cpp b/vm/quotations.cpp index 0237651e17..ef615dc095 100755 --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -396,7 +396,7 @@ VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack) inline void factorvm::vmprim_quot_compiled_p() { tagged quot(dpop()); - quot.untag_check(); + quot.untag_check(this); dpush(tag_boolean(quot->code != NULL)); } diff --git a/vm/tagged.hpp b/vm/tagged.hpp index 4a1babb599..9f8a0eb411 100755 --- a/vm/tagged.hpp +++ b/vm/tagged.hpp @@ -29,9 +29,9 @@ struct tagged 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)) - type_error(TYPE::type_number,value_); + myvm->type_error(TYPE::type_number,value_); return untagged(); } @@ -61,7 +61,7 @@ struct tagged template TYPE *factorvm::untag_check(cell value) { - return tagged(value).untag_check(); + return tagged(value).untag_check(this); } template TYPE *untag_check(cell value)