Merge branch 'master' of git://factorcode.org/git/factor

db4
U-SLAVA-DFB8FF805\Slava 2008-07-03 19:53:50 -05:00
commit ef16e3d3f8
2 changed files with 12 additions and 10 deletions
core/cpu/x86/64

View File

@ -1,6 +1,6 @@
! Copyright (C) 2005, 2007 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types arrays cpu.x86.assembler
USING: accessors alien.c-types arrays cpu.x86.assembler
cpu.x86.architecture cpu.x86.intrinsics cpu.x86.sse2
cpu.x86.allot cpu.architecture kernel kernel.private math
namespaces sequences generator.registers generator.fixup system

View File

@ -101,7 +101,7 @@ void load_image(F_PARAMETERS *p)
}
/* Save the current image to disk */
void save_image(const F_CHAR *filename)
bool save_image(const F_CHAR *filename)
{
FILE* file;
F_HEADER h;
@ -112,7 +112,7 @@ void save_image(const F_CHAR *filename)
if(file == NULL)
{
fprintf(stderr,"Cannot open image file: %s\n",strerror(errno));
return;
return false;
}
F_ZONE *tenured = &data_heap->generations[TENURED];
@ -143,20 +143,22 @@ void save_image(const F_CHAR *filename)
if(fwrite((void*)tenured->start,h.data_size,1,file) != 1)
{
fprintf(stderr,"Save data heap failed: %s\n",strerror(errno));
return;
return false;
}
if(fwrite(first_block(&code_heap),h.code_size,1,file) != 1)
{
fprintf(stderr,"Save code heap failed: %s\n",strerror(errno));
return;
return false;
}
if(fclose(file))
{
fprintf(stderr,"Failed to close image file: %s\n",strerror(errno));
return;
return false;
}
return true;
}
DEFINE_PRIMITIVE(save_image)
@ -187,10 +189,10 @@ DEFINE_PRIMITIVE(save_image_and_exit)
UNREGISTER_C_STRING(path);
/* Save the image */
save_image(path);
/* now exit; we cannot continue executing like this */
exit(0);
if(save_image(path))
exit(0);
else
exit(1);
}
void fixup_word(F_WORD *word)