Merge branch 'master' of git://factorcode.org/git/factor
commit
7fcbd699ea
|
@ -40,9 +40,7 @@ M: unix alien>native-string utf8 alien>string ;
|
||||||
|
|
||||||
HOOK: native-string>alien os ( string -- alien )
|
HOOK: native-string>alien os ( string -- alien )
|
||||||
|
|
||||||
M: wince native-string>alien utf16n string>alien ;
|
M: windows native-string>alien utf16n string>alien ;
|
||||||
|
|
||||||
M: winnt native-string>alien utf8 string>alien ;
|
|
||||||
|
|
||||||
M: unix native-string>alien utf8 string>alien ;
|
M: unix native-string>alien utf8 string>alien ;
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ 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 */
|
||||||
static void *alien_pointer(void)
|
static void *alien_pointer()
|
||||||
{
|
{
|
||||||
fixnum offset = to_fixnum(dpop());
|
fixnum offset = to_fixnum(dpop());
|
||||||
return unbox_alien() + offset;
|
return unbox_alien() + offset;
|
||||||
|
@ -182,7 +182,7 @@ VM_C_API char *alien_offset(cell obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* pop an object representing a C pointer */
|
/* pop an object representing a C pointer */
|
||||||
VM_C_API char *unbox_alien(void)
|
VM_C_API char *unbox_alien()
|
||||||
{
|
{
|
||||||
return alien_offset(dpop());
|
return alien_offset(dpop());
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ PRIMITIVE(dlclose);
|
||||||
PRIMITIVE(dll_validp);
|
PRIMITIVE(dll_validp);
|
||||||
|
|
||||||
VM_C_API char *alien_offset(cell object);
|
VM_C_API char *alien_offset(cell object);
|
||||||
VM_C_API char *unbox_alien(void);
|
VM_C_API char *unbox_alien();
|
||||||
VM_C_API void box_alien(void *ptr);
|
VM_C_API void box_alien(void *ptr);
|
||||||
VM_C_API void to_value_struct(cell src, void *dest, cell size);
|
VM_C_API void to_value_struct(cell src, void *dest, cell size);
|
||||||
VM_C_API void box_value_struct(void *src, cell size);
|
VM_C_API void box_value_struct(void *src, cell size);
|
||||||
|
|
|
@ -54,7 +54,7 @@ This means that if 'callstack' is called in tail position, we
|
||||||
will have popped a necessary frame... however this word is only
|
will have popped a necessary frame... however this word is only
|
||||||
called by continuation implementation, and user code shouldn't
|
called by continuation implementation, and user code shouldn't
|
||||||
be calling it at all, so we leave it as it is for now. */
|
be calling it at all, so we leave it as it is for now. */
|
||||||
stack_frame *capture_start(void)
|
stack_frame *capture_start()
|
||||||
{
|
{
|
||||||
stack_frame *frame = stack_chain->callstack_bottom - 1;
|
stack_frame *frame = stack_chain->callstack_bottom - 1;
|
||||||
while(frame >= stack_chain->callstack_top
|
while(frame >= stack_chain->callstack_top
|
||||||
|
|
|
@ -302,7 +302,7 @@ void mark_object_code_block(object *object)
|
||||||
|
|
||||||
/* References to undefined symbols are patched up to call this function on
|
/* References to undefined symbols are patched up to call this function on
|
||||||
image load */
|
image load */
|
||||||
void undefined_symbol(void)
|
void undefined_symbol()
|
||||||
{
|
{
|
||||||
general_error(ERROR_UNDEFINED_SYMBOL,F,F,NULL);
|
general_error(ERROR_UNDEFINED_SYMBOL,F,F,NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ void mark_object_code_block(object *scan);
|
||||||
|
|
||||||
void relocate_code_block(code_block *relocating);
|
void relocate_code_block(code_block *relocating);
|
||||||
|
|
||||||
inline static bool stack_traces_p(void)
|
inline static bool stack_traces_p()
|
||||||
{
|
{
|
||||||
return userenv[STACK_TRACES_ENV] != F;
|
return userenv[STACK_TRACES_ENV] != F;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,14 +45,14 @@ void iterate_code_heap(code_heap_iterator iter)
|
||||||
|
|
||||||
/* Copy literals referenced from all code blocks to newspace. Only for
|
/* Copy literals referenced from all code blocks to newspace. Only for
|
||||||
aging and nursery collections */
|
aging and nursery collections */
|
||||||
void copy_code_heap_roots(void)
|
void copy_code_heap_roots()
|
||||||
{
|
{
|
||||||
iterate_code_heap(copy_literal_references);
|
iterate_code_heap(copy_literal_references);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update pointers to words referenced from all code blocks. Only after
|
/* Update pointers to words referenced from all code blocks. Only after
|
||||||
defining a new word. */
|
defining a new word. */
|
||||||
void update_code_heap_words(void)
|
void update_code_heap_words()
|
||||||
{
|
{
|
||||||
iterate_code_heap(update_word_references);
|
iterate_code_heap(update_word_references);
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,7 @@ void forward_object_xts()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the XT fields now that the heap has been compacted */
|
/* Set the XT fields now that the heap has been compacted */
|
||||||
void fixup_object_xts(void)
|
void fixup_object_xts()
|
||||||
{
|
{
|
||||||
begin_scan();
|
begin_scan();
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ void fixup_object_xts(void)
|
||||||
since it makes several passes over the code and data heaps, but we only ever
|
since it makes several passes over the code and data heaps, but we only ever
|
||||||
do this before saving a deployed image and exiting, so performaance is not
|
do this before saving a deployed image and exiting, so performaance is not
|
||||||
critical here */
|
critical here */
|
||||||
void compact_code_heap(void)
|
void compact_code_heap()
|
||||||
{
|
{
|
||||||
/* Free all unreachable code blocks */
|
/* Free all unreachable code blocks */
|
||||||
gc();
|
gc();
|
||||||
|
|
|
@ -14,13 +14,13 @@ typedef void (*code_heap_iterator)(code_block *compiled);
|
||||||
|
|
||||||
void iterate_code_heap(code_heap_iterator iter);
|
void iterate_code_heap(code_heap_iterator iter);
|
||||||
|
|
||||||
void copy_code_heap_roots(void);
|
void copy_code_heap_roots();
|
||||||
|
|
||||||
PRIMITIVE(modify_code_heap);
|
PRIMITIVE(modify_code_heap);
|
||||||
|
|
||||||
PRIMITIVE(code_room);
|
PRIMITIVE(code_room);
|
||||||
|
|
||||||
void compact_code_heap(void);
|
void compact_code_heap();
|
||||||
|
|
||||||
inline static void check_code_pointer(cell ptr)
|
inline static void check_code_pointer(cell ptr)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,19 +8,19 @@ namespace factor
|
||||||
cell ds_size, rs_size;
|
cell ds_size, rs_size;
|
||||||
context *unused_contexts;
|
context *unused_contexts;
|
||||||
|
|
||||||
void reset_datastack(void)
|
void reset_datastack()
|
||||||
{
|
{
|
||||||
ds = ds_bot - sizeof(cell);
|
ds = ds_bot - sizeof(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset_retainstack(void)
|
void reset_retainstack()
|
||||||
{
|
{
|
||||||
rs = rs_bot - sizeof(cell);
|
rs = rs_bot - sizeof(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RESERVED (64 * sizeof(cell))
|
#define RESERVED (64 * sizeof(cell))
|
||||||
|
|
||||||
void fix_stacks(void)
|
void fix_stacks()
|
||||||
{
|
{
|
||||||
if(ds + sizeof(cell) < ds_bot || ds + RESERVED >= ds_top) reset_datastack();
|
if(ds + sizeof(cell) < ds_bot || ds + RESERVED >= ds_top) reset_datastack();
|
||||||
if(rs + sizeof(cell) < rs_bot || rs + RESERVED >= rs_top) reset_retainstack();
|
if(rs + sizeof(cell) < rs_bot || rs + RESERVED >= rs_top) reset_retainstack();
|
||||||
|
@ -28,7 +28,7 @@ void fix_stacks(void)
|
||||||
|
|
||||||
/* called before entry into foreign C code. Note that ds and rs might
|
/* called before entry into foreign C code. Note that ds and rs might
|
||||||
be stored in registers, so callbacks must save and restore the correct values */
|
be stored in registers, so callbacks must save and restore the correct values */
|
||||||
void save_stacks(void)
|
void save_stacks()
|
||||||
{
|
{
|
||||||
if(stack_chain)
|
if(stack_chain)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ void save_stacks(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context *alloc_context(void)
|
context *alloc_context()
|
||||||
{
|
{
|
||||||
context *new_context;
|
context *new_context;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ void dealloc_context(context *old_context)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called on entry into a compiled callback */
|
/* called on entry into a compiled callback */
|
||||||
void nest_stacks(void)
|
void nest_stacks()
|
||||||
{
|
{
|
||||||
context *new_context = alloc_context();
|
context *new_context = alloc_context();
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ void nest_stacks(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called when leaving a compiled callback */
|
/* called when leaving a compiled callback */
|
||||||
void unnest_stacks(void)
|
void unnest_stacks()
|
||||||
{
|
{
|
||||||
ds = stack_chain->datastack_save;
|
ds = stack_chain->datastack_save;
|
||||||
rs = stack_chain->retainstack_save;
|
rs = stack_chain->retainstack_save;
|
||||||
|
|
|
@ -46,9 +46,9 @@ extern cell ds_size, rs_size;
|
||||||
DEFPUSHPOP(d,ds)
|
DEFPUSHPOP(d,ds)
|
||||||
DEFPUSHPOP(r,rs)
|
DEFPUSHPOP(r,rs)
|
||||||
|
|
||||||
void reset_datastack(void);
|
void reset_datastack();
|
||||||
void reset_retainstack(void);
|
void reset_retainstack();
|
||||||
void fix_stacks(void);
|
void fix_stacks();
|
||||||
void init_stacks(cell ds_size, cell rs_size);
|
void init_stacks(cell ds_size, cell rs_size);
|
||||||
|
|
||||||
PRIMITIVE(datastack);
|
PRIMITIVE(datastack);
|
||||||
|
@ -57,9 +57,9 @@ PRIMITIVE(set_datastack);
|
||||||
PRIMITIVE(set_retainstack);
|
PRIMITIVE(set_retainstack);
|
||||||
PRIMITIVE(check_datastack);
|
PRIMITIVE(check_datastack);
|
||||||
|
|
||||||
VM_C_API void save_stacks(void);
|
VM_C_API void save_stacks();
|
||||||
VM_C_API void nest_stacks(void);
|
VM_C_API void nest_stacks();
|
||||||
VM_C_API void unnest_stacks(void);
|
VM_C_API void unnest_stacks();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ cell last_code_heap_scan;
|
||||||
bool growing_data_heap;
|
bool growing_data_heap;
|
||||||
data_heap *old_data_heap;
|
data_heap *old_data_heap;
|
||||||
|
|
||||||
void init_data_gc(void)
|
void init_data_gc()
|
||||||
{
|
{
|
||||||
performing_gc = false;
|
performing_gc = false;
|
||||||
last_code_heap_scan = NURSERY;
|
last_code_heap_scan = NURSERY;
|
||||||
|
@ -244,7 +244,7 @@ static void copy_gen_cards(cell gen)
|
||||||
|
|
||||||
/* Scan cards in all generations older than the one being collected, copying
|
/* Scan cards in all generations older than the one being collected, copying
|
||||||
old->new references */
|
old->new references */
|
||||||
static void copy_cards(void)
|
static void copy_cards()
|
||||||
{
|
{
|
||||||
u64 start = current_micros();
|
u64 start = current_micros();
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ static void copy_stack_elements(segment *region, cell top)
|
||||||
copy_handle((cell*)ptr);
|
copy_handle((cell*)ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_registered_locals(void)
|
static void copy_registered_locals()
|
||||||
{
|
{
|
||||||
cell scan = gc_locals_region->start;
|
cell scan = gc_locals_region->start;
|
||||||
|
|
||||||
|
@ -272,7 +272,7 @@ static void copy_registered_locals(void)
|
||||||
copy_handle(*(cell **)scan);
|
copy_handle(*(cell **)scan);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void copy_registered_bignums(void)
|
static void copy_registered_bignums()
|
||||||
{
|
{
|
||||||
cell scan = gc_bignums_region->start;
|
cell scan = gc_bignums_region->start;
|
||||||
|
|
||||||
|
@ -295,7 +295,7 @@ static void copy_registered_bignums(void)
|
||||||
|
|
||||||
/* Copy roots over at the start of GC, namely various constants, stacks,
|
/* Copy roots over at the start of GC, namely various constants, stacks,
|
||||||
the user environment and extra roots registered by local_roots.hpp */
|
the user environment and extra roots registered by local_roots.hpp */
|
||||||
static void copy_roots(void)
|
static void copy_roots()
|
||||||
{
|
{
|
||||||
copy_handle(&T);
|
copy_handle(&T);
|
||||||
copy_handle(&bignum_zero);
|
copy_handle(&bignum_zero);
|
||||||
|
@ -593,7 +593,7 @@ void garbage_collection(cell gen,
|
||||||
performing_gc = false;
|
performing_gc = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gc(void)
|
void gc()
|
||||||
{
|
{
|
||||||
garbage_collection(TENURED,false,0);
|
garbage_collection(TENURED,false,0);
|
||||||
}
|
}
|
||||||
|
@ -633,7 +633,7 @@ PRIMITIVE(gc_stats)
|
||||||
dpush(result.elements.value());
|
dpush(result.elements.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear_gc_stats(void)
|
void clear_gc_stats()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < MAX_GEN_COUNT; i++)
|
for(i = 0; i < MAX_GEN_COUNT; i++)
|
||||||
|
@ -681,7 +681,7 @@ PRIMITIVE(become)
|
||||||
compile_all_words();
|
compile_all_words();
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_C_API void minor_gc(void)
|
VM_C_API void minor_gc()
|
||||||
{
|
{
|
||||||
garbage_collection(NURSERY,false,0);
|
garbage_collection(NURSERY,false,0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,11 @@ extern bool collecting_aging_again;
|
||||||
|
|
||||||
extern cell last_code_heap_scan;
|
extern cell last_code_heap_scan;
|
||||||
|
|
||||||
void init_data_gc(void);
|
void init_data_gc();
|
||||||
|
|
||||||
void gc(void);
|
void gc();
|
||||||
|
|
||||||
inline static bool collecting_accumulation_gen_p(void)
|
inline static bool collecting_accumulation_gen_p()
|
||||||
{
|
{
|
||||||
return ((HAVE_AGING_P
|
return ((HAVE_AGING_P
|
||||||
&& collecting_gen == AGING
|
&& collecting_gen == AGING
|
||||||
|
@ -114,7 +114,7 @@ void copy_reachable_objects(cell scan, cell *end);
|
||||||
|
|
||||||
PRIMITIVE(gc);
|
PRIMITIVE(gc);
|
||||||
PRIMITIVE(gc_stats);
|
PRIMITIVE(gc_stats);
|
||||||
void clear_gc_stats(void);
|
void clear_gc_stats();
|
||||||
PRIMITIVE(clear_gc_stats);
|
PRIMITIVE(clear_gc_stats);
|
||||||
PRIMITIVE(become);
|
PRIMITIVE(become);
|
||||||
|
|
||||||
|
@ -143,6 +143,6 @@ inline static void check_tagged_pointer(cell tagged)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_C_API void minor_gc(void);
|
VM_C_API void minor_gc();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ cell init_zone(zone *z, cell size, cell start)
|
||||||
return z->end;
|
return z->end;
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_card_decks(void)
|
void init_card_decks()
|
||||||
{
|
{
|
||||||
cell start = align(data->seg->start,DECK_SIZE);
|
cell start = align(data->seg->start,DECK_SIZE);
|
||||||
allot_markers_offset = (cell)data->allot_markers - (start >> CARD_BITS);
|
allot_markers_offset = (cell)data->allot_markers - (start >> CARD_BITS);
|
||||||
|
@ -312,7 +312,7 @@ references to an object for debugging purposes. */
|
||||||
cell heap_scan_ptr;
|
cell heap_scan_ptr;
|
||||||
|
|
||||||
/* Disables GC and activates next-object ( -- obj ) primitive */
|
/* Disables GC and activates next-object ( -- obj ) primitive */
|
||||||
void begin_scan(void)
|
void begin_scan()
|
||||||
{
|
{
|
||||||
heap_scan_ptr = data->generations[TENURED].start;
|
heap_scan_ptr = data->generations[TENURED].start;
|
||||||
gc_off = true;
|
gc_off = true;
|
||||||
|
@ -323,7 +323,7 @@ PRIMITIVE(begin_scan)
|
||||||
begin_scan();
|
begin_scan();
|
||||||
}
|
}
|
||||||
|
|
||||||
cell next_object(void)
|
cell next_object()
|
||||||
{
|
{
|
||||||
if(!gc_off)
|
if(!gc_off)
|
||||||
general_error(ERROR_HEAP_SCAN,F,F,NULL);
|
general_error(ERROR_HEAP_SCAN,F,F,NULL);
|
||||||
|
@ -348,7 +348,7 @@ PRIMITIVE(end_scan)
|
||||||
gc_off = false;
|
gc_off = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell find_all_words(void)
|
cell find_all_words()
|
||||||
{
|
{
|
||||||
growable_array words;
|
growable_array words;
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ inline static bool in_zone(zone *z, object *pointer)
|
||||||
|
|
||||||
cell init_zone(zone *z, cell size, cell base);
|
cell init_zone(zone *z, cell size, cell base);
|
||||||
|
|
||||||
void init_card_decks(void);
|
void init_card_decks();
|
||||||
|
|
||||||
data_heap *grow_data_heap(data_heap *data, cell requested_bytes);
|
data_heap *grow_data_heap(data_heap *data, cell requested_bytes);
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ cell unaligned_object_size(object *pointer);
|
||||||
cell binary_payload_start(object *pointer);
|
cell binary_payload_start(object *pointer);
|
||||||
cell object_size(cell tagged);
|
cell object_size(cell tagged);
|
||||||
|
|
||||||
void begin_scan(void);
|
void begin_scan();
|
||||||
cell next_object(void);
|
cell next_object();
|
||||||
|
|
||||||
PRIMITIVE(data_room);
|
PRIMITIVE(data_room);
|
||||||
PRIMITIVE(size);
|
PRIMITIVE(size);
|
||||||
|
@ -99,7 +99,7 @@ PRIMITIVE(end_scan);
|
||||||
/* GC is off during heap walking */
|
/* GC is off during heap walking */
|
||||||
extern bool gc_off;
|
extern bool gc_off;
|
||||||
|
|
||||||
cell find_all_words(void);
|
cell find_all_words();
|
||||||
|
|
||||||
/* Every object has a regular representation in the runtime, which makes GC
|
/* Every object has a regular representation in the runtime, which makes GC
|
||||||
much simpler. Every slot of the object until binary_payload_start is a pointer
|
much simpler. Every slot of the object until binary_payload_start is a pointer
|
||||||
|
|
12
vm/debug.cpp
12
vm/debug.cpp
|
@ -155,13 +155,13 @@ void print_objects(cell *start, cell *end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_datastack(void)
|
void print_datastack()
|
||||||
{
|
{
|
||||||
print_string("==== DATA STACK:\n");
|
print_string("==== DATA STACK:\n");
|
||||||
print_objects((cell *)ds_bot,(cell *)ds);
|
print_objects((cell *)ds_bot,(cell *)ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_retainstack(void)
|
void print_retainstack()
|
||||||
{
|
{
|
||||||
print_string("==== RETAIN STACK:\n");
|
print_string("==== RETAIN STACK:\n");
|
||||||
print_objects((cell *)rs_bot,(cell *)rs);
|
print_objects((cell *)rs_bot,(cell *)rs);
|
||||||
|
@ -179,7 +179,7 @@ void print_stack_frame(stack_frame *frame)
|
||||||
print_string("\n");
|
print_string("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_callstack(void)
|
void print_callstack()
|
||||||
{
|
{
|
||||||
print_string("==== CALL STACK:\n");
|
print_string("==== CALL STACK:\n");
|
||||||
cell bottom = (cell)stack_chain->callstack_bottom;
|
cell bottom = (cell)stack_chain->callstack_bottom;
|
||||||
|
@ -210,7 +210,7 @@ void dump_zone(zone *z)
|
||||||
print_string(", here="); print_cell(z->here - z->start); nl();
|
print_string(", here="); print_cell(z->here - z->start); nl();
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_generations(void)
|
void dump_generations()
|
||||||
{
|
{
|
||||||
cell i;
|
cell i;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ void find_data_references(cell look_for_)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump all code blocks for debugging */
|
/* Dump all code blocks for debugging */
|
||||||
void dump_code_heap(void)
|
void dump_code_heap()
|
||||||
{
|
{
|
||||||
cell reloc_size = 0, literal_size = 0;
|
cell reloc_size = 0, literal_size = 0;
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ void dump_code_heap(void)
|
||||||
print_cell(literal_size); print_string(" bytes of literal data\n");
|
print_cell(literal_size); print_string(" bytes of literal data\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void factorbug(void)
|
void factorbug()
|
||||||
{
|
{
|
||||||
if(fep_disabled)
|
if(fep_disabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,8 +3,8 @@ namespace factor
|
||||||
|
|
||||||
void print_obj(cell obj);
|
void print_obj(cell obj);
|
||||||
void print_nested_obj(cell obj, fixnum nesting);
|
void print_nested_obj(cell obj, fixnum nesting);
|
||||||
void dump_generations(void);
|
void dump_generations();
|
||||||
void factorbug(void);
|
void factorbug();
|
||||||
void dump_zone(zone *z);
|
void dump_zone(zone *z);
|
||||||
|
|
||||||
PRIMITIVE(die);
|
PRIMITIVE(die);
|
||||||
|
|
|
@ -9,7 +9,7 @@ cell signal_number;
|
||||||
cell signal_fault_addr;
|
cell signal_fault_addr;
|
||||||
stack_frame *signal_callstack_top;
|
stack_frame *signal_callstack_top;
|
||||||
|
|
||||||
void out_of_memory(void)
|
void out_of_memory()
|
||||||
{
|
{
|
||||||
print_string("Out of memory\n\n");
|
print_string("Out of memory\n\n");
|
||||||
dump_generations();
|
dump_generations();
|
||||||
|
@ -88,7 +88,7 @@ void type_error(cell type, cell tagged)
|
||||||
general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
|
general_error(ERROR_TYPE,tag_fixnum(type),tagged,NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void not_implemented_error(void)
|
void not_implemented_error()
|
||||||
{
|
{
|
||||||
general_error(ERROR_NOT_IMPLEMENTED,F,F,NULL);
|
general_error(ERROR_NOT_IMPLEMENTED,F,F,NULL);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ void signal_error(int signal, stack_frame *native_stack)
|
||||||
general_error(ERROR_SIGNAL,tag_fixnum(signal),F,native_stack);
|
general_error(ERROR_SIGNAL,tag_fixnum(signal),F,native_stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void divide_by_zero_error(void)
|
void divide_by_zero_error()
|
||||||
{
|
{
|
||||||
general_error(ERROR_DIVIDE_BY_ZERO,F,F,NULL);
|
general_error(ERROR_DIVIDE_BY_ZERO,F,F,NULL);
|
||||||
}
|
}
|
||||||
|
@ -141,12 +141,12 @@ PRIMITIVE(unimplemented)
|
||||||
not_implemented_error();
|
not_implemented_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_signal_handler_impl(void)
|
void memory_signal_handler_impl()
|
||||||
{
|
{
|
||||||
memory_protection_error(signal_fault_addr,signal_callstack_top);
|
memory_protection_error(signal_fault_addr,signal_callstack_top);
|
||||||
}
|
}
|
||||||
|
|
||||||
void misc_signal_handler_impl(void)
|
void misc_signal_handler_impl()
|
||||||
{
|
{
|
||||||
signal_error(signal_number,signal_callstack_top);
|
signal_error(signal_number,signal_callstack_top);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ enum vm_error_type
|
||||||
ERROR_MEMORY,
|
ERROR_MEMORY,
|
||||||
};
|
};
|
||||||
|
|
||||||
void out_of_memory(void);
|
void out_of_memory();
|
||||||
void fatal_error(const char* msg, cell tagged);
|
void fatal_error(const char* msg, cell tagged);
|
||||||
void critical_error(const char* msg, cell tagged);
|
void critical_error(const char* msg, cell tagged);
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ PRIMITIVE(die);
|
||||||
|
|
||||||
void throw_error(cell error, stack_frame *native_stack);
|
void throw_error(cell error, stack_frame *native_stack);
|
||||||
void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *native_stack);
|
void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *native_stack);
|
||||||
void divide_by_zero_error(void);
|
void divide_by_zero_error();
|
||||||
void memory_protection_error(cell addr, stack_frame *native_stack);
|
void memory_protection_error(cell addr, stack_frame *native_stack);
|
||||||
void signal_error(int signal, stack_frame *native_stack);
|
void signal_error(int signal, stack_frame *native_stack);
|
||||||
void type_error(cell type, cell tagged);
|
void type_error(cell type, cell tagged);
|
||||||
void not_implemented_error(void);
|
void not_implemented_error();
|
||||||
|
|
||||||
PRIMITIVE(call_clear);
|
PRIMITIVE(call_clear);
|
||||||
PRIMITIVE(unimplemented);
|
PRIMITIVE(unimplemented);
|
||||||
|
@ -45,7 +45,7 @@ extern cell signal_number;
|
||||||
extern cell signal_fault_addr;
|
extern cell signal_fault_addr;
|
||||||
extern stack_frame *signal_callstack_top;
|
extern stack_frame *signal_callstack_top;
|
||||||
|
|
||||||
void memory_signal_handler_impl(void);
|
void memory_signal_handler_impl();
|
||||||
void misc_signal_handler_impl(void);
|
void misc_signal_handler_impl();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ VM_C_API void init_parameters_from_args(vm_parameters *p, int argc, vm_char **ar
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do some initialization that we do once only */
|
/* Do some initialization that we do once only */
|
||||||
static void do_stage1_init(void)
|
static void do_stage1_init()
|
||||||
{
|
{
|
||||||
print_string("*** Stage 2 early init... ");
|
print_string("*** Stage 2 early init... ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -198,9 +198,9 @@ VM_C_API void factor_eval_free(char *result)
|
||||||
free(result);
|
free(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_C_API void factor_yield(void)
|
VM_C_API void factor_yield()
|
||||||
{
|
{
|
||||||
void (*callback)(void) = (void (*)(void))alien_offset(userenv[YIELD_CALLBACK_ENV]);
|
void (*callback)() = (void (*)())alien_offset(userenv[YIELD_CALLBACK_ENV]);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ VM_C_API void start_standalone_factor(int argc, vm_char **argv);
|
||||||
|
|
||||||
VM_C_API char *factor_eval_string(char *string);
|
VM_C_API char *factor_eval_string(char *string);
|
||||||
VM_C_API void factor_eval_free(char *result);
|
VM_C_API void factor_eval_free(char *result);
|
||||||
VM_C_API void factor_yield(void);
|
VM_C_API void factor_yield();
|
||||||
VM_C_API void factor_sleep(long ms);
|
VM_C_API void factor_sleep(long ms);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,14 +14,14 @@ The Factor library provides platform-specific code for Unix and Windows
|
||||||
with many more capabilities so these words are not usually used in
|
with many more capabilities so these words are not usually used in
|
||||||
normal operation. */
|
normal operation. */
|
||||||
|
|
||||||
void init_c_io(void)
|
void init_c_io()
|
||||||
{
|
{
|
||||||
userenv[STDIN_ENV] = allot_alien(F,(cell)stdin);
|
userenv[STDIN_ENV] = allot_alien(F,(cell)stdin);
|
||||||
userenv[STDOUT_ENV] = allot_alien(F,(cell)stdout);
|
userenv[STDOUT_ENV] = allot_alien(F,(cell)stdout);
|
||||||
userenv[STDERR_ENV] = allot_alien(F,(cell)stderr);
|
userenv[STDERR_ENV] = allot_alien(F,(cell)stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void io_error(void)
|
void io_error()
|
||||||
{
|
{
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
if(errno == EINTR)
|
if(errno == EINTR)
|
||||||
|
@ -216,12 +216,12 @@ 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
|
||||||
reads thread-local storage. */
|
reads thread-local storage. */
|
||||||
VM_C_API int err_no(void)
|
VM_C_API int err_no()
|
||||||
{
|
{
|
||||||
return errno;
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_C_API void clear_err_no(void)
|
VM_C_API void clear_err_no()
|
||||||
{
|
{
|
||||||
errno = 0;
|
errno = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
void init_c_io(void);
|
void init_c_io();
|
||||||
void io_error(void);
|
void io_error();
|
||||||
|
|
||||||
PRIMITIVE(fopen);
|
PRIMITIVE(fopen);
|
||||||
PRIMITIVE(fgetc);
|
PRIMITIVE(fgetc);
|
||||||
|
@ -18,7 +18,7 @@ PRIMITIVE(open_file);
|
||||||
PRIMITIVE(existsp);
|
PRIMITIVE(existsp);
|
||||||
PRIMITIVE(read_dir);
|
PRIMITIVE(read_dir);
|
||||||
|
|
||||||
VM_C_API int err_no(void);
|
VM_C_API int err_no();
|
||||||
VM_C_API void clear_err_no(void);
|
VM_C_API void clear_err_no();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ mach_exception_thread (void *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize the Mach exception handler thread. */
|
/* Initialize the Mach exception handler thread. */
|
||||||
void mach_initialize (void)
|
void mach_initialize ()
|
||||||
{
|
{
|
||||||
mach_port_t self;
|
mach_port_t self;
|
||||||
exception_mask_t mask;
|
exception_mask_t mask;
|
||||||
|
|
|
@ -79,6 +79,6 @@ catch_exception_raise_state_identity (mach_port_t exception_port,
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
void mach_initialize (void);
|
void mach_initialize ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,7 +219,7 @@ PRIMITIVE(byte_array_to_bignum)
|
||||||
drepl(tag<bignum>(result));
|
drepl(tag<bignum>(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell unbox_array_size(void)
|
cell unbox_array_size()
|
||||||
{
|
{
|
||||||
switch(tagged<object>(dpeek()).type())
|
switch(tagged<object>(dpeek()).type())
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ inline static cell allot_cell(cell x)
|
||||||
return tag_fixnum(x);
|
return tag_fixnum(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell unbox_array_size(void);
|
cell unbox_array_size();
|
||||||
|
|
||||||
inline static double untag_float(cell tagged)
|
inline static double untag_float(cell tagged)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
/* From SBCL */
|
/* From SBCL */
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path()
|
||||||
{
|
{
|
||||||
char path[PATH_MAX + 1];
|
char path[PATH_MAX + 1];
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include <osreldate.h>
|
#include <osreldate.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
extern "C" int getosreldate(void);
|
extern "C" int getosreldate();
|
||||||
|
|
||||||
#ifndef KERN_PROC_PATHNAME
|
#ifndef KERN_PROC_PATHNAME
|
||||||
#define KERN_PROC_PATHNAME 12
|
#define KERN_PROC_PATHNAME 12
|
||||||
|
|
|
@ -8,17 +8,17 @@ void c_to_factor_toplevel(cell quot)
|
||||||
c_to_factor(quot);
|
c_to_factor(quot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_signals(void)
|
void init_signals()
|
||||||
{
|
{
|
||||||
unix_init_signals();
|
unix_init_signals();
|
||||||
}
|
}
|
||||||
|
|
||||||
void early_init(void) { }
|
void early_init() { }
|
||||||
|
|
||||||
#define SUFFIX ".image"
|
#define SUFFIX ".image"
|
||||||
#define SUFFIX_LEN 6
|
#define SUFFIX_LEN 6
|
||||||
|
|
||||||
const char *default_image_path(void)
|
const char *default_image_path()
|
||||||
{
|
{
|
||||||
const char *path = vm_executable_path();
|
const char *path = vm_executable_path();
|
||||||
|
|
||||||
|
|
|
@ -5,9 +5,9 @@ namespace factor
|
||||||
#define NULL_DLL NULL
|
#define NULL_DLL NULL
|
||||||
|
|
||||||
void c_to_factor_toplevel(cell quot);
|
void c_to_factor_toplevel(cell quot);
|
||||||
void init_signals(void);
|
void init_signals();
|
||||||
void early_init(void);
|
void early_init();
|
||||||
const char *vm_executable_path(void);
|
const char *vm_executable_path();
|
||||||
const char *default_image_path(void);
|
const char *default_image_path();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Snarfed from SBCL linux-so.c. You must free() this yourself. */
|
/* Snarfed from SBCL linux-so.c. You must free() this yourself. */
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path()
|
||||||
{
|
{
|
||||||
char *path = (char *)safe_malloc(PATH_MAX + 1);
|
char *path = (char *)safe_malloc(PATH_MAX + 1);
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ const char *vm_executable_path(void)
|
||||||
|
|
||||||
#ifdef SYS_inotify_init
|
#ifdef SYS_inotify_init
|
||||||
|
|
||||||
int inotify_init(void)
|
int inotify_init()
|
||||||
{
|
{
|
||||||
return syscall(SYS_inotify_init);
|
return syscall(SYS_inotify_init);
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ int inotify_rm_watch(int fd, u32 wd)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int inotify_init(void)
|
int inotify_init()
|
||||||
{
|
{
|
||||||
not_implemented_error();
|
not_implemented_error();
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
int inotify_init(void);
|
int inotify_init();
|
||||||
int inotify_add_watch(int fd, const char *name, u32 mask);
|
int inotify_add_watch(int fd, const char *name, u32 mask);
|
||||||
int inotify_rm_watch(int fd, u32 wd);
|
int inotify_rm_watch(int fd, u32 wd);
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ namespace factor
|
||||||
#define FACTOR_OS_STRING "macosx"
|
#define FACTOR_OS_STRING "macosx"
|
||||||
#define NULL_DLL "libfactor.dylib"
|
#define NULL_DLL "libfactor.dylib"
|
||||||
|
|
||||||
void init_signals(void);
|
void init_signals();
|
||||||
void early_init(void);
|
void early_init();
|
||||||
|
|
||||||
const char *vm_executable_path(void);
|
const char *vm_executable_path();
|
||||||
const char *default_image_path(void);
|
const char *default_image_path();
|
||||||
|
|
||||||
inline static void *ucontext_stack_pointer(void *uap)
|
inline static void *ucontext_stack_pointer(void *uap)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace factor
|
||||||
|
|
||||||
extern "C" int main();
|
extern "C" int main();
|
||||||
|
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path()
|
||||||
{
|
{
|
||||||
static Dl_info info = {0};
|
static Dl_info info = {0};
|
||||||
if (!info.dli_fname)
|
if (!info.dli_fname)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path()
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
const char *vm_executable_path(void)
|
const char *vm_executable_path()
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ void start_thread(void *(*start_routine)(void *))
|
||||||
|
|
||||||
static void *null_dll;
|
static void *null_dll;
|
||||||
|
|
||||||
s64 current_micros(void)
|
s64 current_micros()
|
||||||
{
|
{
|
||||||
struct timeval t;
|
struct timeval t;
|
||||||
gettimeofday(&t,NULL);
|
gettimeofday(&t,NULL);
|
||||||
|
@ -31,7 +31,7 @@ void sleep_micros(cell usec)
|
||||||
usleep(usec);
|
usleep(usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void init_ffi(void)
|
void init_ffi()
|
||||||
{
|
{
|
||||||
/* NULL_DLL is "libfactor.dylib" for OS X and NULL for generic unix */
|
/* NULL_DLL is "libfactor.dylib" for OS X and NULL for generic unix */
|
||||||
null_dll = dlopen(NULL_DLL,RTLD_LAZY);
|
null_dll = dlopen(NULL_DLL,RTLD_LAZY);
|
||||||
|
@ -145,7 +145,7 @@ static void sigaction_safe(int signum, const struct sigaction *act, struct sigac
|
||||||
fatal_error("sigaction failed", 0);
|
fatal_error("sigaction failed", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void unix_init_signals(void)
|
void unix_init_signals()
|
||||||
{
|
{
|
||||||
struct sigaction memory_sigaction;
|
struct sigaction memory_sigaction;
|
||||||
struct sigaction misc_sigaction;
|
struct sigaction misc_sigaction;
|
||||||
|
@ -279,7 +279,7 @@ void *stdin_loop(void *arg)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_console(void)
|
void open_console()
|
||||||
{
|
{
|
||||||
int filedes[2];
|
int filedes[2];
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ void open_console(void)
|
||||||
start_thread(stdin_loop);
|
start_thread(stdin_loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
VM_C_API void wait_for_stdin(void)
|
VM_C_API void wait_for_stdin()
|
||||||
{
|
{
|
||||||
if(write(control_write,"X",1) != 1)
|
if(write(control_write,"X",1) != 1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,18 +42,18 @@ typedef char symbol_char;
|
||||||
|
|
||||||
void start_thread(void *(*start_routine)(void *));
|
void start_thread(void *(*start_routine)(void *));
|
||||||
|
|
||||||
void init_ffi(void);
|
void init_ffi();
|
||||||
void ffi_dlopen(dll *dll);
|
void ffi_dlopen(dll *dll);
|
||||||
void *ffi_dlsym(dll *dll, symbol_char *symbol);
|
void *ffi_dlsym(dll *dll, symbol_char *symbol);
|
||||||
void ffi_dlclose(dll *dll);
|
void ffi_dlclose(dll *dll);
|
||||||
|
|
||||||
void unix_init_signals(void);
|
void unix_init_signals();
|
||||||
void signal_handler(int signal, siginfo_t* siginfo, void* uap);
|
void signal_handler(int signal, siginfo_t* siginfo, void* uap);
|
||||||
void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
|
void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
|
||||||
|
|
||||||
s64 current_micros(void);
|
s64 current_micros();
|
||||||
void sleep_micros(cell usec);
|
void sleep_micros(cell usec);
|
||||||
|
|
||||||
void open_console(void);
|
void open_console();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
s64 current_micros(void)
|
s64 current_micros()
|
||||||
{
|
{
|
||||||
SYSTEMTIME st;
|
SYSTEMTIME st;
|
||||||
FILETIME ft;
|
FILETIME ft;
|
||||||
|
@ -40,6 +40,6 @@ void c_to_factor_toplevel(cell quot)
|
||||||
c_to_factor(quot);
|
c_to_factor(quot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_console(void) { }
|
void open_console() { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,8 @@ char *getenv(char *name);
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#define snwprintf _snwprintf
|
#define snwprintf _snwprintf
|
||||||
|
|
||||||
s64 current_micros(void);
|
s64 current_micros();
|
||||||
void c_to_factor_toplevel(cell quot);
|
void c_to_factor_toplevel(cell quot);
|
||||||
void open_console(void);
|
void open_console();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
namespace factor
|
namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
s64 current_micros(void)
|
s64 current_micros()
|
||||||
{
|
{
|
||||||
FILETIME t;
|
FILETIME t;
|
||||||
GetSystemTimeAsFileTime(&t);
|
GetSystemTimeAsFileTime(&t);
|
||||||
|
@ -49,7 +49,7 @@ void c_to_factor_toplevel(cell quot)
|
||||||
RemoveVectoredExceptionHandler((void*)exception_handler);
|
RemoveVectoredExceptionHandler((void*)exception_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
void open_console(void)
|
void open_console()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,6 @@ typedef char symbol_char;
|
||||||
|
|
||||||
void c_to_factor_toplevel(cell quot);
|
void c_to_factor_toplevel(cell quot);
|
||||||
long exception_handler(PEXCEPTION_POINTERS pe);
|
long exception_handler(PEXCEPTION_POINTERS pe);
|
||||||
void open_console(void);
|
void open_console();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace factor
|
||||||
|
|
||||||
HMODULE hFactorDll;
|
HMODULE hFactorDll;
|
||||||
|
|
||||||
void init_ffi(void)
|
void init_ffi()
|
||||||
{
|
{
|
||||||
hFactorDll = GetModuleHandle(FACTOR_DLL);
|
hFactorDll = GetModuleHandle(FACTOR_DLL);
|
||||||
if(!hFactorDll)
|
if(!hFactorDll)
|
||||||
|
@ -63,7 +63,7 @@ void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int len
|
||||||
}
|
}
|
||||||
|
|
||||||
/* You must free() this yourself. */
|
/* You must free() this yourself. */
|
||||||
const vm_char *default_image_path(void)
|
const vm_char *default_image_path()
|
||||||
{
|
{
|
||||||
vm_char full_path[MAX_UNICODE_PATH];
|
vm_char full_path[MAX_UNICODE_PATH];
|
||||||
vm_char *ptr;
|
vm_char *ptr;
|
||||||
|
@ -82,7 +82,7 @@ const vm_char *default_image_path(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* You must free() this yourself. */
|
/* You must free() this yourself. */
|
||||||
const vm_char *vm_executable_path(void)
|
const vm_char *vm_executable_path()
|
||||||
{
|
{
|
||||||
vm_char full_path[MAX_UNICODE_PATH];
|
vm_char full_path[MAX_UNICODE_PATH];
|
||||||
if(!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH))
|
if(!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH))
|
||||||
|
@ -131,7 +131,7 @@ void dealloc_segment(segment *block)
|
||||||
free(block);
|
free(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
long getpagesize(void)
|
long getpagesize()
|
||||||
{
|
{
|
||||||
static long g_pagesize = 0;
|
static long g_pagesize = 0;
|
||||||
if (! g_pagesize)
|
if (! g_pagesize)
|
||||||
|
|
|
@ -41,19 +41,19 @@ typedef wchar_t vm_char;
|
||||||
/* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
|
/* Difference between Jan 1 00:00:00 1601 and Jan 1 00:00:00 1970 */
|
||||||
#define EPOCH_OFFSET 0x019db1ded53e8000LL
|
#define EPOCH_OFFSET 0x019db1ded53e8000LL
|
||||||
|
|
||||||
void init_ffi(void);
|
void init_ffi();
|
||||||
void ffi_dlopen(dll *dll);
|
void ffi_dlopen(dll *dll);
|
||||||
void *ffi_dlsym(dll *dll, symbol_char *symbol);
|
void *ffi_dlsym(dll *dll, symbol_char *symbol);
|
||||||
void ffi_dlclose(dll *dll);
|
void ffi_dlclose(dll *dll);
|
||||||
|
|
||||||
void sleep_micros(u64 msec);
|
void sleep_micros(u64 msec);
|
||||||
|
|
||||||
inline static void init_signals(void) {}
|
inline static void init_signals() {}
|
||||||
inline static void early_init(void) {}
|
inline static void early_init() {}
|
||||||
const vm_char *vm_executable_path(void);
|
const vm_char *vm_executable_path();
|
||||||
const vm_char *default_image_path(void);
|
const vm_char *default_image_path();
|
||||||
long getpagesize (void);
|
long getpagesize ();
|
||||||
|
|
||||||
s64 current_micros(void);
|
s64 current_micros();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ namespace factor
|
||||||
|
|
||||||
bool profiling_p;
|
bool profiling_p;
|
||||||
|
|
||||||
void init_profiler(void)
|
void init_profiler()
|
||||||
{
|
{
|
||||||
profiling_p = false;
|
profiling_p = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ namespace factor
|
||||||
{
|
{
|
||||||
|
|
||||||
extern bool profiling_p;
|
extern bool profiling_p;
|
||||||
void init_profiler(void);
|
void init_profiler();
|
||||||
code_block *compile_profiling_stub(cell word);
|
code_block *compile_profiling_stub(cell word);
|
||||||
PRIMITIVE(profiling);
|
PRIMITIVE(profiling);
|
||||||
|
|
||||||
|
|
|
@ -297,7 +297,7 @@ PRIMITIVE(quotation_xt)
|
||||||
drepl(allot_cell((cell)quot->xt));
|
drepl(allot_cell((cell)quot->xt));
|
||||||
}
|
}
|
||||||
|
|
||||||
void compile_all_words(void)
|
void compile_all_words()
|
||||||
{
|
{
|
||||||
gc_root<array> words(find_all_words());
|
gc_root<array> words(find_all_words());
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ fixnum quot_code_offset_to_scan(cell quot, cell offset);
|
||||||
|
|
||||||
PRIMITIVE(jit_compile);
|
PRIMITIVE(jit_compile);
|
||||||
|
|
||||||
void compile_all_words(void);
|
void compile_all_words();
|
||||||
|
|
||||||
PRIMITIVE(array_to_quotation);
|
PRIMITIVE(array_to_quotation);
|
||||||
PRIMITIVE(quotation_xt);
|
PRIMITIVE(quotation_xt);
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespace factor
|
||||||
#define DEFPUSHPOP(prefix,ptr) \
|
#define DEFPUSHPOP(prefix,ptr) \
|
||||||
inline static cell prefix##peek() { return *(cell *)ptr; } \
|
inline static cell prefix##peek() { return *(cell *)ptr; } \
|
||||||
inline static void prefix##repl(cell tagged) { *(cell *)ptr = tagged; } \
|
inline static void prefix##repl(cell tagged) { *(cell *)ptr = tagged; } \
|
||||||
inline static cell prefix##pop(void) \
|
inline static cell prefix##pop() \
|
||||||
{ \
|
{ \
|
||||||
cell value = prefix##peek(); \
|
cell value = prefix##peek(); \
|
||||||
ptr -= sizeof(cell); \
|
ptr -= sizeof(cell); \
|
||||||
|
|
|
@ -20,7 +20,7 @@ vm_char *safe_strdup(const vm_char *str)
|
||||||
|
|
||||||
/* We don't use printf directly, because format directives are not portable.
|
/* We don't use printf directly, because format directives are not portable.
|
||||||
Instead we define the common cases here. */
|
Instead we define the common cases here. */
|
||||||
void nl(void)
|
void nl()
|
||||||
{
|
{
|
||||||
fputs("\n",stdout);
|
fputs("\n",stdout);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ void print_fixnum(fixnum x)
|
||||||
printf(FIXNUM_FORMAT,x);
|
printf(FIXNUM_FORMAT,x);
|
||||||
}
|
}
|
||||||
|
|
||||||
cell read_cell_hex(void)
|
cell read_cell_hex()
|
||||||
{
|
{
|
||||||
cell cell;
|
cell cell;
|
||||||
if(scanf(cell_HEX_FORMAT,&cell) < 0) exit(1);
|
if(scanf(cell_HEX_FORMAT,&cell) < 0) exit(1);
|
||||||
|
|
|
@ -4,12 +4,12 @@ namespace factor
|
||||||
void *safe_malloc(size_t size);
|
void *safe_malloc(size_t size);
|
||||||
vm_char *safe_strdup(const vm_char *str);
|
vm_char *safe_strdup(const vm_char *str);
|
||||||
|
|
||||||
void nl(void);
|
void nl();
|
||||||
void print_string(const char *str);
|
void print_string(const char *str);
|
||||||
void print_cell(cell x);
|
void print_cell(cell x);
|
||||||
void print_cell_hex(cell x);
|
void print_cell_hex(cell x);
|
||||||
void print_cell_hex_pad(cell x);
|
void print_cell_hex_pad(cell x);
|
||||||
void print_fixnum(fixnum x);
|
void print_fixnum(fixnum x);
|
||||||
cell read_cell_hex(void);
|
cell read_cell_hex();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue