From a88f4275c91e9d8a7ed3ae59e07173dbcfd724eb Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 7 Jun 2005 08:33:24 +0000 Subject: [PATCH] fix bug in 16/16 reloc --- library/compiler/ppc/assembler.factor | 2 +- library/compiler/ppc/generator.factor | 2 +- native/relocate.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/compiler/ppc/assembler.factor b/library/compiler/ppc/assembler.factor index 52cd095467..9f500b5ed2 100644 --- a/library/compiler/ppc/assembler.factor +++ b/library/compiler/ppc/assembler.factor @@ -195,7 +195,7 @@ USING: compiler errors kernel math memory words ; G: (B) ( dest aa lk -- ) [ pick ] [ type ] ; M: integer (B) i-form 18 insn ; -M: word (B) 0 swap (B) relative-24 ; +M: word (B) 0 (B) relative-24 ; : B 0 0 (B) ; : BA 1 0 (B) ; : BL 0 1 (B) ; : BLA 1 1 (B) ; diff --git a/library/compiler/ppc/generator.factor b/library/compiler/ppc/generator.factor index 034d8983da..56a4b3739d 100644 --- a/library/compiler/ppc/generator.factor +++ b/library/compiler/ppc/generator.factor @@ -40,7 +40,7 @@ M: %call-label generate-node ( vop -- ) B ; : word-addr ( word -- ) - dup 0 1 rel-primitive word-xt 19 LOAD32 ; + dup word-xt 19 LOAD32 0 1 rel-word ; : compile-call ( label -- ) #! Far C call for primitives, near C call for compiled defs. diff --git a/native/relocate.h b/native/relocate.h index e35f51358d..0a16b3e7d3 100644 --- a/native/relocate.h +++ b/native/relocate.h @@ -50,11 +50,11 @@ void relocate_code(); given address */ INLINE CELL reloc_get_16_16(CELL cell) { - return ((get(cell) & 0xffff) << 16) | (get(cell + 1) & 0xffff); + return ((get(cell - CELLS) & 0xffff) << 16) | (get(cell) & 0xffff); } INLINE void reloc_set_16_16(CELL cell, CELL value) { - put(cell,((get(cell) & ~0xffff) | ((value >> 16) & 0xffff))); - put(cell + 1,((get(cell + 1) & ~0xffff) | (value & 0xffff))); + put(cell - CELLS,((get(cell - CELLS) & ~0xffff) | ((value >> 16) & 0xffff))); + put(cell,((get(cell) & ~0xffff) | (value & 0xffff))); }