]> gitweb.factorcode.org Git - factor.git/blob - vm/tuples.cpp
VM: Remove exec bit from VM source files
[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 /* Allocates memory */
8 void factor_vm::primitive_tuple()
9 {
10         data_root<tuple_layout> layout(ctx->pop(),this);
11         tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
12         t->layout = layout.value();
13
14         memset_cell(t->data(),false_object,tuple_size(layout.untagged()) - sizeof(cell));
15
16         ctx->push(t.value());
17 }
18
19 /* push a new tuple on the stack, filling its slots from the stack */
20 /* Allocates memory */
21 void factor_vm::primitive_tuple_boa()
22 {
23         data_root<tuple_layout> layout(ctx->pop(),this);
24         tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
25         t->layout = layout.value();
26
27         cell size = untag_fixnum(layout.untagged()->size) * sizeof(cell);
28         memcpy(t->data(),(cell *)(ctx->datastack - size + sizeof(cell)),size);
29         ctx->datastack -= size;
30
31         ctx->push(t.value());
32 }
33
34 }