2009-05-02 05:04:19 -04:00
|
|
|
#include "master.hpp"
|
|
|
|
|
2009-05-04 02:46:13 -04:00
|
|
|
namespace factor
|
|
|
|
{
|
|
|
|
|
2009-10-31 03:30:48 -04:00
|
|
|
/* push a new tuple on the stack, filling its slots with f */
|
2013-03-25 17:05:05 -04:00
|
|
|
/* Allocates memory */
|
2009-09-27 14:42:18 -04:00
|
|
|
void factor_vm::primitive_tuple()
|
2009-05-02 05:04:19 -04:00
|
|
|
{
|
2009-12-18 16:59:56 -05:00
|
|
|
data_root<tuple_layout> layout(ctx->pop(),this);
|
2009-10-31 03:58:00 -04:00
|
|
|
tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
|
|
|
|
t->layout = layout.value();
|
|
|
|
|
|
|
|
memset_cell(t->data(),false_object,tuple_size(layout.untagged()) - sizeof(cell));
|
|
|
|
|
2009-12-18 16:59:56 -05:00
|
|
|
ctx->push(t.value());
|
2009-05-02 05:04:19 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* push a new tuple on the stack, filling its slots from the stack */
|
2013-03-25 17:05:05 -04:00
|
|
|
/* Allocates memory */
|
2009-09-27 14:42:18 -04:00
|
|
|
void factor_vm::primitive_tuple_boa()
|
2009-05-02 05:04:19 -04:00
|
|
|
{
|
2009-12-18 16:59:56 -05:00
|
|
|
data_root<tuple_layout> layout(ctx->pop(),this);
|
2009-10-31 03:58:00 -04:00
|
|
|
tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
|
|
|
|
t->layout = layout.value();
|
|
|
|
|
2009-05-04 05:50:24 -04:00
|
|
|
cell size = untag_fixnum(layout.untagged()->size) * sizeof(cell);
|
2009-12-18 16:59:56 -05:00
|
|
|
memcpy(t->data(),(cell *)(ctx->datastack - size + sizeof(cell)),size);
|
|
|
|
ctx->datastack -= size;
|
2009-10-31 03:58:00 -04:00
|
|
|
|
2009-12-18 16:59:56 -05:00
|
|
|
ctx->push(t.value());
|
2009-05-02 05:04:19 -04:00
|
|
|
}
|
2009-05-04 02:46:13 -04:00
|
|
|
|
|
|
|
}
|