5 typedef void (*c_to_factor_func_type)(cell quot);
6 typedef void (*unwind_native_frames_func_type)(cell quot, cell to);
7 typedef cell (*get_fpu_state_func_type)();
8 typedef void (*set_fpu_state_func_type)(cell state);
10 struct growable_array;
16 // THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR. See:
18 // basis/compiler/constants/constants.factor
23 // Spare context -- for callbacks
26 // New objects are allocated here, use the data->nursery reference
27 // instead from c++ code.
28 bump_allocator nursery;
30 // Add this to a shifted address to compute write barrier offsets
34 // cdecl signal handler address, used by signal handler subprimitives
35 cell signal_handler_addr;
37 // are we handling a memory error? used to detect double faults
40 // Various special objects, accessed by special-object and
41 // set-special-object primitives
42 cell special_objects[special_object_count];
44 // THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR.
48 // Handle to the main thread we run in
51 // Data stack and retain stack sizes
52 cell datastack_size, retainstack_size, callstack_size;
54 // Stack of callback IDs
55 std::vector<int> callback_ids;
60 // List of callback function descriptors for PPC
61 std::list<void**> function_descriptors;
63 // Pooling unused contexts to make context allocation cheaper
64 std::list<context*> unused_contexts;
66 // Active contexts, for tracing by the GC
67 std::set<context*> active_contexts;
69 // External entry points
70 c_to_factor_func_type c_to_factor_func;
72 // Is profiling enabled?
73 volatile cell sampling_profiler_p;
74 fixnum samples_per_second;
76 // Global variables used to pass fault handler state from signal handler
78 bool signal_resumable;
80 cell signal_fault_addr;
82 unsigned int signal_fpu_status;
84 // Pipe used to notify Factor multiplexer of signals
85 int signal_pipe_input, signal_pipe_output;
87 // State kept by the sampling profiler
88 std::vector<profiling_sample> samples;
89 std::vector<cell> sample_callstacks;
90 volatile profiling_sample_count sample_counts;
92 // GC is off during heap walking
101 // Pinned callback stubs
102 callback_heap* callbacks;
104 // Only set if we're performing a GC
105 gc_state* current_gc;
106 volatile cell current_gc_p;
108 // Set if we're in the jit
109 volatile fixnum current_jit_count;
111 // Mark stack used for mark & sweep GC
112 std::vector<cell> mark_stack;
114 // If not NULL, we push GC events here
115 std::vector<gc_event>* gc_events;
117 // If a runtime function needs to call another function which potentially
118 // allocates memory, it must wrap any references to the data and code
119 // heaps with data_root and code_root smart pointers, which register
120 // themselves here. See data_roots.hpp and code_roots.hpp
122 std::vector<cell*> data_roots;
123 std::vector<code_root*> code_roots;
127 bool fep_help_was_shown;
131 // Method dispatch statistics
132 dispatch_statistics dispatch_stats;
134 // Number of entries in a polymorphic inline cache
137 // Incrementing object counter for identity hashing
140 // Sanity check to ensure that monotonic counter doesn't decrease
141 uint64_t last_nano_count;
143 // Stack for signal handlers, only used on Unix
144 segment* signal_callstack_seg;
146 // Are we already handling a fault? Used to catch double memory faults
147 static bool fatal_erroring_p;
149 // Two fep_p variants, one might be redundant.
150 volatile cell safepoint_fep_p;
152 // Allow Ctrl-Break a busy loop in the Listener, only used on Windows
153 volatile bool stop_on_ctrl_break;
156 context* new_context();
157 void init_context(context* ctx);
158 void delete_context();
159 void init_contexts(cell datastack_size_, cell retainstack_size_,
160 cell callstack_size_);
161 cell begin_callback(cell quot);
163 void primitive_current_callback();
164 void primitive_context_object();
165 void primitive_context_object_for();
166 void primitive_set_context_object();
167 cell stack_to_array(cell bottom, cell top, vm_error_type error);
168 cell datastack_to_array(context* ctx);
169 void primitive_datastack_for();
170 cell retainstack_to_array(context* ctx);
171 void primitive_retainstack_for();
172 cell array_to_stack(array* array, cell bottom);
173 void primitive_set_datastack();
174 void primitive_set_retainstack();
175 void primitive_check_datastack();
176 void primitive_load_locals();
179 void primitive_exit();
180 void primitive_nano_count();
181 void primitive_sleep();
182 void primitive_set_slot();
185 void primitive_special_object();
186 void primitive_set_special_object();
187 void primitive_identity_hashcode();
188 void primitive_compute_identity_hashcode();
189 void primitive_clone();
190 void primitive_become();
193 void record_sample(bool prolog_p);
194 void start_sampling_profiler(fixnum rate);
195 void end_sampling_profiler();
196 void set_sampling_profiler(fixnum rate);
197 void primitive_sampling_profiler();
198 void primitive_get_samples();
201 void general_error(vm_error_type error, cell arg1, cell arg2);
202 void type_error(cell type, cell tagged);
203 void not_implemented_error();
204 void set_memory_protection_error(cell fault_addr, cell fault_pc);
205 void divide_by_zero_error();
206 void primitive_unimplemented();
209 int bignum_equal_p(bignum* x, bignum* y);
210 enum bignum_comparison bignum_compare(bignum* x, bignum* y);
211 bignum* bignum_add(bignum* x, bignum* y);
212 bignum* bignum_subtract(bignum* x, bignum* y);
213 bignum* bignum_square(bignum* x_);
214 bignum* bignum_multiply(bignum* x, bignum* y);
215 void bignum_divide(bignum* numerator, bignum* denominator, bignum** quotient,
217 bignum* bignum_quotient(bignum* numerator, bignum* denominator);
218 bignum* bignum_remainder(bignum* numerator, bignum* denominator);
219 fixnum bignum_to_fixnum_strict(bignum* bn);
220 bignum* double_to_bignum(double x);
221 int bignum_equal_p_unsigned(bignum* x, bignum* y);
222 enum bignum_comparison bignum_compare_unsigned(bignum* x, bignum* y);
223 bignum* bignum_add_unsigned(bignum* x_, bignum* y_, int negative_p);
224 bignum* bignum_subtract_unsigned(bignum* x_, bignum* y_);
225 bignum* bignum_multiply_unsigned(bignum* x_, bignum* y_, int negative_p);
226 bignum* bignum_multiply_unsigned_small_factor(bignum* x, bignum_digit_type y,
228 void bignum_destructive_add(bignum* bn, bignum_digit_type n);
229 void bignum_destructive_scale_up(bignum* bn, bignum_digit_type factor);
230 void bignum_divide_unsigned_large_denominator(
231 bignum* numerator_, bignum* denominator_, bignum** quotient,
232 bignum** remainder, int q_negative_p, int r_negative_p);
233 void bignum_divide_unsigned_normalized(bignum* u, bignum* v, bignum* q);
234 bignum_digit_type bignum_divide_subtract(bignum_digit_type* v_start,
235 bignum_digit_type* v_end,
236 bignum_digit_type guess,
237 bignum_digit_type* u_start);
238 void bignum_divide_unsigned_medium_denominator(
239 bignum* numerator_, bignum_digit_type denominator, bignum** quotient,
240 bignum** remainder, int q_negative_p, int r_negative_p);
241 void bignum_destructive_normalization(bignum* source, bignum* target,
243 void bignum_destructive_unnormalization(bignum* bn, int shift_right);
244 bignum_digit_type bignum_digit_divide(
245 bignum_digit_type uh, bignum_digit_type ul, bignum_digit_type v,
246 bignum_digit_type* q); // return value
247 bignum_digit_type bignum_digit_divide_subtract(bignum_digit_type v1,
248 bignum_digit_type v2,
249 bignum_digit_type guess,
250 bignum_digit_type* u);
251 void bignum_divide_unsigned_small_denominator(
252 bignum* numerator_, bignum_digit_type denominator, bignum** quotient,
253 bignum** remainder, int q_negative_p, int r_negative_p);
254 bignum_digit_type bignum_destructive_scale_down(
255 bignum* bn, bignum_digit_type denominator);
256 bignum* bignum_remainder_unsigned_small_denominator(bignum* n,
259 bignum* bignum_digit_to_bignum(bignum_digit_type digit, int negative_p);
260 bignum* allot_bignum(bignum_length_type length, int negative_p);
261 bignum* allot_bignum_zeroed(bignum_length_type length, int negative_p);
262 bignum* bignum_shorten_length(bignum* bn, bignum_length_type length);
263 bignum* bignum_trim(bignum* bn);
264 bignum* bignum_new_sign(bignum* x_, int negative_p);
265 bignum* bignum_maybe_new_sign(bignum* x_, int negative_p);
266 void bignum_destructive_copy(bignum* source, bignum* target);
267 bignum* bignum_bitwise_not(bignum* x_);
268 bignum* bignum_arithmetic_shift(bignum* arg1, fixnum n);
269 bignum* bignum_bitwise_and(bignum* arg1, bignum* arg2);
270 bignum* bignum_bitwise_ior(bignum* arg1, bignum* arg2);
271 bignum* bignum_bitwise_xor(bignum* arg1, bignum* arg2);
272 bignum* bignum_magnitude_ash(bignum* arg1_, fixnum n);
273 bignum* bignum_pospos_bitwise_op(int op, bignum* arg1_, bignum* arg2_);
274 bignum* bignum_posneg_bitwise_op(int op, bignum* arg1_, bignum* arg2_);
275 bignum* bignum_negneg_bitwise_op(int op, bignum* arg1_, bignum* arg2_);
276 void bignum_negate_magnitude(bignum* arg);
277 bignum* bignum_integer_length(bignum* x_);
278 int bignum_logbitp(int shift, bignum* arg);
279 int bignum_unsigned_logbitp(int shift, bignum* bn);
280 bignum* bignum_gcd(bignum* a_, bignum* b_);
283 void set_data_heap(data_heap* data_);
284 void primitive_size();
285 data_heap_room data_room();
286 void primitive_data_room();
287 cell instances(cell type);
288 void primitive_all_instances();
290 template <typename Generation, typename Iterator>
291 inline void each_object(Generation* gen, Iterator& iterator) {
292 cell obj = gen->first_object();
294 iterator((object*)obj);
295 obj = gen->next_object_after(obj);
299 template <typename Iterator> inline void each_object(Iterator& iterator) {
301 // The nursery can't be iterated because there may be gaps between
302 // the objects (see factor_vm::reallot_array) so we require it to
304 FACTOR_ASSERT(data->nursery->occupied_space() == 0);
307 each_object(data->tenured, iterator);
308 each_object(data->aging, iterator);
312 template <typename Iterator>
313 inline void each_object_each_slot(Iterator& iterator) {
314 auto each_object_func = [&](object* obj) {
315 auto each_slot_func = [&](cell* slot) {
318 obj->each_slot(each_slot_func);
320 each_object(each_object_func);
323 // the write barrier must be called any time we are potentially storing a
324 // pointer from an older generation to a younger one
325 inline void write_barrier(cell* slot_ptr) {
326 *(unsigned char*)(cards_offset + ((cell)slot_ptr >> card_bits)) = card_mark_mask;
327 *(unsigned char*)(decks_offset + ((cell)slot_ptr >> deck_bits)) = card_mark_mask;
330 inline void write_barrier(object* obj, cell size) {
331 cell start = (cell)obj & (~card_size + 1);
332 cell end = ((cell)obj + size + card_size - 1) & (~card_size + 1);
334 for (cell offset = start; offset < end; offset += card_size)
335 write_barrier((cell*)offset);
339 void check_data_heap();
342 void set_current_gc_op(gc_op op);
343 void start_gc_again();
344 void collect_nursery();
345 void collect_aging();
346 void collect_to_tenured();
347 void update_code_roots_for_compaction();
348 void collect_mark_impl();
349 void collect_sweep_impl();
351 void collect_compact_impl();
352 void collect_compact();
353 void collect_growing_data_heap(cell requested_size);
354 void gc(gc_op op, cell requested_size);
355 void primitive_minor_gc();
356 void primitive_full_gc();
357 void primitive_compact_gc();
358 void primitive_enable_gc_events();
359 void primitive_disable_gc_events();
360 object* allot_object(cell type, cell size);
361 object* allot_large_object(cell type, cell size);
364 template <typename Type> Type* allot(cell size) {
365 return (Type*)allot_object(Type::type_number, size);
369 template <typename Array> Array* allot_uninitialized_array(cell capacity);
370 template <typename Array>
371 bool reallot_array_in_place_p(Array* array, cell capacity);
372 template <typename Array> Array* reallot_array(Array* array_, cell capacity);
375 void print_chars(ostream& out, string* str);
376 void print_word(ostream& out, word* word, cell nesting);
377 void print_factor_string(ostream& out, string* str);
378 void print_array(ostream& out, array* array, cell nesting);
379 void print_byte_array(ostream& out, byte_array* array, cell nesting);
380 void print_tuple(ostream& out, tuple* tuple, cell nesting);
381 void print_alien(ostream& out, alien* alien, cell nesting);
382 void print_nested_obj(ostream& out, cell obj, fixnum nesting);
383 void print_obj(ostream& out, cell obj);
384 void print_objects(ostream& out, cell* start, cell* end);
385 void print_datastack(ostream& out);
386 void print_retainstack(ostream& out);
387 void print_callstack(ostream& out);
388 void print_callstack_object(ostream& out, callstack* obj);
389 void dump_cell(ostream& out, cell x);
390 void dump_memory(ostream& out, cell from, cell to);
391 void dump_memory_layout(ostream& out);
392 void dump_objects(ostream& out, cell type);
393 void dump_edges(ostream& out);
394 void find_data_references(ostream& out, cell look_for_);
395 void dump_code_heap(ostream& out);
396 void factorbug_usage(bool advanced_p);
398 void primitive_die();
399 void primitive_enable_ctrl_break();
400 void primitive_disable_ctrl_break();
403 inline void set_array_nth(array* array, cell slot, cell value);
404 array* allot_array(cell capacity, cell fill_);
405 void primitive_array();
406 cell allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_);
407 void primitive_resize_array();
408 cell std_vector_to_array(std::vector<cell>& elements);
411 string* allot_string_internal(cell capacity);
412 void fill_string(string* str_, cell start, cell capacity, cell fill);
413 string* allot_string(cell capacity, cell fill);
414 void primitive_string();
415 bool reallot_string_in_place_p(string* str, cell capacity);
416 string* reallot_string(string* str_, cell capacity);
417 void primitive_resize_string();
418 void primitive_set_string_nth_fast();
421 cell tag_boolean(cell untagged) {
422 return untagged ? special_objects[OBJ_CANONICAL_TRUE] : false_object;
426 byte_array* allot_byte_array(cell size);
427 void primitive_byte_array();
428 void primitive_uninitialized_byte_array();
429 void primitive_resize_byte_array();
431 template <typename Type> byte_array* byte_array_from_value(Type* value);
434 void primitive_tuple();
435 void primitive_tuple_boa();
438 word* allot_word(cell name_, cell vocab_, cell hashcode_);
439 void primitive_word();
440 void primitive_word_code();
441 void primitive_word_optimized_p();
442 void primitive_wrapper();
443 void jit_compile_word(cell word_, cell def_, bool relocating);
446 void primitive_bignum_to_fixnum();
447 void primitive_bignum_to_fixnum_strict();
448 void primitive_float_to_fixnum();
449 void primitive_fixnum_divint();
450 void primitive_fixnum_divmod();
451 bignum* fixnum_to_bignum(fixnum);
452 bignum* cell_to_bignum(cell);
453 bignum* long_long_to_bignum(int64_t n);
454 bignum* ulong_long_to_bignum(uint64_t n);
455 inline fixnum sign_mask(fixnum x);
456 inline fixnum branchless_max(fixnum x, fixnum y);
457 inline fixnum branchless_abs(fixnum x);
458 void primitive_fixnum_shift();
459 void primitive_fixnum_to_bignum();
460 void primitive_float_to_bignum();
461 void primitive_bignum_eq();
462 void primitive_bignum_add();
463 void primitive_bignum_subtract();
464 void primitive_bignum_multiply();
465 void primitive_bignum_divint();
466 void primitive_bignum_divmod();
467 void primitive_bignum_mod();
468 void primitive_bignum_gcd();
469 void primitive_bignum_and();
470 void primitive_bignum_or();
471 void primitive_bignum_xor();
472 void primitive_bignum_shift();
473 void primitive_bignum_less();
474 void primitive_bignum_lesseq();
475 void primitive_bignum_greater();
476 void primitive_bignum_greatereq();
477 void primitive_bignum_not();
478 void primitive_bignum_bitp();
479 void primitive_bignum_log2();
480 inline cell unbox_array_size();
481 void primitive_fixnum_to_float();
482 void primitive_format_float();
483 void primitive_float_eq();
484 void primitive_float_add();
485 void primitive_float_subtract();
486 void primitive_float_multiply();
487 void primitive_float_divfloat();
488 void primitive_float_less();
489 void primitive_float_lesseq();
490 void primitive_float_greater();
491 void primitive_float_greatereq();
492 void primitive_float_bits();
493 void primitive_bits_float();
494 void primitive_double_bits();
495 void primitive_bits_double();
496 fixnum to_fixnum(cell tagged);
497 fixnum to_fixnum_strict(cell tagged);
498 cell to_cell(cell tagged);
499 cell from_signed_8(int64_t n);
500 int64_t to_signed_8(cell obj);
501 cell from_unsigned_8(uint64_t n);
502 uint64_t to_unsigned_8(cell obj);
503 float to_float(cell value);
504 double to_double(cell value);
505 inline void overflow_fixnum_add(fixnum x, fixnum y);
506 inline void overflow_fixnum_subtract(fixnum x, fixnum y);
507 inline void overflow_fixnum_multiply(fixnum x, fixnum y);
508 inline cell from_signed_cell(fixnum x);
509 inline cell from_unsigned_cell(cell x);
510 inline cell allot_float(double n);
511 inline bignum* float_to_bignum(cell tagged);
512 inline double untag_float(cell tagged);
513 inline double untag_float_check(cell tagged);
514 inline fixnum float_to_fixnum(cell tagged);
515 inline double fixnum_to_float(cell tagged);
518 template <typename Type> void check_tagged(tagged<Type> t) {
520 type_error(Type::type_number, t.value_);
523 template <typename Type> Type* untag_check(cell value) {
524 tagged<Type> t(value);
531 void io_error_if_not_EINTR();
532 FILE* safe_fopen(char* filename, const char* mode);
533 int safe_fgetc(FILE* stream);
534 size_t safe_fread(void* ptr, size_t size, size_t nitems, FILE* stream);
535 void safe_fputc(int c, FILE* stream);
536 size_t safe_fwrite(void* ptr, size_t size, size_t nitems, FILE* stream);
537 int safe_ftell(FILE* stream);
538 void safe_fseek(FILE* stream, off_t offset, int whence);
539 void safe_fflush(FILE* stream);
540 void primitive_fopen();
541 FILE* pop_file_handle();
542 FILE* peek_file_handle();
543 void primitive_fgetc();
544 void primitive_fread();
545 void primitive_fputc();
546 void primitive_fwrite();
547 void primitive_ftell();
548 void primitive_fseek();
549 void primitive_fflush();
550 void primitive_fclose();
553 cell compute_entry_point_pic_address(word* w, cell tagged_quot);
554 cell compute_entry_point_pic_address(cell w_);
555 cell compute_entry_point_pic_tail_address(cell w_);
556 cell compute_external_address(instruction_operand op);
558 void update_word_references(code_block* compiled, bool reset_inline_caches);
559 void undefined_symbol();
560 cell compute_dlsym_address(array* literals, cell index, bool toc);
561 cell lookup_external_address(relocation_type rel_type,
562 code_block* compiled,
565 void initialize_code_block(code_block* compiled, cell literals);
566 void initialize_code_block(code_block* compiled);
567 void fixup_labels(array* labels, code_block* compiled);
568 code_block* allot_code_block(cell size, code_block_type type);
569 code_block* add_code_block(code_block_type type, cell code_, cell labels_,
570 cell owner_, cell relocation_, cell parameters_,
571 cell literals_, cell frame_size_untagged);
574 template <typename Iterator> void each_code_block(Iterator& iter) {
575 code->allocator->iterate(iter, no_fixup());
578 void update_code_heap_words(bool reset_inline_caches);
579 void primitive_modify_code_heap();
580 void primitive_code_room();
581 void primitive_strip_stack_traces();
582 void primitive_code_blocks();
585 void primitive_free_callback();
586 void primitive_callback();
587 void primitive_callback_room();
590 void load_data_heap(FILE* file, image_header* h, vm_parameters* p);
591 void load_code_heap(FILE* file, image_header* h, vm_parameters* p);
592 bool save_image(const vm_char* saving_filename, const vm_char* filename);
593 void primitive_save_image();
594 void fixup_heaps(cell data_offset, cell code_offset);
595 void load_image(vm_parameters* p);
596 bool read_embedded_image_footer(FILE* file, embedded_image_footer* footer);
597 bool embedded_image_p();
599 template <typename Iterator, typename Fixup>
600 void iterate_callstack_object(callstack* stack_, Iterator& iterator,
602 template <typename Iterator>
603 void iterate_callstack_object(callstack* stack_, Iterator& iterator);
605 callstack* allot_callstack(cell size);
606 cell second_from_top_stack_frame(context* ctx);
607 cell capture_callstack(context* ctx);
608 void primitive_callstack_for();
609 void primitive_callstack_to_array();
610 void primitive_innermost_stack_frame_executing();
611 void primitive_innermost_stack_frame_scan();
612 void primitive_set_innermost_stack_frame_quotation();
613 void primitive_callstack_bounds();
615 template <typename Iterator, typename Fixup>
616 void iterate_callstack(context* ctx, Iterator& iterator, Fixup& fixup);
617 template <typename Iterator>
618 void iterate_callstack(context* ctx, Iterator& iterator);
621 void dispatch_signal_handler(cell* sp, cell* pc, cell newpc);
622 #if defined(FACTOR_X86) || defined(FACTOR_64)
623 void dispatch_non_resumable_signal(cell* sp, cell* pc,
626 void dispatch_resumable_signal(cell* sp, cell* pc, cell handler);
630 char* pinned_alien_offset(cell obj);
631 cell allot_alien(cell delegate_, cell displacement);
632 cell allot_alien(cell address);
633 void primitive_displaced_alien();
634 void primitive_alien_address();
635 void* alien_pointer();
636 void primitive_dlopen();
637 void primitive_dlsym();
638 void primitive_dlsym_raw();
639 void primitive_dlclose();
640 void primitive_dll_validp();
641 char* alien_offset(cell obj);
644 void primitive_jit_compile();
645 cell lazy_jit_compile_entry_point();
646 void primitive_array_to_quotation();
647 void primitive_quotation_code();
648 code_block* jit_compile_quotation(cell owner_, cell quot_, bool relocating);
649 void jit_compile_quotation(cell quot_, bool relocating);
650 fixnum quot_code_offset_to_scan(cell quot_, cell offset);
651 cell lazy_jit_compile(cell quot);
652 bool quotation_compiled_p(quotation* quot);
653 void primitive_quotation_compiled_p();
656 cell lookup_tuple_method(cell obj, cell methods);
657 cell lookup_method(cell obj, cell methods);
658 void primitive_lookup_method();
659 cell object_class(cell obj);
660 void update_method_cache(cell cache, cell klass, cell method);
661 void primitive_mega_cache_miss();
662 void primitive_reset_dispatch_stats();
663 void primitive_dispatch_stats();
666 void deallocate_inline_cache(cell return_address);
667 void update_pic_count(cell type);
668 cell add_inline_cache_entry(cell cache_entries_, cell klass_, cell method_);
669 void update_pic_transitions(cell pic_size);
670 cell inline_cache_miss(cell return_address);
673 void c_to_factor(cell quot);
674 void unwind_native_frames(cell quot, cell to);
675 cell get_fpu_state();
676 void set_fpu_state(cell state);
679 void handle_safepoint(cell pc);
680 void enqueue_samples(cell samples, cell pc, bool foreign_thread_p);
684 void prepare_boot_image();
685 void init_factor(vm_parameters* p);
686 void pass_args_to_factor(int argc, vm_char** argv);
688 void start_embedded_factor(vm_parameters* p);
689 void start_standalone_factor(int argc, vm_char** argv);
690 char* factor_eval_string(char* string);
691 void factor_eval_free(char* result);
693 void factor_sleep(long us);
696 void primitive_existsp();
698 void ffi_dlopen(dll* dll);
699 cell ffi_dlsym(dll* dll, symbol_char* symbol);
700 cell ffi_dlsym_raw(dll* dll, symbol_char* symbol);
701 void ffi_dlclose(dll* dll);
702 void c_to_factor_toplevel(cell quot);
704 void start_sampling_profiler_timer();
705 void end_sampling_profiler_timer();
709 /* Id of the main thread we run in. Used for Ctrl-Break handling. */
712 HANDLE ctrl_break_thread;
714 HANDLE sampler_thread;
715 void sampler_thread_loop();
717 const vm_char* vm_executable_path();
718 const vm_char* default_image_path();
719 BOOL windows_stat(vm_char* path);
721 LONG exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c,
725 void dispatch_signal(void* uap, void(handler)());
726 void unix_init_signals();
730 void call_fault_handler(exception_type_t exception,
731 exception_data_type_t code,
732 MACH_EXC_STATE_TYPE* exc_state,
733 MACH_THREAD_STATE_TYPE* thread_state,
734 MACH_FLOAT_STATE_TYPE* float_state);
737 factor_vm(THREADHANDLE thread_id);