}
}
-/* Allocates memory */
/* cell_to_bignum, fixnum_to_bignum, long_long_to_bignum, ulong_long_to_bignum */
+/* Allocates memory */
#define FOO_TO_BIGNUM(name,type,stype,utype) \
bignum * factor_vm::name##_to_bignum(type n) \
{ \
}
};
+/* Allocates memory */
cell factor_vm::instances(cell type)
{
object_accumulator accum(type);
return std_vector_to_array(accum.objects);
}
+/* Allocates memory */
void factor_vm::primitive_all_instances()
{
primitive_full_gc();
}
/* Compile code in boot image so that we can execute the startup quotation */
+/* Allocates memory */
void factor_vm::prepare_boot_image()
{
std::cout << "*** Stage 2 early init... " << std::flush;
/* The fixnum+, fixnum- and fixnum* primitives are defined in cpu_*.S. On
overflow, they call these functions. */
+/* Allocates memory */
inline void factor_vm::overflow_fixnum_add(fixnum x, fixnum y)
{
ctx->replace(tag<bignum>(fixnum_to_bignum(
parent->overflow_fixnum_add(x,y);
}
+/* Allocates memory */
inline void factor_vm::overflow_fixnum_subtract(fixnum x, fixnum y)
{
ctx->replace(tag<bignum>(fixnum_to_bignum(
parent->overflow_fixnum_subtract(x,y);
}
+/* Allocates memory */
inline void factor_vm::overflow_fixnum_multiply(fixnum x, fixnum y)
{
bignum *bx = fixnum_to_bignum(x);
write_barrier(slot_ptr);
}
+/* Allocates memory */
cell factor_vm::clone_object(cell obj_)
{
data_root<object> obj(obj_,this);
}
}
+/* Allocates memory */
void factor_vm::primitive_clone()
{
ctx->replace(clone_object(ctx->peek()));
if(stack_frame) emit(parent->special_objects[JIT_EPILOG]);
}
+/* Allocates memory conditionally */
void quotation_jit::emit_quot(cell quot_)
{
data_root<quotation> quot(quot_,parent);
return compiled;
}
+/* Allocates memory */
void factor_vm::jit_compile_quot(cell quot_, bool relocating)
{
data_root<quotation> quot(quot_,this);
}
}
+/* Allocates memory */
void factor_vm::primitive_jit_compile()
{
jit_compile_quot(ctx->pop(),true);
return untag<word>(special_objects[LAZY_JIT_COMPILE_WORD])->entry_point;
}
-/* Allocates memory */
/* push a new quotation on the stack */
+/* Allocates memory */
void factor_vm::primitive_array_to_quotation()
{
quotation *quot = allot<quotation>(sizeof(quotation));
return compiler.get_position();
}
+/* Allocates memory */
cell factor_vm::lazy_jit_compile(cell quot_)
{
data_root<quotation> quot(quot_,this);
return quot.value();
}
+/* Allocates memory */
VM_C_API cell lazy_jit_compile(cell quot, factor_vm *parent)
{
return parent->lazy_jit_compile(quot);
ctx->push(tag_boolean(quot_compiled_p(quot.untagged())));
}
+/* Allocates memory */
cell factor_vm::find_all_quotations()
{
return instances(QUOTATION_TYPE);
}
+/* Allocates memory */
void factor_vm::initialize_all_quotations()
{
data_root<array> quotations(find_all_quotations(),this);
namespace factor
{
-/* Allocates memory */
/* push a new tuple on the stack, filling its slots with f */
+/* Allocates memory */
void factor_vm::primitive_tuple()
{
data_root<tuple_layout> layout(ctx->pop(),this);
ctx->push(t.value());
}
-/* Allocates memory */
/* push a new tuple on the stack, filling its slots from the stack */
+/* Allocates memory */
void factor_vm::primitive_tuple_boa()
{
data_root<tuple_layout> layout(ctx->pop(),this);
namespace factor
{
-/* Compile a word definition with the non-optimizing compiler. Allocates memory */
+/* Compile a word definition with the non-optimizing compiler. */
+/* Allocates memory */
void factor_vm::jit_compile_word(cell word_, cell def_, bool relocating)
{
data_root<word> word(word_,this);
if(to_boolean(word->pic_tail_def)) jit_compile_quot(word->pic_tail_def,relocating);
}
+/* Allocates memory */
cell factor_vm::find_all_words()
{
return instances(WORD_TYPE);
}
+/* Allocates memory */
void factor_vm::compile_all_words()
{
data_root<array> words(find_all_words(),this);