cell signal_handler_addr;
// are we handling a memory error? used to detect double faults
- cell faulting_p;
+ bool faulting_p;
// Various special objects, accessed by special-object and
// set-special-object primitives
c_to_factor_func_type c_to_factor_func;
// Is profiling enabled?
- volatile cell sampling_profiler_p;
+ volatile bool sampling_profiler_p;
fixnum samples_per_second;
// Global variables used to pass fault handler state from signal handler
// State kept by the sampling profiler
std::vector<profiling_sample> samples;
- std::vector<cell> sample_callstacks;
- volatile profiling_sample_count sample_counts;
+ volatile profiling_sample current_sample;
// GC is off during heap walking
bool gc_off;
// Only set if we're performing a GC
gc_state* current_gc;
- volatile cell current_gc_p;
+ volatile bool current_gc_p;
// Set if we're in the jit
volatile fixnum current_jit_count;
static bool fatal_erroring_p;
// Two fep_p variants, one might be redundant.
- volatile cell safepoint_fep_p;
+ volatile bool safepoint_fep_p;
+
+ // Allow Ctrl-Break a busy loop in the Listener, only used on Windows
+ volatile bool stop_on_ctrl_break;
// contexts
context* new_context();
void init_context(context* ctx);
void delete_context();
- void init_contexts(cell datastack_size_, cell retainstack_size_,
- cell callstack_size_);
cell begin_callback(cell quot);
void end_callback();
void primitive_current_callback();
void primitive_datastack_for();
cell retainstack_to_array(context* ctx);
void primitive_retainstack_for();
- cell array_to_stack(array* array, cell bottom);
void primitive_set_datastack();
void primitive_set_retainstack();
void primitive_check_datastack();
void primitive_set_special_object();
void primitive_identity_hashcode();
void primitive_compute_identity_hashcode();
- cell clone_object(cell obj_);
void primitive_clone();
void primitive_become();
void record_sample(bool prolog_p);
void start_sampling_profiler(fixnum rate);
void end_sampling_profiler();
- void set_sampling_profiler(fixnum rate);
- void primitive_sampling_profiler();
+ void set_profiling(fixnum rate);
+ void primitive_set_profiling();
void primitive_get_samples();
+ array* allot_growarr();
+ void growarr_add(array *growarr_, cell value);
// errors
void general_error(vm_error_type error, cell arg1, cell arg2);
void type_error(cell type, cell tagged);
- void not_implemented_error();
void set_memory_protection_error(cell fault_addr, cell fault_pc);
void divide_by_zero_error();
- void primitive_unimplemented();
// bignum
int bignum_equal_p(bignum* x, bignum* y);
//data heap
void set_data_heap(data_heap* data_);
- void init_data_heap(cell young_size, cell aging_size, cell tenured_size);
void primitive_size();
data_heap_room data_room();
void primitive_data_room();
void collect_nursery();
void collect_aging();
void collect_to_tenured();
- void update_code_roots_for_sweep();
void update_code_roots_for_compaction();
void collect_mark_impl();
void collect_sweep_impl();
void collect_full();
void collect_compact_impl();
void collect_compact();
- void collect_growing_heap(cell requested_size);
+ void collect_growing_data_heap(cell requested_size);
void gc(gc_op op, cell requested_size);
void primitive_minor_gc();
void primitive_full_gc();
void factorbug_usage(bool advanced_p);
void factorbug();
void primitive_die();
+ void primitive_enable_ctrl_break();
+ void primitive_disable_ctrl_break();
// arrays
inline void set_array_nth(array* array, cell slot, cell value);
}
// io
- void init_c_io();
void io_error_if_not_EINTR();
FILE* safe_fopen(char* filename, const char* mode);
int safe_fgetc(FILE* stream);
size_t safe_fread(void* ptr, size_t size, size_t nitems, FILE* stream);
void safe_fputc(int c, FILE* stream);
size_t safe_fwrite(void* ptr, size_t size, size_t nitems, FILE* stream);
- int safe_ftell(FILE* stream);
+ off_t safe_ftell(FILE* stream);
void safe_fseek(FILE* stream, off_t offset, int whence);
void safe_fflush(FILE* stream);
void primitive_fopen();
// inline cache
void deallocate_inline_cache(cell return_address);
void update_pic_count(cell type);
- code_block* compile_inline_cache(fixnum index, cell generic_word_,
- cell methods_, cell cache_entries_,
- bool tail_call_p);
cell add_inline_cache_entry(cell cache_entries_, cell klass_, cell method_);
void update_pic_transitions(cell pic_size);
cell inline_cache_miss(cell return_address);
void init_factor(vm_parameters* p);
void pass_args_to_factor(int argc, vm_char** argv);
void stop_factor();
- void start_embedded_factor(vm_parameters* p);
void start_standalone_factor(int argc, vm_char** argv);
char* factor_eval_string(char* string);
void factor_eval_free(char* result);
// os-windows
#if defined(WINDOWS)
+ /* Id of the main thread we run in. Used for Ctrl-Break handling. */
+ DWORD thread_id;
+
+ HANDLE ctrl_break_thread;
+
HANDLE sampler_thread;
void sampler_thread_loop();