forwarding functions replaced with PRIMITIVE_FORWARD() macro

db4
Phil Dawes 2009-09-25 20:43:01 +01:00
parent e26bbbe9a0
commit 6b7717bf37
25 changed files with 132 additions and 497 deletions

View File

@ -69,10 +69,7 @@ inline void factor_vm::primitive_displaced_alien()
} }
} }
PRIMITIVE(displaced_alien) PRIMITIVE_FORWARD(displaced_alien)
{
PRIMITIVE_GETVM()->primitive_displaced_alien();
}
/* address of an object representing a C pointer. Explicitly throw an error /* address of an object representing a C pointer. Explicitly throw an error
if the object is a byte array, as a sanity check. */ if the object is a byte array, as a sanity check. */
@ -81,10 +78,7 @@ inline void factor_vm::primitive_alien_address()
box_unsigned_cell((cell)pinned_alien_offset(dpop())); box_unsigned_cell((cell)pinned_alien_offset(dpop()));
} }
PRIMITIVE(alien_address) PRIMITIVE_FORWARD(alien_address)
{
PRIMITIVE_GETVM()->primitive_alien_address();
}
/* pop ( alien n ) from datastack, return alien's address plus n */ /* pop ( alien n ) from datastack, return alien's address plus n */
void *factor_vm::alien_pointer() void *factor_vm::alien_pointer()
@ -131,10 +125,7 @@ inline void factor_vm::primitive_dlopen()
dpush(library.value()); dpush(library.value());
} }
PRIMITIVE(dlopen) PRIMITIVE_FORWARD(dlopen)
{
PRIMITIVE_GETVM()->primitive_dlopen();
}
/* look up a symbol in a native library */ /* look up a symbol in a native library */
inline void factor_vm::primitive_dlsym() inline void factor_vm::primitive_dlsym()
@ -158,10 +149,7 @@ inline void factor_vm::primitive_dlsym()
} }
} }
PRIMITIVE(dlsym) PRIMITIVE_FORWARD(dlsym)
{
PRIMITIVE_GETVM()->primitive_dlsym();
}
/* close a native library handle */ /* close a native library handle */
inline void factor_vm::primitive_dlclose() inline void factor_vm::primitive_dlclose()
@ -171,10 +159,7 @@ inline void factor_vm::primitive_dlclose()
ffi_dlclose(d); ffi_dlclose(d);
} }
PRIMITIVE(dlclose) PRIMITIVE_FORWARD(dlclose)
{
PRIMITIVE_GETVM()->primitive_dlclose();
}
inline void factor_vm::primitive_dll_validp() inline void factor_vm::primitive_dll_validp()
{ {
@ -185,10 +170,7 @@ inline void factor_vm::primitive_dll_validp()
dpush(untag_check<dll>(library)->dll == NULL ? F : T); dpush(untag_check<dll>(library)->dll == NULL ? F : T);
} }
PRIMITIVE(dll_validp) PRIMITIVE_FORWARD(dll_validp)
{
PRIMITIVE_GETVM()->primitive_dll_validp();
}
/* gets the address of an object representing a C pointer */ /* gets the address of an object representing a C pointer */
char *factor_vm::alien_offset(cell obj) char *factor_vm::alien_offset(cell obj)
@ -308,9 +290,6 @@ inline void factor_vm::primitive_vm_ptr()
box_alien(this); box_alien(this);
} }
PRIMITIVE(vm_ptr) PRIMITIVE_FORWARD(vm_ptr)
{
PRIMITIVE_GETVM()->primitive_vm_ptr();
}
} }

View File

@ -31,10 +31,7 @@ inline void factor_vm::primitive_array()
dpush(tag<array>(allot_array(size,initial))); dpush(tag<array>(allot_array(size,initial)));
} }
PRIMITIVE(array) PRIMITIVE_FORWARD(array)
{
PRIMITIVE_GETVM()->primitive_array();
}
cell factor_vm::allot_array_1(cell obj_) cell factor_vm::allot_array_1(cell obj_)
{ {
@ -75,10 +72,7 @@ inline void factor_vm::primitive_resize_array()
dpush(tag<array>(reallot_array(a,capacity))); dpush(tag<array>(reallot_array(a,capacity)));
} }
PRIMITIVE(resize_array) PRIMITIVE_FORWARD(resize_array)
{
PRIMITIVE_GETVM()->primitive_resize_array();
}
void growable_array::add(cell elt_) void growable_array::add(cell elt_)
{ {

View File

@ -16,10 +16,7 @@ inline void factor_vm::primitive_byte_array()
dpush(tag<byte_array>(allot_byte_array(size))); dpush(tag<byte_array>(allot_byte_array(size)));
} }
PRIMITIVE(byte_array) PRIMITIVE_FORWARD(byte_array)
{
PRIMITIVE_GETVM()->primitive_byte_array();
}
inline void factor_vm::primitive_uninitialized_byte_array() inline void factor_vm::primitive_uninitialized_byte_array()
{ {
@ -27,10 +24,7 @@ inline void factor_vm::primitive_uninitialized_byte_array()
dpush(tag<byte_array>(allot_array_internal<byte_array>(size))); dpush(tag<byte_array>(allot_array_internal<byte_array>(size)));
} }
PRIMITIVE(uninitialized_byte_array) PRIMITIVE_FORWARD(uninitialized_byte_array)
{
PRIMITIVE_GETVM()->primitive_uninitialized_byte_array();
}
inline void factor_vm::primitive_resize_byte_array() inline void factor_vm::primitive_resize_byte_array()
{ {
@ -39,10 +33,7 @@ inline void factor_vm::primitive_resize_byte_array()
dpush(tag<byte_array>(reallot_array(array,capacity))); dpush(tag<byte_array>(reallot_array(array,capacity)));
} }
PRIMITIVE(resize_byte_array) PRIMITIVE_FORWARD(resize_byte_array)
{
PRIMITIVE_GETVM()->primitive_resize_byte_array();
}
void growable_byte_array::append_bytes(void *elts, cell len) void growable_byte_array::append_bytes(void *elts, cell len)
{ {

View File

@ -60,10 +60,7 @@ inline void factor_vm::primitive_callstack()
dpush(tag<callstack>(stack)); dpush(tag<callstack>(stack));
} }
PRIMITIVE(callstack) PRIMITIVE_FORWARD(callstack)
{
PRIMITIVE_GETVM()->primitive_callstack();
}
inline void factor_vm::primitive_set_callstack() inline void factor_vm::primitive_set_callstack()
{ {
@ -78,10 +75,7 @@ inline void factor_vm::primitive_set_callstack()
critical_error("Bug in set_callstack()",0); critical_error("Bug in set_callstack()",0);
} }
PRIMITIVE(set_callstack) PRIMITIVE_FORWARD(set_callstack)
{
PRIMITIVE_GETVM()->primitive_set_callstack();
}
code_block *factor_vm::frame_code(stack_frame *frame) code_block *factor_vm::frame_code(stack_frame *frame)
{ {
@ -172,10 +166,7 @@ inline void factor_vm::primitive_callstack_to_array()
dpush(accum.frames.elements.value()); dpush(accum.frames.elements.value());
} }
PRIMITIVE(callstack_to_array) PRIMITIVE_FORWARD(callstack_to_array)
{
PRIMITIVE_GETVM()->primitive_callstack_to_array();
}
stack_frame *factor_vm::innermost_stack_frame(callstack *stack) stack_frame *factor_vm::innermost_stack_frame(callstack *stack)
{ {
@ -203,20 +194,14 @@ inline void factor_vm::primitive_innermost_stack_frame_executing()
dpush(frame_executing(innermost_stack_frame(untag_check<callstack>(dpop())))); dpush(frame_executing(innermost_stack_frame(untag_check<callstack>(dpop()))));
} }
PRIMITIVE(innermost_stack_frame_executing) PRIMITIVE_FORWARD(innermost_stack_frame_executing)
{
PRIMITIVE_GETVM()->primitive_innermost_stack_frame_executing();
}
inline void factor_vm::primitive_innermost_stack_frame_scan() inline void factor_vm::primitive_innermost_stack_frame_scan()
{ {
dpush(frame_scan(innermost_stack_frame_quot(untag_check<callstack>(dpop())))); dpush(frame_scan(innermost_stack_frame_quot(untag_check<callstack>(dpop()))));
} }
PRIMITIVE(innermost_stack_frame_scan) PRIMITIVE_FORWARD(innermost_stack_frame_scan)
{
PRIMITIVE_GETVM()->primitive_innermost_stack_frame_scan();
}
inline void factor_vm::primitive_set_innermost_stack_frame_quot() inline void factor_vm::primitive_set_innermost_stack_frame_quot()
{ {
@ -234,10 +219,7 @@ inline void factor_vm::primitive_set_innermost_stack_frame_quot()
FRAME_RETURN_ADDRESS(inner) = (char *)quot->xt + offset; FRAME_RETURN_ADDRESS(inner) = (char *)quot->xt + offset;
} }
PRIMITIVE(set_innermost_stack_frame_quot) PRIMITIVE_FORWARD(set_innermost_stack_frame_quot)
{
PRIMITIVE_GETVM()->primitive_set_innermost_stack_frame_quot();
}
/* called before entry into Factor code. */ /* called before entry into Factor code. */
void factor_vm::save_callstack_bottom(stack_frame *callstack_bottom) void factor_vm::save_callstack_bottom(stack_frame *callstack_bottom)

View File

@ -106,10 +106,7 @@ inline void factor_vm::primitive_modify_code_heap()
update_code_heap_words(); update_code_heap_words();
} }
PRIMITIVE(modify_code_heap) PRIMITIVE_FORWARD(modify_code_heap)
{
PRIMITIVE_GETVM()->primitive_modify_code_heap();
}
/* Push the free space and total size of the code heap */ /* Push the free space and total size of the code heap */
inline void factor_vm::primitive_code_room() inline void factor_vm::primitive_code_room()
@ -122,10 +119,7 @@ inline void factor_vm::primitive_code_room()
dpush(tag_fixnum(max_free / 1024)); dpush(tag_fixnum(max_free / 1024));
} }
PRIMITIVE(code_room) PRIMITIVE_FORWARD(code_room)
{
PRIMITIVE_GETVM()->primitive_code_room();
}
code_block *factor_vm::forward_xt(code_block *compiled) code_block *factor_vm::forward_xt(code_block *compiled)
{ {

View File

@ -146,10 +146,7 @@ inline void factor_vm::primitive_datastack()
general_error(ERROR_DS_UNDERFLOW,F,F,NULL); general_error(ERROR_DS_UNDERFLOW,F,F,NULL);
} }
PRIMITIVE(datastack) PRIMITIVE_FORWARD(datastack)
{
PRIMITIVE_GETVM()->primitive_datastack();
}
inline void factor_vm::primitive_retainstack() inline void factor_vm::primitive_retainstack()
{ {
@ -157,10 +154,7 @@ inline void factor_vm::primitive_retainstack()
general_error(ERROR_RS_UNDERFLOW,F,F,NULL); general_error(ERROR_RS_UNDERFLOW,F,F,NULL);
} }
PRIMITIVE(retainstack) PRIMITIVE_FORWARD(retainstack)
{
PRIMITIVE_GETVM()->primitive_retainstack();
}
/* returns pointer to top of stack */ /* returns pointer to top of stack */
cell factor_vm::array_to_stack(array *array, cell bottom) cell factor_vm::array_to_stack(array *array, cell bottom)
@ -175,20 +169,14 @@ inline void factor_vm::primitive_set_datastack()
ds = array_to_stack(untag_check<array>(dpop()),ds_bot); ds = array_to_stack(untag_check<array>(dpop()),ds_bot);
} }
PRIMITIVE(set_datastack) PRIMITIVE_FORWARD(set_datastack)
{
PRIMITIVE_GETVM()->primitive_set_datastack();
}
inline void factor_vm::primitive_set_retainstack() inline void factor_vm::primitive_set_retainstack()
{ {
rs = array_to_stack(untag_check<array>(dpop()),rs_bot); rs = array_to_stack(untag_check<array>(dpop()),rs_bot);
} }
PRIMITIVE(set_retainstack) PRIMITIVE_FORWARD(set_retainstack)
{
PRIMITIVE_GETVM()->primitive_set_retainstack();
}
/* Used to implement call( */ /* Used to implement call( */
inline void factor_vm::primitive_check_datastack() inline void factor_vm::primitive_check_datastack()
@ -216,9 +204,6 @@ inline void factor_vm::primitive_check_datastack()
} }
} }
PRIMITIVE(check_datastack) PRIMITIVE_FORWARD(check_datastack)
{
PRIMITIVE_GETVM()->primitive_check_datastack();
}
} }

View File

@ -573,10 +573,7 @@ inline void factor_vm::primitive_gc()
gc(); gc();
} }
PRIMITIVE(gc) PRIMITIVE_FORWARD(gc)
{
PRIMITIVE_GETVM()->primitive_gc();
}
inline void factor_vm::primitive_gc_stats() inline void factor_vm::primitive_gc_stats()
{ {
@ -608,10 +605,7 @@ inline void factor_vm::primitive_gc_stats()
dpush(result.elements.value()); dpush(result.elements.value());
} }
PRIMITIVE(gc_stats) PRIMITIVE_FORWARD(gc_stats)
{
PRIMITIVE_GETVM()->primitive_gc_stats();
}
void factor_vm::clear_gc_stats() void factor_vm::clear_gc_stats()
{ {
@ -629,10 +623,7 @@ inline void factor_vm::primitive_clear_gc_stats()
clear_gc_stats(); clear_gc_stats();
} }
PRIMITIVE(clear_gc_stats) PRIMITIVE_FORWARD(clear_gc_stats)
{
PRIMITIVE_GETVM()->primitive_clear_gc_stats();
}
/* classes.tuple uses this to reshape tuples; tools.deploy.shaker uses this /* classes.tuple uses this to reshape tuples; tools.deploy.shaker uses this
to coalesce equal but distinct quotations and wrappers. */ to coalesce equal but distinct quotations and wrappers. */
@ -665,10 +656,7 @@ inline void factor_vm::primitive_become()
compile_all_words(); compile_all_words();
} }
PRIMITIVE(become) PRIMITIVE_FORWARD(become)
{
PRIMITIVE_GETVM()->primitive_become();
}
void factor_vm::inline_gc(cell *gc_roots_base, cell gc_roots_size) void factor_vm::inline_gc(cell *gc_roots_base, cell gc_roots_size)
{ {

View File

@ -222,10 +222,7 @@ inline void factor_vm::primitive_size()
box_unsigned_cell(object_size(dpop())); box_unsigned_cell(object_size(dpop()));
} }
PRIMITIVE(size) PRIMITIVE_FORWARD(size)
{
PRIMITIVE_GETVM()->primitive_size();
}
/* The number of cells from the start of the object which should be scanned by /* The number of cells from the start of the object which should be scanned by
the GC. Some types have a binary payload at the end (string, word, DLL) which the GC. Some types have a binary payload at the end (string, word, DLL) which
@ -284,10 +281,7 @@ inline void factor_vm::primitive_data_room()
dpush(a.elements.value()); dpush(a.elements.value());
} }
PRIMITIVE(data_room) PRIMITIVE_FORWARD(data_room)
{
PRIMITIVE_GETVM()->primitive_data_room();
}
/* Disables GC and activates next-object ( -- obj ) primitive */ /* Disables GC and activates next-object ( -- obj ) primitive */
void factor_vm::begin_scan() void factor_vm::begin_scan()
@ -306,10 +300,7 @@ inline void factor_vm::primitive_begin_scan()
begin_scan(); begin_scan();
} }
PRIMITIVE(begin_scan) PRIMITIVE_FORWARD(begin_scan)
{
PRIMITIVE_GETVM()->primitive_begin_scan();
}
cell factor_vm::next_object() cell factor_vm::next_object()
{ {
@ -330,10 +321,7 @@ inline void factor_vm::primitive_next_object()
dpush(next_object()); dpush(next_object());
} }
PRIMITIVE(next_object) PRIMITIVE_FORWARD(next_object)
{
PRIMITIVE_GETVM()->primitive_next_object();
}
/* Re-enables GC */ /* Re-enables GC */
inline void factor_vm::primitive_end_scan() inline void factor_vm::primitive_end_scan()
@ -341,10 +329,7 @@ inline void factor_vm::primitive_end_scan()
gc_off = false; gc_off = false;
} }
PRIMITIVE(end_scan) PRIMITIVE_FORWARD(end_scan)
{
PRIMITIVE_GETVM()->primitive_end_scan();
}
template<typename TYPE> void factor_vm::each_object(TYPE &functor) template<typename TYPE> void factor_vm::each_object(TYPE &functor)
{ {

View File

@ -484,9 +484,6 @@ inline void factor_vm::primitive_die()
factorbug(); factorbug();
} }
PRIMITIVE(die) PRIMITIVE_FORWARD(die)
{
PRIMITIVE_GETVM()->primitive_die();
}
} }

View File

@ -120,10 +120,7 @@ inline void factor_vm::primitive_lookup_method()
dpush(lookup_method(obj,methods)); dpush(lookup_method(obj,methods));
} }
PRIMITIVE(lookup_method) PRIMITIVE_FORWARD(lookup_method)
{
PRIMITIVE_GETVM()->primitive_lookup_method();
}
cell factor_vm::object_class(cell obj) cell factor_vm::object_class(cell obj)
{ {
@ -169,20 +166,14 @@ inline void factor_vm::primitive_mega_cache_miss()
dpush(method); dpush(method);
} }
PRIMITIVE(mega_cache_miss) PRIMITIVE_FORWARD(mega_cache_miss)
{
PRIMITIVE_GETVM()->primitive_mega_cache_miss();
}
inline void factor_vm::primitive_reset_dispatch_stats() inline void factor_vm::primitive_reset_dispatch_stats()
{ {
megamorphic_cache_hits = megamorphic_cache_misses = 0; megamorphic_cache_hits = megamorphic_cache_misses = 0;
} }
PRIMITIVE(reset_dispatch_stats) PRIMITIVE_FORWARD(reset_dispatch_stats)
{
PRIMITIVE_GETVM()->primitive_reset_dispatch_stats();
}
inline void factor_vm::primitive_dispatch_stats() inline void factor_vm::primitive_dispatch_stats()
{ {
@ -193,10 +184,7 @@ inline void factor_vm::primitive_dispatch_stats()
dpush(stats.elements.value()); dpush(stats.elements.value());
} }
PRIMITIVE(dispatch_stats) PRIMITIVE_FORWARD(dispatch_stats)
{
PRIMITIVE_GETVM()->primitive_dispatch_stats();
}
void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index, cell cache_) void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index, cell cache_)
{ {

View File

@ -133,10 +133,7 @@ inline void factor_vm::primitive_call_clear()
throw_impl(dpop(),stack_chain->callstack_bottom,this); throw_impl(dpop(),stack_chain->callstack_bottom,this);
} }
PRIMITIVE(call_clear) PRIMITIVE_FORWARD(call_clear)
{
PRIMITIVE_GETVM()->primitive_call_clear();
}
/* For testing purposes */ /* For testing purposes */
inline void factor_vm::primitive_unimplemented() inline void factor_vm::primitive_unimplemented()
@ -144,10 +141,7 @@ inline void factor_vm::primitive_unimplemented()
not_implemented_error(); not_implemented_error();
} }
PRIMITIVE(unimplemented) PRIMITIVE_FORWARD(unimplemented)
{
PRIMITIVE_GETVM()->primitive_unimplemented();
}
void factor_vm::memory_signal_handler_impl() void factor_vm::memory_signal_handler_impl()
{ {

View File

@ -128,10 +128,7 @@ inline void factor_vm::primitive_save_image()
save_image((vm_char *)(path.untagged() + 1)); save_image((vm_char *)(path.untagged() + 1));
} }
PRIMITIVE(save_image) PRIMITIVE_FORWARD(save_image)
{
PRIMITIVE_GETVM()->primitive_save_image();
}
inline void factor_vm::primitive_save_image_and_exit() inline void factor_vm::primitive_save_image_and_exit()
{ {
@ -159,10 +156,7 @@ inline void factor_vm::primitive_save_image_and_exit()
exit(1); exit(1);
} }
PRIMITIVE(save_image_and_exit) PRIMITIVE_FORWARD(save_image_and_exit)
{
PRIMITIVE_GETVM()->primitive_save_image_and_exit();
}
void factor_vm::data_fixup(cell *cell) void factor_vm::data_fixup(cell *cell)
{ {

View File

@ -257,10 +257,7 @@ inline void factor_vm::primitive_reset_inline_cache_stats()
for(i = 0; i < 4; i++) pic_counts[i] = 0; for(i = 0; i < 4; i++) pic_counts[i] = 0;
} }
PRIMITIVE(reset_inline_cache_stats) PRIMITIVE_FORWARD(reset_inline_cache_stats)
{
PRIMITIVE_GETVM()->primitive_reset_inline_cache_stats();
}
inline void factor_vm::primitive_inline_cache_stats() inline void factor_vm::primitive_inline_cache_stats()
{ {
@ -275,9 +272,6 @@ inline void factor_vm::primitive_inline_cache_stats()
dpush(stats.elements.value()); dpush(stats.elements.value());
} }
PRIMITIVE(inline_cache_stats) PRIMITIVE_FORWARD(inline_cache_stats)
{
PRIMITIVE_GETVM()->primitive_inline_cache_stats();
}
} }

View File

