forwarding functions replaced with PRIMITIVE_FORWARD() macro
parent
e26bbbe9a0
commit
6b7717bf37
35
vm/alien.cpp
35
vm/alien.cpp
|
@ -69,10 +69,7 @@ inline void factor_vm::primitive_displaced_alien()
|
|||
}
|
||||
}
|
||||
|
||||
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. */
|
||||
|
@ -81,10 +78,7 @@ inline void factor_vm::primitive_alien_address()
|
|||
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()
|
||||
|
@ -131,10 +125,7 @@ inline void factor_vm::primitive_dlopen()
|
|||
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()
|
||||
|
@ -158,10 +149,7 @@ 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()
|
||||
|
@ -171,10 +159,7 @@ 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()
|
||||
{
|
||||
|
@ -185,10 +170,7 @@ 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)
|
||||
|
@ -308,9 +290,6 @@ inline void factor_vm::primitive_vm_ptr()
|
|||
box_alien(this);
|
||||
}
|
||||
|
||||
PRIMITIVE(vm_ptr)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_vm_ptr();
|
||||
}
|
||||
PRIMITIVE_FORWARD(vm_ptr)
|
||||
|
||||
}
|
||||
|
|
|
@ -31,10 +31,7 @@ inline void factor_vm::primitive_array()
|
|||
dpush(tag<array>(allot_array(size,initial)));
|
||||
}
|
||||
|
||||
PRIMITIVE(array)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_array();
|
||||
}
|
||||
PRIMITIVE_FORWARD(array)
|
||||
|
||||
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)));
|
||||
}
|
||||
|
||||
PRIMITIVE(resize_array)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_resize_array();
|
||||
}
|
||||
PRIMITIVE_FORWARD(resize_array)
|
||||
|
||||
void growable_array::add(cell elt_)
|
||||
{
|
||||
|
|
|
@ -16,10 +16,7 @@ inline void factor_vm::primitive_byte_array()
|
|||
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()
|
||||
{
|
||||
|
@ -27,10 +24,7 @@ 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()
|
||||
{
|
||||
|
@ -39,10 +33,7 @@ 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)
|
||||
{
|
||||
|
|
|
@ -60,10 +60,7 @@ inline void factor_vm::primitive_callstack()
|
|||
dpush(tag<callstack>(stack));
|
||||
}
|
||||
|
||||
PRIMITIVE(callstack)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_callstack();
|
||||
}
|
||||
PRIMITIVE_FORWARD(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);
|
||||
}
|
||||
|
||||
PRIMITIVE(set_callstack)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_set_callstack();
|
||||
}
|
||||
PRIMITIVE_FORWARD(set_callstack)
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
PRIMITIVE(callstack_to_array)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_callstack_to_array();
|
||||
}
|
||||
PRIMITIVE_FORWARD(callstack_to_array)
|
||||
|
||||
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()))));
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
|
@ -234,10 +219,7 @@ 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)
|
||||
|
|
|
@ -106,10 +106,7 @@ inline void factor_vm::primitive_modify_code_heap()
|
|||
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()
|
||||
|
@ -122,10 +119,7 @@ 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)
|
||||
{
|
||||
|
|
|
@ -146,10 +146,7 @@ inline void factor_vm::primitive_datastack()
|
|||
general_error(ERROR_DS_UNDERFLOW,F,F,NULL);
|
||||
}
|
||||
|
||||
PRIMITIVE(datastack)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_datastack();
|
||||
}
|
||||
PRIMITIVE_FORWARD(datastack)
|
||||
|
||||
inline void factor_vm::primitive_retainstack()
|
||||
{
|
||||
|
@ -157,10 +154,7 @@ 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)
|
||||
|
@ -175,20 +169,14 @@ inline void factor_vm::primitive_set_datastack()
|
|||
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()
|
||||
|
@ -216,9 +204,6 @@ inline void factor_vm::primitive_check_datastack()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(check_datastack)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_check_datastack();
|
||||
}
|
||||
PRIMITIVE_FORWARD(check_datastack)
|
||||
|
||||
}
|
||||
|
|
|
@ -573,10 +573,7 @@ inline void factor_vm::primitive_gc()
|
|||
gc();
|
||||
}
|
||||
|
||||
PRIMITIVE(gc)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_gc();
|
||||
}
|
||||
PRIMITIVE_FORWARD(gc)
|
||||
|
||||
inline void factor_vm::primitive_gc_stats()
|
||||
{
|
||||
|
@ -608,10 +605,7 @@ 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()
|
||||
{
|
||||
|
@ -629,10 +623,7 @@ inline void factor_vm::primitive_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. */
|
||||
|
@ -665,10 +656,7 @@ inline void factor_vm::primitive_become()
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -222,10 +222,7 @@ inline void factor_vm::primitive_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
|
||||
|
@ -284,10 +281,7 @@ inline void factor_vm::primitive_data_room()
|
|||
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()
|
||||
|
@ -306,10 +300,7 @@ inline void factor_vm::primitive_begin_scan()
|
|||
begin_scan();
|
||||
}
|
||||
|
||||
PRIMITIVE(begin_scan)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_begin_scan();
|
||||
}
|
||||
PRIMITIVE_FORWARD(begin_scan)
|
||||
|
||||
cell factor_vm::next_object()
|
||||
{
|
||||
|
@ -330,10 +321,7 @@ inline void factor_vm::primitive_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()
|
||||
|
@ -341,10 +329,7 @@ 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)
|
||||
{
|
||||
|
|
|
@ -484,9 +484,6 @@ inline void factor_vm::primitive_die()
|
|||
factorbug();
|
||||
}
|
||||
|
||||
PRIMITIVE(die)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_die();
|
||||
}
|
||||
PRIMITIVE_FORWARD(die)
|
||||
|
||||
}
|
||||
|
|
|
@ -120,10 +120,7 @@ inline void factor_vm::primitive_lookup_method()
|
|||
dpush(lookup_method(obj,methods));
|
||||
}
|
||||
|
||||
PRIMITIVE(lookup_method)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_lookup_method();
|
||||
}
|
||||
PRIMITIVE_FORWARD(lookup_method)
|
||||
|
||||
cell factor_vm::object_class(cell obj)
|
||||
{
|
||||
|
@ -169,20 +166,14 @@ inline void factor_vm::primitive_mega_cache_miss()
|
|||
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()
|
||||
{
|
||||
|
@ -193,10 +184,7 @@ 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_)
|
||||
{
|
||||
|
|
|
@ -133,10 +133,7 @@ inline void factor_vm::primitive_call_clear()
|
|||
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()
|
||||
|
@ -144,10 +141,7 @@ 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()
|
||||
{
|
||||
|
|
10
vm/image.cpp
10
vm/image.cpp
|
@ -128,10 +128,7 @@ inline void factor_vm::primitive_save_image()
|
|||
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()
|
||||
{
|
||||
|
@ -159,10 +156,7 @@ 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)
|
||||
{
|
||||
|
|
|
@ -257,10 +257,7 @@ inline void factor_vm::primitive_reset_inline_cache_stats()
|
|||
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()
|
||||
{
|
||||
|
@ -275,9 +272,6 @@ 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)
|
||||
|
||||
}
|
||||
|
|
40
vm/io.cpp
40
vm/io.cpp
|
@ -52,10 +52,7 @@ inline void factor_vm::primitive_fopen()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fopen)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fopen();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fopen)
|
||||
|
||||
inline void factor_vm::primitive_fgetc()
|
||||
{
|
||||
|
@ -82,10 +79,7 @@ inline void factor_vm::primitive_fgetc()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fgetc)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fgetc();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fgetc)
|
||||
|
||||
inline void factor_vm::primitive_fread()
|
||||
{
|
||||
|
@ -127,10 +121,7 @@ inline void factor_vm::primitive_fread()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fread)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fread();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fread)
|
||||
|
||||
inline void factor_vm::primitive_fputc()
|
||||
{
|
||||
|
@ -150,10 +141,7 @@ inline void factor_vm::primitive_fputc()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fputc)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fputc();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fputc)
|
||||
|
||||
inline void factor_vm::primitive_fwrite()
|
||||
{
|
||||
|
@ -184,10 +172,7 @@ inline void factor_vm::primitive_fwrite()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fwrite)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fwrite();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fwrite)
|
||||
|
||||
inline void factor_vm::primitive_fseek()
|
||||
{
|
||||
|
@ -214,10 +199,7 @@ inline void factor_vm::primitive_fseek()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fseek)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fseek();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fseek)
|
||||
|
||||
inline void factor_vm::primitive_fflush()
|
||||
{
|
||||
|
@ -231,10 +213,7 @@ inline void factor_vm::primitive_fflush()
|
|||
}
|
||||
}
|
||||
|
||||
PRIMITIVE(fflush)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fflush();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fflush)
|
||||
|
||||
inline void factor_vm::primitive_fclose()
|
||||
{
|
||||
|
@ -248,10 +227,7 @@ 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
|
||||
|
|
220
vm/math.cpp
220
vm/math.cpp
|
@ -8,20 +8,14 @@ inline void factor_vm::primitive_bignum_to_fixnum()
|
|||
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. */
|
||||
|
@ -36,10 +30,7 @@ inline void factor_vm::primitive_fixnum_divint()
|
|||
drepl(tag_fixnum(result));
|
||||
}
|
||||
|
||||
PRIMITIVE(fixnum_divint)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_fixnum_divint();
|
||||
}
|
||||
PRIMITIVE_FORWARD(fixnum_divint)
|
||||
|
||||
inline void factor_vm::primitive_fixnum_divmod()
|
||||
{
|
||||
|
@ -57,10 +48,7 @@ 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
|
||||
|
@ -108,30 +96,21 @@ inline void factor_vm::primitive_fixnum_shift()
|
|||
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()); \
|
||||
|
@ -143,10 +122,7 @@ inline void factor_vm::primitive_bignum_eq()
|
|||
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()
|
||||
{
|
||||
|
@ -154,10 +130,7 @@ 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()
|
||||
{
|
||||
|
@ -165,10 +138,7 @@ 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()
|
||||
{
|
||||
|
@ -176,10 +146,7 @@ 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()
|
||||
{
|
||||
|
@ -187,10 +154,7 @@ 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()
|
||||
{
|
||||
|
@ -201,10 +165,7 @@ 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()
|
||||
{
|
||||
|
@ -212,10 +173,7 @@ 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()
|
||||
{
|
||||
|
@ -223,10 +181,7 @@ 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()
|
||||
{
|
||||
|
@ -234,10 +189,7 @@ 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()
|
||||
{
|
||||
|
@ -245,10 +197,7 @@ 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()
|
||||
{
|
||||
|
@ -257,10 +206,7 @@ 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()
|
||||
{
|
||||
|
@ -268,10 +214,7 @@ 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()
|
||||
{
|
||||
|
@ -279,10 +222,7 @@ 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()
|
||||
{
|
||||
|
@ -290,10 +230,7 @@ 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()
|
||||
{
|
||||
|
@ -301,20 +238,14 @@ 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()
|
||||
{
|
||||
|
@ -323,20 +254,14 @@ 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)
|
||||
{
|
||||
|
@ -356,10 +281,7 @@ inline void factor_vm::primitive_byte_array_to_bignum()
|
|||
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()
|
||||
{
|
||||
|
@ -399,20 +321,14 @@ inline void factor_vm::primitive_fixnum_to_float()
|
|||
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()
|
||||
{
|
||||
|
@ -428,10 +344,7 @@ 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()
|
||||
{
|
||||
|
@ -440,10 +353,7 @@ 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()); \
|
||||
|
@ -455,10 +365,7 @@ inline void factor_vm::primitive_float_eq()
|
|||
box_boolean(x == y);
|
||||
}
|
||||
|
||||
PRIMITIVE(float_eq)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_float_eq();
|
||||
}
|
||||
PRIMITIVE_FORWARD(float_eq)
|
||||
|
||||
inline void factor_vm::primitive_float_add()
|
||||
{
|
||||
|
@ -466,10 +373,7 @@ 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()
|
||||
{
|
||||
|
@ -477,10 +381,7 @@ 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()
|
||||
{
|
||||
|
@ -488,10 +389,7 @@ 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()
|
||||
{
|
||||
|
@ -499,10 +397,7 @@ 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()
|
||||
{
|
||||
|
@ -510,10 +405,7 @@ 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()
|
||||
{
|
||||
|
@ -521,10 +413,7 @@ 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()
|
||||
{
|
||||
|
@ -532,10 +421,7 @@ 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()
|
||||
{
|
||||
|
@ -543,10 +429,7 @@ 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()
|
||||
{
|
||||
|
@ -554,50 +437,35 @@ 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)
|
||||
{
|
||||
|
|
|
@ -84,10 +84,7 @@ inline void factor_vm::primitive_existsp()
|
|||
box_boolean(stat(path,&sb) >= 0);
|
||||
}
|
||||
|
||||
PRIMITIVE(existsp)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_existsp();
|
||||
}
|
||||
PRIMITIVE_FORWARD(existsp)
|
||||
|
||||
segment *factor_vm::alloc_segment(cell size)
|
||||
{
|
||||
|
|
|
@ -30,10 +30,7 @@ char *getenv(char *name)
|
|||
return 0; /* unreachable */
|
||||
}
|
||||
|
||||
PRIMITIVE(os_envs)
|
||||
{
|
||||
vm->not_implemented_error();
|
||||
}
|
||||
PRIMITIVE_FORWARD(os_envs)
|
||||
|
||||
void c_to_factor_toplevel(cell quot)
|
||||
{
|
||||
|
|
|
@ -96,10 +96,7 @@ inline void factor_vm::primitive_existsp()
|
|||
box_boolean(windows_stat(path));
|
||||
}
|
||||
|
||||
PRIMITIVE(existsp)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_existsp();
|
||||
}
|
||||
PRIMITIVE_FORWARD(existsp)
|
||||
|
||||
segment *factor_vm::alloc_segment(cell size)
|
||||
{
|
||||
|
|
|
@ -4,10 +4,17 @@ namespace factor
|
|||
#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[];
|
||||
}
|
||||
|
|
|
@ -52,9 +52,6 @@ inline void factor_vm::primitive_profiling()
|
|||
set_profiling(to_boolean(dpop()));
|
||||
}
|
||||
|
||||
PRIMITIVE(profiling)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_profiling();
|
||||
}
|
||||
PRIMITIVE_FORWARD(profiling)
|
||||
|
||||
}
|
||||
|
|
|
@ -294,10 +294,7 @@ inline void factor_vm::primitive_jit_compile()
|
|||
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()
|
||||
|
@ -311,10 +308,7 @@ 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()
|
||||
{
|
||||
|
@ -322,10 +316,7 @@ 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()
|
||||
{
|
||||
|
@ -381,9 +372,6 @@ inline void factor_vm::primitive_quot_compiled_p()
|
|||
dpush(tag_boolean(quot->code != NULL));
|
||||
}
|
||||
|
||||
PRIMITIVE(quot_compiled_p)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_quot_compiled_p();
|
||||
}
|
||||
PRIMITIVE_FORWARD(quot_compiled_p)
|
||||
|
||||
}
|
||||
|
|
40
vm/run.cpp
40
vm/run.cpp
|
@ -9,10 +9,7 @@ inline void factor_vm::primitive_getenv()
|
|||
drepl(userenv[e]);
|
||||
}
|
||||
|
||||
PRIMITIVE(getenv)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_getenv();
|
||||
}
|
||||
PRIMITIVE_FORWARD(getenv)
|
||||
|
||||
inline void factor_vm::primitive_setenv()
|
||||
{
|
||||
|
@ -21,40 +18,28 @@ 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()
|
||||
{
|
||||
|
@ -66,10 +51,7 @@ 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()
|
||||
{
|
||||
|
@ -79,10 +61,7 @@ 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_)
|
||||
{
|
||||
|
@ -104,9 +83,6 @@ inline void factor_vm::primitive_clone()
|
|||
drepl(clone_object(dpeek()));
|
||||
}
|
||||
|
||||
PRIMITIVE(clone)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_clone();
|
||||
}
|
||||
PRIMITIVE_FORWARD(clone)
|
||||
|
||||
}
|
||||
|
|
|
@ -106,10 +106,7 @@ inline void factor_vm::primitive_string()
|
|||
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)
|
||||
{
|
||||
|
@ -167,10 +164,7 @@ inline void factor_vm::primitive_resize_string()
|
|||
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()
|
||||
{
|
||||
|
@ -179,10 +173,7 @@ 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()
|
||||
{
|
||||
|
@ -192,10 +183,7 @@ 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()
|
||||
{
|
||||
|
@ -205,9 +193,6 @@ 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)
|
||||
|
||||
}
|
||||
|
|
|
@ -23,10 +23,7 @@ inline void factor_vm::primitive_tuple()
|
|||
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()
|
||||
|
@ -39,9 +36,6 @@ inline void factor_vm::primitive_tuple_boa()
|
|||
dpush(t.value());
|
||||
}
|
||||
|
||||
PRIMITIVE(tuple_boa)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_tuple_boa();
|
||||
}
|
||||
PRIMITIVE_FORWARD(tuple_boa)
|
||||
|
||||
}
|
||||
|
|
20
vm/words.cpp
20
vm/words.cpp
|
@ -39,10 +39,7 @@ inline void factor_vm::primitive_word()
|
|||
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()
|
||||
|
@ -53,10 +50,7 @@ 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_)
|
||||
|
@ -85,10 +79,7 @@ inline void factor_vm::primitive_optimized_p()
|
|||
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()
|
||||
{
|
||||
|
@ -97,9 +88,6 @@ inline void factor_vm::primitive_wrapper()
|
|||
drepl(tag<wrapper>(new_wrapper));
|
||||
}
|
||||
|
||||
PRIMITIVE(wrapper)
|
||||
{
|
||||
PRIMITIVE_GETVM()->primitive_wrapper();
|
||||
}
|
||||
PRIMITIVE_FORWARD(wrapper)
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue