From 1ad7609a5d9044022b95b28c9427f9d213bd05ac Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 15 Jul 2018 14:17:59 -0500 Subject: [PATCH] vm: WIP remove warnings, use C++ style casts...there are hundreds of warnings left. --- GNUmakefile | 4 +-- vm/aging_space.hpp | 2 +- vm/alien.cpp | 20 +++++++------- vm/allot.hpp | 4 +-- vm/bignum.cpp | 16 +++++------ vm/callbacks.cpp | 4 +-- vm/code_blocks.cpp | 6 ++-- vm/code_heap.cpp | 4 +-- vm/contexts.cpp | 4 +-- vm/cpu-x86.cpp | 2 +- vm/cpu-x86.hpp | 2 +- vm/factor.cpp | 4 +-- vm/ffi_test.c | 13 ++++++--- vm/ffi_test.h | 8 +++--- vm/free_list.hpp | 8 +++--- vm/gc.cpp | 8 +++--- vm/image.cpp | 10 +++---- vm/io.cpp | 2 +- vm/layouts.hpp | 36 ++++++++++++------------ vm/mach_signal.cpp | 4 +-- vm/mark_bits.hpp | 4 +-- vm/master.hpp | 18 ++++++------ vm/math.hpp | 8 +++--- vm/mvm-none.cpp | 2 +- vm/mvm-unix.cpp | 2 +- vm/mvm.hpp | 2 +- vm/os-unix.cpp | 66 +++++++++++++++++++++++--------------------- vm/os-unix.hpp | 4 ++- vm/os-windows.cpp | 38 ++++++++++++------------- vm/os-windows.hpp | 2 +- vm/quotations.hpp | 1 - vm/slot_visitor.hpp | 2 +- vm/tenured_space.hpp | 2 +- vm/utilities.cpp | 4 +-- vm/vm.cpp | 16 +++++------ 35 files changed, 170 insertions(+), 162 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 1d4ebaabcf..d3a5e0e20d 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -6,13 +6,13 @@ ifdef CONFIG include $(CONFIG) - CFLAGS = -Wall \ + CFLAGS = -Wall -Weverything -Wno-c++98-compat-pedantic -Wno-padded \ -pedantic \ -DFACTOR_VERSION="$(VERSION)" \ -DFACTOR_GIT_LABEL="$(GIT_LABEL)" \ $(SITE_CFLAGS) - CXXFLAGS += -std=c++11 + CXXFLAGS += -std=c++14 ifdef DEBUG CFLAGS += -g -DFACTOR_DEBUG diff --git a/vm/aging_space.hpp b/vm/aging_space.hpp index fc6c150d62..4ccc5c443c 100644 --- a/vm/aging_space.hpp +++ b/vm/aging_space.hpp @@ -8,7 +8,7 @@ struct aging_space : bump_allocator { object* allot(cell size) { if (here + size > end) - return NULL; + return nullptr; object* obj = bump_allocator::allot(size); starts.record_object_start_offset(obj); diff --git a/vm/alien.cpp b/vm/alien.cpp index 894ba2d4c8..e3181f461e 100644 --- a/vm/alien.cpp +++ b/vm/alien.cpp @@ -16,10 +16,10 @@ char* factor_vm::pinned_alien_offset(cell obj) { return (char*)ptr->address; } case F_TYPE: - return NULL; + return nullptr; default: type_error(ALIEN_TYPE, obj); - return NULL; // can't happen + return nullptr; // can't happen } } @@ -118,12 +118,12 @@ void factor_vm::primitive_dlsym() { if (to_boolean(library.value())) { dll* d = untag_check(library.value()); - if (d->handle == NULL) + if (d->handle == nullptr) ctx->replace(false_object); else ctx->replace(allot_alien(ffi_dlsym(d, sym))); } else - ctx->replace(allot_alien(ffi_dlsym(NULL, sym))); + ctx->replace(allot_alien(ffi_dlsym(nullptr, sym))); } // look up a symbol in a native library @@ -138,25 +138,25 @@ void factor_vm::primitive_dlsym_raw() { if (to_boolean(library.value())) { dll* d = untag_check(library.value()); - if (d->handle == NULL) + if (d->handle == nullptr) ctx->replace(false_object); else ctx->replace(allot_alien(ffi_dlsym_raw(d, sym))); } else - ctx->replace(allot_alien(ffi_dlsym_raw(NULL, sym))); + ctx->replace(allot_alien(ffi_dlsym_raw(nullptr, sym))); } // close a native library handle void factor_vm::primitive_dlclose() { dll* d = untag_check(ctx->pop()); - if (d->handle != NULL) + if (d->handle != nullptr) ffi_dlclose(d); } void factor_vm::primitive_dll_validp() { cell library = ctx->peek(); if (to_boolean(library)) - ctx->replace(tag_boolean(untag_check(library)->handle != NULL)); + ctx->replace(tag_boolean(untag_check(library)->handle != nullptr)); else ctx->replace(special_objects[OBJ_CANONICAL_TRUE]); } @@ -169,10 +169,10 @@ char* factor_vm::alien_offset(cell obj) { case ALIEN_TYPE: return (char*)untag(obj)->address; case F_TYPE: - return NULL; + return nullptr; default: type_error(ALIEN_TYPE, obj); - return NULL; // can't happen + return nullptr; // can't happen } } diff --git a/vm/allot.hpp b/vm/allot.hpp index b6bb8c1b71..9a5f77816f 100644 --- a/vm/allot.hpp +++ b/vm/allot.hpp @@ -9,7 +9,7 @@ inline code_block* factor_vm::allot_code_block(cell size, cell block_size = size + sizeof(code_block); code_block* block = code->allocator->allot(block_size); - if (block == NULL) { + if (block == nullptr) { // If allocation failed, do a full GC and compact the code heap. // A full GC that occurs as a result of the data heap filling up does not // trigger a compaction. This setup ensures that most GCs do not compact @@ -19,7 +19,7 @@ inline code_block* factor_vm::allot_code_block(cell size, block = code->allocator->allot(block_size); // Insufficient room even after code GC, give up - if (block == NULL) { + if (block == nullptr) { std::cout << "Code heap used: " << code->allocator->occupied_space() << "\n"; std::cout << "Code heap free: " << code->allocator->free_space << "\n"; diff --git a/vm/bignum.cpp b/vm/bignum.cpp index 45024ba45b..7437ef7a0e 100644 --- a/vm/bignum.cpp +++ b/vm/bignum.cpp @@ -776,7 +776,7 @@ void factor_vm::bignum_divide_unsigned_large_denominator( } } - if (quotient != NULL) { + if (quotient != nullptr) { bignum *q_ = allot_bignum(length_n - length_d, q_negative_p); data_root q(q_, this); @@ -793,7 +793,7 @@ void factor_vm::bignum_divide_unsigned_large_denominator( shift); bignum_destructive_normalization(denominator.untagged(), v, shift); bignum_divide_unsigned_normalized(u.untagged(), v, q.untagged()); - if (remainder != NULL) + if (remainder != nullptr) bignum_destructive_unnormalization(u.untagged(), shift); } @@ -806,7 +806,7 @@ void factor_vm::bignum_divide_unsigned_large_denominator( (BIGNUM_REF(u.untagged(), (length_n - 1))) = 0; bignum_divide_unsigned_normalized(u.untagged(), denominator.untagged(), - NULL); + nullptr); } else { bignum* v = allot_bignum(length_d, 0); bignum_destructive_normalization(numerator.untagged(), @@ -815,14 +815,14 @@ void factor_vm::bignum_divide_unsigned_large_denominator( bignum_destructive_normalization(denominator.untagged(), v, shift); - bignum_divide_unsigned_normalized(u.untagged(), v, NULL); - if (remainder != NULL) + bignum_divide_unsigned_normalized(u.untagged(), v, nullptr); + if (remainder != nullptr) bignum_destructive_unnormalization(u.untagged(), shift); } } u.set_untagged(bignum_trim(u.untagged())); - if (remainder != NULL) + if (remainder != nullptr) *remainder = u.untagged(); } @@ -836,7 +836,7 @@ void factor_vm::bignum_divide_unsigned_normalized(bignum* u, bignum* v, bignum_digit_type* u_scan_start = (u_scan - v_length); bignum_digit_type* v_start = (BIGNUM_START_PTR(v)); bignum_digit_type* v_end = (v_start + v_length); - bignum_digit_type* q_scan = NULL; + bignum_digit_type* q_scan = nullptr; bignum_digit_type v1 = (v_end[-1]); bignum_digit_type v2 = (v_end[-2]); bignum_digit_type ph; // high half of double-digit product @@ -1422,7 +1422,7 @@ bignum* factor_vm::bignum_magnitude_ash(bignum* arg1_, fixnum n) { data_root arg1(arg1_, this); - bignum* result = NULL; + bignum* result = nullptr; bignum_digit_type* scan1; bignum_digit_type* scanr; bignum_digit_type* end; diff --git a/vm/callbacks.cpp b/vm/callbacks.cpp index 492e7a9884..807ce43880 100644 --- a/vm/callbacks.cpp +++ b/vm/callbacks.cpp @@ -21,9 +21,9 @@ callback_heap::callback_heap(cell size, factor_vm* parent) { callback_heap::~callback_heap() { delete allocator; - allocator = NULL; + allocator = nullptr; delete seg; - seg = NULL; + seg = nullptr; } instruction_operand callback_heap::callback_operand(code_block* stub, diff --git a/vm/code_blocks.cpp b/vm/code_blocks.cpp index d9d774f9f9..656c36e2db 100644 --- a/vm/code_blocks.cpp +++ b/vm/code_blocks.cpp @@ -140,11 +140,11 @@ cell factor_vm::compute_dlsym_address(array* parameters, bool toc) { cell symbol = array_nth(parameters, index); cell library = array_nth(parameters, index + 1); - dll* d = to_boolean(library) ? untag(library) : NULL; + dll* d = to_boolean(library) ? untag(library) : nullptr; cell undef = (cell)factor::undefined_symbol; undef = toc ? FUNCTION_TOC_POINTER(undef) : FUNCTION_CODE_POINTER(undef); - if (d != NULL && !d->handle) + if (d != nullptr && !d->handle) return undef; FACTOR_ASSERT(TAG(symbol) == BYTE_ARRAY_TYPE); @@ -188,7 +188,7 @@ cell factor_vm::compute_external_address(instruction_operand op) { code_block* compiled = op.compiled; array* parameters = to_boolean(compiled->parameters) ? untag(compiled->parameters) - : NULL; + : nullptr; cell idx = op.index; relocation_type rel_type = op.rel.type(); diff --git a/vm/code_heap.cpp b/vm/code_heap.cpp index ad507c2e78..5f2807c229 100644 --- a/vm/code_heap.cpp +++ b/vm/code_heap.cpp @@ -20,9 +20,9 @@ code_heap::code_heap(cell size) { code_heap::~code_heap() { delete allocator; - allocator = NULL; + allocator = nullptr; delete seg; - seg = NULL; + seg = nullptr; } void code_heap::write_barrier(code_block* compiled) { diff --git a/vm/contexts.cpp b/vm/contexts.cpp index 48afadaa27..31f8f0da23 100644 --- a/vm/contexts.cpp +++ b/vm/contexts.cpp @@ -277,8 +277,8 @@ void factor_vm::primitive_load_locals() { memcpy((cell*)(ctx->retainstack + sizeof(cell)), (cell*)(ctx->datastack - sizeof(cell) * (count - 1)), sizeof(cell) * count); - ctx->datastack -= sizeof(cell) * count; - ctx->retainstack += sizeof(cell) * count; + ctx->datastack -= sizeof(cell) * (cell)count; + ctx->retainstack += sizeof(cell) * (cell)count; } } diff --git a/vm/cpu-x86.cpp b/vm/cpu-x86.cpp index c7169d26fd..cf90c1a7fa 100644 --- a/vm/cpu-x86.cpp +++ b/vm/cpu-x86.cpp @@ -60,7 +60,7 @@ void factor_vm::dispatch_resumable_signal(cell* sp, cell* pc, cell handler) { index = SIGNAL_HANDLER_WORD; } else if (offset == 16 - sizeof(cell)) { // Make a fake frame for the leaf procedure - FACTOR_ASSERT(code->code_block_for_address(*pc) != NULL); + FACTOR_ASSERT(code->code_block_for_address(*pc) != nullptr); delta = LEAF_FRAME_SIZE; index = LEAF_SIGNAL_HANDLER_WORD; } else { diff --git a/vm/cpu-x86.hpp b/vm/cpu-x86.hpp index a0d83b5d78..e2d4c82a15 100644 --- a/vm/cpu-x86.hpp +++ b/vm/cpu-x86.hpp @@ -19,7 +19,7 @@ static const unsigned char call_opcode = 0xe8; static const unsigned char jmp_opcode = 0xe9; inline static unsigned char call_site_opcode(cell return_address) { - return *(unsigned char*)(return_address - 5); + return *reinterpret_cast(return_address - 5); } inline static void check_call_site(cell return_address) { diff --git a/vm/factor.cpp b/vm/factor.cpp index 4d364384c8..6f2acf359e 100644 --- a/vm/factor.cpp +++ b/vm/factor.cpp @@ -56,7 +56,7 @@ void factor_vm::init_factor(vm_parameters* p) { p->executable_path = vm_executable_path(); - if (p->image_path == NULL) { + if (p->image_path == nullptr) { if (embedded_image_p()) { p->embedded_image = true; p->image_path = safe_strdup(p->executable_path); @@ -71,7 +71,7 @@ void factor_vm::init_factor(vm_parameters* p) { retainstack_size = p->retainstack_size; callstack_size = p->callstack_size; - ctx = NULL; + ctx = nullptr; spare_ctx = new_context(); callbacks = new callback_heap(p->callback_size, this); diff --git a/vm/ffi_test.c b/vm/ffi_test.c index 4bf5e70f3e..1927a8d988 100644 --- a/vm/ffi_test.c +++ b/vm/ffi_test.c @@ -84,7 +84,10 @@ FACTOR_STDCALL(struct bar) ffi_test_19(long x, long y, long z) { } void ffi_test_20(double x1, double x2, double x3, double y1, double y2, - double y3, double z1, double z2, double z3) {} + double y3, double z1, double z2, double z3) { + (void) x1, (void) x2, (void) x3, (void) y1, (void) y2, + (void) y3, (void) z1, (void) z2, (void) z3; +} long long ffi_test_21(long x, long y) { return (long long) x * (long long) y; } @@ -309,7 +312,7 @@ unsigned long long ffi_test_60(unsigned long long x) { /* C99 features */ #ifndef _MSC_VER -struct bool_and_ptr ffi_test_61() { +struct bool_and_ptr ffi_test_61(void) { struct bool_and_ptr bap; bap.b = true; bap.ptr = NULL; @@ -318,14 +321,14 @@ struct bool_and_ptr ffi_test_61() { #endif -struct uint_pair ffi_test_62() { +struct uint_pair ffi_test_62(void) { struct uint_pair uip; uip.a = 0xabcdefab; uip.b = 0x12345678; return uip; } -struct ulonglong_pair ffi_test_63() { +struct ulonglong_pair ffi_test_63(void) { struct ulonglong_pair ullp; ullp.a = 0xabcdefabcdefabcd; ullp.b = 0x1234567891234567; @@ -360,6 +363,8 @@ void* bug1021_test_1(void* x, int y) { } int bug1021_test_2(int x, char *y, void *z) { + (void) x; + (void) z; return y[0]; } diff --git a/vm/ffi_test.h b/vm/ffi_test.h index c359811e65..1c7ae7ddb3 100644 --- a/vm/ffi_test.h +++ b/vm/ffi_test.h @@ -161,7 +161,7 @@ struct test_struct_16 { FACTOR_EXPORT struct test_struct_16 ffi_test_43(float x, int a); -FACTOR_EXPORT struct test_struct_14 ffi_test_44(); +FACTOR_EXPORT struct test_struct_14 ffi_test_44(void); /* C99 features */ #ifndef _MSC_VER @@ -211,7 +211,7 @@ struct bool_and_ptr { void* ptr; }; -FACTOR_EXPORT struct bool_and_ptr ffi_test_61(); +FACTOR_EXPORT struct bool_and_ptr ffi_test_61(void); #endif @@ -220,14 +220,14 @@ struct uint_pair { unsigned int b; }; -FACTOR_EXPORT struct uint_pair ffi_test_62(); +FACTOR_EXPORT struct uint_pair ffi_test_62(void); struct ulonglong_pair { unsigned long long a; unsigned long long b; }; -FACTOR_EXPORT struct ulonglong_pair ffi_test_63(); +FACTOR_EXPORT struct ulonglong_pair ffi_test_63(void); FACTOR_EXPORT int ffi_test_64(int n, ...); FACTOR_EXPORT double ffi_test_65(int n, ...); diff --git a/vm/free_list.hpp b/vm/free_list.hpp index a996ee834a..4e80c55758 100644 --- a/vm/free_list.hpp +++ b/vm/free_list.hpp @@ -155,7 +155,7 @@ free_heap_block* free_list_allocator::find_free_block(cell size) { // Allocate a block this big free_heap_block* large_block = find_free_block(large_block_size); if (!large_block) - return NULL; + return nullptr; large_block = split_free_block(large_block, large_block_size); @@ -192,7 +192,7 @@ free_heap_block* free_list_allocator::find_free_block(cell size) { return block; } - return NULL; + return nullptr; } } @@ -206,7 +206,7 @@ Block* free_list_allocator::allot(cell size) { block = split_free_block(block, size); return (Block*)block; } - return NULL; + return nullptr; } template @@ -299,7 +299,7 @@ template void free_list_allocator::iterate(Iterator& iter, Fixup fixup) { cell scan = this->start; while (scan != this->end) { - Block* block = (Block*)scan; + Block* block = reinterpret_cast(scan); cell size = fixup.size(block); if (!block->free_p()) iter(block, size); diff --git a/vm/gc.cpp b/vm/gc.cpp index 58e39d8d62..979b125c7a 100644 --- a/vm/gc.cpp +++ b/vm/gc.cpp @@ -31,13 +31,13 @@ gc_state::gc_state(gc_op op, factor_vm* parent) : op(op) { event = new gc_event(op, parent); start_time = nano_count(); } else - event = NULL; + event = nullptr; } gc_state::~gc_state() { if (event) { delete event; - event = NULL; + event = nullptr; } } @@ -139,7 +139,7 @@ void factor_vm::gc(gc_op op, cell requested_size) { if (ctx) ctx->callstack_seg->set_border_locked(true); delete current_gc; - current_gc = NULL; + current_gc = nullptr; // Check the invariant again, just in case. FACTOR_ASSERT(!data->high_fragmentation_p()); @@ -168,7 +168,7 @@ void factor_vm::primitive_disable_gc_events() { growable_array result(this); std::vector* gc_events = this->gc_events; - this->gc_events = NULL; + this->gc_events = nullptr; FACTOR_FOR_EACH(*gc_events) { gc_event event = *iter; diff --git a/vm/image.cpp b/vm/image.cpp index f29ca779a3..11ca120396 100644 --- a/vm/image.cpp +++ b/vm/image.cpp @@ -13,8 +13,8 @@ bool factor_arg(const vm_char* str, const vm_char* arg, cell* value) { vm_parameters::vm_parameters() { embedded_image = false; - image_path = NULL; - executable_path = NULL; + image_path = nullptr; + executable_path = nullptr; datastack_size = 32 * sizeof(cell); retainstack_size = 32 * sizeof(cell); @@ -36,7 +36,7 @@ vm_parameters::vm_parameters() { signals = true; #ifdef WINDOWS - console = GetConsoleWindow() != NULL; + console = GetConsoleWindow() != nullptr; #else console = true; #endif @@ -231,7 +231,7 @@ char *threadsafe_strerror(int errnum) { void factor_vm::load_image(vm_parameters* p) { FILE* file = OPEN_READ(p->image_path); - if (file == NULL) { + if (file == nullptr) { std::cout << "Cannot open image file: " << p->image_path << std::endl; char *msg = threadsafe_strerror(errno); std::cout << "strerror:2: " << msg << std::endl; @@ -289,7 +289,7 @@ bool factor_vm::save_image(const vm_char* saving_filename, (save_special_p(i) ? special_objects[i] : false_object); FILE* file = OPEN_WRITE(saving_filename); - if (file == NULL) + if (file == nullptr) return false; if (safe_fwrite(&h, sizeof(image_header), 1, file) != 1) return false; diff --git a/vm/io.cpp b/vm/io.cpp index b58e4a8d5e..c329c0df0d 100644 --- a/vm/io.cpp +++ b/vm/io.cpp @@ -53,7 +53,7 @@ FILE* factor_vm::safe_fopen(char* filename, const char* mode) { FILE* file; for (;;) { file = fopen(filename, mode); - if (file == NULL) + if (file == nullptr) io_error_if_not_EINTR(); else break; diff --git a/vm/layouts.hpp b/vm/layouts.hpp index e60201ed5d..3037c9429a 100644 --- a/vm/layouts.hpp +++ b/vm/layouts.hpp @@ -12,12 +12,12 @@ static const cell data_alignment = 16; // Must match leaf-stack-frame-size in core/layouts/layouts.factor #define LEAF_FRAME_SIZE 16 -#define WORD_SIZE (signed)(sizeof(cell) * 8) +#define WORD_SIZE static_cast(sizeof(cell) * 8) #define TAG_MASK 15 #define TAG_BITS 4 -#define TAG(x) ((cell)(x) & TAG_MASK) -#define UNTAG(x) ((cell)(x) & ~TAG_MASK) +#define TAG(x) (reinterpret_cast(x) & static_cast(TAG_MASK)) +#define UNTAG(x) (reinterpret_cast(x) & static_cast(~TAG_MASK)) #define RETAG(x, tag) (UNTAG(x) | (tag)) // Type tags, should be kept in sync with: @@ -100,11 +100,11 @@ inline static bool immediate_p(cell obj) { inline static fixnum untag_fixnum(cell tagged) { FACTOR_ASSERT(TAG(tagged) == FIXNUM_TYPE); - return ((fixnum)tagged) >> TAG_BITS; + return static_cast(tagged) >> TAG_BITS; } inline static cell tag_fixnum(fixnum untagged) { - return ( (cell)untagged << TAG_BITS) | FIXNUM_TYPE; + return ( static_cast(untagged) << TAG_BITS) | FIXNUM_TYPE; } #define NO_TYPE_CHECK static const cell type_number = TYPE_COUNT @@ -128,7 +128,7 @@ struct object { cell slot_count() const; template cell slot_count(Fixup fixup) const; - cell* slots() const { return (cell*)this; } + cell* slots() const { return const_cast(reinterpret_cast(this)); } template void each_slot(Iterator& iter); @@ -148,9 +148,9 @@ struct object { bool forwarding_pointer_p() const { return (header & 2) == 2; } - object* forwarding_pointer() const { return (object*)UNTAG(header); } + object* forwarding_pointer() const { return reinterpret_cast(UNTAG(header)); } - void forward_to(object* pointer) { header = ((cell)pointer | 2); } + void forward_to(object* pointer) { header = reinterpret_cast(pointer) | 2; } }; // Assembly code makes assumptions about the layout of this struct @@ -160,7 +160,7 @@ struct array : public object { // tagged cell capacity; - cell* data() const { return (cell*)(this + 1); } + cell* data() const { return const_cast(reinterpret_cast(this + 1)); } }; // These are really just arrays, but certain elements have special @@ -181,7 +181,7 @@ struct bignum : public object { // tagged cell capacity; - cell* data() const { return (cell*)(this + 1); } + cell* data() const { return const_cast(reinterpret_cast(this + 1)); } }; struct byte_array : public object { @@ -196,7 +196,7 @@ struct byte_array : public object { #endif template Scalar* data() const { - return (Scalar*)(this + 1); + return const_cast(reinterpret_cast(this + 1)); } }; @@ -210,7 +210,7 @@ struct string : public object { // tagged cell hashcode; - uint8_t* data() const { return (uint8_t*)(this + 1); } + uint8_t* data() const { return const_cast(reinterpret_cast(this + 1)); } }; struct code_block; @@ -319,12 +319,12 @@ struct callstack : public object { cell length; cell frame_top_at(cell offset) const { - return (cell)(this + 1) + offset; + return reinterpret_cast(this + 1) + offset; } - void* top() const { return (void*)(this + 1); } + void* top() const { return const_cast(static_cast(this + 1)); } void* bottom() const { - return (void*)((cell)(this + 1) + untag_fixnum(length)); + return const_cast(reinterpret_cast((this + 1) + untag_fixnum(length))); } }; @@ -333,11 +333,11 @@ struct tuple : public object { // tagged layout cell layout; - cell* data() const { return (cell*)(this + 1); } + cell* data() const { return const_cast(reinterpret_cast(this + 1)); } }; inline static cell tuple_capacity(const tuple_layout *layout) { - return untag_fixnum(layout->size); + return static_cast(untag_fixnum(layout->size)); } inline static cell tuple_size(const tuple_layout* layout) { @@ -345,7 +345,7 @@ inline static cell tuple_size(const tuple_layout* layout) { } inline static cell string_capacity(const string* str) { - return untag_fixnum(str->length); + return static_cast(untag_fixnum(str->length)); } inline static cell string_size(cell size) { return sizeof(string) + size; } diff --git a/vm/mach_signal.cpp b/vm/mach_signal.cpp index 96eee762eb..de16028df3 100644 --- a/vm/mach_signal.cpp +++ b/vm/mach_signal.cpp @@ -183,7 +183,7 @@ static void* mach_exception_thread(void* arg) { abort(); } } - return NULL; // quiet warning + return nullptr; // quiet warning } // Initialize the Mach exception handler thread. @@ -210,7 +210,7 @@ void mach_initialize() { mask = EXC_MASK_BAD_ACCESS | EXC_MASK_BAD_INSTRUCTION | EXC_MASK_ARITHMETIC; // Create the thread listening on the exception port. - start_thread(mach_exception_thread, NULL); + start_thread(mach_exception_thread, nullptr); // Replace the exception port info for these exceptions with our own. // Note that we replace the exception port for the entire task, not only diff --git a/vm/mark_bits.hpp b/vm/mark_bits.hpp index efd66b339c..67bb234f50 100644 --- a/vm/mark_bits.hpp +++ b/vm/mark_bits.hpp @@ -26,9 +26,9 @@ struct mark_bits { ~mark_bits() { delete[] marked; - marked = NULL; + marked = nullptr; delete[] forwarding; - forwarding = NULL; + forwarding = nullptr; } cell block_line(cell address) { diff --git a/vm/master.hpp b/vm/master.hpp index 4c87f74b97..a61e9ed5d1 100644 --- a/vm/master.hpp +++ b/vm/master.hpp @@ -1,13 +1,13 @@ -#ifndef __FACTOR_MASTER_H__ -#define __FACTOR_MASTER_H__ +#ifndef FACTOR_MASTER_H +#define FACTOR_MASTER_H -#ifndef _THREAD_SAFE -#define _THREAD_SAFE -#endif +//#ifndef _THREAD_SAFE +//#define _THREAD_SAFE +//#endif -#ifndef _REENTRANT -#define _REENTRANT -#endif +//#ifndef _REENTRANT +//#define _REENTRANT +//#endif #include @@ -139,4 +139,4 @@ namespace factor { struct factor_vm; } #include "mvm.hpp" #include "factor.hpp" -#endif // __FACTOR_MASTER_H__ +#endif // FACTOR_MASTER_H diff --git a/vm/math.hpp b/vm/math.hpp index c0b6f7ed32..5daaefba7c 100644 --- a/vm/math.hpp +++ b/vm/math.hpp @@ -40,18 +40,18 @@ inline double factor_vm::untag_float_check(cell tagged) { } inline fixnum factor_vm::float_to_fixnum(cell tagged) { - return (fixnum)untag_float(tagged); + return static_cast(untag_float(tagged)); } inline double factor_vm::fixnum_to_float(cell tagged) { - return (double)untag_fixnum(tagged); + return static_cast(untag_fixnum(tagged)); } inline cell factor_vm::unbox_array_size() { cell obj = ctx->pop(); fixnum n = to_fixnum_strict(obj); - if (n >= 0 && n < (fixnum)array_size_max) { - return n; + if (n >= 0 && n < static_cast(array_size_max)) { + return static_cast(n); } general_error(ERROR_ARRAY_SIZE, obj, tag_fixnum(array_size_max)); return 0; // can't happen diff --git a/vm/mvm-none.cpp b/vm/mvm-none.cpp index e1cadd1150..ff38850bb8 100644 --- a/vm/mvm-none.cpp +++ b/vm/mvm-none.cpp @@ -4,7 +4,7 @@ namespace factor { factor_vm* global_vm; -void init_mvm() { global_vm = NULL; } +void init_mvm() { global_vm = nullptr; } void register_vm_with_thread(factor_vm* vm) { FACTOR_ASSERT(!global_vm); diff --git a/vm/mvm-unix.cpp b/vm/mvm-unix.cpp index 11261fe9cc..e9713f23de 100644 --- a/vm/mvm-unix.cpp +++ b/vm/mvm-unix.cpp @@ -5,7 +5,7 @@ namespace factor { pthread_key_t current_vm_tls_key; void init_mvm() { - if (pthread_key_create(¤t_vm_tls_key, NULL) != 0) + if (pthread_key_create(¤t_vm_tls_key, nullptr) != 0) fatal_error("pthread_key_create() failed", 0); } diff --git a/vm/mvm.hpp b/vm/mvm.hpp index 87c1bed728..6e4f53dd15 100644 --- a/vm/mvm.hpp +++ b/vm/mvm.hpp @@ -6,7 +6,7 @@ factor_vm* current_vm_p(); inline factor_vm* current_vm() { factor_vm* vm = current_vm_p(); - FACTOR_ASSERT(vm != NULL); + FACTOR_ASSERT(vm != nullptr); return vm; } diff --git a/vm/os-unix.cpp b/vm/os-unix.cpp index 5d030d2c8e..f5487386e8 100644 --- a/vm/os-unix.cpp +++ b/vm/os-unix.cpp @@ -23,6 +23,7 @@ THREADHANDLE start_thread(void* (*start_routine)(void*), void* args) { static void* null_dll; + void sleep_nanos(uint64_t nsec) { timespec ts; timespec ts_rem; @@ -39,7 +40,7 @@ void sleep_nanos(uint64_t nsec) { fatal_error("nanosleep failed", 0); } -void factor_vm::init_ffi() { null_dll = dlopen(NULL, RTLD_LAZY); } +void factor_vm::init_ffi() { null_dll = dlopen(nullptr, RTLD_LAZY); } void factor_vm::ffi_dlopen(dll* dll) { dll->handle = dlopen(alien_offset(dll->path), RTLD_LAZY | RTLD_GLOBAL); @@ -56,7 +57,7 @@ cell factor_vm::ffi_dlsym(dll* dll, symbol_char* symbol) { void factor_vm::ffi_dlclose(dll* dll) { if (dlclose(dll->handle)) general_error(ERROR_FFI, false_object, false_object); - dll->handle = NULL; + dll->handle = nullptr; } void factor_vm::primitive_existsp() { @@ -86,7 +87,7 @@ segment::segment(cell size_, bool executable_p) { prot = PROT_READ | PROT_WRITE; cell alloc_size = 2 * pagesize + size; - char* array = (char*)mmap(NULL, alloc_size, prot, + char* array = (char*)mmap(nullptr, alloc_size, prot, MAP_ANON | MAP_PRIVATE, -1, 0); if (array == (char*)-1) @@ -110,13 +111,13 @@ void factor_vm::start_sampling_profiler_timer() { memset((void*)&timer, 0, sizeof(struct itimerval)); timer.it_value.tv_usec = 1000000 / samples_per_second; timer.it_interval.tv_usec = 1000000 / samples_per_second; - setitimer(ITIMER_REAL, &timer, NULL); + setitimer(ITIMER_REAL, &timer, nullptr); } void factor_vm::end_sampling_profiler_timer() { struct itimerval timer; memset((void*)&timer, 0, sizeof(struct itimerval)); - setitimer(ITIMER_REAL, &timer, NULL); + setitimer(ITIMER_REAL, &timer, nullptr); } void factor_vm::dispatch_signal(void* uap, void(handler)()) { @@ -176,7 +177,7 @@ void fep_signal_handler(int signal, siginfo_t* siginfo, void* uap) { void sample_signal_handler(int signal, siginfo_t* siginfo, void* uap) { factor_vm* vm = current_vm_p(); bool foreign_thread = false; - if (vm == NULL) { + if (vm == nullptr) { foreign_thread = true; vm = thread_vms.begin()->second; } @@ -255,43 +256,43 @@ void factor_vm::unix_init_signals() { signal_callstack.ss_size = signal_callstack_seg->size; signal_callstack.ss_flags = 0; - if (sigaltstack(&signal_callstack, (stack_t*)NULL) < 0) + if (sigaltstack(&signal_callstack, nullptr) < 0) fatal_error("sigaltstack() failed", 0); { struct sigaction memory_sigaction; init_sigaction_with_handler(&memory_sigaction, memory_signal_handler); - sigaction_safe(SIGBUS, &memory_sigaction, NULL); - sigaction_safe(SIGSEGV, &memory_sigaction, NULL); - sigaction_safe(SIGTRAP, &memory_sigaction, NULL); + sigaction_safe(SIGBUS, &memory_sigaction, nullptr); + sigaction_safe(SIGSEGV, &memory_sigaction, nullptr); + sigaction_safe(SIGTRAP, &memory_sigaction, nullptr); } { struct sigaction fpe_sigaction; init_sigaction_with_handler(&fpe_sigaction, fpe_signal_handler); - sigaction_safe(SIGFPE, &fpe_sigaction, NULL); + sigaction_safe(SIGFPE, &fpe_sigaction, nullptr); } { struct sigaction synchronous_sigaction; init_sigaction_with_handler(&synchronous_sigaction, synchronous_signal_handler); - sigaction_safe(SIGILL, &synchronous_sigaction, NULL); - sigaction_safe(SIGABRT, &synchronous_sigaction, NULL); + sigaction_safe(SIGILL, &synchronous_sigaction, nullptr); + sigaction_safe(SIGABRT, &synchronous_sigaction, nullptr); } { struct sigaction enqueue_sigaction; init_sigaction_with_handler(&enqueue_sigaction, enqueue_signal_handler); - sigaction_safe(SIGWINCH, &enqueue_sigaction, NULL); - sigaction_safe(SIGUSR1, &enqueue_sigaction, NULL); - sigaction_safe(SIGCONT, &enqueue_sigaction, NULL); - sigaction_safe(SIGURG, &enqueue_sigaction, NULL); - sigaction_safe(SIGIO, &enqueue_sigaction, NULL); - sigaction_safe(SIGPROF, &enqueue_sigaction, NULL); - sigaction_safe(SIGVTALRM, &enqueue_sigaction, NULL); + sigaction_safe(SIGWINCH, &enqueue_sigaction, nullptr); + sigaction_safe(SIGUSR1, &enqueue_sigaction, nullptr); + sigaction_safe(SIGCONT, &enqueue_sigaction, nullptr); + sigaction_safe(SIGURG, &enqueue_sigaction, nullptr); + sigaction_safe(SIGIO, &enqueue_sigaction, nullptr); + sigaction_safe(SIGPROF, &enqueue_sigaction, nullptr); + sigaction_safe(SIGVTALRM, &enqueue_sigaction, nullptr); #ifdef SIGINFO - sigaction_safe(SIGINFO, &enqueue_sigaction, NULL); + sigaction_safe(SIGINFO, &enqueue_sigaction, nullptr); #endif } @@ -300,7 +301,7 @@ void factor_vm::unix_init_signals() { { struct sigaction sample_sigaction; init_sigaction_with_handler(&sample_sigaction, sample_signal_handler); - sigaction_safe(SIGALRM, &sample_sigaction, NULL); + sigaction_safe(SIGALRM, &sample_sigaction, nullptr); } // We don't use SA_IGN here because then the ignore action is inherited @@ -309,9 +310,9 @@ void factor_vm::unix_init_signals() { { struct sigaction ignore_sigaction; init_sigaction_with_handler(&ignore_sigaction, ignore_signal_handler); - sigaction_safe(SIGPIPE, &ignore_sigaction, NULL); + sigaction_safe(SIGPIPE, &ignore_sigaction, nullptr); // We send SIGUSR2 to the stdin_loop thread to interrupt it on FEP - sigaction_safe(SIGUSR2, &ignore_sigaction, NULL); + sigaction_safe(SIGUSR2, &ignore_sigaction, nullptr); } } @@ -359,7 +360,7 @@ void safe_write(int fd, void* data, ssize_t size) { void safe_write_nonblock(int fd, void* data, ssize_t size) { if (!check_write(fd, data, size) && errno != EAGAIN) - fatal_error("error writing fd", errno); + fatal_error("error writing fd", static_cast(errno)); } bool safe_read(int fd, void* data, ssize_t size) { @@ -376,6 +377,7 @@ bool safe_read(int fd, void* data, ssize_t size) { } void* stdin_loop(void* arg) { + (void) arg; unsigned char buf[4096]; bool loop_running = true; @@ -385,7 +387,7 @@ void* stdin_loop(void* arg) { sigdelset(&mask, SIGTTIN); sigdelset(&mask, SIGTERM); sigdelset(&mask, SIGQUIT); - pthread_sigmask(SIG_SETMASK, &mask, NULL); + pthread_sigmask(SIG_SETMASK, &mask, nullptr); int unused; pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &unused); @@ -424,7 +426,7 @@ void* stdin_loop(void* arg) { safe_close(stdin_write); safe_close(control_read); - return NULL; + return nullptr; } void open_console() { @@ -432,9 +434,9 @@ void open_console() { safe_pipe(&control_read, &control_write); safe_pipe(&size_read, &size_write); safe_pipe(&stdin_read, &stdin_write); - stdin_thread = start_thread(stdin_loop, NULL); + stdin_thread = start_thread(stdin_loop, nullptr); stdin_thread_initialized_p = true; - pthread_mutex_init(&stdin_mutex, NULL); + pthread_mutex_init(&stdin_mutex, nullptr); } // This method is used to kill the stdin_loop before exiting from factor. @@ -443,7 +445,7 @@ void open_console() { void close_console() { if (stdin_thread_initialized_p) { pthread_cancel(stdin_thread); - pthread_join(stdin_thread, 0); + pthread_join(stdin_thread, nullptr); } } @@ -471,7 +473,7 @@ void ignore_ctrl_c() { void handle_ctrl_c() { struct sigaction fep_sigaction; init_sigaction_with_handler(&fep_sigaction, fep_signal_handler); - sigaction_safe(SIGINT, &fep_sigaction, NULL); + sigaction_safe(SIGINT, &fep_sigaction, nullptr); } void factor_vm::primitive_disable_ctrl_break() { @@ -482,7 +484,7 @@ void factor_vm::primitive_enable_ctrl_break() { stop_on_ctrl_break = true; } -void abort() { +__attribute__((noreturn)) void abort() { sig_t ret; do { ret = signal(SIGABRT, SIG_DFL); diff --git a/vm/os-unix.hpp b/vm/os-unix.hpp index 90d95cf59a..c8a0649742 100644 --- a/vm/os-unix.hpp +++ b/vm/os-unix.hpp @@ -50,8 +50,10 @@ inline static THREADHANDLE thread_id() { return pthread_self(); } uint64_t nano_count(); void sleep_nanos(uint64_t nsec); +void* stdin_loop(void* arg); + void check_ENOMEM(const char* msg); -static inline void breakpoint() { __builtin_trap(); } +__attribute__((noreturn)) static inline void breakpoint() { __builtin_trap(); } } diff --git a/vm/os-windows.cpp b/vm/os-windows.cpp index d5ecad1d09..c8fb9726b8 100644 --- a/vm/os-windows.cpp +++ b/vm/os-windows.cpp @@ -12,13 +12,13 @@ bool set_memory_locked(cell base, cell size, bool locked) { } void factor_vm::init_ffi() { - hFactorDll = GetModuleHandle(NULL); + hFactorDll = GetModuleHandle(nullptr); if (!hFactorDll) fatal_error("GetModuleHandle() failed", 0); } void factor_vm::ffi_dlopen(dll* dll) { - dll->handle = LoadLibraryEx((WCHAR*)alien_offset(dll->path), NULL, 0); + dll->handle = LoadLibraryEx((WCHAR*)alien_offset(dll->path), nullptr, 0); } cell factor_vm::ffi_dlsym(dll* dll, symbol_char* symbol) { @@ -32,13 +32,13 @@ cell factor_vm::ffi_dlsym_raw(dll* dll, symbol_char* symbol) { void factor_vm::ffi_dlclose(dll* dll) { FreeLibrary((HMODULE) dll->handle); - dll->handle = NULL; + dll->handle = nullptr; } BOOL factor_vm::windows_stat(vm_char* path) { BY_HANDLE_FILE_INFORMATION bhfi; - HANDLE h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + HANDLE h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, nullptr, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (h == INVALID_HANDLE_VALUE) { // FindFirstFile is the only call that can stat c:\pagefile.sys @@ -61,7 +61,7 @@ const vm_char* factor_vm::default_image_path() { vm_char* ptr; vm_char temp_path[MAX_UNICODE_PATH]; - if (!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH)) + if (!GetModuleFileName(nullptr, full_path, MAX_UNICODE_PATH)) fatal_error("GetModuleFileName() failed", 0); if ((ptr = wcsrchr(full_path, '.'))) @@ -79,7 +79,7 @@ const vm_char* factor_vm::default_image_path() { // You must free() this yourself. const vm_char* factor_vm::vm_executable_path() { vm_char full_path[MAX_UNICODE_PATH]; - if (!GetModuleFileName(NULL, full_path, MAX_UNICODE_PATH)) + if (!GetModuleFileName(nullptr, full_path, MAX_UNICODE_PATH)) fatal_error("GetModuleFileName() failed", 0); return safe_strdup(full_path); } @@ -95,7 +95,7 @@ segment::segment(cell size_, bool executable_p) { char* mem; cell alloc_size = getpagesize() * 2 + size; if ((mem = (char*)VirtualAlloc( - NULL, alloc_size, MEM_COMMIT, + nullptr, alloc_size, MEM_COMMIT, executable_p ? PAGE_EXECUTE_READWRITE : PAGE_READWRITE)) == 0) { fatal_error("Out of memory in VirtualAlloc", alloc_size); @@ -141,7 +141,7 @@ bool move_file(const vm_char* path1, const vm_char* path2) { void factor_vm::init_signals() {} THREADHANDLE start_thread(void* (*start_routine)(void*), void* args) { - return (void*)CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) start_routine, + return (void*)CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE) start_routine, args, 0, 0); } @@ -254,7 +254,7 @@ static void wake_up_thread(HANDLE thread) { // CancelSynchronousIo() didn't find anything to cancel, let's try // with QueueUserAPC() instead. if (err == ERROR_NOT_FOUND) { - if (!QueueUserAPC(&dummy_cb, thread, NULL)) { + if (!QueueUserAPC(&dummy_cb, thread, nullptr)) { fatal_error("QueueUserAPC() failed", GetLastError()); } } else { @@ -307,7 +307,7 @@ static DWORD WINAPI ctrl_break_thread_proc(LPVOID parent_vm) { } else if (!ctrl_break_handled) { /* Check if the VM thread has the same Id as the thread Id of the currently active window. Note that thread Id is not a handle. */ - DWORD fg_thd_id = GetWindowThreadProcessId(GetForegroundWindow(), NULL); + DWORD fg_thd_id = GetWindowThreadProcessId(GetForegroundWindow(), nullptr); if ((fg_thd_id == vm->thread_id) && !vm->fep_p) { vm->enqueue_fep(); ctrl_break_handled = true; @@ -320,22 +320,22 @@ static DWORD WINAPI ctrl_break_thread_proc(LPVOID parent_vm) { void factor_vm::primitive_disable_ctrl_break() { stop_on_ctrl_break = false; - if (ctrl_break_thread != NULL) { + if (ctrl_break_thread != nullptr) { DWORD wait_result = WaitForSingleObject(ctrl_break_thread, 2 * ctrl_break_sleep); if (wait_result != WAIT_OBJECT_0) TerminateThread(ctrl_break_thread, 0); CloseHandle(ctrl_break_thread); - ctrl_break_thread = NULL; + ctrl_break_thread = nullptr; } } void factor_vm::primitive_enable_ctrl_break() { stop_on_ctrl_break = true; - if (ctrl_break_thread == NULL) { + if (ctrl_break_thread == nullptr) { DisableProcessWindowsGhosting(); - ctrl_break_thread = CreateThread(NULL, 0, factor::ctrl_break_thread_proc, - static_cast(this), 0, NULL); + ctrl_break_thread = CreateThread(nullptr, 0, factor::ctrl_break_thread_proc, + static_cast(this), 0, nullptr); SetThreadPriority(ctrl_break_thread, THREAD_PRIORITY_ABOVE_NORMAL); } } @@ -397,8 +397,8 @@ static DWORD WINAPI sampler_thread_entry(LPVOID parent_vm) { } void factor_vm::start_sampling_profiler_timer() { - sampler_thread = CreateThread(NULL, 0, &sampler_thread_entry, - static_cast(this), 0, NULL); + sampler_thread = CreateThread(nullptr, 0, &sampler_thread_entry, + static_cast(this), 0, nullptr); } void factor_vm::end_sampling_profiler_timer() { @@ -408,7 +408,7 @@ void factor_vm::end_sampling_profiler_timer() { if (wait_result != WAIT_OBJECT_0) TerminateThread(sampler_thread, 0); CloseHandle(sampler_thread); - sampler_thread = NULL; + sampler_thread = nullptr; } void abort() { ::abort(); } diff --git a/vm/os-windows.hpp b/vm/os-windows.hpp index cca3c7e776..02904d7e5b 100644 --- a/vm/os-windows.hpp +++ b/vm/os-windows.hpp @@ -79,7 +79,7 @@ inline static THREADHANDLE thread_id() { HANDLE threadHandle = OpenThread( THREAD_GET_CONTEXT | THREAD_SET_CONTEXT | THREAD_SUSPEND_RESUME, FALSE, id); - FACTOR_ASSERT(threadHandle != NULL); + FACTOR_ASSERT(threadHandle != nullptr); return threadHandle; } diff --git a/vm/quotations.hpp b/vm/quotations.hpp index dd80c94882..3c659126dc 100644 --- a/vm/quotations.hpp +++ b/vm/quotations.hpp @@ -10,7 +10,6 @@ struct quotation_jit : public jit { elements(false_object, vm), compiling(compiling), relocate(relocate) {} - ; cell nth(cell index); void init_quotation(cell quot); diff --git a/vm/slot_visitor.hpp b/vm/slot_visitor.hpp index 79bc3eb367..e0f6acee0d 100644 --- a/vm/slot_visitor.hpp +++ b/vm/slot_visitor.hpp @@ -374,7 +374,7 @@ template void slot_visitor::visit_object_code_block(object* obj) { switch (obj->type()) { case WORD_TYPE: { - word* w = (word*)obj; + word* w = static_cast(obj); if (w->entry_point) w->entry_point = fixup.fixup_code(w->code())->entry_point(); break; diff --git a/vm/tenured_space.hpp b/vm/tenured_space.hpp index 2fff0515ad..a628b2c1b6 100644 --- a/vm/tenured_space.hpp +++ b/vm/tenured_space.hpp @@ -12,7 +12,7 @@ struct tenured_space : free_list_allocator { starts.record_object_start_offset(obj); return obj; } - return NULL; + return nullptr; } cell next_allocated_object_after(cell scan) { diff --git a/vm/utilities.cpp b/vm/utilities.cpp index 60d524a87b..79c3946a8a 100644 --- a/vm/utilities.cpp +++ b/vm/utilities.cpp @@ -6,8 +6,8 @@ namespace factor { void* fill_function_descriptor(void* ptr, void* code) { void** descriptor = (void**)ptr; descriptor[0] = code; - descriptor[1] = NULL; - descriptor[2] = NULL; + descriptor[1] = nullptr; + descriptor[2] = nullptr; return descriptor; } diff --git a/vm/vm.cpp b/vm/vm.cpp index bf4037962b..303d1b3cd8 100644 --- a/vm/vm.cpp +++ b/vm/vm.cpp @@ -3,33 +3,33 @@ namespace factor { factor_vm::factor_vm(THREADHANDLE thread) - : ctx(NULL), + : ctx(nullptr), nursery(0, 0), faulting_p(false), thread(thread), #if defined(WINDOWS) thread_id(GetCurrentThreadId()), - ctrl_break_thread(NULL), + ctrl_break_thread(nullptr), #endif callback_id(0), - c_to_factor_func(NULL), + c_to_factor_func(nullptr), 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), + data(nullptr), code(nullptr), callbacks(nullptr), + current_gc(nullptr), current_gc_p(false), current_jit_count(0), - gc_events(NULL), + gc_events(nullptr), fep_p(false), fep_help_was_shown(false), fep_disabled(false), full_output(false), object_counter(0), last_nano_count(0), - signal_callstack_seg(NULL), + signal_callstack_seg(nullptr), safepoint_fep_p(false), stop_on_ctrl_break(false) { primitive_reset_dispatch_stats(); @@ -54,7 +54,7 @@ factor_vm::~factor_vm() { delete code; if (signal_callstack_seg) { delete signal_callstack_seg; - signal_callstack_seg = NULL; + signal_callstack_seg = nullptr; } FACTOR_FOR_EACH(function_descriptors) { delete[] * iter;