Revert "vm: replace line comments // with block comments /**/ for consintency"

This reverts commit 7ee4e5dea5.
char-rename
Alexander Iljin 2016-08-05 15:44:37 +03:00 committed by Björn Lindqvist
parent 897d0d6eeb
commit e0acf4f328
23 changed files with 120 additions and 118 deletions

View File

@ -1737,7 +1737,7 @@ bignum* factor_vm::bignum_gcd(bignum* a_, bignum* b_) {
/* clone the bignums so we can modify them in-place */ /* clone the bignums so we can modify them in-place */
size_a = BIGNUM_LENGTH(a); size_a = BIGNUM_LENGTH(a);
data_root<bignum> c(allot_bignum(size_a, 0), this); data_root<bignum> c(allot_bignum(size_a, 0), this);
/* c = allot_bignum(size_a, 0); */ // c = allot_bignum(size_a, 0);
scan_a = BIGNUM_START_PTR(a); scan_a = BIGNUM_START_PTR(a);
a_end = scan_a + size_a; a_end = scan_a + size_a;
scan_c = BIGNUM_START_PTR(c); scan_c = BIGNUM_START_PTR(c);
@ -1808,7 +1808,7 @@ bignum* factor_vm::bignum_gcd(bignum* a_, bignum* b_) {
return c.untagged(); return c.untagged();
} }
/* copy 'b' to 'a' */ // copy 'b' to 'a'
scan_a = BIGNUM_START_PTR(a); scan_a = BIGNUM_START_PTR(a);
scan_b = BIGNUM_START_PTR(b); scan_b = BIGNUM_START_PTR(b);
a_end = scan_a + size_a; a_end = scan_a + size_a;
@ -1819,7 +1819,7 @@ bignum* factor_vm::bignum_gcd(bignum* a_, bignum* b_) {
*(scan_a++) = 0; *(scan_a++) = 0;
size_a = size_b; size_a = size_b;
/* copy 'c' to 'b' */ // copy 'c' to 'b'
scan_b = BIGNUM_START_PTR(b); scan_b = BIGNUM_START_PTR(b);
scan_c = BIGNUM_START_PTR(c); scan_c = BIGNUM_START_PTR(c);
size_c = BIGNUM_LENGTH(c); size_c = BIGNUM_LENGTH(c);
@ -1858,7 +1858,7 @@ bignum* factor_vm::bignum_gcd(bignum* a_, bignum* b_) {
s -= (B * *scan_a); s -= (B * *scan_a);
t += (D * *scan_a++); t += (D * *scan_a++);
*scan_c++ = (bignum_digit_type)(s & BIGNUM_DIGIT_MASK); *scan_c++ = (bignum_digit_type)(s & BIGNUM_DIGIT_MASK);
/* *scan_d++ = (bignum_digit_type) (t & BIGNUM_DIGIT_MASK); */ //*scan_d++ = (bignum_digit_type) (t & BIGNUM_DIGIT_MASK);
s >>= BIGNUM_DIGIT_LENGTH; s >>= BIGNUM_DIGIT_LENGTH;
t >>= BIGNUM_DIGIT_LENGTH; t >>= BIGNUM_DIGIT_LENGTH;
} }
@ -1875,7 +1875,7 @@ bignum* factor_vm::bignum_gcd(bignum* a_, bignum* b_) {
s += (A * *scan_a); s += (A * *scan_a);
t -= (C * *scan_a++); t -= (C * *scan_a++);
*scan_c++ = (bignum_digit_type)(s & BIGNUM_DIGIT_MASK); *scan_c++ = (bignum_digit_type)(s & BIGNUM_DIGIT_MASK);
/* *scan_d++ = (bignum_digit_type) (t & BIGNUM_DIGIT_MASK); */ //*scan_d++ = (bignum_digit_type) (t & BIGNUM_DIGIT_MASK);
s >>= BIGNUM_DIGIT_LENGTH; s >>= BIGNUM_DIGIT_LENGTH;
t >>= BIGNUM_DIGIT_LENGTH; t >>= BIGNUM_DIGIT_LENGTH;
} }
@ -1883,7 +1883,7 @@ bignum* factor_vm::bignum_gcd(bignum* a_, bignum* b_) {
BIGNUM_ASSERT(s == 0); BIGNUM_ASSERT(s == 0);
BIGNUM_ASSERT(t == 0); BIGNUM_ASSERT(t == 0);
/* update size_a and size_b to remove any zeroes at end */ // update size_a and size_b to remove any zeros at end
while (size_a > 0 && *(--scan_a) == 0) while (size_a > 0 && *(--scan_a) == 0)
size_a--; size_a--;
while (size_b > 0 && *(--scan_b) == 0) while (size_b > 0 && *(--scan_b) == 0)

View File

@ -59,11 +59,11 @@ inline cell popcount(cell x) {
cell ks = 24; cell ks = 24;
#endif #endif
x = x - ((x >> 1) & k1); /* put count of each 2 bits into those 2 bits */ x = x - ((x >> 1) & k1); // put count of each 2 bits into those 2 bits
x = (x & k2) + ((x >> 2) & k2); /* put count of each 4 bits into those 4 bits */ x = (x & k2) + ((x >> 2) & k2); // put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & k4; /* put count of each 8 bits into those 8 bits */ x = (x + (x >> 4)) & k4; // put count of each 8 bits into those 8 bits
x = (x * kf) >> ks; /* returns 8 most significant bits of x + (x<<8) + */ x = (x * kf) >> ks; // returns 8 most significant bits of x + (x<<8) +
(x<<16) + (x<<24) + ... */ // (x<<16) + (x<<24) + ...
return x; return x;
#endif #endif

View File

@ -2,14 +2,14 @@ namespace factor {
/* The compiled code heap is structured into blocks. */ /* The compiled code heap is structured into blocks. */
struct code_block { struct code_block {
/* header format (bits indexed with least significant as zero): // header format (bits indexed with least significant as zero):
bit 0 : free? // bit 0 : free?
bits 1-2: type (as a code_block_type) // bits 1-2: type (as a code_block_type)
if not free: // if not free:
bits 3-23: code size / 8 // bits 3-23: code size / 8
bits 24-31: stack frame size / 16 // bits 24-31: stack frame size / 16
if free: // if free:
bits 3-end: code size / 8 */ // bits 3-end: code size / 8
cell header; cell header;
cell owner; /* tagged pointer to word, quotation or f */ cell owner; /* tagged pointer to word, quotation or f */
cell parameters; /* tagged pointer to array or f */ cell parameters; /* tagged pointer to array or f */

View File

@ -140,9 +140,9 @@ VM_C_API void delete_context(factor_vm* parent) {
/* Allocates memory (init_context()) */ /* Allocates memory (init_context()) */
VM_C_API void reset_context(factor_vm* parent) { VM_C_API void reset_context(factor_vm* parent) {
/* The function is used by (start-context-and-delete) which expects // The function is used by (start-context-and-delete) which expects
the top two datastack items to be preserved after the context has // the top two datastack items to be preserved after the context has
been reset. */ // been resetted.
context* ctx = parent->ctx; context* ctx = parent->ctx;
cell arg1 = ctx->pop(); cell arg1 = ctx->pop();

View File

@ -25,7 +25,7 @@ inline static unsigned char call_site_opcode(cell return_address) {
inline static void check_call_site(cell return_address) { inline static void check_call_site(cell return_address) {
unsigned char opcode = call_site_opcode(return_address); unsigned char opcode = call_site_opcode(return_address);
FACTOR_ASSERT(opcode == call_opcode || opcode == jmp_opcode); FACTOR_ASSERT(opcode == call_opcode || opcode == jmp_opcode);
(void)opcode; /* suppress warning when compiling without assertions */ (void)opcode; // suppress warning when compiling without assertions
} }
inline static void* get_call_target(cell return_address) { inline static void* get_call_target(cell return_address) {

View File

@ -35,7 +35,7 @@ data_heap::data_heap(bump_allocator* vm_nursery,
aging = new aging_space(aging_size, tenured->end); aging = new aging_space(aging_size, tenured->end);
aging_semispace = new aging_space(aging_size, aging->end); aging_semispace = new aging_space(aging_size, aging->end);
/* Initialize vm nursery */ // Initialize vm nursery
vm_nursery->here = aging_semispace->end; vm_nursery->here = aging_semispace->end;
vm_nursery->start = aging_semispace->end; vm_nursery->start = aging_semispace->end;
vm_nursery->end = vm_nursery->start + young_size; vm_nursery->end = vm_nursery->start + young_size;

View File

@ -440,9 +440,9 @@ void factor_vm::factorbug() {
cout << "Starting low level debugger..." << endl; cout << "Starting low level debugger..." << endl;
/* Even though we've stopped the VM, the stdin_loop thread (see os-*.cpp) // Even though we've stopped the VM, the stdin_loop thread (see os-*.cpp)
that pumps the console is still running concurrently. We lock a mutex so // that pumps the console is still running concurrently. We lock a mutex so
the thread will take a break and give us exclusive access to stdin. */ // the thread will take a break and give us exclusive access to stdin.
lock_console(); lock_console();
ignore_ctrl_c(); ignore_ctrl_c();

View File

@ -1,8 +1,8 @@
namespace factor { namespace factor {
/* Runtime errors must be kept in sync with: // Runtime errors must be kept in sync with:
basis/debugger/debugger.factor // basis/debugger/debugger.factor
core/kernel/kernel.factor */ // core/kernel/kernel.factor
#define KERNEL_ERROR 0xfac7 #define KERNEL_ERROR 0xfac7
enum vm_error_type { enum vm_error_type {

View File

@ -9,7 +9,7 @@ void init_globals() { init_mvm(); }
void factor_vm::prepare_boot_image() { void factor_vm::prepare_boot_image() {
std::cout << "*** Stage 2 early init... " << std::flush; std::cout << "*** Stage 2 early init... " << std::flush;
/* Compile all words. */ // Compile all words.
data_root<array> words(instances(WORD_TYPE), this); data_root<array> words(instances(WORD_TYPE), this);
cell n_words = array_capacity(words.untagged()); cell n_words = array_capacity(words.untagged());
@ -21,7 +21,7 @@ void factor_vm::prepare_boot_image() {
} }
update_code_heap_words(true); update_code_heap_words(true);
/* Initialize all quotations */ // Initialize all quotations
data_root<array> quotations(instances(QUOTATION_TYPE), this); data_root<array> quotations(instances(QUOTATION_TYPE), this);
cell n_quots = array_capacity(quotations.untagged()); cell n_quots = array_capacity(quotations.untagged());

View File

@ -4,13 +4,13 @@ VM_C_API void init_globals();
factor_vm* new_factor_vm(); factor_vm* new_factor_vm();
VM_C_API void start_standalone_factor(int argc, vm_char** argv); VM_C_API void start_standalone_factor(int argc, vm_char** argv);
/* image */ // image
bool factor_arg(const vm_char* str, const vm_char* arg, cell* value); bool factor_arg(const vm_char* str, const vm_char* arg, cell* value);
/* objects */ // objects
cell object_size(cell tagged); cell object_size(cell tagged);
/* os-* */ // os-*
void open_console(); void open_console();
void close_console(); void close_console();
void lock_console(); void lock_console();

View File

@ -1,8 +1,8 @@
namespace factor { namespace factor {
/* gc_info should be kept in sync with: // gc_info should be kept in sync with:
basis/compiler/codegen/gc-maps/gc-maps.factor // basis/compiler/codegen/gc-maps/gc-maps.factor
basis/vm/vm.factor */ // basis/vm/vm.factor
struct gc_info { struct gc_info {
uint32_t scrub_d_count; uint32_t scrub_d_count;
uint32_t scrub_r_count; uint32_t scrub_r_count;

View File

@ -34,7 +34,7 @@ size_t raw_fread(void* ptr, size_t size, size_t nitems, FILE* stream) {
return items_read; return items_read;
} }
/* Call fclose() once only. Issues #1335, #908. */ // Call fclose() once only. Issues #1335, #908.
int raw_fclose(FILE* stream) { int raw_fclose(FILE* stream) {
if (fclose(stream) == EOF && errno != EINTR) if (fclose(stream) == EOF && errno != EINTR)
return -1; return -1;

View File

@ -110,14 +110,14 @@ inline static cell tag_fixnum(fixnum untagged) {
struct object { struct object {
NO_TYPE_CHECK; NO_TYPE_CHECK;
/* header format (bits indexed with least significant as zero): // header format (bits indexed with least significant as zero):
bit 0 : free? // bit 0 : free?
if not forwarding: // if not forwarding:
bit 1 : forwarding pointer? // bit 1 : forwarding pointer?
bit 2-5 : tag // bit 2-5 : tag
bit 7-end : hashcode // bit 7-end : hashcode
if forwarding: // if forwarding:
bit 2-end : forwarding pointer */ // bit 2-end : forwarding pointer
cell header; cell header;
template <typename Fixup> cell base_size(Fixup fixup) const; template <typename Fixup> cell base_size(Fixup fixup) const;

View File

@ -187,7 +187,7 @@ static void* mach_exception_thread(void* arg) {
abort(); abort();
} }
} }
return NULL; /* quiet warning */ return NULL; // quiet warning
} }
/* Initialize the Mach exception handler thread. */ /* Initialize the Mach exception handler thread. */

View File

@ -9,7 +9,7 @@ struct startargs {
vm_char** argv; vm_char** argv;
}; };
/* arg must be new'ed because we're going to delete it! */ // arg must be new'ed because we're going to delete it!
void* start_standalone_factor_thread(void* arg) { void* start_standalone_factor_thread(void* arg) {
factor_vm* newvm = new_factor_vm(); factor_vm* newvm = new_factor_vm();
startargs* args = (startargs*)arg; startargs* args = (startargs*)arg;

View File

@ -1,8 +1,8 @@
namespace factor { namespace factor {
/* Special object count and identifiers must be kept in sync with: // Special object count and identifiers must be kept in sync with:
core/kernel/kernel.factor // core/kernel/kernel.factor
basis/bootstrap/image/image.factor */ // basis/bootstrap/image/image.factor
static const cell special_object_count = 85; static const cell special_object_count = 85;

View File

@ -2,8 +2,9 @@
namespace factor { namespace factor {
/* glibc lies about the contents of the fpstate the kernel provides, hiding the // glibc lies about the contents of the fpstate the kernel provides, hiding the
FXSR environment */ // FXSR
// environment
struct _fpstate { struct _fpstate {
/* Regular FPU environment */ /* Regular FPU environment */
unsigned long cw; unsigned long cw;

View File

@ -41,7 +41,7 @@ BOOL factor_vm::windows_stat(vm_char* path) {
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
if (h == INVALID_HANDLE_VALUE) { if (h == INVALID_HANDLE_VALUE) {
/* FindFirstFile is the only call that can stat c:\pagefile.sys */ // FindFirstFile is the only call that can stat c:\pagefile.sys
WIN32_FIND_DATA st; WIN32_FIND_DATA st;
HANDLE h; HANDLE h;
@ -151,12 +151,12 @@ uint64_t nano_count() {
static uint32_t hi = 0; static uint32_t hi = 0;
static uint32_t lo = 0; static uint32_t lo = 0;
/* Note: on older systems QueryPerformanceCounter may be unreliable // Note: on older systems QueryPerformanceCounter may be unreliable
until you add /usepmtimer to Boot.ini. I had an issue where two // until you add /usepmtimer to Boot.ini. I had an issue where two
nano_count calls would show a difference of about 1 second, // nano_count calls would show a difference of about 1 second,
while actually about 80 seconds have passed. The /usepmtimer // while actually about 80 seconds have passed. The /usepmtimer
switch cured the issue on that PC (WinXP Pro SP3 32-bit). // switch cured the issue on that PC (WinXP Pro SP3 32-bit).
See also http://www.virtualdub.org/blog/pivot/entry.php?id=106 */ // See also http://www.virtualdub.org/blog/pivot/entry.php?id=106
LARGE_INTEGER count; LARGE_INTEGER count;
BOOL ret = QueryPerformanceCounter(&count); BOOL ret = QueryPerformanceCounter(&count);
if (ret == 0) if (ret == 0)
@ -246,7 +246,7 @@ VM_C_API LONG exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c,
cancellation requests to unblock the thread. */ cancellation requests to unblock the thread. */
VOID CALLBACK dummy_cb (ULONG_PTR dwParam) { } VOID CALLBACK dummy_cb (ULONG_PTR dwParam) { }
/* CancelSynchronousIo is not in Windows XP */ // CancelSynchronousIo is not in Windows XP
#if _WIN32_WINNT >= 0x0600 #if _WIN32_WINNT >= 0x0600
static void wake_up_thread(HANDLE thread) { static void wake_up_thread(HANDLE thread) {
if (!CancelSynchronousIo(thread)) { if (!CancelSynchronousIo(thread)) {

View File

@ -7,8 +7,8 @@
#if _WIN32_WINNT != 0x0600 #if _WIN32_WINNT != 0x0600
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 /* For AddVectoredExceptionHandler, WinXP support */ #define _WIN32_WINNT 0x0501 // For AddVectoredExceptionHandler, WinXP support
/*#define _WIN32_WINNT 0x0600 /* For CancelSynchronousIo */ //#define _WIN32_WINNT 0x0600 // For CancelSynchronousIo
#endif #endif
#ifndef UNICODE #ifndef UNICODE
@ -51,8 +51,9 @@ typedef HANDLE THREADHANDLE;
#define FACTOR_OS_STRING "windows" #define FACTOR_OS_STRING "windows"
/* SSE traps raise these exception codes, which are defined in internal NT // SSE traps raise these exception codes, which are defined in internal NT
headers, but not winbase.h */ // headers
// but not winbase.h
#ifndef STATUS_FLOAT_MULTIPLE_FAULTS #ifndef STATUS_FLOAT_MULTIPLE_FAULTS
#define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4 #define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
#endif #endif

View File

@ -67,7 +67,7 @@ void factor_vm::set_sampling_profiler(fixnum rate) {
void factor_vm::start_sampling_profiler(fixnum rate) { void factor_vm::start_sampling_profiler(fixnum rate) {
samples_per_second = rate; samples_per_second = rate;
sample_counts.clear(); sample_counts.clear();
/* Release the memory consumed by collecting samples. */ // Release the memory consumed by collecting samples.
samples.clear(); samples.clear();
samples.shrink_to_fit(); samples.shrink_to_fit();
sample_callstacks.clear(); sample_callstacks.clear();

View File

@ -1,15 +1,15 @@
namespace factor { namespace factor {
struct profiling_sample_count { struct profiling_sample_count {
/* Number of samples taken before the safepoint that recorded the sample */ // Number of samples taken before the safepoint that recorded the sample
fixnum sample_count; fixnum sample_count;
/* Number of samples taken during GC */ // Number of samples taken during GC
fixnum gc_sample_count; fixnum gc_sample_count;
/* Number of samples taken during unoptimized compiler */ // Number of samples taken during unoptimized compiler
fixnum jit_sample_count; fixnum jit_sample_count;
/* Number of samples taken during foreign code execution */ // Number of samples taken during foreign code execution
fixnum foreign_sample_count; fixnum foreign_sample_count;
/* Number of samples taken during code execution in non-Factor threads */ // Number of samples taken during code execution in non-Factor threads
fixnum foreign_thread_sample_count; fixnum foreign_thread_sample_count;
profiling_sample_count(fixnum sample_count, fixnum gc_sample_count, profiling_sample_count(fixnum sample_count, fixnum gc_sample_count,
@ -32,9 +32,9 @@ struct profiling_sample_count {
}; };
struct profiling_sample { struct profiling_sample {
/* Sample counts */ // Sample counts
profiling_sample_count counts; profiling_sample_count counts;
/* Active thread during sample */ // Active thread during sample
cell thread; cell thread;
/* The callstack at safepoint time. Indexes to the beginning and ending /* The callstack at safepoint time. Indexes to the beginning and ending
code_block entries in the vm sample_callstacks array. */ code_block entries in the vm sample_callstacks array. */

View File

@ -1,6 +1,6 @@
namespace factor { namespace factor {
/* Poor man's range-based for-loops. */ // Poor mans range-based for loops.
#define FACTOR_FOR_EACH(iterable) \ #define FACTOR_FOR_EACH(iterable) \
for (auto iter = (iterable).begin(), \ for (auto iter = (iterable).begin(), \
_end = (iterable).end(); \ _end = (iterable).end(); \

View File

@ -11,11 +11,11 @@ struct growable_array;
struct code_root; struct code_root;
struct factor_vm { struct factor_vm {
/* //
vvvvvv // vvvvvv
THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR. See: // THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR. See:
basis/vm/vm.factor // basis/vm/vm.factor
basis/compiler/constants/constants.factor */ // basis/compiler/constants/constants.factor
/* Current context */ /* Current context */
context* ctx; context* ctx;
@ -41,9 +41,9 @@ struct factor_vm {
set-special-object primitives */ set-special-object primitives */
cell special_objects[special_object_count]; cell special_objects[special_object_count];
/* THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR. // THESE FIELDS ARE ACCESSED DIRECTLY FROM FACTOR.
^^^^^^ // ^^^^^^
*/ //
/* Handle to the main thread we run in */ /* Handle to the main thread we run in */
THREADHANDLE thread; THREADHANDLE thread;
@ -149,7 +149,7 @@ struct factor_vm {
/* Two fep_p variants, one might be redundant. */ /* Two fep_p variants, one might be redundant. */
volatile cell safepoint_fep_p; volatile cell safepoint_fep_p;
/* contexts */ // contexts
context* new_context(); context* new_context();
void init_context(context* ctx); void init_context(context* ctx);
void delete_context(); void delete_context();
@ -172,13 +172,13 @@ struct factor_vm {
void primitive_check_datastack(); void primitive_check_datastack();
void primitive_load_locals(); void primitive_load_locals();
/* run */ // run
void primitive_exit(); void primitive_exit();
void primitive_nano_count(); void primitive_nano_count();
void primitive_sleep(); void primitive_sleep();
void primitive_set_slot(); void primitive_set_slot();
/* objects */ // objects
void primitive_special_object(); void primitive_special_object();
void primitive_set_special_object(); void primitive_set_special_object();
void primitive_identity_hashcode(); void primitive_identity_hashcode();
@ -187,7 +187,7 @@ struct factor_vm {
void primitive_clone(); void primitive_clone();
void primitive_become(); void primitive_become();
/* sampling_profiler */ // sampling_profiler
void record_sample(bool prolog_p); void record_sample(bool prolog_p);
void start_sampling_profiler(fixnum rate); void start_sampling_profiler(fixnum rate);
void end_sampling_profiler(); void end_sampling_profiler();
@ -195,7 +195,7 @@ struct factor_vm {
void primitive_sampling_profiler(); void primitive_sampling_profiler();
void primitive_get_samples(); void primitive_get_samples();
/* errors */ // errors
void general_error(vm_error_type error, cell arg1, cell arg2); void general_error(vm_error_type error, cell arg1, cell arg2);
void type_error(cell type, cell tagged); void type_error(cell type, cell tagged);
void not_implemented_error(); void not_implemented_error();
@ -203,7 +203,7 @@ struct factor_vm {
void divide_by_zero_error(); void divide_by_zero_error();
void primitive_unimplemented(); void primitive_unimplemented();
/* bignum */ // bignum
int bignum_equal_p(bignum* x, bignum* y); int bignum_equal_p(bignum* x, bignum* y);
enum bignum_comparison bignum_compare(bignum* x, bignum* y); enum bignum_comparison bignum_compare(bignum* x, bignum* y);
bignum* bignum_add(bignum* x, bignum* y); bignum* bignum_add(bignum* x, bignum* y);
@ -277,7 +277,7 @@ struct factor_vm {
int bignum_unsigned_logbitp(int shift, bignum* bn); int bignum_unsigned_logbitp(int shift, bignum* bn);
bignum* bignum_gcd(bignum* a_, bignum* b_); bignum* bignum_gcd(bignum* a_, bignum* b_);
/* data heap */ //data heap
void set_data_heap(data_heap* data_); void set_data_heap(data_heap* data_);
void init_data_heap(cell young_size, cell aging_size, cell tenured_size); void init_data_heap(cell young_size, cell aging_size, cell tenured_size);
void primitive_size(); void primitive_size();
@ -334,10 +334,10 @@ struct factor_vm {
write_barrier((cell*)offset); write_barrier((cell*)offset);
} }
/* data heap checker */ // data heap checker
void check_data_heap(); void check_data_heap();
/* gc */ // gc
void end_gc(); void end_gc();
void set_current_gc_op(gc_op op); void set_current_gc_op(gc_op op);
void start_gc_again(); void start_gc_again();
@ -366,13 +366,13 @@ struct factor_vm {
return (Type*)allot_object(Type::type_number, size); return (Type*)allot_object(Type::type_number, size);
} }
/* generic arrays */ // generic arrays
template <typename Array> Array* allot_uninitialized_array(cell capacity); template <typename Array> Array* allot_uninitialized_array(cell capacity);
template <typename Array> template <typename Array>
bool reallot_array_in_place_p(Array* array, cell capacity); bool reallot_array_in_place_p(Array* array, cell capacity);
template <typename Array> Array* reallot_array(Array* array_, cell capacity); template <typename Array> Array* reallot_array(Array* array_, cell capacity);
/* debug */ // debug
void print_chars(ostream& out, string* str); void print_chars(ostream& out, string* str);
void print_word(ostream& out, word* word, cell nesting); void print_word(ostream& out, word* word, cell nesting);
void print_factor_string(ostream& out, string* str); void print_factor_string(ostream& out, string* str);
@ -398,7 +398,7 @@ struct factor_vm {
void factorbug(); void factorbug();
void primitive_die(); void primitive_die();
/* arrays */ // arrays
inline void set_array_nth(array* array, cell slot, cell value); inline void set_array_nth(array* array, cell slot, cell value);
array* allot_array(cell capacity, cell fill_); array* allot_array(cell capacity, cell fill_);
void primitive_array(); void primitive_array();
@ -406,7 +406,7 @@ struct factor_vm {
void primitive_resize_array(); void primitive_resize_array();
cell std_vector_to_array(std::vector<cell>& elements); cell std_vector_to_array(std::vector<cell>& elements);
/* strings */ // strings
string* allot_string_internal(cell capacity); string* allot_string_internal(cell capacity);
void fill_string(string* str_, cell start, cell capacity, cell fill); void fill_string(string* str_, cell start, cell capacity, cell fill);
string* allot_string(cell capacity, cell fill); string* allot_string(cell capacity, cell fill);
@ -416,12 +416,12 @@ struct factor_vm {
void primitive_resize_string(); void primitive_resize_string();
void primitive_set_string_nth_fast(); void primitive_set_string_nth_fast();
/* booleans */ // booleans
cell tag_boolean(cell untagged) { cell tag_boolean(cell untagged) {
return untagged ? special_objects[OBJ_CANONICAL_TRUE] : false_object; return untagged ? special_objects[OBJ_CANONICAL_TRUE] : false_object;
} }
/* byte arrays */ // byte arrays
byte_array* allot_byte_array(cell size); byte_array* allot_byte_array(cell size);
void primitive_byte_array(); void primitive_byte_array();
void primitive_uninitialized_byte_array(); void primitive_uninitialized_byte_array();
@ -429,11 +429,11 @@ struct factor_vm {
template <typename Type> byte_array* byte_array_from_value(Type* value); template <typename Type> byte_array* byte_array_from_value(Type* value);
/* tuples */ // tuples
void primitive_tuple(); void primitive_tuple();
void primitive_tuple_boa(); void primitive_tuple_boa();
/* words */ // words
word* allot_word(cell name_, cell vocab_, cell hashcode_); word* allot_word(cell name_, cell vocab_, cell hashcode_);
void primitive_word(); void primitive_word();
void primitive_word_code(); void primitive_word_code();
@ -441,7 +441,7 @@ struct factor_vm {
void primitive_wrapper(); void primitive_wrapper();
void jit_compile_word(cell word_, cell def_, bool relocating); void jit_compile_word(cell word_, cell def_, bool relocating);
/* math */ // math
void primitive_bignum_to_fixnum(); void primitive_bignum_to_fixnum();
void primitive_bignum_to_fixnum_strict(); void primitive_bignum_to_fixnum_strict();
void primitive_float_to_fixnum(); void primitive_float_to_fixnum();
@ -513,7 +513,7 @@ struct factor_vm {
inline fixnum float_to_fixnum(cell tagged); inline fixnum float_to_fixnum(cell tagged);
inline double fixnum_to_float(cell tagged); inline double fixnum_to_float(cell tagged);
/* tagged */ // tagged
template <typename Type> void check_tagged(tagged<Type> t) { template <typename Type> void check_tagged(tagged<Type> t) {
if (!t.type_p()) if (!t.type_p())
type_error(Type::type_number, t.value_); type_error(Type::type_number, t.value_);
@ -525,7 +525,7 @@ struct factor_vm {
return t.untagged(); return t.untagged();
} }
/* io */ // io
void init_c_io(); void init_c_io();
void io_error_if_not_EINTR(); void io_error_if_not_EINTR();
FILE* safe_fopen(char* filename, const char* mode); FILE* safe_fopen(char* filename, const char* mode);
@ -548,7 +548,7 @@ struct factor_vm {
void primitive_fflush(); void primitive_fflush();
void primitive_fclose(); void primitive_fclose();
/* code_block */ // code_block
cell compute_entry_point_pic_address(word* w, cell tagged_quot); cell compute_entry_point_pic_address(word* w, cell tagged_quot);
cell compute_entry_point_pic_address(cell w_); cell compute_entry_point_pic_address(cell w_);
cell compute_entry_point_pic_tail_address(cell w_); cell compute_entry_point_pic_tail_address(cell w_);
@ -569,7 +569,7 @@ struct factor_vm {
cell owner_, cell relocation_, cell parameters_, cell owner_, cell relocation_, cell parameters_,
cell literals_, cell frame_size_untagged); cell literals_, cell frame_size_untagged);
/* code heap */ //code heap
template <typename Iterator> void each_code_block(Iterator& iter) { template <typename Iterator> void each_code_block(Iterator& iter) {
code->allocator->iterate(iter); code->allocator->iterate(iter);
} }
@ -581,12 +581,12 @@ struct factor_vm {
void primitive_strip_stack_traces(); void primitive_strip_stack_traces();
void primitive_code_blocks(); void primitive_code_blocks();
/* callbacks */ // callbacks
void primitive_free_callback(); void primitive_free_callback();
void primitive_callback(); void primitive_callback();
void primitive_callback_room(); void primitive_callback_room();
/* image */ // image
void load_data_heap(FILE* file, image_header* h, vm_parameters* p); void load_data_heap(FILE* file, image_header* h, vm_parameters* p);
void load_code_heap(FILE* file, image_header* h, vm_parameters* p); void load_code_heap(FILE* file, image_header* h, vm_parameters* p);
bool save_image(const vm_char* saving_filename, const vm_char* filename); bool save_image(const vm_char* saving_filename, const vm_char* filename);
@ -618,7 +618,7 @@ struct factor_vm {
template <typename Iterator> template <typename Iterator>
void iterate_callstack(context* ctx, Iterator& iterator); void iterate_callstack(context* ctx, Iterator& iterator);
/* cpu-* */ // cpu-*
void dispatch_signal_handler(cell* sp, cell* pc, cell newpc); void dispatch_signal_handler(cell* sp, cell* pc, cell newpc);
#if defined(FACTOR_X86) || defined(FACTOR_64) #if defined(FACTOR_X86) || defined(FACTOR_64)
void dispatch_non_resumable_signal(cell* sp, cell* pc, void dispatch_non_resumable_signal(cell* sp, cell* pc,
@ -627,7 +627,7 @@ struct factor_vm {
void dispatch_resumable_signal(cell* sp, cell* pc, cell handler); void dispatch_resumable_signal(cell* sp, cell* pc, cell handler);
#endif #endif
/* alien */ // alien
char* pinned_alien_offset(cell obj); char* pinned_alien_offset(cell obj);
cell allot_alien(cell delegate_, cell displacement); cell allot_alien(cell delegate_, cell displacement);
cell allot_alien(cell address); cell allot_alien(cell address);
@ -641,7 +641,7 @@ struct factor_vm {
void primitive_dll_validp(); void primitive_dll_validp();
char* alien_offset(cell obj); char* alien_offset(cell obj);
/* quotations */ // quotations
void primitive_jit_compile(); void primitive_jit_compile();
cell lazy_jit_compile_entry_point(); cell lazy_jit_compile_entry_point();
void primitive_array_to_quotation(); void primitive_array_to_quotation();
@ -653,7 +653,7 @@ struct factor_vm {
bool quotation_compiled_p(quotation* quot); bool quotation_compiled_p(quotation* quot);
void primitive_quotation_compiled_p(); void primitive_quotation_compiled_p();
/* dispatch */ // dispatch
cell lookup_tuple_method(cell obj, cell methods); cell lookup_tuple_method(cell obj, cell methods);
cell lookup_method(cell obj, cell methods); cell lookup_method(cell obj, cell methods);
void primitive_lookup_method(); void primitive_lookup_method();
@ -663,7 +663,7 @@ struct factor_vm {
void primitive_reset_dispatch_stats(); void primitive_reset_dispatch_stats();
void primitive_dispatch_stats(); void primitive_dispatch_stats();
/* inline cache */ // inline cache
void deallocate_inline_cache(cell return_address); void deallocate_inline_cache(cell return_address);
void update_pic_count(cell type); void update_pic_count(cell type);
code_block* compile_inline_cache(fixnum index, cell generic_word_, code_block* compile_inline_cache(fixnum index, cell generic_word_,
@ -673,18 +673,18 @@ struct factor_vm {
void update_pic_transitions(cell pic_size); void update_pic_transitions(cell pic_size);
cell inline_cache_miss(cell return_address); cell inline_cache_miss(cell return_address);
/* entry points */ // entry points
void c_to_factor(cell quot); void c_to_factor(cell quot);
void unwind_native_frames(cell quot, cell to); void unwind_native_frames(cell quot, cell to);
cell get_fpu_state(); cell get_fpu_state();
void set_fpu_state(cell state); void set_fpu_state(cell state);
/* safepoints */ // safepoints
void handle_safepoint(cell pc); void handle_safepoint(cell pc);
void enqueue_samples(cell samples, cell pc, bool foreign_thread_p); void enqueue_samples(cell samples, cell pc, bool foreign_thread_p);
void enqueue_fep(); void enqueue_fep();
/* factor */ // factor
void prepare_boot_image(); void prepare_boot_image();
void init_factor(vm_parameters* p); void init_factor(vm_parameters* p);
void pass_args_to_factor(int argc, vm_char** argv); void pass_args_to_factor(int argc, vm_char** argv);
@ -696,7 +696,7 @@ struct factor_vm {
void factor_yield(); void factor_yield();
void factor_sleep(long us); void factor_sleep(long us);
/* os-* */ // os-*
void primitive_existsp(); void primitive_existsp();
void init_ffi(); void init_ffi();
void ffi_dlopen(dll* dll); void ffi_dlopen(dll* dll);
@ -708,7 +708,7 @@ struct factor_vm {
void start_sampling_profiler_timer(); void start_sampling_profiler_timer();
void end_sampling_profiler_timer(); void end_sampling_profiler_timer();
/* os-windows */ // os-windows
#if defined(WINDOWS) #if defined(WINDOWS)
HANDLE sampler_thread; HANDLE sampler_thread;
void sampler_thread_loop(); void sampler_thread_loop();
@ -720,7 +720,7 @@ struct factor_vm {
LONG exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c, LONG exception_handler(PEXCEPTION_RECORD e, void* frame, PCONTEXT c,
void* dispatch); void* dispatch);
#else /* UNIX */ #else // UNIX
void dispatch_signal(void* uap, void(handler)()); void dispatch_signal(void* uap, void(handler)());
void unix_init_signals(); void unix_init_signals();
#endif #endif