@ -52,10 +52,7 @@ inline void factor_vm::primitive_fopen()
} }
} }
PRIMITIVE(fopen) PRIMITIVE_FORWARD(fopen)
{
PRIMITIVE_GETVM()->primitive_fopen();
}
inline void factor_vm::primitive_fgetc() inline void factor_vm::primitive_fgetc()
{ {
@ -82,10 +79,7 @@ inline void factor_vm::primitive_fgetc()
} }
} }
PRIMITIVE(fgetc) PRIMITIVE_FORWARD(fgetc)
{
PRIMITIVE_GETVM()->primitive_fgetc();
}
inline void factor_vm::primitive_fread() inline void factor_vm::primitive_fread()
{ {
@ -127,10 +121,7 @@ inline void factor_vm::primitive_fread()
} }
} }
PRIMITIVE(fread) PRIMITIVE_FORWARD(fread)
{
PRIMITIVE_GETVM()->primitive_fread();
}
inline void factor_vm::primitive_fputc() inline void factor_vm::primitive_fputc()
{ {
@ -150,10 +141,7 @@ inline void factor_vm::primitive_fputc()
} }
} }
PRIMITIVE(fputc) PRIMITIVE_FORWARD(fputc)
{
PRIMITIVE_GETVM()->primitive_fputc();
}
inline void factor_vm::primitive_fwrite() inline void factor_vm::primitive_fwrite()
{ {
@ -184,10 +172,7 @@ inline void factor_vm::primitive_fwrite()
} }
} }
PRIMITIVE(fwrite) PRIMITIVE_FORWARD(fwrite)
{
PRIMITIVE_GETVM()->primitive_fwrite();
}
inline void factor_vm::primitive_fseek() inline void factor_vm::primitive_fseek()
{ {
@ -214,10 +199,7 @@ inline void factor_vm::primitive_fseek()
} }
} }
PRIMITIVE(fseek) PRIMITIVE_FORWARD(fseek)
{
PRIMITIVE_GETVM()->primitive_fseek();
}
inline void factor_vm::primitive_fflush() inline void factor_vm::primitive_fflush()
{ {
@ -231,10 +213,7 @@ inline void factor_vm::primitive_fflush()
} }
} }
PRIMITIVE(fflush) PRIMITIVE_FORWARD(fflush)
{
PRIMITIVE_GETVM()->primitive_fflush();
}
inline void factor_vm::primitive_fclose() inline void factor_vm::primitive_fclose()
{ {
@ -248,10 +227,7 @@ inline void factor_vm::primitive_fclose()
} }
} }
PRIMITIVE(fclose) PRIMITIVE_FORWARD(fclose)
{
PRIMITIVE_GETVM()->primitive_fclose();
}
/* This function is used by FFI I/O. Accessing the errno global directly is /* This function is used by FFI I/O. Accessing the errno global directly is
not portable, since on some libc's errno is not a global but a funky macro that not portable, since on some libc's errno is not a global but a funky macro that

View File

@ -8,20 +8,14 @@ inline void factor_vm::primitive_bignum_to_fixnum()
drepl(tag_fixnum(bignum_to_fixnum(untag<bignum>(dpeek())))); drepl(tag_fixnum(bignum_to_fixnum(untag<bignum>(dpeek()))));
} }
PRIMITIVE(bignum_to_fixnum) PRIMITIVE_FORWARD(bignum_to_fixnum)
{
PRIMITIVE_GETVM()->primitive_bignum_to_fixnum();
}
inline void factor_vm::primitive_float_to_fixnum() inline void factor_vm::primitive_float_to_fixnum()
{ {
drepl(tag_fixnum(float_to_fixnum(dpeek()))); drepl(tag_fixnum(float_to_fixnum(dpeek())));
} }
PRIMITIVE(float_to_fixnum) PRIMITIVE_FORWARD(float_to_fixnum)
{
PRIMITIVE_GETVM()->primitive_float_to_fixnum();
}
/* Division can only overflow when we are dividing the most negative fixnum /* Division can only overflow when we are dividing the most negative fixnum
by -1. */ by -1. */
@ -36,10 +30,7 @@ inline void factor_vm::primitive_fixnum_divint()
drepl(tag_fixnum(result)); drepl(tag_fixnum(result));
} }
PRIMITIVE(fixnum_divint) PRIMITIVE_FORWARD(fixnum_divint)
{
PRIMITIVE_GETVM()->primitive_fixnum_divint();
}
inline void factor_vm::primitive_fixnum_divmod() inline void factor_vm::primitive_fixnum_divmod()
{ {
@ -57,10 +48,7 @@ inline void factor_vm::primitive_fixnum_divmod()
} }
} }
PRIMITIVE(fixnum_divmod) PRIMITIVE_FORWARD(fixnum_divmod)
{
PRIMITIVE_GETVM()->primitive_fixnum_divmod();
}
/* /*
* If we're shifting right by n bits, we won't overflow as long as none of the * If we're shifting right by n bits, we won't overflow as long as none of the
@ -108,30 +96,21 @@ inline void factor_vm::primitive_fixnum_shift()
fixnum_to_bignum(x),y))); fixnum_to_bignum(x),y)));
} }
PRIMITIVE(fixnum_shift) PRIMITIVE_FORWARD(fixnum_shift)
{
PRIMITIVE_GETVM()->primitive_fixnum_shift();
}
inline void factor_vm::primitive_fixnum_to_bignum() inline void factor_vm::primitive_fixnum_to_bignum()
{ {
drepl(tag<bignum>(fixnum_to_bignum(untag_fixnum(dpeek())))); drepl(tag<bignum>(fixnum_to_bignum(untag_fixnum(dpeek()))));
} }
PRIMITIVE(fixnum_to_bignum) PRIMITIVE_FORWARD(fixnum_to_bignum)
{
PRIMITIVE_GETVM()->primitive_fixnum_to_bignum();
}
inline void factor_vm::primitive_float_to_bignum() inline void factor_vm::primitive_float_to_bignum()
{ {
drepl(tag<bignum>(float_to_bignum(dpeek()))); drepl(tag<bignum>(float_to_bignum(dpeek())));
} }
PRIMITIVE(float_to_bignum) PRIMITIVE_FORWARD(float_to_bignum)
{
PRIMITIVE_GETVM()->primitive_float_to_bignum();
}
#define POP_BIGNUMS(x,y) \ #define POP_BIGNUMS(x,y) \
bignum * y = untag<bignum>(dpop()); \ bignum * y = untag<bignum>(dpop()); \
@ -143,10 +122,7 @@ inline void factor_vm::primitive_bignum_eq()
box_boolean(bignum_equal_p(x,y)); box_boolean(bignum_equal_p(x,y));
} }
PRIMITIVE(bignum_eq) PRIMITIVE_FORWARD(bignum_eq)
{
PRIMITIVE_GETVM()->primitive_bignum_eq();
}
inline void factor_vm::primitive_bignum_add() inline void factor_vm::primitive_bignum_add()
{ {
@ -154,10 +130,7 @@ inline void factor_vm::primitive_bignum_add()
dpush(tag<bignum>(bignum_add(x,y))); dpush(tag<bignum>(bignum_add(x,y)));
} }
PRIMITIVE(bignum_add) PRIMITIVE_FORWARD(bignum_add)
{
PRIMITIVE_GETVM()->primitive_bignum_add();
}
inline void factor_vm::primitive_bignum_subtract() inline void factor_vm::primitive_bignum_subtract()
{ {
@ -165,10 +138,7 @@ inline void factor_vm::primitive_bignum_subtract()
dpush(tag<bignum>(bignum_subtract(x,y))); dpush(tag<bignum>(bignum_subtract(x,y)));
} }
PRIMITIVE(bignum_subtract) PRIMITIVE_FORWARD(bignum_subtract)
{
PRIMITIVE_GETVM()->primitive_bignum_subtract();
}
inline void factor_vm::primitive_bignum_multiply() inline void factor_vm::primitive_bignum_multiply()
{ {
@ -176,10 +146,7 @@ inline void factor_vm::primitive_bignum_multiply()
dpush(tag<bignum>(bignum_multiply(x,y))); dpush(tag<bignum>(bignum_multiply(x,y)));
} }
PRIMITIVE(bignum_multiply) PRIMITIVE_FORWARD(bignum_multiply)
{
PRIMITIVE_GETVM()->primitive_bignum_multiply();
}
inline void factor_vm::primitive_bignum_divint() inline void factor_vm::primitive_bignum_divint()
{ {
@ -187,10 +154,7 @@ inline void factor_vm::primitive_bignum_divint()
dpush(tag<bignum>(bignum_quotient(x,y))); dpush(tag<bignum>(bignum_quotient(x,y)));
} }
PRIMITIVE(bignum_divint) PRIMITIVE_FORWARD(bignum_divint)
{
PRIMITIVE_GETVM()->primitive_bignum_divint();
}
inline void factor_vm::primitive_bignum_divmod() inline void factor_vm::primitive_bignum_divmod()
{ {
@ -201,10 +165,7 @@ inline void factor_vm::primitive_bignum_divmod()
dpush(tag<bignum>(r)); dpush(tag<bignum>(r));
} }
PRIMITIVE(bignum_divmod) PRIMITIVE_FORWARD(bignum_divmod)
{
PRIMITIVE_GETVM()->primitive_bignum_divmod();
}
inline void factor_vm::primitive_bignum_mod() inline void factor_vm::primitive_bignum_mod()
{ {
@ -212,10 +173,7 @@ inline void factor_vm::primitive_bignum_mod()
dpush(tag<bignum>(bignum_remainder(x,y))); dpush(tag<bignum>(bignum_remainder(x,y)));
} }
PRIMITIVE(bignum_mod) PRIMITIVE_FORWARD(bignum_mod)
{
PRIMITIVE_GETVM()->primitive_bignum_mod();
}
inline void factor_vm::primitive_bignum_and() inline void factor_vm::primitive_bignum_and()
{ {
@ -223,10 +181,7 @@ inline void factor_vm::primitive_bignum_and()
dpush(tag<bignum>(bignum_bitwise_and(x,y))); dpush(tag<bignum>(bignum_bitwise_and(x,y)));
} }
PRIMITIVE(bignum_and) PRIMITIVE_FORWARD(bignum_and)
{
PRIMITIVE_GETVM()->primitive_bignum_and();
}
inline void factor_vm::primitive_bignum_or() inline void factor_vm::primitive_bignum_or()
{ {
@ -234,10 +189,7 @@ inline void factor_vm::primitive_bignum_or()
dpush(tag<bignum>(bignum_bitwise_ior(x,y))); dpush(tag<bignum>(bignum_bitwise_ior(x,y)));
} }
PRIMITIVE(bignum_or) PRIMITIVE_FORWARD(bignum_or)
{
PRIMITIVE_GETVM()->primitive_bignum_or();
}
inline void factor_vm::primitive_bignum_xor() inline void factor_vm::primitive_bignum_xor()
{ {
@ -245,10 +197,7 @@ inline void factor_vm::primitive_bignum_xor()
dpush(tag<bignum>(bignum_bitwise_xor(x,y))); dpush(tag<bignum>(bignum_bitwise_xor(x,y)));
} }
PRIMITIVE(bignum_xor) PRIMITIVE_FORWARD(bignum_xor)
{
PRIMITIVE_GETVM()->primitive_bignum_xor();
}
inline void factor_vm::primitive_bignum_shift() inline void factor_vm::primitive_bignum_shift()
{ {
@ -257,10 +206,7 @@ inline void factor_vm::primitive_bignum_shift()
dpush(tag<bignum>(bignum_arithmetic_shift(x,y))); dpush(tag<bignum>(bignum_arithmetic_shift(x,y)));
} }
PRIMITIVE(bignum_shift) PRIMITIVE_FORWARD(bignum_shift)
{
PRIMITIVE_GETVM()->primitive_bignum_shift();
}
inline void factor_vm::primitive_bignum_less() inline void factor_vm::primitive_bignum_less()
{ {
@ -268,10 +214,7 @@ inline void factor_vm::primitive_bignum_less()
box_boolean(bignum_compare(x,y) == bignum_comparison_less); box_boolean(bignum_compare(x,y) == bignum_comparison_less);
} }
PRIMITIVE(bignum_less) PRIMITIVE_FORWARD(bignum_less)
{
PRIMITIVE_GETVM()->primitive_bignum_less();
}
inline void factor_vm::primitive_bignum_lesseq() inline void factor_vm::primitive_bignum_lesseq()
{ {
@ -279,10 +222,7 @@ inline void factor_vm::primitive_bignum_lesseq()
box_boolean(bignum_compare(x,y) != bignum_comparison_greater); box_boolean(bignum_compare(x,y) != bignum_comparison_greater);
} }
PRIMITIVE(bignum_lesseq) PRIMITIVE_FORWARD(bignum_lesseq)
{
PRIMITIVE_GETVM()->primitive_bignum_lesseq();
}
inline void factor_vm::primitive_bignum_greater() inline void factor_vm::primitive_bignum_greater()
{ {
@ -290,10 +230,7 @@ inline void factor_vm::primitive_bignum_greater()
box_boolean(bignum_compare(x,y) == bignum_comparison_greater); box_boolean(bignum_compare(x,y) == bignum_comparison_greater);
} }
PRIMITIVE(bignum_greater) PRIMITIVE_FORWARD(bignum_greater)
{
PRIMITIVE_GETVM()->primitive_bignum_greater();
}
inline void factor_vm::primitive_bignum_greatereq() inline void factor_vm::primitive_bignum_greatereq()
{ {
@ -301,20 +238,14 @@ inline void factor_vm::primitive_bignum_greatereq()
box_boolean(bignum_compare(x,y) != bignum_comparison_less); box_boolean(bignum_compare(x,y) != bignum_comparison_less);
} }
PRIMITIVE(bignum_greatereq) PRIMITIVE_FORWARD(bignum_greatereq)
{
PRIMITIVE_GETVM()->primitive_bignum_greatereq();
}
inline void factor_vm::primitive_bignum_not() inline void factor_vm::primitive_bignum_not()
{ {
drepl(tag<bignum>(bignum_bitwise_not(untag<bignum>(dpeek())))); drepl(tag<bignum>(bignum_bitwise_not(untag<bignum>(dpeek()))));
} }
PRIMITIVE(bignum_not) PRIMITIVE_FORWARD(bignum_not)
{
PRIMITIVE_GETVM()->primitive_bignum_not();
}
inline void factor_vm::primitive_bignum_bitp() inline void factor_vm::primitive_bignum_bitp()
{ {
@ -323,20 +254,14 @@ inline void factor_vm::primitive_bignum_bitp()
box_boolean(bignum_logbitp(bit,x)); box_boolean(bignum_logbitp(bit,x));
} }
PRIMITIVE(bignum_bitp) PRIMITIVE_FORWARD(bignum_bitp)
{
PRIMITIVE_GETVM()->primitive_bignum_bitp();
}
inline void factor_vm::primitive_bignum_log2() inline void factor_vm::primitive_bignum_log2()
{ {
drepl(tag<bignum>(bignum_integer_length(untag<bignum>(dpeek())))); drepl(tag<bignum>(bignum_integer_length(untag<bignum>(dpeek()))));
} }
PRIMITIVE(bignum_log2) PRIMITIVE_FORWARD(bignum_log2)
{
PRIMITIVE_GETVM()->primitive_bignum_log2();
}
unsigned int factor_vm::bignum_producer(unsigned int digit) unsigned int factor_vm::bignum_producer(unsigned int digit)
{ {
@ -356,10 +281,7 @@ inline void factor_vm::primitive_byte_array_to_bignum()
drepl(tag<bignum>(result)); drepl(tag<bignum>(result));
} }
PRIMITIVE(byte_array_to_bignum) PRIMITIVE_FORWARD(byte_array_to_bignum)
{
PRIMITIVE_GETVM()->primitive_byte_array_to_bignum();
}
cell factor_vm::unbox_array_size() cell factor_vm::unbox_array_size()
{ {
@ -399,20 +321,14 @@ inline void factor_vm::primitive_fixnum_to_float()
drepl(allot_float(fixnum_to_float(dpeek()))); drepl(allot_float(fixnum_to_float(dpeek())));
} }
PRIMITIVE(fixnum_to_float) PRIMITIVE_FORWARD(fixnum_to_float)
{
PRIMITIVE_GETVM()->primitive_fixnum_to_float();
}
inline void factor_vm::primitive_bignum_to_float() inline void factor_vm::primitive_bignum_to_float()
{ {
drepl(allot_float(bignum_to_float(dpeek()))); drepl(allot_float(bignum_to_float(dpeek())));
} }
PRIMITIVE(bignum_to_float) PRIMITIVE_FORWARD(bignum_to_float)
{
PRIMITIVE_GETVM()->primitive_bignum_to_float();
}
inline void factor_vm::primitive_str_to_float() inline void factor_vm::primitive_str_to_float()
{ {
@ -428,10 +344,7 @@ inline void factor_vm::primitive_str_to_float()
drepl(F); drepl(F);
} }
PRIMITIVE(str_to_float) PRIMITIVE_FORWARD(str_to_float)
{
PRIMITIVE_GETVM()->primitive_str_to_float();
}
inline void factor_vm::primitive_float_to_str() inline void factor_vm::primitive_float_to_str()
{ {
@ -440,10 +353,7 @@ inline void factor_vm::primitive_float_to_str()
dpush(tag<byte_array>(array)); dpush(tag<byte_array>(array));
} }
PRIMITIVE(float_to_str) PRIMITIVE_FORWARD(float_to_str)
{
PRIMITIVE_GETVM()->primitive_float_to_str();
}
#define POP_FLOATS(x,y) \ #define POP_FLOATS(x,y) \
double y = untag_float(dpop()); \ double y = untag_float(dpop()); \
@ -455,10 +365,7 @@ inline void factor_vm::primitive_float_eq()
box_boolean(x == y); box_boolean(x == y);
} }
PRIMITIVE(float_eq) PRIMITIVE_FORWARD(float_eq)
{
PRIMITIVE_GETVM()->primitive_float_eq();
}
inline void factor_vm::primitive_float_add() inline void factor_vm::primitive_float_add()
{ {
@ -466,10 +373,7 @@ inline void factor_vm::primitive_float_add()
box_double(x + y); box_double(x + y);
} }
PRIMITIVE(float_add) PRIMITIVE_FORWARD(float_add)
{
PRIMITIVE_GETVM()->primitive_float_add();
}
inline void factor_vm::primitive_float_subtract() inline void factor_vm::primitive_float_subtract()
{ {
@ -477,10 +381,7 @@ inline void factor_vm::primitive_float_subtract()
box_double(x - y); box_double(x - y);
} }
PRIMITIVE(float_subtract) PRIMITIVE_FORWARD(float_subtract)
{
PRIMITIVE_GETVM()->primitive_float_subtract();
}
inline void factor_vm::primitive_float_multiply() inline void factor_vm::primitive_float_multiply()
{ {
@ -488,10 +389,7 @@ inline void factor_vm::primitive_float_multiply()
box_double(x * y); box_double(x * y);
} }
PRIMITIVE(float_multiply) PRIMITIVE_FORWARD(float_multiply)
{
PRIMITIVE_GETVM()->primitive_float_multiply();
}
inline void factor_vm::primitive_float_divfloat() inline void factor_vm::primitive_float_divfloat()
{ {
@ -499,10 +397,7 @@ inline void factor_vm::primitive_float_divfloat()
box_double(x / y); box_double(x / y);
} }
PRIMITIVE(float_divfloat) PRIMITIVE_FORWARD(float_divfloat)
{
PRIMITIVE_GETVM()->primitive_float_divfloat();
}
inline void factor_vm::primitive_float_mod() inline void factor_vm::primitive_float_mod()
{ {
@ -510,10 +405,7 @@ inline void factor_vm::primitive_float_mod()
box_double(fmod(x,y)); box_double(fmod(x,y));
} }
PRIMITIVE(float_mod) PRIMITIVE_FORWARD(float_mod)
{
PRIMITIVE_GETVM()->primitive_float_mod();
}
inline void factor_vm::primitive_float_less() inline void factor_vm::primitive_float_less()
{ {
@ -521,10 +413,7 @@ inline void factor_vm::primitive_float_less()
box_boolean(x < y); box_boolean(x < y);
} }
PRIMITIVE(float_less) PRIMITIVE_FORWARD(float_less)
{
PRIMITIVE_GETVM()->primitive_float_less();
}
inline void factor_vm::primitive_float_lesseq() inline void factor_vm::primitive_float_lesseq()
{ {
@ -532,10 +421,7 @@ inline void factor_vm::primitive_float_lesseq()
box_boolean(x <= y); box_boolean(x <= y);
} }
PRIMITIVE(float_lesseq) PRIMITIVE_FORWARD(float_lesseq)
{
PRIMITIVE_GETVM()->primitive_float_lesseq();
}
inline void factor_vm::primitive_float_greater() inline void factor_vm::primitive_float_greater()
{ {
@ -543,10 +429,7 @@ inline void factor_vm::primitive_float_greater()
box_boolean(x > y); box_boolean(x > y);
} }
PRIMITIVE(float_greater) PRIMITIVE_FORWARD(float_greater)
{
PRIMITIVE_GETVM()->primitive_float_greater();
}
inline void factor_vm::primitive_float_greatereq() inline void factor_vm::primitive_float_greatereq()
{ {
@ -554,50 +437,35 @@ inline void factor_vm::primitive_float_greatereq()
box_boolean(x >= y); box_boolean(x >= y);
} }
PRIMITIVE(float_greatereq) PRIMITIVE_FORWARD(float_greatereq)
{
PRIMITIVE_GETVM()->primitive_float_greatereq();
}
inline void factor_vm::primitive_float_bits() inline void factor_vm::primitive_float_bits()
{ {
box_unsigned_4(float_bits(untag_float_check(dpop()))); box_unsigned_4(float_bits(untag_float_check(dpop())));
} }
PRIMITIVE(float_bits) PRIMITIVE_FORWARD(float_bits)
{
PRIMITIVE_GETVM()->primitive_float_bits();
}
inline void factor_vm::primitive_bits_float() inline void factor_vm::primitive_bits_float()
{ {
box_float(bits_float(to_cell(dpop()))); box_float(bits_float(to_cell(dpop())));
} }
PRIMITIVE(bits_float) PRIMITIVE_FORWARD(bits_float)
{
PRIMITIVE_GETVM()->primitive_bits_float();
}
inline void factor_vm::primitive_double_bits() inline void factor_vm::primitive_double_bits()
{ {
box_unsigned_8(double_bits(untag_float_check(dpop()))); box_unsigned_8(double_bits(untag_float_check(dpop())));
} }
PRIMITIVE(double_bits) PRIMITIVE_FORWARD(double_bits)
{
PRIMITIVE_GETVM()->primitive_double_bits();
}
inline void factor_vm::primitive_bits_double() inline void factor_vm::primitive_bits_double()
{ {
box_double(bits_double(to_unsigned_8(dpop()))); box_double(bits_double(to_unsigned_8(dpop())));
} }
PRIMITIVE(bits_double) PRIMITIVE_FORWARD(bits_double)
{
PRIMITIVE_GETVM()->primitive_bits_double();
}
fixnum factor_vm::to_fixnum(cell tagged) fixnum factor_vm::to_fixnum(cell tagged)
{ {

View File

@ -84,10 +84,7 @@ inline void factor_vm::primitive_existsp()
box_boolean(stat(path,&sb) >= 0); box_boolean(stat(path,&sb) >= 0);
} }
PRIMITIVE(existsp) PRIMITIVE_FORWARD(existsp)
{
PRIMITIVE_GETVM()->primitive_existsp();
}
segment *factor_vm::alloc_segment(cell size) segment *factor_vm::alloc_segment(cell size)
{ {

View File

@ -30,10 +30,7 @@ char *getenv(char *name)
return 0; /* unreachable */ return 0; /* unreachable */
} }
PRIMITIVE(os_envs) PRIMITIVE_FORWARD(os_envs)
{
vm->not_implemented_error();
}
void c_to_factor_toplevel(cell quot) void c_to_factor_toplevel(cell quot)
{ {

View File

@ -96,10 +96,7 @@ inline void factor_vm::primitive_existsp()
box_boolean(windows_stat(path)); box_boolean(windows_stat(path));
} }
PRIMITIVE(existsp) PRIMITIVE_FORWARD(existsp)
{
PRIMITIVE_GETVM()->primitive_existsp();
}
segment *factor_vm::alloc_segment(cell size) segment *factor_vm::alloc_segment(cell size)
{ {

View File

@ -4,10 +4,17 @@ namespace factor
#if defined(FACTOR_X86) #if defined(FACTOR_X86)
extern "C" __attribute__ ((regparm (1))) typedef void (*primitive_type)(void *myvm); extern "C" __attribute__ ((regparm (1))) typedef void (*primitive_type)(void *myvm);
#define PRIMITIVE(name) extern "C" __attribute__ ((regparm (1))) void primitive_##name(void *myvm) #define PRIMITIVE(name) extern "C" __attribute__ ((regparm (1))) void primitive_##name(void *myvm)
#define PRIMITIVE_FORWARD(name) extern "C" __attribute__ ((regparm (1))) void primitive_##name(void *myvm) \
{ \
PRIMITIVE_GETVM()->primitive_##name(); \
}
#else #else
extern "C" typedef void (*primitive_type)(void *myvm); extern "C" typedef void (*primitive_type)(void *myvm);
#define PRIMITIVE(name) extern "C" void primitive_##name(void *myvm) #define PRIMITIVE(name) extern "C" void primitive_##name(void *myvm)
#define PRIMITIVE_FORWARD(name) extern "C" void primitive_##name(void *myvm) \
{ \
PRIMITIVE_GETVM()->primitive_##name(); \
}
#endif #endif
extern const primitive_type primitives[]; extern const primitive_type primitives[];
} }

View File

@ -52,9 +52,6 @@ inline void factor_vm::primitive_profiling()
set_profiling(to_boolean(dpop())); set_profiling(to_boolean(dpop()));
} }
PRIMITIVE(profiling) PRIMITIVE_FORWARD(profiling)
{
PRIMITIVE_GETVM()->primitive_profiling();
}
} }

View File

@ -294,10 +294,7 @@ inline void factor_vm::primitive_jit_compile()
jit_compile(dpop(),true); jit_compile(dpop(),true);
} }
PRIMITIVE(jit_compile) PRIMITIVE_FORWARD(jit_compile)
{
PRIMITIVE_GETVM()->primitive_jit_compile();
}
/* push a new quotation on the stack */ /* push a new quotation on the stack */
inline void factor_vm::primitive_array_to_quotation() inline void factor_vm::primitive_array_to_quotation()
@ -311,10 +308,7 @@ inline void factor_vm::primitive_array_to_quotation()
drepl(tag<quotation>(quot)); drepl(tag<quotation>(quot));
} }
PRIMITIVE(array_to_quotation) PRIMITIVE_FORWARD(array_to_quotation)
{
PRIMITIVE_GETVM()->primitive_array_to_quotation();
}
inline void factor_vm::primitive_quotation_xt() inline void factor_vm::primitive_quotation_xt()
{ {
@ -322,10 +316,7 @@ inline void factor_vm::primitive_quotation_xt()
drepl(allot_cell((cell)quot->xt)); drepl(allot_cell((cell)quot->xt));
} }
PRIMITIVE(quotation_xt) PRIMITIVE_FORWARD(quotation_xt)
{
PRIMITIVE_GETVM()->primitive_quotation_xt();
}
void factor_vm::compile_all_words() void factor_vm::compile_all_words()
{ {
@ -381,9 +372,6 @@ inline void factor_vm::primitive_quot_compiled_p()
dpush(tag_boolean(quot->code != NULL)); dpush(tag_boolean(quot->code != NULL));
} }
PRIMITIVE(quot_compiled_p) PRIMITIVE_FORWARD(quot_compiled_p)
{
PRIMITIVE_GETVM()->primitive_quot_compiled_p();
}
} }

View File

@ -9,10 +9,7 @@ inline void factor_vm::primitive_getenv()
drepl(userenv[e]); drepl(userenv[e]);
} }
PRIMITIVE(getenv) PRIMITIVE_FORWARD(getenv)
{
PRIMITIVE_GETVM()->primitive_getenv();
}
inline void factor_vm::primitive_setenv() inline void factor_vm::primitive_setenv()
{ {
@ -21,40 +18,28 @@ inline void factor_vm::primitive_setenv()
userenv[e] = value; userenv[e] = value;
} }
PRIMITIVE(setenv) PRIMITIVE_FORWARD(setenv)
{
PRIMITIVE_GETVM()->primitive_setenv();
}
inline void factor_vm::primitive_exit() inline void factor_vm::primitive_exit()
{ {
exit(to_fixnum(dpop())); exit(to_fixnum(dpop()));
} }
PRIMITIVE(exit) PRIMITIVE_FORWARD(exit)
{
PRIMITIVE_GETVM()->primitive_exit();
}
inline void factor_vm::primitive_micros() inline void factor_vm::primitive_micros()
{ {
box_unsigned_8(current_micros()); box_unsigned_8(current_micros());
} }
PRIMITIVE(micros) PRIMITIVE_FORWARD(micros)
{
PRIMITIVE_GETVM()->primitive_micros();
}
inline void factor_vm::primitive_sleep() inline void factor_vm::primitive_sleep()
{ {
sleep_micros(to_cell(dpop())); sleep_micros(to_cell(dpop()));
} }
PRIMITIVE(sleep) PRIMITIVE_FORWARD(sleep)
{
PRIMITIVE_GETVM()->primitive_sleep();
}
inline void factor_vm::primitive_set_slot() inline void factor_vm::primitive_set_slot()
{ {
@ -66,10 +51,7 @@ inline void factor_vm::primitive_set_slot()
write_barrier(obj); write_barrier(obj);
} }
PRIMITIVE(set_slot) PRIMITIVE_FORWARD(set_slot)
{
PRIMITIVE_GETVM()->primitive_set_slot();
}
inline void factor_vm::primitive_load_locals() inline void factor_vm::primitive_load_locals()
{ {
@ -79,10 +61,7 @@ inline void factor_vm::primitive_load_locals()
rs += sizeof(cell) * count; rs += sizeof(cell) * count;
} }
PRIMITIVE(load_locals) PRIMITIVE_FORWARD(load_locals)
{
PRIMITIVE_GETVM()->primitive_load_locals();
}
cell factor_vm::clone_object(cell obj_) cell factor_vm::clone_object(cell obj_)
{ {
@ -104,9 +83,6 @@ inline void factor_vm::primitive_clone()
drepl(clone_object(dpeek())); drepl(clone_object(dpeek()));
} }
PRIMITIVE(clone) PRIMITIVE_FORWARD(clone)
{
PRIMITIVE_GETVM()->primitive_clone();
}
} }

View File

@ -106,10 +106,7 @@ inline void factor_vm::primitive_string()
dpush(tag<string>(allot_string(length,initial))); dpush(tag<string>(allot_string(length,initial)));
} }
PRIMITIVE(string) PRIMITIVE_FORWARD(string)
{
PRIMITIVE_GETVM()->primitive_string();
}
bool factor_vm::reallot_string_in_place_p(string *str, cell capacity) bool factor_vm::reallot_string_in_place_p(string *str, cell capacity)
{ {
@ -167,10 +164,7 @@ inline void factor_vm::primitive_resize_string()
dpush(tag<string>(reallot_string(str,capacity))); dpush(tag<string>(reallot_string(str,capacity)));
} }
PRIMITIVE(resize_string) PRIMITIVE_FORWARD(resize_string)
{
PRIMITIVE_GETVM()->primitive_resize_string();
}
inline void factor_vm::primitive_string_nth() inline void factor_vm::primitive_string_nth()
{ {
@ -179,10 +173,7 @@ inline void factor_vm::primitive_string_nth()
dpush(tag_fixnum(string_nth(str,index))); dpush(tag_fixnum(string_nth(str,index)));
} }
PRIMITIVE(string_nth) PRIMITIVE_FORWARD(string_nth)
{
PRIMITIVE_GETVM()->primitive_string_nth();
}
inline void factor_vm::primitive_set_string_nth_fast() inline void factor_vm::primitive_set_string_nth_fast()
{ {
@ -192,10 +183,7 @@ inline void factor_vm::primitive_set_string_nth_fast()
set_string_nth_fast(str,index,value); set_string_nth_fast(str,index,value);
} }
PRIMITIVE(set_string_nth_fast) PRIMITIVE_FORWARD(set_string_nth_fast)
{
PRIMITIVE_GETVM()->primitive_set_string_nth_fast();
}
inline void factor_vm::primitive_set_string_nth_slow() inline void factor_vm::primitive_set_string_nth_slow()
{ {
@ -205,9 +193,6 @@ inline void factor_vm::primitive_set_string_nth_slow()
set_string_nth_slow(str,index,value); set_string_nth_slow(str,index,value);
} }
PRIMITIVE(set_string_nth_slow) PRIMITIVE_FORWARD(set_string_nth_slow)
{
PRIMITIVE_GETVM()->primitive_set_string_nth_slow();
}
} }

