From 507d0ca1501c64d39e9c2e9c8cf5a3f29d5167db Mon Sep 17 00:00:00 2001 From: "U-SLAVA-FB3999113\\Slava" Date: Sun, 21 Oct 2007 15:18:31 -0400 Subject: [PATCH] More ARM fixes --- core/cpu/arm/allot/allot.factor | 6 +++--- core/cpu/arm/architecture/architecture.factor | 8 ++++---- core/cpu/arm/intrinsics/intrinsics.factor | 2 +- vm/cpu-arm.h | 1 - vm/factor.c | 2 +- vm/image.c | 10 ++++++---- vm/image.h | 2 +- vm/os-windows-ce.h | 3 +-- 8 files changed, 17 insertions(+), 17 deletions(-) mode change 100644 => 100755 vm/image.c mode change 100644 => 100755 vm/image.h diff --git a/core/cpu/arm/allot/allot.factor b/core/cpu/arm/allot/allot.factor index 440aeca2a3..41a5cab91e 100755 --- a/core/cpu/arm/allot/allot.factor +++ b/core/cpu/arm/allot/allot.factor @@ -40,7 +40,7 @@ IN: cpu.arm.allot "end" define-label ! is it zero? dup v>operand 0 CMP - 0 >bignum over EQ load-literal + 0 >bignum pick EQ load-literal "end" get EQ B ! ! it is non-zero 1 %allot-bignum @@ -64,12 +64,12 @@ IN: cpu.arm.allot M: arm-backend %box-alien ( dst src -- ) "end" define-label dup v>operand 0 CMP - over f v>operand EQ MOV + over v>operand f v>operand EQ MOV "end" get EQ B alien 4 cells %allot ! Store offset v>operand R11 3 cells <+> STR - R12 f v>operand R12 + R12 f v>operand MOV ! Store expired slot R12 R11 1 cells <+> STR ! Store underlying-alien slot diff --git a/core/cpu/arm/architecture/architecture.factor b/core/cpu/arm/architecture/architecture.factor index 4545ad2e93..d2b72da3a1 100755 --- a/core/cpu/arm/architecture/architecture.factor +++ b/core/cpu/arm/architecture/architecture.factor @@ -326,7 +326,7 @@ M: arm-backend %unbox-any-c-ptr ( dst src -- ) "start" define-label ! Save R14. R14 SP 4 <-> STR - ! Address is computed in RR11 + ! Address is computed in R11 R11 0 MOV ! Load object into R12 R12 swap v>operand MOV @@ -337,7 +337,7 @@ M: arm-backend %unbox-any-c-ptr ( dst src -- ) ! If so, done "end" get EQ B ! Is the object an alien? - R14 R12 header-offset <+> LDR + R14 R12 header-offset <+/-> LDR R14 alien type-number tag-header CMP ! Add byte array address to address being computed 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 "end" get NE B ! If alien, load the offset - R14 R12 alien-offset LDR + R14 R12 alien-offset <+/-> LDR ! Add it to address being computed R11 R11 R14 ADD ! Now recurse on the underlying alien - R12 R12 underlying-alien-offset LDR + R12 R12 underlying-alien-offset <+/-> LDR "start" get B "end" resolve-label ! Done, store address in destination register diff --git a/core/cpu/arm/intrinsics/intrinsics.factor b/core/cpu/arm/intrinsics/intrinsics.factor index bc2e966906..4b0a0bf591 100755 --- a/core/cpu/arm/intrinsics/intrinsics.factor +++ b/core/cpu/arm/intrinsics/intrinsics.factor @@ -22,7 +22,7 @@ IN: cpu.arm.intrinsics : %slot-any "scratch" operand "obj" operand %untag "n" operand dup 1 MOV - "scratch" operand "val" operand "n" operand <+> ; + "val" operand "scratch" operand "n" operand <+> ; \ slot { ! Slot number is literal and the tag is known diff --git a/vm/cpu-arm.h b/vm/cpu-arm.h index 3e2e722edf..67dadb2906 100755 --- a/vm/cpu-arm.h +++ b/vm/cpu-arm.h @@ -32,4 +32,3 @@ void undefined(CELL word); 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 lazy_jit_compile(CELL quot); -void flush_icache(CELL start, CELL len); diff --git a/vm/factor.c b/vm/factor.c index b611fb05ba..d5e3ab23cf 100755 --- a/vm/factor.c +++ b/vm/factor.c @@ -140,7 +140,7 @@ void init_factor_from_args(F_CHAR *image, int argc, F_CHAR **argv, bool embedded if(p.fep) factorbug(); - c_to_factor(userenv[BOOT_ENV]); + c_to_factor_toplevel(userenv[BOOT_ENV]); unnest_stacks(); for(i = 0; i < argc; i++) diff --git a/vm/image.c b/vm/image.c old mode 100644 new mode 100755 index e5c4b45861..7b9e67f5cf --- a/vm/image.c +++ b/vm/image.c @@ -82,7 +82,7 @@ void load_image(F_PARAMETERS *p) } /* Save the current image to disk */ -bool save_image(const F_CHAR *filename) +void save_image(const F_CHAR *filename) { FILE* file; F_HEADER h; @@ -91,7 +91,11 @@ bool save_image(const F_CHAR *filename) file = OPEN_WRITE(filename); 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]; @@ -122,8 +126,6 @@ bool save_image(const F_CHAR *filename) fwrite(first_block(&code_heap),h.code_size,1,file); fclose(file); - - return true; } DEFINE_PRIMITIVE(save_image) diff --git a/vm/image.h b/vm/image.h old mode 100644 new mode 100755 index ba953677cf..0fc2f03a3d --- a/vm/image.h +++ b/vm/image.h @@ -36,7 +36,7 @@ typedef struct { void load_image(F_PARAMETERS *p); 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_and_exit); diff --git a/vm/os-windows-ce.h b/vm/os-windows-ce.h index f73fb0a08c..959de89634 100755 --- a/vm/os-windows-ce.h +++ b/vm/os-windows-ce.h @@ -16,12 +16,11 @@ typedef wchar_t F_SYMBOL; int errno; char *strerror(int err); -void flush_icache(); +void flush_icache(CELL start, CELL end); char *getenv(char *name); #define snprintf _snprintf #define snwprintf _snwprintf -#define EINTR 0 s64 current_millis(void); void c_to_factor_toplevel(CELL quot);