]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/vm.hpp
io.streams.256color: faster by caching styles
[factor.git] / vm / vm.hpp
index df45b83d65b12919f08dc4a4a783d01241f52d5b..4bacc4c077322eac297a761837c6ae5b6bf421bc 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -35,7 +35,7 @@ struct factor_vm {
   cell signal_handler_addr;
 
   // are we handling a memory error? used to detect double faults
-  cell faulting_p;
+  bool faulting_p;
 
   // Various special objects, accessed by special-object and
   // set-special-object primitives
@@ -70,7 +70,7 @@ struct factor_vm {
   c_to_factor_func_type c_to_factor_func;
 
   // Is profiling enabled?
-  volatile cell sampling_profiler_p;
+  volatile bool sampling_profiler_p;
   fixnum samples_per_second;
 
   // Global variables used to pass fault handler state from signal handler
@@ -86,8 +86,7 @@ struct factor_vm {
 
   // State kept by the sampling profiler
   std::vector<profiling_sample> samples;
-  std::vector<cell> sample_callstacks;
-  volatile profiling_sample_count sample_counts;
+  volatile profiling_sample current_sample;
 
   // GC is off during heap walking
   bool gc_off;
@@ -103,7 +102,7 @@ struct factor_vm {
 
   // Only set if we're performing a GC
   gc_state* current_gc;
-  volatile cell current_gc_p;
+  volatile bool current_gc_p;
 
   // Set if we're in the jit
   volatile fixnum current_jit_count;
@@ -147,14 +146,15 @@ struct factor_vm {
   static bool fatal_erroring_p;
 
   // Two fep_p variants, one might be redundant.
-  volatile cell safepoint_fep_p;
+  volatile bool safepoint_fep_p;
+
+  // Allow Ctrl-Break a busy loop in the Listener, only used on Windows
+  volatile bool stop_on_ctrl_break;
 
   // contexts
   context* new_context();
   void init_context(context* ctx);
   void delete_context();
-  void init_contexts(cell datastack_size_, cell retainstack_size_,
-                     cell callstack_size_);
   cell begin_callback(cell quot);
   void end_callback();
   void primitive_current_callback();
@@ -166,7 +166,6 @@ struct factor_vm {
   void primitive_datastack_for();
   cell retainstack_to_array(context* ctx);
   void primitive_retainstack_for();
-  cell array_to_stack(array* array, cell bottom);
   void primitive_set_datastack();
   void primitive_set_retainstack();
   void primitive_check_datastack();
@@ -190,17 +189,17 @@ struct factor_vm {
   void record_sample(bool prolog_p);
   void start_sampling_profiler(fixnum rate);
   void end_sampling_profiler();
-  void set_sampling_profiler(fixnum rate);
-  void primitive_sampling_profiler();
+  void set_profiling(fixnum rate);
+  void primitive_set_profiling();
   void primitive_get_samples();
+  array* allot_growarr();
+  void growarr_add(array *growarr_, cell value);
 
   // errors
   void general_error(vm_error_type error, cell arg1, cell arg2);
   void type_error(cell type, cell tagged);
-  void not_implemented_error();
   void set_memory_protection_error(cell fault_addr, cell fault_pc);
   void divide_by_zero_error();
-  void primitive_unimplemented();
 
   // bignum
   int bignum_equal_p(bignum* x, bignum* y);
@@ -395,7 +394,6 @@ struct factor_vm {
   void primitive_die();
   void primitive_enable_ctrl_break();
   void primitive_disable_ctrl_break();
-  volatile bool stop_on_ctrl_break;
 
   // arrays
   inline void set_array_nth(array* array, cell slot, cell value);
@@ -525,14 +523,13 @@ struct factor_vm {
   }
 
   // io
-  void init_c_io();
   void io_error_if_not_EINTR();
   FILE* safe_fopen(char* filename, const char* mode);
   int safe_fgetc(FILE* stream);
   size_t safe_fread(void* ptr, size_t size, size_t nitems, FILE* stream);
   void safe_fputc(int c, FILE* stream);
   size_t safe_fwrite(void* ptr, size_t size, size_t nitems, FILE* stream);
-  int safe_ftell(FILE* stream);
+  off_t safe_ftell(FILE* stream);
   void safe_fseek(FILE* stream, off_t offset, int whence);
   void safe_fflush(FILE* stream);
   void primitive_fopen();
@@ -683,7 +680,6 @@ struct factor_vm {
   void init_factor(vm_parameters* p);
   void pass_args_to_factor(int argc, vm_char** argv);
   void stop_factor();
-  void start_embedded_factor(vm_parameters* p);
   void start_standalone_factor(int argc, vm_char** argv);
   char* factor_eval_string(char* string);
   void factor_eval_free(char* result);