2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								namespace factor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-15 06:51:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct growable_array;
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-02 19:10:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct code_root;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-15 06:51:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct factor_vm
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 15:09:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-25 02:46:34 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									//
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// vvvvvv
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR. See:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									//   basis/vm/vm.factor
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									//   basis/compiler/constants/constants.factor
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Current context */
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 12:39:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									context *ctx;
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Spare context -- for callbacks */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									context *spare_ctx;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* New objects are allocated here */
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									nursery_space nursery;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Add this to a shifted address to compute write barrier offsets */
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 15:09:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell cards_offset;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell decks_offset;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-03 14:41:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-25 02:46:34 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* cdecl signal handler address, used by signal handler subprimitives */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell signal_handler_addr;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-12 15:57:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* are we handling a memory error? used to detect double faults */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell faulting_p;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-18 05:06:00 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Various special objects, accessed by special-object and
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									set-special-object primitives */
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-23 01:33:53 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell special_objects[special_object_count];
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-25 02:46:34 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// ^^^^^^
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									//
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-07 15:51:49 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Handle to the main thread we run in */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									THREADHANDLE thread;
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-03 00:18:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Data stack and retain stack sizes */
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell datastack_size, retainstack_size, callstack_size;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Stack of callback IDs */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::vector<int> callback_ids;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Next callback ID */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int callback_id;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-05-20 18:11:50 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* List of callback function descriptors for PPC */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::list<void **> function_descriptors;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Pooling unused contexts to make context allocation cheaper */
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-17 23:52:27 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									std::list<context *> unused_contexts;
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Active contexts, for tracing by the GC */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::set<context *> active_contexts;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 15:09:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-18 21:26:21 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Canonical truth value. In Factor, 't' */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell true_object;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-05 21:47:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* External entry points */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									c_to_factor_func_type c_to_factor_func;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Is profiling enabled? */
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-02 00:00:46 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									volatile cell sampling_profiler_p;
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-01 00:46:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									fixnum samples_per_second;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-02 23:55:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Global variables used to pass fault handler state from signal handler
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									to VM */
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-25 18:42:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool signal_resumable;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell signal_number;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell signal_fault_addr;
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-17 20:13:59 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell signal_fault_pc;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									unsigned int signal_fpu_status;
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-07 15:51:49 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Pipe used to notify Factor multiplexer of signals */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int signal_pipe_input, signal_pipe_output;
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* State kept by the sampling profiler */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::vector<profiling_sample> samples;
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-01 21:53:37 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									std::vector<cell> sample_callstacks;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* GC is off during heap walking */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool gc_off;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Data heap */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									data_heap *data;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:40:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Code heap */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									code_heap *code;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 12:39:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Pinned callback stubs */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									callback_heap *callbacks;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Only set if we're performing a GC */
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-02 00:01:40 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									gc_state *current_gc;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									volatile cell current_gc_p;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Set if we're in the jit */
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-02 02:40:46 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									volatile fixnum current_jit_count;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-23 19:51:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Mark stack */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::vector<cell> mark_stack;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 04:32:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* If not NULL, we push GC events here */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::vector<gc_event> *gc_events;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* If a runtime function needs to call another function which potentially
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-02 19:10:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									   allocates memory, it must wrap any references to the data and code
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									   heaps with data_root and code_root smart pointers, which register
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									   themselves here. See data_roots.hpp and code_roots.hpp */
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-06 06:30:37 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									std::vector<data_root_range> data_roots;
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-02 19:10:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									std::vector<cell> bignum_roots;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									std::vector<code_root *> code_roots;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Debugger */
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-21 00:00:25 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool fep_p;
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-31 20:38:42 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool fep_help_was_shown;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool fep_disabled;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool full_output;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Canonical bignums */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell bignum_zero;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell bignum_pos_one;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell bignum_neg_one;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Method dispatch statistics */
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 02:07:59 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									dispatch_statistics dispatch_stats;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									/* Number of entries in a polymorphic inline cache */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell max_pic_size;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-11 01:50:57 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Incrementing object counter for identity hashing */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell object_counter;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-14 02:09:04 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Sanity check to ensure that monotonic counter doesn't
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									decrease */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									u64 last_nano_count;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Stack for signal handlers, only used on Unix */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									segment *signal_callstack_seg;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-01 21:22:46 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Are we already handling a fault? Used to catch double memory faults */
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-11 16:29:46 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									static bool fatal_erroring_p;
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-01 21:22:46 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-07 15:51:49 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* Safepoint state */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									volatile safepoint_state safepoint;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-07 09:33:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// contexts
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									context *new_context();
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-01 22:12:45 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_context(context *ctx);
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void delete_context(context *old_context);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void init_contexts(cell datastack_size_, cell retainstack_size_, cell callstack_size_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void delete_contexts();
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-01 22:12:45 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell begin_callback(cell quot);
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void end_callback();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_current_callback();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-18 05:06:00 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_context_object();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_context_object_for();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-18 05:06:00 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_set_context_object();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell stack_to_array(cell bottom, cell top);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell datastack_to_array(context *ctx);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_datastack();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_datastack_for();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell retainstack_to_array(context *ctx);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_retainstack();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_retainstack_for();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell array_to_stack(array *array, cell bottom);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void set_datastack(context *ctx, array *array);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_set_datastack();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void set_retainstack(context *ctx, array *array);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_set_retainstack();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_check_datastack();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_load_locals();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 17:18:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator, typename Fixup>
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 18:00:02 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void iterate_active_callstacks(Iterator &iter, Fixup &fixup)
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 17:18:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										std::set<context *>::const_iterator begin = active_contexts.begin();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										std::set<context *>::const_iterator end = active_contexts.end();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										while(begin != end)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 18:00:02 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											iterate_callstack(*begin++,iter,fixup);
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 17:18:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// run
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_exit();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-18 16:58:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_nano_count();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_sleep();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_set_slot();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// objects
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_special_object();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_set_special_object();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-10 22:06:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_identity_hashcode();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-11 01:50:57 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void compute_identity_hashcode(object *obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_compute_identity_hashcode();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell object_size(cell tagged);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell clone_object(cell obj_);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_clone();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_become();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 19:00:47 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// sampling_profiler
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-30 21:41:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void clear_samples();
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-17 20:13:59 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void record_sample(bool prolog_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void record_callstack_sample(cell *begin, cell *end, bool prolog_p);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-01 00:46:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void start_sampling_profiler(fixnum rate);
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void end_sampling_profiler();
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-01 00:46:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void set_sampling_profiler(fixnum rate);
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_sampling_profiler();
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-31 01:30:55 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_get_samples();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_clear_samples();
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// errors
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-27 07:33:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void general_error(vm_error_type error, cell arg1, cell arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void type_error(cell type, cell tagged);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void not_implemented_error();
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-11 16:29:46 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void verify_memory_protection_error(cell addr);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-17 20:13:59 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void memory_protection_error(cell pc, cell addr);
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-02 23:55:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void signal_error(cell signal);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void divide_by_zero_error();
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-02 23:55:52 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void fp_trap_error(unsigned int fpu_status);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_unimplemented();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void memory_signal_handler_impl();
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-19 18:39:44 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void synchronous_signal_handler_impl();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void fp_signal_handler_impl();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// bignum
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int bignum_equal_p(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									enum bignum_comparison bignum_compare(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_add(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_subtract(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_multiply(bignum * x, bignum * y);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_divide(bignum * numerator, bignum * denominator, bignum * * quotient, bignum * * remainder);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_quotient(bignum * numerator, bignum * denominator);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_remainder(bignum * numerator, bignum * denominator);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell bignum_to_cell(bignum * bignum);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									fixnum bignum_to_fixnum(bignum * bignum);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									s64 bignum_to_long_long(bignum * bignum);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									u64 bignum_to_ulong_long(bignum * bignum);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bignum *double_to_bignum(double x);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int bignum_equal_p_unsigned(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									enum bignum_comparison bignum_compare_unsigned(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_add_unsigned(bignum * x, bignum * y, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_subtract_unsigned(bignum * x, bignum * y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_multiply_unsigned(bignum * x, bignum * y, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_multiply_unsigned_small_factor(bignum * x, bignum_digit_type y,int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void bignum_destructive_add(bignum * bignum, bignum_digit_type n);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void bignum_destructive_scale_up(bignum * bignum, bignum_digit_type factor);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_divide_unsigned_large_denominator(bignum * numerator, bignum * denominator,
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-06 02:06:26 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
															bignum * * quotient, bignum * * remainder, int q_negative_p, int r_negative_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_divide_unsigned_normalized(bignum * u, bignum * v, bignum * q);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bignum_digit_type bignum_divide_subtract(bignum_digit_type * v_start, bignum_digit_type * v_end,
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-20 01:47:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
															bignum_digit_type guess, bignum_digit_type * u_start);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_divide_unsigned_medium_denominator(bignum * numerator,bignum_digit_type denominator,
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-06 02:06:26 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
															bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_destructive_normalization(bignum * source, bignum * target, int shift_left);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_destructive_unnormalization(bignum * bignum, int shift_right);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bignum_digit_type bignum_digit_divide(bignum_digit_type uh, bignum_digit_type ul,
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-06 02:06:26 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
															bignum_digit_type v, bignum_digit_type * q) /* return value */;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bignum_digit_type bignum_digit_divide_subtract(bignum_digit_type v1, bignum_digit_type v2,
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-06 02:06:26 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
															bignum_digit_type guess, bignum_digit_type * u);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void bignum_divide_unsigned_small_denominator(bignum * numerator, bignum_digit_type denominator,
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-06 02:06:26 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
															bignum * * quotient, bignum * * remainder,int q_negative_p, int r_negative_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bignum_digit_type bignum_destructive_scale_down(bignum * bignum, bignum_digit_type denominator);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum * bignum_remainder_unsigned_small_denominator(bignum * n, bignum_digit_type d, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_digit_to_bignum(bignum_digit_type digit, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *allot_bignum(bignum_length_type length, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum * allot_bignum_zeroed(bignum_length_type length, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_shorten_length(bignum * bignum, bignum_length_type length);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_trim(bignum * bignum);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_new_sign(bignum * x, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_maybe_new_sign(bignum * x, int negative_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void bignum_destructive_copy(bignum * source, bignum * target);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_bitwise_not(bignum * x);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_arithmetic_shift(bignum * arg1, fixnum n);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_bitwise_and(bignum * arg1, bignum * arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_bitwise_ior(bignum * arg1, bignum * arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_bitwise_xor(bignum * arg1, bignum * arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_magnitude_ash(bignum * arg1, fixnum n);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_pospos_bitwise_op(int op, bignum * arg1, bignum * arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_posneg_bitwise_op(int op, bignum * arg1, bignum * arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_negneg_bitwise_op(int op, bignum * arg1, bignum * arg2);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void bignum_negate_magnitude(bignum * arg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *bignum_integer_length(bignum * x);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int bignum_logbitp(int shift, bignum * arg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int bignum_unsigned_logbitp(int shift, bignum * bignum);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									//data heap
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_card_decks();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void set_data_heap(data_heap *data_);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-01 04:47:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_data_heap(cell young_size, cell aging_size, cell tenured_size);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_size();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 22:31:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									data_heap_room data_room();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_data_room();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void begin_scan();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void end_scan();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 22:49:03 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell instances(cell type);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_all_instances();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Generation, typename Iterator>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline void each_object(Generation *gen, Iterator &iterator)
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-31 22:06:34 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										cell obj = gen->first_object();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										while(obj)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										{
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 22:49:03 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											iterator((object *)obj);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											obj = gen->next_object_after(obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator> inline void each_object(Iterator &iterator)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										gc_off = true;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										each_object(data->tenured,iterator);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										each_object(data->aging,iterator);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										each_object(data->nursery,iterator);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										gc_off = false;
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-31 22:06:34 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-28 14:02:51 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									/* the write barrier must be called any time we are potentially storing a
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									   pointer from an older generation to a younger one */
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-13 22:16:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline void write_barrier(cell *slot_ptr)
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-28 14:02:51 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-14 07:13:51 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										*(char *)(cards_offset + ((cell)slot_ptr >> card_bits)) = card_mark_mask;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										*(char *)(decks_offset + ((cell)slot_ptr >> deck_bits)) = card_mark_mask;
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-28 14:02:51 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline void write_barrier(object *obj, cell size)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-16 09:43:22 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										cell start = (cell)obj & (~card_size + 1);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cell end = ((cell)obj + size + card_size - 1) & (~card_size + 1);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-11 20:31:18 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for(cell offset = start; offset < end; offset += card_size)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											write_barrier((cell *)offset);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-05 20:03:51 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-11 20:31:18 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// data heap checker
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void check_data_heap();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// gc
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 04:32:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void end_gc();
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-04 16:21:45 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void set_current_gc_op(gc_op op);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 04:32:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void start_gc_again();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-15 23:31:41 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void update_code_heap_for_minor_gc(std::set<code_block *> *remembered_set);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 23:16:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_nursery();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void collect_aging();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_to_tenured();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-02 19:10:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void update_code_roots_for_sweep();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void update_code_roots_for_compaction();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-25 15:02:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_mark_impl(bool trace_contexts_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void collect_sweep_impl();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-03 23:25:22 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_full(bool trace_contexts_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-25 15:02:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_compact_impl(bool trace_contexts_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-01 05:40:15 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_compact_code_impl(bool trace_contexts_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-03 23:25:22 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_compact(bool trace_contexts_p);
							 | 
						
					
						
							
								
									
										
										
										
											2011-09-06 02:30:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void collect_growing_heap(cell requested_size, bool trace_contexts_p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void gc(gc_op op, cell requested_size, bool trace_contexts_p);
							 | 
						
					
						
							
								
									
										
										
										
											2010-06-11 20:06:00 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void scrub_context(context *ctx);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void scrub_contexts();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 05:33:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_minor_gc();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 12:39:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_full_gc();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 05:33:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_compact_gc();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 04:32:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_enable_gc_events();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_disable_gc_events();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-10 22:06:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									object *allot_object(cell type, cell size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									object *allot_large_object(cell type, cell size);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-03 09:47:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Type> Type *allot(cell size)
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-29 14:53:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-10 22:06:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return (Type *)allot_object(Type::type_number,size);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-29 14:53:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline void check_data_pointer(object *pointer)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									#ifdef FACTOR_DEBUG
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-15 06:51:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if(!(current_gc && current_gc->op == collect_growing_heap_op))
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-17 23:42:30 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											FACTOR_ASSERT(data->seg->in_segment_p((cell)pointer));
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-29 14:53:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// generic arrays
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-20 13:45:00 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Array> Array *allot_uninitialized_array(cell capacity);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-03 09:47:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Array> bool reallot_array_in_place_p(Array *array, cell capacity);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									template<typename Array> Array *reallot_array(Array *array_, cell capacity);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// debug
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void print_chars(string* str);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_word(word* word, cell nesting);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_factor_string(string* str);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_array(array* array, cell nesting);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-06 23:26:10 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void print_byte_array(byte_array *array, cell nesting);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void print_tuple(tuple *tuple, cell nesting);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-06 23:26:10 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void print_alien(alien *alien, cell nesting);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void print_nested_obj(cell obj, fixnum nesting);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_obj(cell obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_objects(cell *start, cell *end);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_datastack();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_retainstack();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void print_callstack();
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-20 17:38:01 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void print_callstack_object(callstack *obj);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void dump_cell(cell x);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dump_memory(cell from, cell to);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-20 23:20:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Generation> void dump_generation(const char *name, Generation *gen);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void dump_generations();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dump_objects(cell type);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-11 13:12:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void dump_edges();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void find_data_references(cell look_for_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dump_code_heap();
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void factorbug_usage(bool advanced_p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void factorbug();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_die();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// arrays
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-02 07:46:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline void set_array_nth(array *array, cell slot, cell value);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									array *allot_array(cell capacity, cell fill_);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_array();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell allot_array_1(cell obj_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell allot_array_2(cell v1_, cell v2_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_resize_array();
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-02 07:46:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell std_vector_to_array(std::vector<cell> &elements);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// strings
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									string *allot_string_internal(cell capacity);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void fill_string(string *str_, cell start, cell capacity, cell fill);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									string *allot_string(cell capacity, cell fill);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_string();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool reallot_string_in_place_p(string *str, cell capacity);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									string* reallot_string(string *str_, cell capacity);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_resize_string();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_set_string_nth_fast();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// booleans
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-18 16:59:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell tag_boolean(cell untagged)
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-02 01:48:41 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										return (untagged ? true_object : false_object);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// byte arrays
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									byte_array *allot_byte_array(cell size);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_byte_array();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_uninitialized_byte_array();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_resize_byte_array();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:06 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-01 04:47:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Type> byte_array *byte_array_from_value(Type *value);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 04:32:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// tuples
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_tuple();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_tuple_boa();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// words
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 22:09:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									word *allot_word(cell name_, cell vocab_, cell hashcode_);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_word();
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-18 02:51:27 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_word_code();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_optimized_p();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_wrapper();
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-15 07:20:09 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void jit_compile_word(cell word_, cell def_, bool relocating);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell find_all_words();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void compile_all_words();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// math
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_to_fixnum();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_to_fixnum();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fixnum_divint();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fixnum_divmod();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:13 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bignum *fixnum_to_bignum(fixnum);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *cell_to_bignum(cell);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *long_long_to_bignum(s64 n);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bignum *ulong_long_to_bignum(u64 n);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline fixnum sign_mask(fixnum x);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline fixnum branchless_max(fixnum x, fixnum y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline fixnum branchless_abs(fixnum x);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_fixnum_shift();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fixnum_to_bignum();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_to_bignum();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_eq();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_add();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_subtract();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_multiply();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_divint();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_divmod();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_mod();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_and();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_or();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_xor();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_shift();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_less();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_lesseq();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_greater();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_greatereq();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_not();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_bitp();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bignum_log2();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-31 03:30:48 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline cell unbox_array_size();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell unbox_array_size_slow();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_fixnum_to_float();
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-14 00:21:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_format_float();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_float_eq();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_add();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_subtract();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_multiply();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_divfloat();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_less();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_lesseq();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_greater();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_greatereq();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_float_bits();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bits_float();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_double_bits();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_bits_double();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									fixnum to_fixnum(cell tagged);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell to_cell(cell tagged);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-18 16:59:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell from_signed_8(s64 n);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									s64 to_signed_8(cell obj);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-18 16:59:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell from_unsigned_8(u64 n);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									u64 to_unsigned_8(cell obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									float to_float(cell value);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									double to_double(cell value);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-04 14:23:20 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline void overflow_fixnum_add(fixnum x, fixnum y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline void overflow_fixnum_subtract(fixnum x, fixnum y);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline void overflow_fixnum_multiply(fixnum x, fixnum y);
							 | 
						
					
						
							
								
									
										
										
										
											2010-07-19 10:09:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline cell from_signed_cell(fixnum x);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline cell from_unsigned_cell(cell x);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline cell allot_float(double n);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline bignum *float_to_bignum(cell tagged);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline double untag_float(cell tagged);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline double untag_float_check(cell tagged);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline fixnum float_to_fixnum(cell tagged);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									inline double fixnum_to_float(cell tagged);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-21 21:12:57 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// tagged
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-03 09:47:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Type> Type *untag_check(cell value);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// io
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_c_io();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void io_error();
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-05 00:52:55 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									FILE* safe_fopen(char *filename, char *mode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int safe_fgetc(FILE *stream);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-05 00:55:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									size_t safe_fread(void *ptr, size_t size, size_t nitems, FILE *stream);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-05 00:52:55 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void safe_fputc(int c, FILE* stream);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-05 00:55:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									size_t safe_fwrite(void *ptr, size_t size, size_t nitems, FILE *stream);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-05 00:52:55 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int safe_ftell(FILE *stream);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void safe_fseek(FILE *stream, off_t offset, int whence);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-05 00:55:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void safe_fflush(FILE *stream);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void safe_fclose(FILE *stream);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_fopen();
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-18 16:59:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									FILE *pop_file_handle();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_fgetc();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fread();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fputc();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fwrite();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-03 19:20:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_ftell();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_fseek();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fflush();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_fclose();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// code_block
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-18 02:51:27 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell compute_entry_point_address(cell obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell compute_entry_point_pic_address(word *w, cell tagged_quot);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell compute_entry_point_pic_address(cell w_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell compute_entry_point_pic_tail_address(cell w_);
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-27 18:05:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell code_block_owner(code_block *compiled);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-01 08:49:05 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void update_word_references(code_block *compiled, bool reset_inline_caches);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-02 02:09:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void undefined_symbol();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell compute_dlsym_address(array *literals, cell index);
							 | 
						
					
						
							
								
									
										
										
										
											2011-05-20 18:11:50 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#ifdef FACTOR_PPC
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell compute_dlsym_toc_address(array *literals, cell index);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-02 02:09:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell compute_vm_address(cell arg);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void store_external_address(instruction_operand op);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-02 05:55:48 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell compute_here_address(cell arg, cell offset, code_block *compiled);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-01 08:49:05 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void initialize_code_block(code_block *compiled, cell literals);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-02 02:09:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void initialize_code_block(code_block *compiled);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void fixup_labels(array *labels, code_block *compiled);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-20 10:37:24 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									code_block *allot_code_block(cell size, code_block_type type);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-25 21:58:21 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									code_block *add_code_block(code_block_type type, cell code_, cell labels_,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cell owner_, cell relocation_, cell parameters_, cell literals_,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										cell frame_size_untagged);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-08 03:10:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									//code heap
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-02 07:46:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									inline void check_code_pointer(cell ptr) { }
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator> void each_code_block(Iterator &iter)
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-06 02:42:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									{
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-02 07:46:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										code->allocator->iterate(iter);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-06 02:42:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 15:09:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_code_heap(cell size);
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-01 08:49:05 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void update_code_heap_words(bool reset_inline_caches);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void initialize_code_blocks();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_modify_code_heap();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-27 22:31:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									code_heap_room code_room();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_code_room();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-06 07:25:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_strip_stack_traces();
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-02 07:46:17 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell code_blocks();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_code_blocks();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-03 09:47:05 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// callbacks
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 13:13:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_callbacks(cell size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_callback();
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-16 12:39:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// image
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_objects(image_header *h);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void load_data_heap(FILE *file, image_header *h, vm_parameters *p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void load_code_heap(FILE *file, image_header *h, vm_parameters *p);
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-20 23:40:25 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool save_image(const vm_char *saving_filename, const vm_char *filename);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_save_image();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_save_image_and_exit();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-27 18:05:08 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void fixup_data(cell data_offset, cell code_offset);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void fixup_code(cell data_offset, cell code_offset);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-18 21:05:23 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									FILE *open_image(vm_parameters *p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void load_image(vm_parameters *p);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-27 17:39:21 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool read_embedded_image_footer(FILE *file, embedded_image_footer *footer);
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-18 21:05:23 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool embedded_image_p();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 15:53:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator, typename Fixup>
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 18:00:02 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void iterate_callstack_object(callstack *stack_, Iterator &iterator,
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 17:51:41 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										Fixup &fixup);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator>
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 18:00:02 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void iterate_callstack_object(callstack *stack_, Iterator &iterator);
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 15:53:34 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									callstack *allot_callstack(cell size);
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 20:53:52 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void *second_from_top_stack_frame(context *ctx);
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell capture_callstack(context *ctx);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_callstack();
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-29 20:40:17 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_callstack_for();
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 20:53:52 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void *frame_predecessor(void *frame);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_callstack_to_array();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_innermost_stack_frame_executing();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_innermost_stack_frame_scan();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_set_innermost_stack_frame_quot();
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-19 21:08:15 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_callstack_bounds();
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 17:18:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator, typename Fixup>
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 18:00:02 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void iterate_callstack(context *ctx, Iterator &iterator, Fixup &fixup);
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 17:51:41 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Iterator>
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 18:00:02 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void iterate_callstack(context *ctx, Iterator &iterator);
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-05 17:18:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-26 19:22:42 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// cpu-*
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dispatch_signal_handler(cell *sp, cell *pc, cell newpc);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// alien
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									char *pinned_alien_offset(cell obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell allot_alien(cell delegate_, cell displacement);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-18 16:59:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell allot_alien(void *address);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_displaced_alien();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_alien_address();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void *alien_pointer();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_dlopen();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_dlsym();
							 | 
						
					
						
							
								
									
										
										
										
											2011-05-20 18:11:50 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_dlsym_raw();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_dlclose();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_dll_validp();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									char *alien_offset(cell obj);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// quotations
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_jit_compile();
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-10 19:00:47 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void *lazy_jit_compile_entry_point();
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_array_to_quotation();
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-18 02:51:27 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_quotation_code();
							 | 
						
					
						
							
								
									
										
										
										
											2009-11-24 23:38:15 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									code_block *jit_compile_quot(cell owner_, cell quot_, bool relocating);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void jit_compile_quot(cell quot_, bool relocating);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									fixnum quot_code_offset_to_scan(cell quot_, cell offset);
							 | 
						
					
						
							
								
									
										
										
										
											2009-12-23 07:37:24 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell lazy_jit_compile(cell quot);
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-06 05:49:14 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool quot_compiled_p(quotation *quot);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_quot_compiled_p();
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-05 21:47:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell find_all_quotations();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void initialize_all_quotations();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// dispatch
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell search_lookup_alist(cell table, cell klass);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell search_lookup_hash(cell table, cell klass, cell hashcode);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell nth_superclass(tuple_layout *layout, fixnum echelon);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell nth_hashcode(tuple_layout *layout, fixnum echelon);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell lookup_tuple_method(cell obj, cell methods);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell lookup_method(cell obj, cell methods);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_lookup_method();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell object_class(cell obj);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell method_cache_hashcode(cell klass, array *array);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void update_method_cache(cell cache, cell klass, cell method);
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_mega_cache_miss();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_reset_dispatch_stats();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void primitive_dispatch_stats();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// inline cache
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:08 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_inline_caching(int max_size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void deallocate_inline_cache(cell return_address);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell determine_inline_cache_type(array *cache_entries);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									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);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void *megamorphic_call_stub(cell generic_word);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell inline_cache_size(cell cache_entries);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									cell add_inline_cache_entry(cell cache_entries_, cell klass_, cell method_);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void update_pic_transitions(cell pic_size);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void *inline_cache_miss(cell return_address);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// entry points
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-05 21:47:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void c_to_factor(cell quot);
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-03 02:40:16 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									template<typename Func> Func get_entry_point(cell n);
							 | 
						
					
						
							
								
									
										
										
										
											2011-12-06 20:53:52 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void unwind_native_frames(cell quot, void *to);
							 | 
						
					
						
							
								
									
										
										
										
											2010-09-01 23:46:39 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									cell get_fpu_state();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void set_fpu_state(cell state);
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-05 21:47:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// factor
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void default_parameters(vm_parameters *p);
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-05 21:47:36 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									bool factor_arg(const vm_char *str, const vm_char *arg, cell *value);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv);
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-05 23:55:20 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void prepare_boot_image();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_factor(vm_parameters *p);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void pass_args_to_factor(int argc, vm_char **argv);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void start_factor(vm_parameters *p);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-20 00:28:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void stop_factor();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									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);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void factor_yield();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void factor_sleep(long us);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-25 01:35:54 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									// os-*
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-27 14:42:18 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void primitive_existsp();
							 | 
						
					
						
							
								
									
										
										
										
											2010-02-03 16:12:13 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void move_file(const vm_char *path1, const vm_char *path2);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-18 14:02:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_ffi();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void ffi_dlopen(dll *dll);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void *ffi_dlsym(dll *dll, symbol_char *symbol);
							 | 
						
					
						
							
								
									
										
										
										
											2011-05-20 18:11:50 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void *ffi_dlsym_raw(dll *dll, symbol_char *symbol);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 #ifdef FACTOR_PPC
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void *ffi_dlsym_toc(dll *dll, symbol_char *symbol);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								 #endif
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-18 14:02:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void ffi_dlclose(dll *dll);
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-25 13:08:45 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void c_to_factor_toplevel(cell quot);
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void init_signals();
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-28 18:42:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void start_sampling_profiler_timer();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void end_sampling_profiler_timer();
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-12 17:47:32 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									static void open_console();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									static void close_console();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									static void lock_console();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									static void unlock_console();
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-15 21:50:42 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									static void ignore_ctrl_c();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									static void handle_ctrl_c();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-25 03:35:22 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									// os-windows
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  #if defined(WINDOWS)
							 | 
						
					
						
							
								
									
										
										
										
											2011-10-31 17:38:49 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									HANDLE sampler_thread;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void sampler_thread_loop();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-18 14:02:04 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const vm_char *vm_executable_path();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-18 14:52:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const vm_char *default_image_path();
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void windows_image_path(vm_char *full_path, vm_char *temp_path, unsigned int length);
							 | 
						
					
						
							
								
									
										
										
										
											2010-01-16 09:43:22 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									BOOL windows_stat(vm_char *path);
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-03 20:24:33 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									LONG exception_handler(PEXCEPTION_RECORD e, void *frame, PCONTEXT c, void *dispatch);
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-25 13:17:14 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  #else  // UNIX
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-22 06:38:02 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void dispatch_signal(void *uap, void (handler)());
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-28 11:37:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void unix_init_signals();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-18 15:03:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  #endif
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:07 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2009-09-14 03:00:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  #ifdef __APPLE__
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									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);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  #endif
							 | 
						
					
						
							
								
									
										
										
										
											2009-10-05 04:27:28 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2011-11-03 00:18:31 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									factor_vm(THREADHANDLE thread_id);
							 | 
						
					
						
							
								
									
										
										
										
											2010-03-26 22:44:43 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									~factor_vm();
							 | 
						
					
						
							
								
									
										
										
										
											2009-08-17 16:37:04 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 |