VM: Refactor tuples.cpp/hpp to Factor style
parent
93b586da31
commit
5b1a9d753e
|
@ -1,25 +1,23 @@
|
||||||
#include "master.hpp"
|
#include "master.hpp"
|
||||||
|
|
||||||
namespace factor
|
namespace factor {
|
||||||
{
|
|
||||||
|
|
||||||
/* push a new tuple on the stack, filling its slots with f */
|
/* push a new tuple on the stack, filling its slots with f */
|
||||||
/* Allocates memory */
|
/* Allocates memory */
|
||||||
void factor_vm::primitive_tuple()
|
void factor_vm::primitive_tuple() {
|
||||||
{
|
|
||||||
data_root<tuple_layout> layout(ctx->pop(), this);
|
data_root<tuple_layout> layout(ctx->pop(), this);
|
||||||
tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
|
tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
|
||||||
t->layout = layout.value();
|
t->layout = layout.value();
|
||||||
|
|
||||||
memset_cell(t->data(),false_object,tuple_size(layout.untagged()) - sizeof(cell));
|
memset_cell(t->data(), false_object,
|
||||||
|
tuple_size(layout.untagged()) - sizeof(cell));
|
||||||
|
|
||||||
ctx->push(t.value());
|
ctx->push(t.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* push a new tuple on the stack, filling its slots from the stack */
|
/* push a new tuple on the stack, filling its slots from the stack */
|
||||||
/* Allocates memory */
|
/* Allocates memory */
|
||||||
void factor_vm::primitive_tuple_boa()
|
void factor_vm::primitive_tuple_boa() {
|
||||||
{
|
|
||||||
data_root<tuple_layout> layout(ctx->pop(), this);
|
data_root<tuple_layout> layout(ctx->pop(), this);
|
||||||
tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
|
tagged<tuple> t(allot<tuple>(tuple_size(layout.untagged())));
|
||||||
t->layout = layout.value();
|
t->layout = layout.value();
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
namespace factor
|
namespace factor {
|
||||||
{
|
|
||||||
|
|
||||||
inline static cell tuple_size(const tuple_layout *layout)
|
inline static cell tuple_size(const tuple_layout* layout) {
|
||||||
{
|
|
||||||
cell size = untag_fixnum(layout->size);
|
cell size = untag_fixnum(layout->size);
|
||||||
return sizeof(tuple) + size * sizeof(cell);
|
return sizeof(tuple) + size * sizeof(cell);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue