From b9ee92e484456d2103c6f5b3f9fa13ed36746774 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 8 Nov 2008 20:36:05 -0600 Subject: [PATCH 1/4] factor.sh fixes --- build-support/factor.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build-support/factor.sh b/build-support/factor.sh index 7fbb54a568..bd234afb5f 100755 --- a/build-support/factor.sh +++ b/build-support/factor.sh @@ -271,17 +271,21 @@ check_os_arch_word() { set_build_info() { check_os_arch_word - MAKE_TARGET=$OS-$ARCH-$WORD if [[ $OS == macosx && $ARCH == ppc ]] ; then MAKE_IMAGE_TARGET=macosx-ppc + MAKE_TARGET=macosx-ppc elif [[ $OS == linux && $ARCH == ppc ]] ; then MAKE_IMAGE_TARGET=linux-ppc + MAKE_TARGET=linux-ppc elif [[ $OS == winnt && $ARCH == x86 && $WORD == 64 ]] ; then MAKE_IMAGE_TARGET=winnt-x86.64 + MAKE_TARGET=winnt-x86-64 elif [[ $ARCH == x86 && $WORD == 64 ]] ; then MAKE_IMAGE_TARGET=unix-x86.64 - else + MAKE_TARGET=$OS-x86-64 + else MAKE_IMAGE_TARGET=$ARCH.$WORD + MAKE_TARGET=$OS-$ARCH-$WORD fi BOOT_IMAGE=boot.$MAKE_IMAGE_TARGET.image } From 65dea0aa26e233cddd29af5494ab085ea900c2fd Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 8 Nov 2008 20:36:14 -0600 Subject: [PATCH 2/4] PowerPC backend fixes --- basis/cpu/ppc/linux/linux.factor | 13 +++++++------ basis/cpu/ppc/macosx/macosx.factor | 13 +++++++------ basis/cpu/ppc/ppc.factor | 13 +++++++++---- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/basis/cpu/ppc/linux/linux.factor b/basis/cpu/ppc/linux/linux.factor index d92709a399..6f21aa74d5 100644 --- a/basis/cpu/ppc/linux/linux.factor +++ b/basis/cpu/ppc/linux/linux.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ; +USING: accessors system kernel layouts +alien.c-types cpu.architecture cpu.ppc ; IN: cpu.ppc.linux << @@ -8,12 +9,12 @@ t "longlong" c-type (>>stack-align?) t "ulonglong" c-type (>>stack-align?) >> -M: linux reserved-area-size 2 ; +M: linux reserved-area-size 2 cells ; -M: linux lr-save 1 ; +M: linux lr-save 1 cells ; -M: float-regs param-regs { 1 2 3 4 5 6 7 8 } ; +M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 } ; -M: ppc value-structs? drop f ; +M: ppc value-structs? f ; -M: ppc fp-shadows-int? drop f ; +M: ppc fp-shadows-int? f ; diff --git a/basis/cpu/ppc/macosx/macosx.factor b/basis/cpu/ppc/macosx/macosx.factor index 1e0a6caca0..619b82a04b 100644 --- a/basis/cpu/ppc/macosx/macosx.factor +++ b/basis/cpu/ppc/macosx/macosx.factor @@ -1,6 +1,7 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors system kernel alien.c-types cpu.architecture cpu.ppc ; +USING: accessors system kernel layouts +alien.c-types cpu.architecture cpu.ppc ; IN: cpu.ppc.macosx << @@ -9,12 +10,12 @@ IN: cpu.ppc.macosx 4 "double" c-type (>>align) >> -M: macosx reserved-area-size 6 ; +M: macosx reserved-area-size 6 cells ; -M: macosx lr-save 2 ; +M: macosx lr-save 2 cells ; -M: float-regs param-regs { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; +M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; -M: ppc value-structs? drop t ; +M: ppc value-structs? t ; -M: ppc fp-shadows-int? drop t ; +M: ppc fp-shadows-int? t ; diff --git a/basis/cpu/ppc/ppc.factor b/basis/cpu/ppc/ppc.factor index d2d1e26396..2be46d15ee 100644 --- a/basis/cpu/ppc/ppc.factor +++ b/basis/cpu/ppc/ppc.factor @@ -349,12 +349,17 @@ M: ppc %gc "end" resolve-label ; M: ppc %prologue ( n -- ) - 0 scratch-reg LOAD32 rc-absolute-ppc-2/2 rel-this + #! We use a volatile register (r11) here for scratch. Because + #! callback bodies have a prologue too, we cannot assume + #! that c_to_factor saved all non-volatile registers, so + #! we have to respect the C calling convention. Also, we + #! cannot touch any param-regs either. + 0 11 LOAD32 rc-absolute-ppc-2/2 rel-this 0 MFLR 1 1 pick neg ADDI - scratch-reg 1 pick xt-save STW - dup scratch-reg LI - scratch-reg 1 pick next-save STW + 11 1 pick xt-save STW + dup 11 LI + 11 1 pick next-save STW 0 1 rot lr-save + STW ; M: ppc %epilogue ( n -- ) From fdbea06e279f71892ecf2354790121d5cf8da559 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 8 Nov 2008 20:40:09 -0600 Subject: [PATCH 3/4] Fix compile warning --- vm/callstack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/callstack.c b/vm/callstack.c index c9466bbbb2..b7e99b418c 100755 --- a/vm/callstack.c +++ b/vm/callstack.c @@ -117,7 +117,7 @@ CELL frame_executing(F_STACK_FRAME *frame) F_STACK_FRAME *frame_successor(F_STACK_FRAME *frame) { if(frame->size == 0) - critical_error("Stack frame has zero size",frame); + critical_error("Stack frame has zero size",(CELL)frame); return (F_STACK_FRAME *)((CELL)frame - frame->size); } From abc3915387c145215dd50f8923796c71c46fd2b3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 8 Nov 2008 21:06:51 -0600 Subject: [PATCH 4/4] Fix x86-32 VM compilation; was using a 64-bit reg on accident --- vm/cpu-x86.32.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/cpu-x86.32.S b/vm/cpu-x86.32.S index eec850dc9e..6ddbd52da2 100755 --- a/vm/cpu-x86.32.S +++ b/vm/cpu-x86.32.S @@ -10,7 +10,7 @@ and the callstack top is passed in EDX */ #define DS_REG %esi #define RETURN_REG %eax -#define NV_TEMP_REG %rbx +#define NV_TEMP_REG %ebx #define CELL_SIZE 4 #define STACK_PADDING 12