9 // First five fields accessed directly by assembler. See vm.factor
14 /* New objects are allocated here */
15 nursery_space nursery;
17 /* Add this to a shifted address to compute write barrier offsets */
21 /* Various special objects, accessed by special-object and
22 set-special-object primitives */
23 cell special_objects[special_object_count];
25 /* Data stack and retain stack sizes */
26 cell ds_size, rs_size;
28 /* Pooling unused contexts to make callbacks cheaper */
29 context *unused_contexts;
31 /* Canonical truth value. In Factor, 't' */
34 /* External entry points */
35 c_to_factor_func_type c_to_factor_func;
37 /* Is call counting enabled? */
40 /* Global variables used to pass fault handler state from signal handler to
43 cell signal_fault_addr;
44 unsigned int signal_fpu_status;
45 stack_frame *signal_callstack_top;
47 /* GC is off during heap walking */
56 /* Pinned callback stubs */
57 callback_heap *callbacks;
59 /* Only set if we're performing a GC */
63 std::vector<cell> mark_stack;
65 /* If not NULL, we push GC events here */
66 std::vector<gc_event> *gc_events;
68 /* If a runtime function needs to call another function which potentially
69 allocates memory, it must wrap any references to the data and code
70 heaps with data_root and code_root smart pointers, which register
71 themselves here. See data_roots.hpp and code_roots.hpp */
72 std::vector<data_root_range> data_roots;
73 std::vector<cell> bignum_roots;
74 std::vector<code_root *> code_roots;
80 /* Canonical bignums */
85 /* Method dispatch statistics */
86 dispatch_statistics dispatch_stats;
88 /* Number of entries in a polymorphic inline cache */
91 /* Incrementing object counter for identity hashing */
94 /* Sanity check to ensure that monotonic counter doesn't
99 context *alloc_context();
100 void dealloc_context(context *old_context);
102 void unnest_stacks();
103 void init_stacks(cell ds_size_, cell rs_size_);
104 void primitive_context_object();
105 void primitive_set_context_object();
106 bool stack_to_array(cell bottom, cell top);
107 cell array_to_stack(array *array, cell bottom);
108 void primitive_datastack();
109 void primitive_retainstack();
110 void primitive_set_datastack();
111 void primitive_set_retainstack();
112 void primitive_check_datastack();
113 void primitive_load_locals();
115 template<typename Iterator> void iterate_active_frames(Iterator &iter)
117 context *ctx = this->ctx;
121 iterate_callstack(ctx,iter);
127 void primitive_exit();
128 void primitive_system_micros();
129 void primitive_nano_count();
130 void primitive_sleep();
131 void primitive_set_slot();
134 void primitive_special_object();
135 void primitive_set_special_object();
136 void primitive_identity_hashcode();
137 void compute_identity_hashcode(object *obj);
138 void primitive_compute_identity_hashcode();
139 cell object_size(cell tagged);
140 cell clone_object(cell obj_);
141 void primitive_clone();
142 void primitive_become();
145 void init_profiler();
146 code_block *compile_profiling_stub(cell word_);
147 void set_profiling(bool profiling);
148 void primitive_profiling();
151 void throw_error(cell error, stack_frame *callstack_top);
152 void not_implemented_error();
153 bool in_page(cell fault, cell area, cell area_size, int offset);
154 void memory_protection_error(cell addr, stack_frame *native_stack);
155 void signal_error(cell signal, stack_frame *native_stack);
156 void divide_by_zero_error();
157 void fp_trap_error(unsigned int fpu_status, stack_frame *signal_callstack_top);
158 void primitive_call_clear();
159 void primitive_unimplemented();
160 void memory_signal_handler_impl();
161 void misc_signal_handler_impl();
162 void fp_signal_handler_impl();
163 void type_error(cell type, cell tagged);
164 void general_error(vm_error_type error, cell arg1, cell arg2, stack_frame *native_stack);
167 int bignum_equal_p(bignum * x, bignum * y);
168 enum bignum_comparison bignum_compare(bignum * x, bignum * y);
169 bignum *bignum_add(bignum * x, bignum * y);
170 bignum *bignum_subtract(bignum * x, bignum * y);
171 bignum *bignum_multiply(bignum * x, bignum * y);
172 void bignum_divide(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder);
173 bignum *bignum_quotient(bignum * numerator, bignum * denominator);
174 bignum *bignum_remainder(bignum * numerator, bignum * denominator);
175 cell bignum_to_cell(bignum * bignum);
176 fixnum bignum_to_fixnum(bignum * bignum);
177 s64 bignum_to_long_long(bignum * bignum);
178 u64 bignum_to_ulong_long(bignum * bignum);
179 double bignum_to_double(bignum * bignum);
180 bignum *double_to_bignum(double x);
181 int bignum_equal_p_unsigned(bignum * x, bignum * y);
182 enum bignum_comparison bignum_compare_unsigned(bignum * x, bignum * y);
183 bignum *bignum_add_unsigned(bignum * x, bignum * y, int negative_p);
184 bignum *bignum_subtract_unsigned(bignum * x, bignum * y);
185 bignum *bignum_multiply_unsigned(bignum * x, bignum * y, int negative_p);
186 bignum *bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit_type y,int negative_p);
187 void bignum_destructive_add(bignum * bignum, bignum_digit_type n);
188 void bignum_destructive_scale_up(bignum * bignum, bignum_digit_type factor);
189 void bignum_divide_unsigned_large_denominator(bignum * numerator, bignum * denominator,
190 bignum * * quotient, bignum * * remainder, int q_negative_p, int r_negative_p);
191 void bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum * q);
192 bignum_digit_type bignum_divide_subtract(bignum_digit_type * v_start, bignum_digit_type * v_end,
193 bignum_digit_type guess, bignum_digit_type * u_start);
194 void bignum_divide_unsigned_medium_denominator(bignum * numerator,bignum_digit_type denominator,
195 bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p);
196 void bignum_destructive_normalization(bignum * source, bignum * target, int shift_left);
197 void bignum_destructive_unnormalization(bignum * bignum, int shift_right);
198 bignum_digit_type bignum_digit_divide(bignum_digit_type uh, bignum_digit_type ul,
199 bignum_digit_type v, bignum_digit_type * q) /* return value */;
200 bignum_digit_type bignum_digit_divide_subtract(bignum_digit_type v1, bignum_digit_type v2,
201 bignum_digit_type guess, bignum_digit_type * u);
202 void bignum_divide_unsigned_small_denominator(bignum * numerator, bignum_digit_type denominator,
203 bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p);
204 bignum_digit_type bignum_destructive_scale_down(bignum * bignum, bignum_digit_type denominator);
205 bignum * bignum_remainder_unsigned_small_denominator(bignum * n, bignum_digit_type d, int negative_p);
206 bignum *bignum_digit_to_bignum(bignum_digit_type digit, int negative_p);
207 bignum *allot_bignum(bignum_length_type length, int negative_p);
208 bignum * allot_bignum_zeroed(bignum_length_type length, int negative_p);
209 bignum *bignum_shorten_length(bignum * bignum, bignum_length_type length);
210 bignum *bignum_trim(bignum * bignum);
211 bignum *bignum_new_sign(bignum * x, int negative_p);
212 bignum *bignum_maybe_new_sign(bignum * x, int negative_p);
213 void bignum_destructive_copy(bignum * source, bignum * target);
214 bignum *bignum_bitwise_not(bignum * x);
215 bignum *bignum_arithmetic_shift(bignum * arg1, fixnum n);
216 bignum *bignum_bitwise_and(bignum * arg1, bignum * arg2);
217 bignum *bignum_bitwise_ior(bignum * arg1, bignum * arg2);
218 bignum *bignum_bitwise_xor(bignum * arg1, bignum * arg2);
219 bignum *bignum_magnitude_ash(bignum * arg1, fixnum n);
220 bignum *bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2);
221 bignum *bignum_posneg_bitwise_op(int op, bignum * arg1, bignum * arg2);
222 bignum *bignum_negneg_bitwise_op(int op, bignum * arg1, bignum * arg2);
223 void bignum_negate_magnitude(bignum * arg);
224 bignum *bignum_integer_length(bignum * x);
225 int bignum_logbitp(int shift, bignum * arg);
226 int bignum_unsigned_logbitp(int shift, bignum * bignum);
227 bignum *digit_stream_to_bignum(unsigned int n_digits, unsigned int (*producer)(unsigned int, factor_vm *), unsigned int radix, int negative_p);
230 void init_card_decks();
231 void set_data_heap(data_heap *data_);
232 void init_data_heap(cell young_size, cell aging_size, cell tenured_size);
233 void primitive_size();
234 data_heap_room data_room();
235 void primitive_data_room();
238 cell instances(cell type);
239 void primitive_all_instances();
241 template<typename Generation, typename Iterator>
242 inline void each_object(Generation *gen, Iterator &iterator)
244 cell obj = gen->first_object();
247 iterator((object *)obj);
248 obj = gen->next_object_after(obj);
252 template<typename Iterator> inline void each_object(Iterator &iterator)
256 each_object(data->tenured,iterator);
257 each_object(data->aging,iterator);
258 each_object(data->nursery,iterator);
263 /* the write barrier must be called any time we are potentially storing a
264 pointer from an older generation to a younger one */
265 inline void write_barrier(cell *slot_ptr)
267 *(char *)(cards_offset + ((cell)slot_ptr >> card_bits)) = card_mark_mask;
268 *(char *)(decks_offset + ((cell)slot_ptr >> deck_bits)) = card_mark_mask;
271 inline void write_barrier(object *obj, cell size)
273 cell start = (cell)obj & (~card_size + 1);
274 cell end = ((cell)obj + size + card_size - 1) & (~card_size + 1);
276 for(cell offset = start; offset < end; offset += card_size)
277 write_barrier((cell *)offset);
281 void check_data_heap();
285 void start_gc_again();
286 void update_code_heap_for_minor_gc(std::set<code_block *> *remembered_set);
287 void collect_nursery();
288 void collect_aging();
289 void collect_to_tenured();
290 void update_code_roots_for_sweep();
291 void update_code_roots_for_compaction();
292 void collect_mark_impl(bool trace_contexts_p);
293 void collect_sweep_impl();
294 void collect_full(bool trace_contexts_p);
295 void collect_compact_impl(bool trace_contexts_p);
296 void collect_compact_code_impl(bool trace_contexts_p);
297 void collect_compact(bool trace_contexts_p);
298 void collect_growing_heap(cell requested_bytes, bool trace_contexts_p);
299 void gc(gc_op op, cell requested_bytes, bool trace_contexts_p);
300 void primitive_minor_gc();
301 void primitive_full_gc();
302 void primitive_compact_gc();
303 void inline_gc(cell *data_roots_base, cell data_roots_size);
304 void primitive_enable_gc_events();
305 void primitive_disable_gc_events();
306 object *allot_object(cell type, cell size);
307 object *allot_large_object(cell type, cell size);
309 template<typename Type> Type *allot(cell size)
311 return (Type *)allot_object(Type::type_number,size);
314 inline void check_data_pointer(object *pointer)
317 if(!(current_gc && current_gc->op == collect_growing_heap_op))
319 assert((cell)pointer >= data->seg->start
320 && (cell)pointer < data->seg->end);
326 template<typename Array> Array *allot_uninitialized_array(cell capacity);
327 template<typename Array> bool reallot_array_in_place_p(Array *array, cell capacity);
328 template<typename Array> Array *reallot_array(Array *array_, cell capacity);
331 void print_chars(string* str);
332 void print_word(word* word, cell nesting);
333 void print_factor_string(string* str);
334 void print_array(array* array, cell nesting);
335 void print_tuple(tuple *tuple, cell nesting);
336 void print_nested_obj(cell obj, fixnum nesting);
337 void print_obj(cell obj);
338 void print_objects(cell *start, cell *end);
339 void print_datastack();
340 void print_retainstack();
341 void print_callstack();
342 void dump_cell(cell x);
343 void dump_memory(cell from, cell to);
344 template<typename Generation> void dump_generation(const char *name, Generation *gen);
345 void dump_generations();
346 void dump_objects(cell type);
347 void find_data_references_step(cell *scan);
348 void find_data_references(cell look_for_);
349 void dump_code_heap();
351 void primitive_die();
354 inline void set_array_nth(array *array, cell slot, cell value);
355 array *allot_array(cell capacity, cell fill_);
356 void primitive_array();
357 cell allot_array_1(cell obj_);
358 cell allot_array_2(cell v1_, cell v2_);
359 cell allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_);
360 void primitive_resize_array();
361 cell std_vector_to_array(std::vector<cell> &elements);
364 cell string_nth(const string *str, cell index);
365 void set_string_nth_fast(string *str, cell index, cell ch);
366 void set_string_nth_slow(string *str_, cell index, cell ch);
367 void set_string_nth(string *str, cell index, cell ch);
368 string *allot_string_internal(cell capacity);
369 void fill_string(string *str_, cell start, cell capacity, cell fill);
370 string *allot_string(cell capacity, cell fill);
371 void primitive_string();
372 bool reallot_string_in_place_p(string *str, cell capacity);
373 string* reallot_string(string *str_, cell capacity);
374 void primitive_resize_string();
375 void primitive_string_nth();
376 void primitive_set_string_nth_fast();
377 void primitive_set_string_nth_slow();
380 cell tag_boolean(cell untagged)
382 return (untagged ? true_object : false_object);
386 byte_array *allot_byte_array(cell size);
387 void primitive_byte_array();
388 void primitive_uninitialized_byte_array();
389 void primitive_resize_byte_array();
391 template<typename Type> byte_array *byte_array_from_value(Type *value);
394 void primitive_tuple();
395 void primitive_tuple_boa();
398 word *allot_word(cell name_, cell vocab_, cell hashcode_);
399 void primitive_word();
400 void primitive_word_code();
401 void update_word_entry_point(word *w_);
402 void primitive_optimized_p();
403 void primitive_wrapper();
404 void jit_compile_word(cell word_, cell def_, bool relocating);
405 cell find_all_words();
406 void compile_all_words();
409 void primitive_bignum_to_fixnum();
410 void primitive_float_to_fixnum();
411 void primitive_fixnum_divint();
412 void primitive_fixnum_divmod();
413 bignum *fixnum_to_bignum(fixnum);
414 bignum *cell_to_bignum(cell);
415 bignum *long_long_to_bignum(s64 n);
416 bignum *ulong_long_to_bignum(u64 n);
417 inline fixnum sign_mask(fixnum x);
418 inline fixnum branchless_max(fixnum x, fixnum y);
419 inline fixnum branchless_abs(fixnum x);
420 void primitive_fixnum_shift();
421 void primitive_fixnum_to_bignum();
422 void primitive_float_to_bignum();
423 void primitive_bignum_eq();
424 void primitive_bignum_add();
425 void primitive_bignum_subtract();
426 void primitive_bignum_multiply();
427 void primitive_bignum_divint();
428 void primitive_bignum_divmod();
429 void primitive_bignum_mod();
430 void primitive_bignum_and();
431 void primitive_bignum_or();
432 void primitive_bignum_xor();
433 void primitive_bignum_shift();
434 void primitive_bignum_less();
435 void primitive_bignum_lesseq();
436 void primitive_bignum_greater();
437 void primitive_bignum_greatereq();
438 void primitive_bignum_not();
439 void primitive_bignum_bitp();
440 void primitive_bignum_log2();
441 unsigned int bignum_producer(unsigned int digit);
442 void primitive_byte_array_to_bignum();
443 inline cell unbox_array_size();
444 cell unbox_array_size_slow();
445 void primitive_fixnum_to_float();
446 void primitive_bignum_to_float();
447 void primitive_float_to_str();
448 void primitive_float_eq();
449 void primitive_float_add();
450 void primitive_float_subtract();
451 void primitive_float_multiply();
452 void primitive_float_divfloat();
453 void primitive_float_mod();
454 void primitive_float_less();
455 void primitive_float_lesseq();
456 void primitive_float_greater();
457 void primitive_float_greatereq();
458 void primitive_float_bits();
459 void primitive_bits_float();
460 void primitive_double_bits();
461 void primitive_bits_double();
462 fixnum to_fixnum(cell tagged);
463 cell to_cell(cell tagged);
464 cell from_signed_1(s8 n);
465 cell from_unsigned_1(u8 n);
466 cell from_signed_2(s16 n);
467 cell from_unsigned_2(u16 n);
468 cell from_signed_4(s32 n);
469 cell from_unsigned_4(u32 n);
470 cell from_signed_cell(fixnum integer);
471 cell from_unsigned_cell(cell integer);
472 cell from_signed_8(s64 n);
473 s64 to_signed_8(cell obj);
474 cell from_unsigned_8(u64 n);
475 u64 to_unsigned_8(cell obj);
476 float to_float(cell value);
477 double to_double(cell value);
478 inline void overflow_fixnum_add(fixnum x, fixnum y);
479 inline void overflow_fixnum_subtract(fixnum x, fixnum y);
480 inline void overflow_fixnum_multiply(fixnum x, fixnum y);
481 inline cell allot_integer(fixnum x);
482 inline cell allot_cell(cell x);
483 inline cell allot_float(double n);
484 inline bignum *float_to_bignum(cell tagged);
485 inline double bignum_to_float(cell tagged);
486 inline double untag_float(cell tagged);
487 inline double untag_float_check(cell tagged);
488 inline fixnum float_to_fixnum(cell tagged);
489 inline double fixnum_to_float(cell tagged);
492 template<typename Type> Type *untag_check(cell value);
497 FILE* safe_fopen(char *filename, char *mode);
498 int safe_fgetc(FILE *stream);
499 size_t safe_fread(void *ptr, size_t size, size_t nitems, FILE *stream);
500 void safe_fputc(int c, FILE* stream);
501 size_t safe_fwrite(void *ptr, size_t size, size_t nitems, FILE *stream);
502 int safe_ftell(FILE *stream);
503 void safe_fseek(FILE *stream, off_t offset, int whence);
504 void safe_fflush(FILE *stream);
505 void safe_fclose(FILE *stream);
506 void primitive_fopen();
507 FILE *pop_file_handle();
508 void primitive_fgetc();
509 void primitive_fread();
510 void primitive_fputc();
511 void primitive_fwrite();
512 void primitive_ftell();
513 void primitive_fseek();
514 void primitive_fflush();
515 void primitive_fclose();
518 cell compute_entry_point_address(cell obj);
519 cell compute_entry_point_pic_address(word *w, cell tagged_quot);
520 cell compute_entry_point_pic_address(cell w_);
521 cell compute_entry_point_pic_tail_address(cell w_);
522 cell code_block_owner(code_block *compiled);
523 void update_word_references(code_block *compiled, bool reset_inline_caches);
524 void undefined_symbol();
525 cell compute_dlsym_address(array *literals, cell index);
526 cell compute_vm_address(cell arg);
527 void store_external_address(instruction_operand op);
528 cell compute_here_address(cell arg, cell offset, code_block *compiled);
529 void initialize_code_block(code_block *compiled, cell literals);
530 void initialize_code_block(code_block *compiled);
531 void fixup_labels(array *labels, code_block *compiled);
532 code_block *allot_code_block(cell size, code_block_type type);
533 code_block *add_code_block(code_block_type type, cell code_, cell labels_, cell owner_, cell relocation_, cell parameters_, cell literals_);
536 inline void check_code_pointer(cell ptr) { }
538 template<typename Iterator> void each_code_block(Iterator &iter)
540 code->allocator->iterate(iter);
543 void init_code_heap(cell size);
544 bool in_code_heap_p(cell ptr);
545 void update_code_heap_words(bool reset_inline_caches);
546 void initialize_code_blocks();
547 void primitive_modify_code_heap();
548 code_heap_room code_room();
549 void primitive_code_room();
550 void primitive_strip_stack_traces();
552 void primitive_code_blocks();
555 void init_callbacks(cell size);
556 void primitive_callback();
559 void init_objects(image_header *h);
560 void load_data_heap(FILE *file, image_header *h, vm_parameters *p);
561 void load_code_heap(FILE *file, image_header *h, vm_parameters *p);
562 bool save_image(const vm_char *saving_filename, const vm_char *filename);
563 void primitive_save_image();
564 void primitive_save_image_and_exit();
565 void fixup_data(cell data_offset, cell code_offset);
566 void fixup_code(cell data_offset, cell code_offset);
567 void load_image(vm_parameters *p);
570 template<typename Iterator> void iterate_callstack_object(callstack *stack_, Iterator &iterator);
571 void check_frame(stack_frame *frame);
572 callstack *allot_callstack(cell size);
573 stack_frame *fix_callstack_top(stack_frame *top, stack_frame *bottom);
574 stack_frame *second_from_top_stack_frame();
575 void primitive_callstack();
576 code_block *frame_code(stack_frame *frame);
577 code_block_type frame_type(stack_frame *frame);
578 cell frame_executing(stack_frame *frame);
579 cell frame_executing_quot(stack_frame *frame);
580 stack_frame *frame_successor(stack_frame *frame);
581 cell frame_scan(stack_frame *frame);
582 void primitive_callstack_to_array();
583 stack_frame *innermost_stack_frame(callstack *stack);
584 void primitive_innermost_stack_frame_executing();
585 void primitive_innermost_stack_frame_scan();
586 void primitive_set_innermost_stack_frame_quot();
587 template<typename Iterator> void iterate_callstack(context *ctx, Iterator &iterator);
590 char *pinned_alien_offset(cell obj);
591 cell allot_alien(cell delegate_, cell displacement);
592 cell allot_alien(void *address);
593 void primitive_displaced_alien();
594 void primitive_alien_address();
595 void *alien_pointer();
596 void primitive_dlopen();
597 void primitive_dlsym();
598 void primitive_dlclose();
599 void primitive_dll_validp();
600 char *alien_offset(cell obj);
601 void to_value_struct(cell src, void *dest, cell size);
602 cell from_value_struct(void *src, cell size);
603 cell from_small_struct(cell x, cell y, cell size);
604 cell from_medium_struct(cell x1, cell x2, cell x3, cell x4, cell size);
607 void primitive_jit_compile();
608 code_block *lazy_jit_compile_block();
609 void primitive_array_to_quotation();
610 void primitive_quotation_code();
611 void set_quot_entry_point(quotation *quot, code_block *code);
612 code_block *jit_compile_quot(cell owner_, cell quot_, bool relocating);
613 void jit_compile_quot(cell quot_, bool relocating);
614 fixnum quot_code_offset_to_scan(cell quot_, cell offset);
615 cell lazy_jit_compile(cell quot);
616 bool quot_compiled_p(quotation *quot);
617 void primitive_quot_compiled_p();
618 cell find_all_quotations();
619 void initialize_all_quotations();
622 cell search_lookup_alist(cell table, cell klass);
623 cell search_lookup_hash(cell table, cell klass, cell hashcode);
624 cell nth_superclass(tuple_layout *layout, fixnum echelon);
625 cell nth_hashcode(tuple_layout *layout, fixnum echelon);
626 cell lookup_tuple_method(cell obj, cell methods);
627 cell lookup_method(cell obj, cell methods);
628 void primitive_lookup_method();
629 cell object_class(cell obj);
630 cell method_cache_hashcode(cell klass, array *array);
631 void update_method_cache(cell cache, cell klass, cell method);
632 void primitive_mega_cache_miss();
633 void primitive_reset_dispatch_stats();
634 void primitive_dispatch_stats();
637 void init_inline_caching(int max_size);
638 void deallocate_inline_cache(cell return_address);
639 cell determine_inline_cache_type(array *cache_entries);
640 void update_pic_count(cell type);
641 code_block *compile_inline_cache(fixnum index,cell generic_word_,cell methods_,cell cache_entries_,bool tail_call_p);
642 void *megamorphic_call_stub(cell generic_word);
643 cell inline_cache_size(cell cache_entries);
644 cell add_inline_cache_entry(cell cache_entries_, cell klass_, cell method_);
645 void update_pic_transitions(cell pic_size);
646 void *inline_cache_miss(cell return_address);
649 void c_to_factor(cell quot);
650 void unwind_native_frames(cell quot, stack_frame *to);
653 void default_parameters(vm_parameters *p);
654 bool factor_arg(const vm_char *str, const vm_char *arg, cell *value);
655 void init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv);
656 void prepare_boot_image();
657 void init_factor(vm_parameters *p);
658 void pass_args_to_factor(int argc, vm_char **argv);
659 void start_factor(vm_parameters *p);
661 void start_embedded_factor(vm_parameters *p);
662 void start_standalone_factor(int argc, vm_char **argv);
663 char *factor_eval_string(char *string);
664 void factor_eval_free(char *result);
666 void factor_sleep(long us);
669 void primitive_existsp();
670 void move_file(const vm_char *path1, const vm_char *path2);
672 void ffi_dlopen(dll *dll);
673 void *ffi_dlsym(dll *dll, symbol_char *symbol);
674 void ffi_dlclose(dll *dll);
675 void c_to_factor_toplevel(cell quot);
679 const vm_char *vm_executable_path();
680 const vm_char *default_image_path();
681 void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length);
682 BOOL windows_stat(vm_char *path);
686 LONG exception_handler(PEXCEPTION_POINTERS pe);
689 void dispatch_signal(void *uap, void (handler)());
693 void call_fault_handler(exception_type_t exception, exception_data_type_t code, MACH_EXC_STATE_TYPE *exc_state, MACH_THREAD_STATE_TYPE *thread_state, MACH_FLOAT_STATE_TYPE *float_state);
700 extern std::map<THREADHANDLE, factor_vm *> thread_vms;