More ARM fixes

release
U-SLAVA-FB3999113\Slava 2007-10-21 15:18:31 -04:00
parent 0754b991e5
commit 507d0ca150
8 changed files with 17 additions and 17 deletions

View File

@ -40,7 +40,7 @@ IN: cpu.arm.allot
"end" define-label "end" define-label
! is it zero? ! is it zero?
dup v>operand 0 CMP dup v>operand 0 CMP
0 >bignum over EQ load-literal 0 >bignum pick EQ load-literal
"end" get EQ B "end" get EQ B
! ! it is non-zero ! ! it is non-zero
1 %allot-bignum 1 %allot-bignum
@ -64,12 +64,12 @@ IN: cpu.arm.allot
M: arm-backend %box-alien ( dst src -- ) M: arm-backend %box-alien ( dst src -- )
"end" define-label "end" define-label
dup v>operand 0 CMP dup v>operand 0 CMP
over f v>operand EQ MOV over v>operand f v>operand EQ MOV
"end" get EQ B "end" get EQ B
alien 4 cells %allot alien 4 cells %allot
! Store offset ! Store offset
v>operand R11 3 cells <+> STR v>operand R11 3 cells <+> STR
R12 f v>operand R12 R12 f v>operand MOV
! Store expired slot ! Store expired slot
R12 R11 1 cells <+> STR R12 R11 1 cells <+> STR
! Store underlying-alien slot ! Store underlying-alien slot

View File

@ -326,7 +326,7 @@ M: arm-backend %unbox-any-c-ptr ( dst src -- )
"start" define-label "start" define-label
! Save R14. ! Save R14.
R14 SP 4 <-> STR R14 SP 4 <-> STR
! Address is computed in RR11 ! Address is computed in R11
R11 0 MOV R11 0 MOV
! Load object into R12 ! Load object into R12
R12 swap v>operand MOV R12 swap v>operand MOV
@ -337,7 +337,7 @@ M: arm-backend %unbox-any-c-ptr ( dst src -- )
! If so, done ! If so, done
"end" get EQ B "end" get EQ B
! Is the object an alien? ! Is the object an alien?
R14 R12 header-offset <+> LDR R14 R12 header-offset <+/-> LDR
R14 alien type-number tag-header CMP R14 alien type-number tag-header CMP
! Add byte array address to address being computed ! Add byte array address to address being computed
R11 R11 R12 NE ADD R11 R11 R12 NE ADD
@ -345,11 +345,11 @@ M: arm-backend %unbox-any-c-ptr ( dst src -- )
R11 R11 byte-array-offset NE ADD R11 R11 byte-array-offset NE ADD
"end" get NE B "end" get NE B
! If alien, load the offset ! If alien, load the offset
R14 R12 alien-offset LDR R14 R12 alien-offset <+/-> LDR
! Add it to address being computed ! Add it to address being computed
R11 R11 R14 ADD R11 R11 R14 ADD
! Now recurse on the underlying alien ! Now recurse on the underlying alien
R12 R12 underlying-alien-offset LDR R12 R12 underlying-alien-offset <+/-> LDR
"start" get B "start" get B
"end" resolve-label "end" resolve-label
! Done, store address in destination register ! Done, store address in destination register

View File

@ -22,7 +22,7 @@ IN: cpu.arm.intrinsics
: %slot-any : %slot-any
"scratch" operand "obj" operand %untag "scratch" operand "obj" operand %untag
"n" operand dup 1 <LSR> MOV "n" operand dup 1 <LSR> MOV
"scratch" operand "val" operand "n" operand <+> ; "val" operand "scratch" operand "n" operand <+> ;
\ slot { \ slot {
! Slot number is literal and the tag is known ! Slot number is literal and the tag is known

View File

@ -32,4 +32,3 @@ void undefined(CELL word);
void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy); void set_callstack(F_STACK_FRAME *to, F_STACK_FRAME *from, CELL length, void *memcpy);
void throw_impl(CELL quot, F_STACK_FRAME *rewind); void throw_impl(CELL quot, F_STACK_FRAME *rewind);
void lazy_jit_compile(CELL quot); void lazy_jit_compile(CELL quot);
void flush_icache(CELL start, CELL len);

View File

@ -140,7 +140,7 @@ void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded
if(p.fep) if(p.fep)
factorbug(); factorbug();
c_to_factor(userenv[BOOT_ENV]); c_to_factor_toplevel(userenv[BOOT_ENV]);
unnest_stacks(); unnest_stacks();
for(i = 0; i < argc; i++) for(i = 0; i < argc; i++)

10
vm/image.c Normal file → Executable file
View File

@ -82,7 +82,7 @@ void load_image(F_PARAMETERS *p)
} }
/* Save the current image to disk */ /* Save the current image to disk */
bool save_image(const F_CHAR *filename) void save_image(const F_CHAR *filename)
{ {
FILE* file; FILE* file;
F_HEADER h; F_HEADER h;
@ -91,7 +91,11 @@ bool save_image(const F_CHAR *filename)
file = OPEN_WRITE(filename); file = OPEN_WRITE(filename);
if(file == NULL) if(file == NULL)
fatal_error("Cannot open image for writing",errno); {
FPRINTF(stderr,"Cannot open image file: %s\n",filename);
fprintf(stderr,"%s\n",strerror(errno));
return;
}
F_ZONE *tenured = &data_heap->generations[TENURED]; F_ZONE *tenured = &data_heap->generations[TENURED];
@ -122,8 +126,6 @@ bool save_image(const F_CHAR *filename)
fwrite(first_block(&code_heap),h.code_size,1,file); fwrite(first_block(&code_heap),h.code_size,1,file);
fclose(file); fclose(file);
return true;
} }
DEFINE_PRIMITIVE(save_image) DEFINE_PRIMITIVE(save_image)

2
vm/image.h Normal file → Executable file
View File

@ -36,7 +36,7 @@ typedef struct {
void load_image(F_PARAMETERS *p); void load_image(F_PARAMETERS *p);
void init_objects(F_HEADER *h); void init_objects(F_HEADER *h);
bool save_image(const F_CHAR *file); void save_image(const F_CHAR *file);
DECLARE_PRIMITIVE(save_image); DECLARE_PRIMITIVE(save_image);
DECLARE_PRIMITIVE(save_image_and_exit); DECLARE_PRIMITIVE(save_image_and_exit);

View File

@ -16,12 +16,11 @@ typedef wchar_t F_SYMBOL;
int errno; int errno;
char *strerror(int err); char *strerror(int err);
void flush_icache(); void flush_icache(CELL start, CELL end);
char *getenv(char *name); char *getenv(char *name);
#define snprintf _snprintf #define snprintf _snprintf
#define snwprintf _snwprintf #define snwprintf _snwprintf
#define EINTR 0
s64 current_millis(void); s64 current_millis(void);
void c_to_factor_toplevel(CELL quot); void c_to_factor_toplevel(CELL quot);