]> gitweb.factorcode.org Git - factor.git/commitdiff
vm ptr passed to untag_check
authorPhil Dawes <phil@phildawes.net>
Mon, 17 Aug 2009 20:37:15 +0000 (21:37 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:26 +0000 (08:16 +0100)
vm/alien.cpp
vm/callstack.cpp
vm/image.cpp
vm/inlineimpls.hpp
vm/io.cpp
vm/quotations.cpp
vm/tagged.hpp

index 0419e3cec3643cb585823b86c06a46a2e9b2e6a6..ffd49f60b0b0bff58a23937b5e823a4b722961a4 100755 (executable)
@@ -139,7 +139,7 @@ DEFINE_ALIEN_ACCESSOR(cell,void *,box_alien,pinned_alien_offset)
 inline void factorvm::vmprim_dlopen()
 {
        gc_root<byte_array> path(dpop(),this);
-       path.untag_check();
+       path.untag_check(this);
        gc_root<dll> library(allot<dll>(sizeof(dll)),this);
        library->path = path.value();
        ffi_dlopen(library.untagged());
@@ -156,7 +156,7 @@ inline void factorvm::vmprim_dlsym()
 {
        gc_root<object> library(dpop(),this);
        gc_root<byte_array> name(dpop(),this);
-       name.untag_check();
+       name.untag_check(this);
 
        symbol_char *sym = name->data<symbol_char>();
 
index 8df438206c300f30839b0ebfba657e5c68c3203f..c330e38064171f3b761fdeecc52fa102bcc185a7 100755 (executable)
@@ -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<quotation>(frame_executing(inner)).untag_check();
+       tagged<quotation>(frame_executing(inner)).untag_check(this);
        return inner;
 }
 
@@ -278,8 +278,8 @@ inline void factorvm::vmprim_set_innermost_stack_frame_quot()
        gc_root<callstack> callstack(dpop(),this);
        gc_root<quotation> quot(dpop(),this);
 
-       callstack.untag_check();
-       quot.untag_check();
+       callstack.untag_check(this);
+       quot.untag_check(this);
 
        jit_compile(quot.value(),true);
 
index b8e89d5fcb9f9f5b8073c927172fc52d9378dd9e..5ceefdfeb4679c7c2719a1fdb7f753acfc03dffb 100755 (executable)
@@ -146,7 +146,7 @@ inline void factorvm::vmprim_save_image()
        gc();
 
        gc_root<byte_array> 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<byte_array> 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++)
index 8885c09404747e8794010634bc8987901ae4a817..b7aaacbc582e7e0845d50aab4f6f213d49a363b3 100644 (file)
@@ -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)
index 93ae005b6a6ea120b82039390b1fd8224db61a82..cfbafda90781946407547253ed96ff69d88b9c87 100755 (executable)
--- a/vm/io.cpp
+++ b/vm/io.cpp
@@ -45,8 +45,8 @@ inline void factorvm::vmprim_fopen()
 {
        gc_root<byte_array> mode(dpop(),this);
        gc_root<byte_array> path(dpop(),this);
-       mode.untag_check();
-       path.untag_check();
+       mode.untag_check(this);
+       path.untag_check(this);
 
        for(;;)
        {
index 0237651e175a1d8200af4d01e028b9243f6c95b2..ef615dc09531e6ae9439ae9e94676f464b1ffbe4 100755 (executable)
@@ -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<quotation> quot(dpop());
-       quot.untag_check();
+       quot.untag_check(this);
        dpush(tag_boolean(quot->code != NULL));
 }
 
index 4a1babb59983b9f3dde802ec3bedb1942a09610c..9f8a0eb4115ca1dc6debc3475fb9a39494eedf39 100755 (executable)
@@ -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 <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)