}
}
-PRIMITIVE(displaced_alien)
-{
- PRIMITIVE_GETVM()->primitive_displaced_alien();
-}
+PRIMITIVE_FORWARD(displaced_alien)
/* address of an object representing a C pointer. Explicitly throw an error
if the object is a byte array, as a sanity check. */
box_unsigned_cell((cell)pinned_alien_offset(dpop()));
}
-PRIMITIVE(alien_address)
-{
- PRIMITIVE_GETVM()->primitive_alien_address();
-}
+PRIMITIVE_FORWARD(alien_address)
/* pop ( alien n ) from datastack, return alien's address plus n */
void *factor_vm::alien_pointer()
dpush(library.value());
}
-PRIMITIVE(dlopen)
-{
- PRIMITIVE_GETVM()->primitive_dlopen();
-}
+PRIMITIVE_FORWARD(dlopen)
/* look up a symbol in a native library */
inline void factor_vm::primitive_dlsym()
}
}
-PRIMITIVE(dlsym)
-{
- PRIMITIVE_GETVM()->primitive_dlsym();
-}
+PRIMITIVE_FORWARD(dlsym)
/* close a native library handle */
inline void factor_vm::primitive_dlclose()
ffi_dlclose(d);
}
-PRIMITIVE(dlclose)
-{
- PRIMITIVE_GETVM()->primitive_dlclose();
-}
+PRIMITIVE_FORWARD(dlclose)
inline void factor_vm::primitive_dll_validp()
{
dpush(untag_check<dll>(library)->dll == NULL ? F : T);
}
-PRIMITIVE(dll_validp)
-{
- PRIMITIVE_GETVM()->primitive_dll_validp();
-}
+PRIMITIVE_FORWARD(dll_validp)
/* gets the address of an object representing a C pointer */
char *factor_vm::alien_offset(cell obj)
box_alien(this);
}
-PRIMITIVE(vm_ptr)
-{
- PRIMITIVE_GETVM()->primitive_vm_ptr();
-}
+PRIMITIVE_FORWARD(vm_ptr)
}
dpush(tag<array>(allot_array(size,initial)));
}
-PRIMITIVE(array)
-{
- PRIMITIVE_GETVM()->primitive_array();
-}
+PRIMITIVE_FORWARD(array)
cell factor_vm::allot_array_1(cell obj_)
{
dpush(tag<array>(reallot_array(a,capacity)));
}
-PRIMITIVE(resize_array)
-{
- PRIMITIVE_GETVM()->primitive_resize_array();
-}
+PRIMITIVE_FORWARD(resize_array)
void growable_array::add(cell elt_)
{
dpush(tag<byte_array>(allot_byte_array(size)));
}
-PRIMITIVE(byte_array)
-{
- PRIMITIVE_GETVM()->primitive_byte_array();
-}
+PRIMITIVE_FORWARD(byte_array)
inline void factor_vm::primitive_uninitialized_byte_array()
{
dpush(tag<byte_array>(allot_array_internal<byte_array>(size)));
}
-PRIMITIVE(uninitialized_byte_array)
-{
- PRIMITIVE_GETVM()->primitive_uninitialized_byte_array();
-}
+PRIMITIVE_FORWARD(uninitialized_byte_array)
inline void factor_vm::primitive_resize_byte_array()
{
dpush(tag<byte_array>(reallot_array(array,capacity)));
}
-PRIMITIVE(resize_byte_array)
-{
- PRIMITIVE_GETVM()->primitive_resize_byte_array();
-}
+PRIMITIVE_FORWARD(resize_byte_array)
void growable_byte_array::append_bytes(void *elts, cell len)
{
dpush(tag<callstack>(stack));
}
-PRIMITIVE(callstack)
-{
- PRIMITIVE_GETVM()->primitive_callstack();
-}
+PRIMITIVE_FORWARD(callstack)
inline void factor_vm::primitive_set_callstack()
{
critical_error("Bug in set_callstack()",0);
}
-PRIMITIVE(set_callstack)
-{
- PRIMITIVE_GETVM()->primitive_set_callstack();
-}
+PRIMITIVE_FORWARD(set_callstack)
code_block *factor_vm::frame_code(stack_frame *frame)
{
dpush(accum.frames.elements.value());
}
-PRIMITIVE(callstack_to_array)
-{
- PRIMITIVE_GETVM()->primitive_callstack_to_array();
-}
+PRIMITIVE_FORWARD(callstack_to_array)
stack_frame *factor_vm::innermost_stack_frame(callstack *stack)
{
dpush(frame_executing(innermost_stack_frame(untag_check<callstack>(dpop()))));
}
-PRIMITIVE(innermost_stack_frame_executing)
-{
- PRIMITIVE_GETVM()->primitive_innermost_stack_frame_executing();
-}
+PRIMITIVE_FORWARD(innermost_stack_frame_executing)
inline void factor_vm::primitive_innermost_stack_frame_scan()
{
dpush(frame_scan(innermost_stack_frame_quot(untag_check<callstack>(dpop()))));
}
-PRIMITIVE(innermost_stack_frame_scan)
-{
- PRIMITIVE_GETVM()->primitive_innermost_stack_frame_scan();
-}
+PRIMITIVE_FORWARD(innermost_stack_frame_scan)
inline void factor_vm::primitive_set_innermost_stack_frame_quot()
{
FRAME_RETURN_ADDRESS(inner) = (char *)quot->xt + offset;
}
-PRIMITIVE(set_innermost_stack_frame_quot)
-{
- PRIMITIVE_GETVM()->primitive_set_innermost_stack_frame_quot();
-}
+PRIMITIVE_FORWARD(set_innermost_stack_frame_quot)
/* called before entry into Factor code. */
void factor_vm::save_callstack_bottom(stack_frame *callstack_bottom)
update_code_heap_words();
}
-PRIMITIVE(modify_code_heap)
-{
- PRIMITIVE_GETVM()->primitive_modify_code_heap();
-}
+PRIMITIVE_FORWARD(modify_code_heap)
/* Push the free space and total size of the code heap */
inline void factor_vm::primitive_code_room()
dpush(tag_fixnum(max_free / 1024));
}
-PRIMITIVE(code_room)
-{
- PRIMITIVE_GETVM()->primitive_code_room();
-}
+PRIMITIVE_FORWARD(code_room)
code_block *factor_vm::forward_xt(code_block *compiled)
{
general_error(ERROR_DS_UNDERFLOW,F,F,NULL);
}
-PRIMITIVE(datastack)
-{
- PRIMITIVE_GETVM()->primitive_datastack();
-}
+PRIMITIVE_FORWARD(datastack)
inline void factor_vm::primitive_retainstack()
{
general_error(ERROR_RS_UNDERFLOW,F,F,NULL);
}
-PRIMITIVE(retainstack)
-{
- PRIMITIVE_GETVM()->primitive_retainstack();
-}
+PRIMITIVE_FORWARD(retainstack)
/* returns pointer to top of stack */
cell factor_vm::array_to_stack(array *array, cell bottom)
ds = array_to_stack(untag_check<array>(dpop()),ds_bot);
}
-PRIMITIVE(set_datastack)
-{
- PRIMITIVE_GETVM()->primitive_set_datastack();
-}
+PRIMITIVE_FORWARD(set_datastack)
inline void factor_vm::primitive_set_retainstack()
{
rs = array_to_stack(untag_check<array>(dpop()),rs_bot);
}
-PRIMITIVE(set_retainstack)
-{
- PRIMITIVE_GETVM()->primitive_set_retainstack();
-}
+PRIMITIVE_FORWARD(set_retainstack)
/* Used to implement call( */
inline void factor_vm::primitive_check_datastack()
}
}
-PRIMITIVE(check_datastack)
-{
- PRIMITIVE_GETVM()->primitive_check_datastack();
-}
+PRIMITIVE_FORWARD(check_datastack)
}
gc();
}
-PRIMITIVE(gc)
-{
- PRIMITIVE_GETVM()->primitive_gc();
-}
+PRIMITIVE_FORWARD(gc)
inline void factor_vm::primitive_gc_stats()
{
dpush(result.elements.value());
}
-PRIMITIVE(gc_stats)
-{
- PRIMITIVE_GETVM()->primitive_gc_stats();
-}
+PRIMITIVE_FORWARD(gc_stats)
void factor_vm::clear_gc_stats()
{
clear_gc_stats();
}
-PRIMITIVE(clear_gc_stats)
-{
- PRIMITIVE_GETVM()->primitive_clear_gc_stats();
-}
+PRIMITIVE_FORWARD(clear_gc_stats)
/* classes.tuple uses this to reshape tuples; tools.deploy.shaker uses this
to coalesce equal but distinct quotations and wrappers. */
compile_all_words();
}
-PRIMITIVE(become)
-{
- PRIMITIVE_GETVM()->primitive_become();
-}
+PRIMITIVE_FORWARD(become)
void factor_vm::inline_gc(cell *gc_roots_base, cell gc_roots_size)
{
box_unsigned_cell(object_size(dpop()));
}
-PRIMITIVE(size)
-{
- PRIMITIVE_GETVM()->primitive_size();
-}
+PRIMITIVE_FORWARD(size)
/* 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
dpush(a.elements.value());
}
-PRIMITIVE(data_room)
-{
- PRIMITIVE_GETVM()->primitive_data_room();
-}
+PRIMITIVE_FORWARD(data_room)
/* Disables GC and activates next-object ( -- obj ) primitive */
void factor_vm::begin_scan()
begin_scan();
}
-PRIMITIVE(begin_scan)
-{
- PRIMITIVE_GETVM()->primitive_begin_scan();
-}
+PRIMITIVE_FORWARD(begin_scan)
cell factor_vm::next_object()
{
dpush(next_object());
}
-PRIMITIVE(next_object)
-{
- PRIMITIVE_GETVM()->primitive_next_object();
-}
+PRIMITIVE_FORWARD(next_object)
/* Re-enables GC */
inline void factor_vm::primitive_end_scan()
gc_off = false;
}
-PRIMITIVE(end_scan)
-{
- PRIMITIVE_GETVM()->primitive_end_scan();
-}
+PRIMITIVE_FORWARD(end_scan)
template<typename TYPE> void factor_vm::each_object(TYPE &functor)
{
factorbug();
}
-PRIMITIVE(die)
-{
- PRIMITIVE_GETVM()->primitive_die();
-}
+PRIMITIVE_FORWARD(die)
}
dpush(lookup_method(obj,methods));
}
-PRIMITIVE(lookup_method)
-{
- PRIMITIVE_GETVM()->primitive_lookup_method();
-}
+PRIMITIVE_FORWARD(lookup_method)
cell factor_vm::object_class(cell obj)
{
dpush(method);
}
-PRIMITIVE(mega_cache_miss)
-{
- PRIMITIVE_GETVM()->primitive_mega_cache_miss();
-}
+PRIMITIVE_FORWARD(mega_cache_miss)
inline void factor_vm::primitive_reset_dispatch_stats()
{
megamorphic_cache_hits = megamorphic_cache_misses = 0;
}
-PRIMITIVE(reset_dispatch_stats)
-{
- PRIMITIVE_GETVM()->primitive_reset_dispatch_stats();
-}
+PRIMITIVE_FORWARD(reset_dispatch_stats)
inline void factor_vm::primitive_dispatch_stats()
{
dpush(stats.elements.value());
}
-PRIMITIVE(dispatch_stats)
-{
- PRIMITIVE_GETVM()->primitive_dispatch_stats();
-}
+PRIMITIVE_FORWARD(dispatch_stats)
void quotation_jit::emit_mega_cache_lookup(cell methods_, fixnum index, cell cache_)
{
throw_impl(dpop(),stack_chain->callstack_bottom,this);
}
-PRIMITIVE(call_clear)
-{
- PRIMITIVE_GETVM()->primitive_call_clear();
-}
+PRIMITIVE_FORWARD(call_clear)
/* For testing purposes */
inline void factor_vm::primitive_unimplemented()
not_implemented_error();
}
-PRIMITIVE(unimplemented)
-{
- PRIMITIVE_GETVM()->primitive_unimplemented();
-}
+PRIMITIVE_FORWARD(unimplemented)
void factor_vm::memory_signal_handler_impl()
{
save_image((vm_char *)(path.untagged() + 1));
}
-PRIMITIVE(save_image)
-{
- PRIMITIVE_GETVM()->primitive_save_image();
-}
+PRIMITIVE_FORWARD(save_image)
inline void factor_vm::primitive_save_image_and_exit()
{
exit(1);
}
-PRIMITIVE(save_image_and_exit)
-{
- PRIMITIVE_GETVM()->primitive_save_image_and_exit();
-}
+PRIMITIVE_FORWARD(save_image_and_exit)
void factor_vm::data_fixup(cell *cell)
{
for(i = 0; i < 4; i++) pic_counts[i] = 0;
}
-PRIMITIVE(reset_inline_cache_stats)
-{
- PRIMITIVE_GETVM()->primitive_reset_inline_cache_stats();
-}
+PRIMITIVE_FORWARD(reset_inline_cache_stats)
inline void factor_vm::primitive_inline_cache_stats()
{
dpush(stats.elements.value());
}
-PRIMITIVE(inline_cache_stats)
-{
- PRIMITIVE_GETVM()->primitive_inline_cache_stats();
-}
+PRIMITIVE_FORWARD(inline_cache_stats)
}
}
}
-PRIMITIVE(fopen)
-{
- PRIMITIVE_GETVM()->primitive_fopen();
-}
+PRIMITIVE_FORWARD(fopen)
inline void factor_vm::primitive_fgetc()
{
}
}
-PRIMITIVE(fgetc)
-{
- PRIMITIVE_GETVM()->primitive_fgetc();
-}
+PRIMITIVE_FORWARD(fgetc)
inline void factor_vm::primitive_fread()
{
}
}
-PRIMITIVE(fread)
-{
- PRIMITIVE_GETVM()->primitive_fread();
-}
+PRIMITIVE_FORWARD(fread)
inline void factor_vm::primitive_fputc()
{
}
}
-PRIMITIVE(fputc)
-{
- PRIMITIVE_GETVM()->primitive_fputc();
-}
+PRIMITIVE_FORWARD(fputc)
inline void factor_vm::primitive_fwrite()
{
}
}
-PRIMITIVE(fwrite)
-{
- PRIMITIVE_GETVM()->primitive_fwrite();
-}
+PRIMITIVE_FORWARD(fwrite)
inline void factor_vm::primitive_fseek()
{
}
}
-PRIMITIVE(fseek)
-{
- PRIMITIVE_GETVM()->primitive_fseek();
-}
+PRIMITIVE_FORWARD(fseek)
inline void factor_vm::primitive_fflush()
{
}
}
-PRIMITIVE(fflush)
-{
- PRIMITIVE_GETVM()->primitive_fflush();
-}
+PRIMITIVE_FORWARD(fflush)
inline void factor_vm::primitive_fclose()
{
}
}
-PRIMITIVE(fclose)
-{
- PRIMITIVE_GETVM()->primitive_fclose();
-}
+PRIMITIVE_FORWARD(fclose)
/* 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
drepl(tag_fixnum(bignum_to_fixnum(untag<bignum>(dpeek()))));
}
-PRIMITIVE(bignum_to_fixnum)
-{
- PRIMITIVE_GETVM()->primitive_bignum_to_fixnum();
-}
+PRIMITIVE_FORWARD(bignum_to_fixnum)
inline void factor_vm::primitive_float_to_fixnum()
{
drepl(tag_fixnum(float_to_fixnum(dpeek())));
}
-PRIMITIVE(float_to_fixnum)
-{
- PRIMITIVE_GETVM()->primitive_float_to_fixnum();
-}
+PRIMITIVE_FORWARD(float_to_fixnum)
/* Division can only overflow when we are dividing the most negative fixnum
by -1. */
drepl(tag_fixnum(result));
}
-PRIMITIVE(fixnum_divint)
-{
- PRIMITIVE_GETVM()->primitive_fixnum_divint();
-}
+PRIMITIVE_FORWARD(fixnum_divint)
inline void factor_vm::primitive_fixnum_divmod()
{
}
}
-PRIMITIVE(fixnum_divmod)
-{
- PRIMITIVE_GETVM()->primitive_fixnum_divmod();
-}
+PRIMITIVE_FORWARD(fixnum_divmod)
/*
* If we're shifting right by n bits, we won't overflow as long as none of the
fixnum_to_bignum(x),y)));
}
-PRIMITIVE(fixnum_shift)
-{
- PRIMITIVE_GETVM()->primitive_fixnum_shift();
-}
+PRIMITIVE_FORWARD(fixnum_shift)
inline void factor_vm::primitive_fixnum_to_bignum()
{
drepl(tag<bignum>(fixnum_to_bignum(untag_fixnum(dpeek()))));
}
-PRIMITIVE(fixnum_to_bignum)
-{
- PRIMITIVE_GETVM()->primitive_fixnum_to_bignum();
-}
+PRIMITIVE_FORWARD(fixnum_to_bignum)
inline void factor_vm::primitive_float_to_bignum()
{
drepl(tag<bignum>(float_to_bignum(dpeek())));
}
-PRIMITIVE(float_to_bignum)
-{
- PRIMITIVE_GETVM()->primitive_float_to_bignum();
-}
+PRIMITIVE_FORWARD(float_to_bignum)
#define POP_BIGNUMS(x,y) \
bignum * y = untag<bignum>(dpop()); \
box_boolean(bignum_equal_p(x,y));
}
-PRIMITIVE(bignum_eq)
-{
- PRIMITIVE_GETVM()->primitive_bignum_eq();
-}
+PRIMITIVE_FORWARD(bignum_eq)
inline void factor_vm::primitive_bignum_add()
{
dpush(tag<bignum>(bignum_add(x,y)));
}
-PRIMITIVE(bignum_add)
-{
- PRIMITIVE_GETVM()->primitive_bignum_add();
-}
+PRIMITIVE_FORWARD(bignum_add)
inline void factor_vm::primitive_bignum_subtract()
{
dpush(tag<bignum>(bignum_subtract(x,y)));
}
-PRIMITIVE(bignum_subtract)
-{
- PRIMITIVE_GETVM()->primitive_bignum_subtract();
-}
+PRIMITIVE_FORWARD(bignum_subtract)
inline void factor_vm::primitive_bignum_multiply()
{
dpush(tag<bignum>(bignum_multiply(x,y)));
}
-PRIMITIVE(bignum_multiply)
-{
- PRIMITIVE_GETVM()->primitive_bignum_multiply();
-}
+PRIMITIVE_FORWARD(bignum_multiply)
inline void factor_vm::primitive_bignum_divint()
{
dpush(tag<bignum>(bignum_quotient(x,y)));
}
-PRIMITIVE(bignum_divint)
-{
- PRIMITIVE_GETVM()->primitive_bignum_divint();
-}
+PRIMITIVE_FORWARD(bignum_divint)
inline void factor_vm::primitive_bignum_divmod()
{
dpush(tag<bignum>(r));
}
-PRIMITIVE(bignum_divmod)
-{
- PRIMITIVE_GETVM()->primitive_bignum_divmod();
-}
+PRIMITIVE_FORWARD(bignum_divmod)
inline void factor_vm::primitive_bignum_mod()
{
dpush(tag<bignum>(bignum_remainder(x,y)));
}
-PRIMITIVE(bignum_mod)
-{
- PRIMITIVE_GETVM()->primitive_bignum_mod();
-}
+PRIMITIVE_FORWARD(bignum_mod)
inline void factor_vm::primitive_bignum_and()
{
dpush(tag<bignum>(bignum_bitwise_and(x,y)));
}
-PRIMITIVE(bignum_and)
-{
- PRIMITIVE_GETVM()->primitive_bignum_and();
-}
+PRIMITIVE_FORWARD(bignum_and)
inline void factor_vm::primitive_bignum_or()
{
dpush(tag<bignum>(bignum_bitwise_ior(x,y)));
}
-PRIMITIVE(bignum_or)
-{
- PRIMITIVE_GETVM()->primitive_bignum_or();
-}
+PRIMITIVE_FORWARD(bignum_or)
inline void factor_vm::primitive_bignum_xor()
{
dpush(tag<bignum>(bignum_bitwise_xor(x,y)));
}
-PRIMITIVE(bignum_xor)
-{
- PRIMITIVE_GETVM()->primitive_bignum_xor();
-}
+PRIMITIVE_FORWARD(bignum_xor)
inline void factor_vm::primitive_bignum_shift()
{
dpush(tag<bignum>(bignum_arithmetic_shift(x,y)));
}
-PRIMITIVE(bignum_shift)
-{
- PRIMITIVE_GETVM()->primitive_bignum_shift();
-}
+PRIMITIVE_FORWARD(bignum_shift)
inline void factor_vm::primitive_bignum_less()
{
box_boolean(bignum_compare(x,y) == bignum_comparison_less);
}
-PRIMITIVE(bignum_less)
-{
- PRIMITIVE_GETVM()->primitive_bignum_less();
-}
+PRIMITIVE_FORWARD(bignum_less)
inline void factor_vm::primitive_bignum_lesseq()
{
box_boolean(bignum_compare(x,y) != bignum_comparison_greater);
}
-PRIMITIVE(bignum_lesseq)
-{
- PRIMITIVE_GETVM()->primitive_bignum_lesseq();
-}
+PRIMITIVE_FORWARD(bignum_lesseq)
inline void factor_vm::primitive_bignum_greater()
{
box_boolean(bignum_compare(x,y) == bignum_comparison_greater);
}
-PRIMITIVE(bignum_greater)
-{
- PRIMITIVE_GETVM()->primitive_bignum_greater();
-}
+PRIMITIVE_FORWARD(bignum_greater)
inline void factor_vm::primitive_bignum_greatereq()
{
box_boolean(bignum_compare(x,y) != bignum_comparison_less);
}
-PRIMITIVE(bignum_greatereq)
-{
- PRIMITIVE_GETVM()->primitive_bignum_greatereq();
-}
+PRIMITIVE_FORWARD(bignum_greatereq)
inline void factor_vm::primitive_bignum_not()
{
drepl(tag<bignum>(bignum_bitwise_not(untag<bignum>(dpeek()))));
}
-PRIMITIVE(bignum_not)
-{
- PRIMITIVE_GETVM()->primitive_bignum_not();
-}
+PRIMITIVE_FORWARD(bignum_not)
inline void factor_vm::primitive_bignum_bitp()
{
box_boolean(bignum_logbitp(bit,x));
}
-PRIMITIVE(bignum_bitp)
-{
- PRIMITIVE_GETVM()->primitive_bignum_bitp();
-}
+PRIMITIVE_FORWARD(bignum_bitp)
inline void factor_vm::primitive_bignum_log2()
{
drepl(tag<bignum>(bignum_integer_length(untag<bignum>(dpeek()))));
}
-PRIMITIVE(bignum_log2)
-{
- PRIMITIVE_GETVM()->primitive_bignum_log2();
-}
+PRIMITIVE_FORWARD(bignum_log2)
unsigned int factor_vm::bignum_producer(unsigned int digit)
{
drepl(tag<bignum>(result));
}
-PRIMITIVE(byte_array_to_bignum)
-{
- PRIMITIVE_GETVM()->primitive_byte_array_to_bignum();
-}
+PRIMITIVE_FORWARD(byte_array_to_bignum)
cell factor_vm::unbox_array_size()
{
drepl(allot_float(fixnum_to_float(dpeek())));
}
-PRIMITIVE(fixnum_to_float)
-{
- PRIMITIVE_GETVM()->primitive_fixnum_to_float();
-}
+PRIMITIVE_FORWARD(fixnum_to_float)
inline void factor_vm::primitive_bignum_to_float()
{
drepl(allot_float(bignum_to_float(dpeek())));
}
-PRIMITIVE(bignum_to_float)
-{
- PRIMITIVE_GETVM()->primitive_bignum_to_float();
-}
+PRIMITIVE_FORWARD(bignum_to_float)
inline void factor_vm::primitive_str_to_float()
{
drepl(F);
}
-PRIMITIVE(str_to_float)
-{
- PRIMITIVE_GETVM()->primitive_str_to_float();
-}
+PRIMITIVE_FORWARD(str_to_float)
inline void factor_vm::primitive_float_to_str()
{
dpush(tag<byte_array>(array));
}
-PRIMITIVE(float_to_str)
-{
- PRIMITIVE_GETVM()->primitive_float_to_str();
-}
+PRIMITIVE_FORWARD(float_to_str)
#define POP_FLOATS(x,y) \
double y = untag_float(dpop()); \
box_boolean(x == y);
}
-PRIMITIVE(float_eq)
-{
- PRIMITIVE_GETVM()->primitive_float_eq();
-}
+PRIMITIVE_FORWARD(float_eq)
inline void factor_vm::primitive_float_add()
{
box_double(x + y);
}
-PRIMITIVE(float_add)
-{
- PRIMITIVE_GETVM()->primitive_float_add();
-}
+PRIMITIVE_FORWARD(float_add)
inline void factor_vm::primitive_float_subtract()
{
box_double(x - y);
}
-PRIMITIVE(float_subtract)
-{
- PRIMITIVE_GETVM()->primitive_float_subtract();
-}
+PRIMITIVE_FORWARD(float_subtract)
inline void factor_vm::primitive_float_multiply()
{
box_double(x * y);
}
-PRIMITIVE(float_multiply)
-{
- PRIMITIVE_GETVM()->primitive_float_multiply();
-}
+PRIMITIVE_FORWARD(float_multiply)
inline void factor_vm::primitive_float_divfloat()
{
box_double(x / y);
}
-PRIMITIVE(float_divfloat)
-{
- PRIMITIVE_GETVM()->primitive_float_divfloat();
-}
+PRIMITIVE_FORWARD(float_divfloat)
inline void factor_vm::primitive_float_mod()
{
box_double(fmod(x,y));
}
-PRIMITIVE(float_mod)
-{
- PRIMITIVE_GETVM()->primitive_float_mod();
-}
+PRIMITIVE_FORWARD(float_mod)
inline void factor_vm::primitive_float_less()
{
box_boolean(x < y);
}
-PRIMITIVE(float_less)
-{
- PRIMITIVE_GETVM()->primitive_float_less();
-}
+PRIMITIVE_FORWARD(float_less)
inline void factor_vm::primitive_float_lesseq()
{
box_boolean(x <= y);
}
-PRIMITIVE(float_lesseq)
-{
- PRIMITIVE_GETVM()->primitive_float_lesseq();
-}
+PRIMITIVE_FORWARD(float_lesseq)
inline void factor_vm::primitive_float_greater()
{
box_boolean(x > y);
}
-PRIMITIVE(float_greater)
-{
- PRIMITIVE_GETVM()->primitive_float_greater();
-}
+PRIMITIVE_FORWARD(float_greater)
inline void factor_vm::primitive_float_greatereq()
{
box_boolean(x >= y);
}
-PRIMITIVE(float_greatereq)
-{
- PRIMITIVE_GETVM()->primitive_float_greatereq();
-}
+PRIMITIVE_FORWARD(float_greatereq)
inline void factor_vm::primitive_float_bits()
{
box_unsigned_4(float_bits(untag_float_check(dpop())));
}
-PRIMITIVE(float_bits)
-{
- PRIMITIVE_GETVM()->primitive_float_bits();
-}
+PRIMITIVE_FORWARD(float_bits)
inline void factor_vm::primitive_bits_float()
{
box_float(bits_float(to_cell(dpop())));
}
-PRIMITIVE(bits_float)
-{
- PRIMITIVE_GETVM()->primitive_bits_float();
-}
+PRIMITIVE_FORWARD(bits_float)
inline void factor_vm::primitive_double_bits()
{
box_unsigned_8(double_bits(untag_float_check(dpop())));
}
-PRIMITIVE(double_bits)
-{
- PRIMITIVE_GETVM()->primitive_double_bits();
-}
+PRIMITIVE_FORWARD(double_bits)
inline void factor_vm::primitive_bits_double()
{
box_double(bits_double(to_unsigned_8(dpop())));
}
-PRIMITIVE(bits_double)
-{
- PRIMITIVE_GETVM()->primitive_bits_double();
-}
+PRIMITIVE_FORWARD(bits_double)
fixnum factor_vm::to_fixnum(cell tagged)
{
box_boolean(stat(path,&sb) >= 0);
}
-PRIMITIVE(existsp)
-{
- PRIMITIVE_GETVM()->primitive_existsp();
-}
+PRIMITIVE_FORWARD(existsp)
segment *factor_vm::alloc_segment(cell size)
{
return 0; /* unreachable */
}
-PRIMITIVE(os_envs)
-{
- vm->not_implemented_error();
-}
+PRIMITIVE_FORWARD(os_envs)
void c_to_factor_toplevel(cell quot)
{
box_boolean(windows_stat(path));
}
-PRIMITIVE(existsp)
-{
- PRIMITIVE_GETVM()->primitive_existsp();
-}
+PRIMITIVE_FORWARD(existsp)
segment *factor_vm::alloc_segment(cell size)
{
#if defined(FACTOR_X86)
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_FORWARD(name) extern "C" __attribute__ ((regparm (1))) void primitive_##name(void *myvm) \
+ { \
+ PRIMITIVE_GETVM()->primitive_##name(); \
+ }
#else
extern "C" typedef void (*primitive_type)(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
-
extern const primitive_type primitives[];
}
set_profiling(to_boolean(dpop()));
}
-PRIMITIVE(profiling)
-{
- PRIMITIVE_GETVM()->primitive_profiling();
-}
+PRIMITIVE_FORWARD(profiling)
}
jit_compile(dpop(),true);
}
-PRIMITIVE(jit_compile)
-{
- PRIMITIVE_GETVM()->primitive_jit_compile();
-}
+PRIMITIVE_FORWARD(jit_compile)
/* push a new quotation on the stack */
inline void factor_vm::primitive_array_to_quotation()
drepl(tag<quotation>(quot));
}
-PRIMITIVE(array_to_quotation)
-{
- PRIMITIVE_GETVM()->primitive_array_to_quotation();
-}
+PRIMITIVE_FORWARD(array_to_quotation)
inline void factor_vm::primitive_quotation_xt()
{
drepl(allot_cell((cell)quot->xt));
}
-PRIMITIVE(quotation_xt)
-{
- PRIMITIVE_GETVM()->primitive_quotation_xt();
-}
+PRIMITIVE_FORWARD(quotation_xt)
void factor_vm::compile_all_words()
{
dpush(tag_boolean(quot->code != NULL));
}
-PRIMITIVE(quot_compiled_p)
-{
- PRIMITIVE_GETVM()->primitive_quot_compiled_p();
-}
+PRIMITIVE_FORWARD(quot_compiled_p)
}
drepl(userenv[e]);
}
-PRIMITIVE(getenv)
-{
- PRIMITIVE_GETVM()->primitive_getenv();
-}
+PRIMITIVE_FORWARD(getenv)
inline void factor_vm::primitive_setenv()
{
userenv[e] = value;
}
-PRIMITIVE(setenv)
-{
- PRIMITIVE_GETVM()->primitive_setenv();
-}
+PRIMITIVE_FORWARD(setenv)
inline void factor_vm::primitive_exit()
{
exit(to_fixnum(dpop()));
}
-PRIMITIVE(exit)
-{
- PRIMITIVE_GETVM()->primitive_exit();
-}
+PRIMITIVE_FORWARD(exit)
inline void factor_vm::primitive_micros()
{
box_unsigned_8(current_micros());
}
-PRIMITIVE(micros)
-{
- PRIMITIVE_GETVM()->primitive_micros();
-}
+PRIMITIVE_FORWARD(micros)
inline void factor_vm::primitive_sleep()
{
sleep_micros(to_cell(dpop()));
}
-PRIMITIVE(sleep)
-{
- PRIMITIVE_GETVM()->primitive_sleep();
-}
+PRIMITIVE_FORWARD(sleep)
inline void factor_vm::primitive_set_slot()
{
write_barrier(obj);
}
-PRIMITIVE(set_slot)
-{
- PRIMITIVE_GETVM()->primitive_set_slot();
-}
+PRIMITIVE_FORWARD(set_slot)
inline void factor_vm::primitive_load_locals()
{
rs += sizeof(cell) * count;
}
-PRIMITIVE(load_locals)
-{
- PRIMITIVE_GETVM()->primitive_load_locals();
-}
+PRIMITIVE_FORWARD(load_locals)
cell factor_vm::clone_object(cell obj_)
{
drepl(clone_object(dpeek()));
}
-PRIMITIVE(clone)
-{
- PRIMITIVE_GETVM()->primitive_clone();
-}
+PRIMITIVE_FORWARD(clone)
}
dpush(tag<string>(allot_string(length,initial)));
}
-PRIMITIVE(string)
-{
- PRIMITIVE_GETVM()->primitive_string();
-}
+PRIMITIVE_FORWARD(string)
bool factor_vm::reallot_string_in_place_p(string *str, cell capacity)
{
dpush(tag<string>(reallot_string(str,capacity)));
}
-PRIMITIVE(resize_string)
-{
- PRIMITIVE_GETVM()->primitive_resize_string();
-}
+PRIMITIVE_FORWARD(resize_string)
inline void factor_vm::primitive_string_nth()
{
dpush(tag_fixnum(string_nth(str,index)));
}
-PRIMITIVE(string_nth)
-{
- PRIMITIVE_GETVM()->primitive_string_nth();
-}
+PRIMITIVE_FORWARD(string_nth)
inline void factor_vm::primitive_set_string_nth_fast()
{
set_string_nth_fast(str,index,value);
}
-PRIMITIVE(set_string_nth_fast)
-{
- PRIMITIVE_GETVM()->primitive_set_string_nth_fast();
-}
+PRIMITIVE_FORWARD(set_string_nth_fast)
inline void factor_vm::primitive_set_string_nth_slow()
{
set_string_nth_slow(str,index,value);
}
-PRIMITIVE(set_string_nth_slow)
-{
- PRIMITIVE_GETVM()->primitive_set_string_nth_slow();
-}
+PRIMITIVE_FORWARD(set_string_nth_slow)
}
dpush(tag<tuple>(t));
}
-PRIMITIVE(tuple)
-{
- PRIMITIVE_GETVM()->primitive_tuple();
-}
+PRIMITIVE_FORWARD(tuple)
/* push a new tuple on the stack, filling its slots from the stack */
inline void factor_vm::primitive_tuple_boa()
dpush(t.value());
}
-PRIMITIVE(tuple_boa)
-{
- PRIMITIVE_GETVM()->primitive_tuple_boa();
-}
+PRIMITIVE_FORWARD(tuple_boa)
}
dpush(tag<word>(allot_word(vocab,name)));
}
-PRIMITIVE(word)
-{
- PRIMITIVE_GETVM()->primitive_word();
-}
+PRIMITIVE_FORWARD(word)
/* word-xt ( word -- start end ) */
inline void factor_vm::primitive_word_xt()
dpush(allot_cell((cell)code + code->size));
}
-PRIMITIVE(word_xt)
-{
- PRIMITIVE_GETVM()->primitive_word_xt();
-}
+PRIMITIVE_FORWARD(word_xt)
/* Allocates memory */
void factor_vm::update_word_xt(cell w_)
drepl(tag_boolean(word_optimized_p(untag_check<word>(dpeek()))));
}
-PRIMITIVE(optimized_p)
-{
- PRIMITIVE_GETVM()->primitive_optimized_p();
-}
+PRIMITIVE_FORWARD(optimized_p)
inline void factor_vm::primitive_wrapper()
{
drepl(tag<wrapper>(new_wrapper));
}
-PRIMITIVE(wrapper)
-{
- PRIMITIVE_GETVM()->primitive_wrapper();
-}
+PRIMITIVE_FORWARD(wrapper)
}