vm: Fix unused variable warnings on Windows.
							parent
							
								
									0939974c65
								
							
						
					
					
						commit
						2a409c79e0
					
				| 
						 | 
				
			
			@ -56,6 +56,8 @@ void factor_vm::primitive_callstack_to_array() {
 | 
			
		|||
                                     cell size,
 | 
			
		||||
                                     code_block* owner,
 | 
			
		||||
                                     cell addr) {
 | 
			
		||||
    (void)frame_top;
 | 
			
		||||
    (void)size;
 | 
			
		||||
    data_root<object> executing_quot(owner->owner_quot(), this);
 | 
			
		||||
    data_root<object> executing(owner->owner, this);
 | 
			
		||||
    data_root<object> scan(owner->scan(this, addr), this);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,7 +62,7 @@ struct code_block {
 | 
			
		|||
    header = (header & 0xFFFFFF) | (frame_size << 20);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  template <typename Fixup> cell size(Fixup fixup) const { return size(); }
 | 
			
		||||
  template <typename Fixup> cell size(Fixup fixup) const { (void)fixup; return size(); }
 | 
			
		||||
 | 
			
		||||
  cell entry_point() const { return (cell)(this + 1); }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -71,6 +71,8 @@ void code_heap::sweep() {
 | 
			
		|||
 | 
			
		||||
void code_heap::verify_all_blocks_set() {
 | 
			
		||||
  auto all_blocks_set_verifier = [&](code_block* block, cell size) {
 | 
			
		||||
    (void)block;
 | 
			
		||||
    (void)size;
 | 
			
		||||
    FACTOR_ASSERT(all_blocks.find((cell)block) != all_blocks.end());
 | 
			
		||||
  };
 | 
			
		||||
  allocator->iterate(all_blocks_set_verifier, no_fixup());
 | 
			
		||||
| 
						 | 
				
			
			@ -102,6 +104,7 @@ cell code_heap::frame_predecessor(cell frame_top) {
 | 
			
		|||
void code_heap::initialize_all_blocks_set() {
 | 
			
		||||
  all_blocks.clear();
 | 
			
		||||
  auto all_blocks_set_inserter = [&](code_block* block, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    all_blocks.insert((cell)block);
 | 
			
		||||
  };
 | 
			
		||||
  allocator->iterate(all_blocks_set_inserter, no_fixup());
 | 
			
		||||
| 
						 | 
				
			
			@ -115,6 +118,7 @@ void code_heap::initialize_all_blocks_set() {
 | 
			
		|||
// If generic words were redefined, inline caches need to be reset.
 | 
			
		||||
void factor_vm::update_code_heap_words(bool reset_inline_caches) {
 | 
			
		||||
  auto word_updater = [&](code_block* block, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    update_word_references(block, reset_inline_caches);
 | 
			
		||||
  };
 | 
			
		||||
  each_code_block(word_updater);
 | 
			
		||||
| 
						 | 
				
			
			@ -182,6 +186,7 @@ void factor_vm::primitive_code_room() {
 | 
			
		|||
 | 
			
		||||
void factor_vm::primitive_strip_stack_traces() {
 | 
			
		||||
  auto stack_trace_stripper = [](code_block* block, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    block->owner = false_object;
 | 
			
		||||
  };
 | 
			
		||||
  each_code_block(stack_trace_stripper);
 | 
			
		||||
| 
						 | 
				
			
			@ -191,6 +196,7 @@ void factor_vm::primitive_strip_stack_traces() {
 | 
			
		|||
void factor_vm::primitive_code_blocks() {
 | 
			
		||||
  std::vector<cell> objects;
 | 
			
		||||
  auto code_block_accumulator = [&](code_block* block, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    objects.push_back(block->owner);
 | 
			
		||||
    objects.push_back(block->parameters);
 | 
			
		||||
    objects.push_back(block->relocation);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -109,6 +109,8 @@ void factor_vm::collect_compact_impl() {
 | 
			
		|||
    // Slide everything in tenured space up, and update data and code heap
 | 
			
		||||
    // pointers inside objects.
 | 
			
		||||
    auto compact_object_func = [&](object* old_addr, object* new_addr, cell size) {
 | 
			
		||||
      (void)old_addr;
 | 
			
		||||
      (void)size;
 | 
			
		||||
      forwarder.visit_slots(new_addr);
 | 
			
		||||
      forwarder.visit_object_code_block(new_addr);
 | 
			
		||||
      tenured->starts.record_object_start_offset(new_addr);
 | 
			
		||||
| 
						 | 
				
			
			@ -120,6 +122,7 @@ void factor_vm::collect_compact_impl() {
 | 
			
		|||
    auto compact_code_func = [&](code_block* old_addr,
 | 
			
		||||
                                 code_block* new_addr,
 | 
			
		||||
                                 cell size) {
 | 
			
		||||
      (void)size;
 | 
			
		||||
      forwarder.visit_code_block_objects(new_addr);
 | 
			
		||||
      cell old_entry_point = old_addr->entry_point();
 | 
			
		||||
      forwarder.visit_instruction_operands(new_addr, old_entry_point);
 | 
			
		||||
| 
						 | 
				
			
			@ -136,6 +139,7 @@ void factor_vm::collect_compact_impl() {
 | 
			
		|||
  // the code heap. Since the code heap has now been compacted, those
 | 
			
		||||
  // pointers are invalid and we need to update them.
 | 
			
		||||
  auto callback_updater = [&](code_block* stub, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    callbacks->update(stub);
 | 
			
		||||
  };
 | 
			
		||||
  callbacks->allocator->iterate(callback_updater, no_fixup());
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ namespace factor {
 | 
			
		|||
#define CALLSTACK_BOTTOM(ctx) \
 | 
			
		||||
  (ctx->callstack_seg->end - sizeof(cell) * 5)
 | 
			
		||||
 | 
			
		||||
inline static void flush_icache(cell start, cell len) {}
 | 
			
		||||
inline static void flush_icache(cell start, cell len) { (void)start; (void)len; }
 | 
			
		||||
 | 
			
		||||
// In the instruction sequence:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,6 +62,7 @@ void factor_vm::print_alien(ostream& out, alien* alien, cell nesting) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
void factor_vm::print_byte_array(ostream& out, byte_array* array, cell nesting) {
 | 
			
		||||
  (void)nesting;
 | 
			
		||||
  cell length = array->capacity;
 | 
			
		||||
  cell i;
 | 
			
		||||
  bool trimmed;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -263,7 +263,7 @@ void free_list_allocator<Block>::sweep(Iterator& iter) {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
template <typename Block> void free_list_allocator<Block>::sweep() {
 | 
			
		||||
  auto null_sweep = [](Block* free_block, cell size) { };
 | 
			
		||||
  auto null_sweep = [](Block* free_block, cell size) { (void)free_block; (void)size; };
 | 
			
		||||
  sweep(null_sweep);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -177,6 +177,7 @@ void factor_vm::fixup_heaps(cell data_offset, cell code_offset) {
 | 
			
		|||
  visitor.visit_all_roots();
 | 
			
		||||
 | 
			
		||||
  auto start_object_updater = [&](object *obj, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    data->tenured->starts.record_object_start_offset(obj);
 | 
			
		||||
    visitor.visit_slots(obj);
 | 
			
		||||
    switch (obj->type()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -201,6 +202,7 @@ void factor_vm::fixup_heaps(cell data_offset, cell code_offset) {
 | 
			
		|||
  data->tenured->iterate(start_object_updater, fixup);
 | 
			
		||||
 | 
			
		||||
  auto updater = [&](code_block* compiled, cell size) {
 | 
			
		||||
    (void)size;
 | 
			
		||||
    visitor.visit_code_block_objects(compiled);
 | 
			
		||||
    cell rel_base = compiled->entry_point() - fixup.code_offset;
 | 
			
		||||
    visitor.visit_instruction_operands(compiled, rel_base);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,6 +16,10 @@ VM_C_API int wmain(int argc, wchar_t** argv) {
 | 
			
		|||
 | 
			
		||||
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
 | 
			
		||||
                   LPSTR lpCmdLine, int nCmdShow) {
 | 
			
		||||
  (void)hInstance;
 | 
			
		||||
  (void)hPrevInstance;
 | 
			
		||||
  (void)lpCmdLine;
 | 
			
		||||
  (void)nCmdShow;
 | 
			
		||||
  int argc;
 | 
			
		||||
  wchar_t** argv = CommandLineToArgvW(GetCommandLine(), &argc);
 | 
			
		||||
  wmain(argc, argv);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -111,6 +111,7 @@ void factor_vm::primitive_become() {
 | 
			
		|||
    each_object(object_become_func);
 | 
			
		||||
 | 
			
		||||
    auto code_block_become_func = [&](code_block* compiled, cell size) {
 | 
			
		||||
      (void)size;
 | 
			
		||||
      visitor.visit_code_block_objects(compiled);
 | 
			
		||||
      visitor.visit_embedded_literals(compiled);
 | 
			
		||||
      code->write_barrier(compiled);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -194,6 +194,8 @@ typedef enum _EXCEPTION_DISPOSITION {
 | 
			
		|||
 | 
			
		||||
LONG factor_vm::exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c,
 | 
			
		||||
                                  void* dispatch) {
 | 
			
		||||
  (void)frame;
 | 
			
		||||
  (void)dispatch;
 | 
			
		||||
  switch (e->ExceptionCode) {
 | 
			
		||||
    case EXCEPTION_ACCESS_VIOLATION:
 | 
			
		||||
      set_memory_protection_error(e->ExceptionInformation[1], c->EIP);
 | 
			
		||||
| 
						 | 
				
			
			@ -242,7 +244,7 @@ VM_C_API LONG exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c,
 | 
			
		|||
// On Unix SIGINT (ctrl-c) automatically interrupts blocking io system
 | 
			
		||||
// calls. It doesn't on Windows, so we need to manually send some
 | 
			
		||||
// cancellation requests to unblock the thread.
 | 
			
		||||
VOID CALLBACK dummy_cb (ULONG_PTR dwParam) { }
 | 
			
		||||
VOID CALLBACK dummy_cb(ULONG_PTR dwParam) { (void)dwParam; }
 | 
			
		||||
 | 
			
		||||
// CancelSynchronousIo is not in Windows XP
 | 
			
		||||
#if _WIN32_WINNT >= 0x0600
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +263,7 @@ static void wake_up_thread(HANDLE thread) {
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
#else
 | 
			
		||||
static void wake_up_thread(HANDLE thread) {}
 | 
			
		||||
static void wake_up_thread(HANDLE thread) { (void)thread; }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static BOOL WINAPI ctrl_handler(DWORD dwCtrlType) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,6 +73,9 @@ void factor_vm::record_sample(bool prolog_p) {
 | 
			
		|||
 | 
			
		||||
  bool skip_p = prolog_p;
 | 
			
		||||
  auto recorder = [&](cell frame_top, cell size, code_block* owner, cell addr) {
 | 
			
		||||
    (void)frame_top;
 | 
			
		||||
    (void)size;
 | 
			
		||||
    (void)addr;
 | 
			
		||||
    if (skip_p)
 | 
			
		||||
      skip_p = false;
 | 
			
		||||
    else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -206,6 +206,7 @@ template <typename Fixup> void slot_visitor<Fixup>::visit_all_roots() {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  auto callback_slot_visitor = [&](code_block* stub, cell size) {
 | 
			
		||||
	  (void)size;
 | 
			
		||||
    visit_handle(&stub->owner);
 | 
			
		||||
  };
 | 
			
		||||
  parent->callbacks->allocator->iterate(callback_slot_visitor, no_fixup());
 | 
			
		||||
| 
						 | 
				
			
			@ -245,6 +246,7 @@ template <typename Fixup> struct call_frame_slot_visitor {
 | 
			
		|||
  //              [size]
 | 
			
		||||
 | 
			
		||||
  void operator()(cell frame_top, cell size, code_block* owner, cell addr) {
 | 
			
		||||
	  (void)size;
 | 
			
		||||
    cell return_address = owner->offset(addr);
 | 
			
		||||
 | 
			
		||||
    code_block* compiled =
 | 
			
		||||
| 
						 | 
				
			
			@ -359,7 +361,8 @@ template <typename Fixup> struct call_frame_code_block_visitor {
 | 
			
		|||
  call_frame_code_block_visitor(Fixup fixup) : fixup(fixup) {}
 | 
			
		||||
 | 
			
		||||
  void operator()(cell frame_top, cell size, code_block* owner, cell addr) {
 | 
			
		||||
    code_block* compiled =
 | 
			
		||||
    (void)size;
 | 
			
		||||
	  code_block* compiled =
 | 
			
		||||
        Fixup::translated_code_block_map ? owner : fixup.fixup_code(owner);
 | 
			
		||||
    cell fixed_addr = compiled->address_for_offset(owner->offset(addr));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue