vm_parameters::vm_parameters() {
embedded_image = false;
image_path = NULL;
+ executable_path = NULL;
datastack_size = 32 * sizeof(cell);
retainstack_size = 32 * sizeof(cell);
callstack_size = 128 * sizeof(cell);
#endif
- code_size = 64;
+ code_size = 96;
young_size = sizeof(cell) / 4;
aging_size = sizeof(cell) / 2;
tenured_size = 24 * sizeof(cell);
else if (factor_arg(arg, STRING_LITERAL("-callstack=%d"),
&callstack_size))
;
- else if (factor_arg(arg, STRING_LITERAL("-young=%d"), &young_size))
+ else if (factor_arg(arg, STRING_LITERAL("-young=%d"),
+ &young_size))
;
- else if (factor_arg(arg, STRING_LITERAL("-aging=%d"), &aging_size))
+ else if (factor_arg(arg, STRING_LITERAL("-aging=%d"),
+ &aging_size))
;
- else if (factor_arg(arg, STRING_LITERAL("-tenured=%d"), &tenured_size))
+ else if (factor_arg(arg, STRING_LITERAL("-tenured=%d"),
+ &tenured_size))
;
- else if (factor_arg(arg, STRING_LITERAL("-codeheap=%d"), &code_size))
+ else if (factor_arg(arg, STRING_LITERAL("-codeheap=%d"),
+ &code_size))
;
- else if (factor_arg(arg, STRING_LITERAL("-pic=%d"), &max_pic_size))
+ else if (factor_arg(arg, STRING_LITERAL("-pic=%d"),
+ &max_pic_size))
;
- else if (factor_arg(arg, STRING_LITERAL("-callbacks=%d"), &callback_size))
+ else if (factor_arg(arg, STRING_LITERAL("-callbacks=%d"),
+ &callback_size))
;
else if (STRNCMP(arg, STRING_LITERAL("-i="), 3) == 0) {
// In case you specify -i more than once.
}
else if (STRCMP(arg, STRING_LITERAL("-fep")) == 0)
fep = true;
- else if (STRCMP(arg, STRING_LITERAL("-nosignals")) == 0)
+ else if (STRCMP(arg, STRING_LITERAL("-no-signals")) == 0)
signals = false;
- else if (STRCMP(arg, STRING_LITERAL("-console")) == 0)
- console = true;
}
}
return (code_block*)((cell)obj + code_offset);
}
- object* translate_data(const object* obj) { return fixup_data((object*)obj); }
+ object* translate_data(const object* obj) {
+ return fixup_data((object*)obj);
+ }
code_block* translate_code(const code_block* compiled) {
return fixup_code((code_block*)compiled);
}
- cell size(const object* obj) { return obj->size(*this); }
+ cell size(const object* obj) {
+ return obj->size(*this);
+ }
- cell size(code_block* compiled) { return compiled->size(*this); }
+ cell size(code_block* compiled) {
+ return compiled->size(*this);
+ }
};
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()) {
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);
char *threadsafe_strerror(int errnum) {
char *buf = (char *) malloc(STRERROR_BUFFER_SIZE);
- if(!buf) {
+ if (!buf) {
fatal_error("Out of memory in threadsafe_strerror, errno", errnum);
}
THREADSAFE_STRERROR(errnum, buf, STRERROR_BUFFER_SIZE);
FILE* file = OPEN_READ(p->image_path);
if (file == NULL) {
- std::cout << "Cannot open image file: " << p->image_path << std::endl;
+ std::cout << "Cannot open image file: " << AS_UTF8(p->image_path) << std::endl;
char *msg = threadsafe_strerror(errno);
- std::cout << "strerror:2: " << msg << std::endl;
+ std::cout << "strerror: " << msg << std::endl;
free(msg);
exit(1);
}
// so. Instead we signal failure by returning false.
bool factor_vm::save_image(const vm_char* saving_filename,
const vm_char* filename) {
- image_header h;
+ image_header h = {};
h.magic = image_magic;
h.version = image_version;