factor/native/compiler.c

45 lines
786 B
C
Raw Normal View History

2004-09-06 02:32:04 -04:00
#include "factor.h"
2005-03-14 11:25:41 -05:00
void init_compiler(CELL size)
{
init_zone(&compiling,size);
last_flush = compiling.base;
}
void primitive_compiled_offset(void)
2004-09-06 02:32:04 -04:00
{
2004-09-19 17:39:28 -04:00
box_integer(compiling.here);
2004-09-06 02:32:04 -04:00
}
void primitive_set_compiled_offset(void)
{
2004-09-19 17:39:28 -04:00
CELL offset = unbox_integer();
compiling.here = offset;
}
void primitive_literal_top(void)
{
2004-09-19 17:39:28 -04:00
box_integer(literal_top);
}
void primitive_set_literal_top(void)
{
2004-09-19 17:39:28 -04:00
CELL offset = unbox_integer();
2004-12-25 02:55:03 -05:00
if(offset >= literal_max)
critical_error("Too many compiled literals",offset);
literal_top = offset;
}
2005-03-14 11:25:41 -05:00
void primitive_flush_icache(void)
{
flush_icache((void*)last_flush,compiling.here - last_flush);
last_flush = compiling.here;
}
void collect_literals(void)
{
2004-12-24 02:52:02 -05:00
CELL i;
for(i = compiling.base; i < literal_top; i += CELLS)
2005-02-19 23:25:21 -05:00
copy_handle((CELL*)i);
}