static void load_code_heap(FILE *file, image_header *h, vm_parameters *p) { cell good_size = h->code_size + (1 << 19); if(good_size > p->code_size) p->code_size = good_size; init_code_heap(p->code_size); if(h->code_size != 0) { size_t bytes_read = fread(first_block(&code),1,h->code_size,file); if(bytes_read != h->code_size) { print_string("truncated image: "); print_fixnum(bytes_read); print_string(" bytes read, "); print_cell(h->code_size); print_string(" bytes expected\n"); fatal_error("load_code_heap failed",0); } } code_relocation_base = h->code_relocation_base; build_free_list(&code,h->code_size); }
INLINE void load_code_heap(FILE *file, F_HEADER *h, F_PARAMETERS *p) { CELL good_size = h->code_size + (1 << 19); if(good_size > p->code_size) p->code_size = good_size; init_code_heap(p->code_size); if(h->code_size != 0 && fread(first_block(&code_heap),h->code_size,1,file) != 1) fatal_error("load_code_heap failed",0); code_relocation_base = h->code_relocation_base; build_free_list(&code_heap,h->code_size); }
void factor_vm::load_code_heap(FILE *file, image_header *h, vm_parameters *p) { if(h->code_size > p->code_size) fatal_error("Code heap too small to fit image",h->code_size); init_code_heap(p->code_size); if(h->code_size != 0) { size_t bytes_read = safe_fread(code->allocator->first_block(),1,h->code_size,file); if(bytes_read != h->code_size) { std::cout << "truncated image: " << bytes_read << " bytes read, "; std::cout << h->code_size << " bytes expected\n"; fatal_error("load_code_heap failed",0); } } code->allocator->initial_free_list(h->code_size); }
INLINE void load_code_heap(FILE *file, F_HEADER *h, F_PARAMETERS *p) { CELL good_size = h->code_size + (1 << 19); if(good_size > p->code_size) p->code_size = good_size; init_code_heap(p->code_size); if(h->code_size != 0) { long int bytes_read = fread(first_block(&code_heap),1,h->code_size,file); if(bytes_read != h->code_size) { fprintf(stderr,"truncated image: %ld bytes read, %ld bytes expected\n", bytes_read,h->code_size); fatal_error("load_code_heap failed",0); } } code_relocation_base = h->code_relocation_base; build_free_list(&code_heap,h->code_size); }
void factor_vm::load_code_heap(FILE *file, image_header *h, vm_parameters *p) { if(h->code_size > p->code_size) fatal_error("Code heap too small to fit image",h->code_size); init_code_heap(p->code_size); if(h->code_size != 0) { size_t bytes_read = fread(code->first_block(),1,h->code_size,file); if(bytes_read != h->code_size) { print_string("truncated image: "); print_fixnum(bytes_read); print_string(" bytes read, "); print_cell(h->code_size); print_string(" bytes expected\n"); fatal_error("load_code_heap failed",0); } } code->build_free_list(h->code_size); }