]> gitweb.factorcode.org Git - factor.git/blobdiff - vm/vm.cpp
Put brackets around ipv6 addresses in `inet6 present`
[factor.git] / vm / vm.cpp
index bca34d024871937f760fb44fd41f190274948ec7..bf4037962bf33720db1197a9fd33313bb13b5b96 100644 (file)
--- a/vm/vm.cpp
+++ b/vm/vm.cpp
@@ -3,15 +3,22 @@
 namespace factor {
 
 factor_vm::factor_vm(THREADHANDLE thread)
-    : nursery(0, 0),
+    : ctx(NULL),
+      nursery(0, 0),
       faulting_p(false),
       thread(thread),
+#if defined(WINDOWS)
+      thread_id(GetCurrentThreadId()),
+      ctrl_break_thread(NULL),
+#endif
       callback_id(0),
       c_to_factor_func(NULL),
       sampling_profiler_p(false),
       signal_pipe_input(0),
       signal_pipe_output(0),
+      current_sample(0, 0, 0, 0, 0),
       gc_off(false),
+      data(NULL), code(NULL), callbacks(NULL),
       current_gc(NULL),
       current_gc_p(false),
       current_jit_count(0),
@@ -20,23 +27,37 @@ factor_vm::factor_vm(THREADHANDLE thread)
       fep_help_was_shown(false),
       fep_disabled(false),
       full_output(false),
+      object_counter(0),
       last_nano_count(0),
       signal_callstack_seg(NULL),
-      safepoint() {
+      safepoint_fep_p(false),
+      stop_on_ctrl_break(false) {
   primitive_reset_dispatch_stats();
 }
 
 factor_vm::~factor_vm() {
-  delete_contexts();
+  free(alien_offset(special_objects[OBJ_EXECUTABLE]));
+  free(alien_offset(special_objects[OBJ_IMAGE]));
+  close_console();
+  FACTOR_ASSERT(!ctx);
+  FACTOR_FOR_EACH(unused_contexts) {
+    delete *iter;
+  }
+  FACTOR_FOR_EACH(active_contexts) {
+    delete *iter;
+  }
+  if (callbacks)
+    delete callbacks;
+  if (data)
+    delete data;
+  if (code)
+    delete code;
   if (signal_callstack_seg) {
     delete signal_callstack_seg;
     signal_callstack_seg = NULL;
   }
-  std::list<void**>::const_iterator iter = function_descriptors.begin();
-  std::list<void**>::const_iterator end = function_descriptors.end();
-  while (iter != end) {
+  FACTOR_FOR_EACH(function_descriptors) {
     delete[] * iter;
-    iter++;
   }
 }