View File

@ -23,10 +23,7 @@ inline void factor_vm::primitive_tuple()
dpush(tag<tuple>(t)); dpush(tag<tuple>(t));
} }
PRIMITIVE(tuple) PRIMITIVE_FORWARD(tuple)
{
PRIMITIVE_GETVM()->primitive_tuple();
}
/* 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 */
inline void factor_vm::primitive_tuple_boa() inline void factor_vm::primitive_tuple_boa()
@ -39,9 +36,6 @@ inline void factor_vm::primitive_tuple_boa()
dpush(t.value()); dpush(t.value());
} }
PRIMITIVE(tuple_boa) PRIMITIVE_FORWARD(tuple_boa)
{
PRIMITIVE_GETVM()->primitive_tuple_boa();
}
} }

View File

@ -39,10 +39,7 @@ inline void factor_vm::primitive_word()
dpush(tag<word>(allot_word(vocab,name))); dpush(tag<word>(allot_word(vocab,name)));
} }
PRIMITIVE(word) PRIMITIVE_FORWARD(word)
{
PRIMITIVE_GETVM()->primitive_word();
}
/* word-xt ( word -- start end ) */ /* word-xt ( word -- start end ) */
inline void factor_vm::primitive_word_xt() inline void factor_vm::primitive_word_xt()
@ -53,10 +50,7 @@ inline void factor_vm::primitive_word_xt()
dpush(allot_cell((cell)code + code->size)); dpush(allot_cell((cell)code + code->size));
} }
PRIMITIVE(word_xt) PRIMITIVE_FORWARD(word_xt)
{
PRIMITIVE_GETVM()->primitive_word_xt();
}
/* Allocates memory */ /* Allocates memory */
void factor_vm::update_word_xt(cell w_) void factor_vm::update_word_xt(cell w_)
@ -85,10 +79,7 @@ inline void factor_vm::primitive_optimized_p()
drepl(tag_boolean(word_optimized_p(untag_check<word>(dpeek())))); drepl(tag_boolean(word_optimized_p(untag_check<word>(dpeek()))));
} }
PRIMITIVE(optimized_p) PRIMITIVE_FORWARD(optimized_p)
{
PRIMITIVE_GETVM()->primitive_optimized_p();
}
inline void factor_vm::primitive_wrapper() inline void factor_vm::primitive_wrapper()
{ {
@ -97,9 +88,6 @@ inline void factor_vm::primitive_wrapper()
drepl(tag<wrapper>(new_wrapper)); drepl(tag<wrapper>(new_wrapper));
} }
PRIMITIVE(wrapper) PRIMITIVE_FORWARD(wrapper)
{
PRIMITIVE_GETVM()->primitive_wrapper();
}
} }