]> gitweb.factorcode.org Git - factor.git/commitdiff
added tuples fns to vm
authorPhil Dawes <phil@phildawes.net>
Mon, 17 Aug 2009 20:37:06 +0000 (21:37 +0100)
committerPhil Dawes <phil@phildawes.net>
Wed, 16 Sep 2009 07:16:19 +0000 (08:16 +0100)
vm/tuples.cpp
vm/vm.hpp

index d7e22bb807e489febae8da62312de745b126cc86..c38832ac0bb83cb068915cf4c1bf7e756af002b6 100644 (file)
@@ -4,7 +4,7 @@ namespace factor
 {
 
 /* push a new tuple on the stack */
-tuple *allot_tuple(cell layout_)
+tuple *factorvm::allot_tuple(cell layout_)
 {
        gc_root<tuple_layout> layout(layout_);
        gc_root<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
@@ -12,7 +12,12 @@ tuple *allot_tuple(cell layout_)
        return t.untagged();
 }
 
-PRIMITIVE(tuple)
+tuple *allot_tuple(cell layout_)
+{
+       return vm->allot_tuple(layout_);
+}
+
+inline void factorvm::vmprim_tuple()
 {
        gc_root<tuple_layout> layout(dpop());
        tuple *t = allot_tuple(layout.value());
@@ -23,8 +28,13 @@ PRIMITIVE(tuple)
        dpush(tag<tuple>(t));
 }
 
+PRIMITIVE(tuple)
+{
+       PRIMITIVE_GETVM()->vmprim_tuple();
+}
+
 /* push a new tuple on the stack, filling its slots from the stack */
-PRIMITIVE(tuple_boa)
+inline void factorvm::vmprim_tuple_boa()
 {
        gc_root<tuple_layout> layout(dpop());
        gc_root<tuple> t(allot_tuple(layout.value()));
@@ -34,4 +44,9 @@ PRIMITIVE(tuple_boa)
        dpush(t.value());
 }
 
+PRIMITIVE(tuple_boa)
+{
+       PRIMITIVE_GETVM()->vmprim_tuple_boa();
+}
+
 }
index 8e8d8bb9b874bf2c1979997bddaace30cafab196..5ddfd5cd4a740bc8b9dade4f6c749cbd049d32b4 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -231,6 +231,11 @@ struct factorvm {
        inline void vmprim_byte_array();
        inline void vmprim_uninitialized_byte_array();
        inline void vmprim_resize_byte_array();
+
+       //tuples
+       tuple *allot_tuple(cell layout_);
+       inline void vmprim_tuple();
+       inline void vmprim_tuple_boa();
        // next method here: