]> gitweb.factorcode.org Git - factor.git/blob - vm/tuples.cpp
vm: rename gc_root to data_root, add code_root to fix a problem where code blocks...
[factor.git] / vm / tuples.cpp
1 #include "master.hpp"
2
3 namespace factor
4 {
5
6 /* push a new tuple on the stack, filling its slots with f */
7 void factor_vm::primitive_tuple()
8 {
9         data_root<tuple_layout> layout(dpop(),this);
10         tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
11         t->layout = layout.value();
12
13         memset_cell(t->data(),false_object,tuple_size(layout.untagged()) - sizeof(cell));
14
15         dpush(t.value());
16 }
17
18 /* push a new tuple on the stack, filling its slots from the stack */
19 void factor_vm::primitive_tuple_boa()
20 {
21         data_root<tuple_layout> layout(dpop(),this);
22         tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
23         t->layout = layout.value();
24
25         cell size = untag_fixnum(layout.untagged()->size) * sizeof(cell);
26         memcpy(t->data(),(cell *)(ds - size + sizeof(cell)),size);
27         ds -= size;
28
29         dpush(t.value());
30 }
31
32 }