fix generic word error

cvs
Slava Pestov 2005-12-07 05:14:24 +00:00
parent 2c756975ae
commit 35b40a0f10
6 changed files with 20 additions and 23 deletions

View File

@ -16,8 +16,6 @@ word help sections:
parsing word sections: parsing word sections:
- syntax - syntax
- sort out types on 64-bit platforms -- on win64, long is 4 bytes,
on linux, 8
- malloc, free, realloc, memcpy: aliens - malloc, free, realloc, memcpy: aliens
- check 'see' - check 'see'
- intrinsic char-slot set-char-slot for x86 - intrinsic char-slot set-char-slot for x86

View File

@ -6,13 +6,15 @@ USING: assembler compiler-backend kernel sequences ;
! R14 datastack ! R14 datastack
! R15 callstack ! R15 callstack
: ds-reg R14 ; inline
: cs-reg R15 ; inline
: fixnum-imm? ( -- ? ) : fixnum-imm? ( -- ? )
#! Can fixnum operations take immediate operands? #! Can fixnum operations take immediate operands?
f ; inline f ; inline
: ds-reg R14 ; inline
: cs-reg R15 ; inline
: return-reg RAX ; inline
: remainder-reg RDX ; inline
: vregs { RAX RCX RDX RSI RDI R8 R9 R10 R11 } ; inline : vregs { RAX RCX RDX RSI RDI R8 R9 R10 R11 } ; inline
! FIXME ! FIXME
@ -28,7 +30,3 @@ M: float-regs fastcall-regs drop 0 ;
0 scratch [ swap MOV ] keep ; inline 0 scratch [ swap MOV ] keep ; inline
: fixnum>slot@ drop ; inline : fixnum>slot@ drop ; inline
: return-register RAX ; inline
: remainder-reg RDX ; inline

View File

@ -7,6 +7,7 @@ USING: io kernel parser sequences ;
"/library/compiler/x86/generator.factor" "/library/compiler/x86/generator.factor"
"/library/compiler/x86/slots.factor" "/library/compiler/x86/slots.factor"
"/library/compiler/x86/stack.factor" "/library/compiler/x86/stack.factor"
"/library/compiler/x86/fixnum.factor"
] [ ] [
dup print run-resource dup print run-resource
] each ] each

View File

@ -6,13 +6,15 @@ USING: assembler compiler-backend kernel sequences ;
! ESI datastack ! ESI datastack
! EBX callstack ! EBX callstack
: ds-reg ESI ; inline
: cs-reg EBX ; inline
: fixnum-imm? ( -- ? ) : fixnum-imm? ( -- ? )
#! Can fixnum operations take immediate operands? #! Can fixnum operations take immediate operands?
t ; inline t ; inline
: ds-reg ESI ; inline
: cs-reg EBX ; inline
: return-register EAX ; inline
: remainder-reg EDX ; inline
: vregs { EAX ECX EDX } ; inline : vregs { EAX ECX EDX } ; inline
! On x86, parameters are never passed in registers. ! On x86, parameters are never passed in registers.
@ -28,7 +30,3 @@ M: float-regs fastcall-regs drop 0 ;
; inline ; inline
: fixnum>slot@ 1 SHR ; inline : fixnum>slot@ 1 SHR ; inline
: return-register EAX ; inline
: remainder-reg EDX ; inline

View File

@ -148,11 +148,13 @@ UNION: operand register indirect displaced disp-only ;
#! Relative to after next 32-bit immediate. #! Relative to after next 32-bit immediate.
compiled-offset - 4 - ; compiled-offset - 4 - ;
PREDICATE: word callable register? not ;
( Moving stuff ) ( Moving stuff )
GENERIC: PUSH ( op -- ) GENERIC: PUSH ( op -- )
M: register PUSH f HEX: 50 short-operand ; M: register PUSH f HEX: 50 short-operand ;
M: integer PUSH HEX: 68 assemble-1 assemble-4 ; M: integer PUSH HEX: 68 assemble-1 assemble-4 ;
M: word PUSH 0 PUSH absolute-4 ; M: callable PUSH 0 PUSH absolute-4 ;
M: operand PUSH BIN: 110 f HEX: ff 1-operand ; M: operand PUSH BIN: 110 f HEX: ff 1-operand ;
GENERIC: POP ( op -- ) GENERIC: POP ( op -- )
@ -166,24 +168,24 @@ M: operand (MOV-I) BIN: 000 t HEX: c7 1-operand assemble-4 ;
GENERIC: MOV ( dst src -- ) GENERIC: MOV ( dst src -- )
M: integer MOV swap (MOV-I) ; M: integer MOV swap (MOV-I) ;
M: word MOV 0 rot (MOV-I) absolute-cell ; M: callable MOV 0 rot (MOV-I) absolute-cell ;
M: operand MOV HEX: 89 2-operand ; M: operand MOV HEX: 89 2-operand ;
( Control flow ) ( Control flow )
GENERIC: JMP ( op -- ) GENERIC: JMP ( op -- )
M: integer JMP HEX: e9 assemble-1 from assemble-4 ; M: integer JMP HEX: e9 assemble-1 from assemble-4 ;
M: callable JMP 0 JMP relative-4 ;
M: operand JMP BIN: 100 t HEX: ff 1-operand ; M: operand JMP BIN: 100 t HEX: ff 1-operand ;
M: word JMP 0 JMP relative-4 ;
GENERIC: CALL ( op -- ) GENERIC: CALL ( op -- )
M: integer CALL HEX: e8 assemble-1 from assemble-4 ; M: integer CALL HEX: e8 assemble-1 from assemble-4 ;
M: callable CALL 0 CALL relative-4 ;
M: operand CALL BIN: 010 t HEX: ff 1-operand ; M: operand CALL BIN: 010 t HEX: ff 1-operand ;
M: word CALL 0 CALL relative-4 ;
GENERIC: JUMPcc ( opcode addr -- ) GENERIC: JUMPcc ( opcode addr -- )
M: integer JUMPcc ( opcode addr -- ) M: integer JUMPcc ( opcode addr -- )
HEX: 0f assemble-1 swap assemble-1 from assemble-4 ; HEX: 0f assemble-1 swap assemble-1 from assemble-4 ;
M: word JUMPcc ( opcode addr -- ) M: callable JUMPcc ( opcode addr -- )
>r 0 JUMPcc r> relative-4 ; >r 0 JUMPcc r> relative-4 ;
: JO HEX: 80 swap JUMPcc ; : JO HEX: 80 swap JUMPcc ;

View File

@ -108,10 +108,10 @@ SYMBOL: failures
: compiler-tests : compiler-tests
{ {
"io/buffer" "compiler/optimizer" "io/buffer"
"compiler/simple" "compiler/simple"
"compiler/stack" "compiler/ifte" "compiler/stack" "compiler/ifte"
"compiler/generic" "compiler/bail-out" "compiler/generic" "compiler/bail-out"
"compiler/linearizer" "compiler/intrinsics" "compiler/linearizer" "compiler/intrinsics"
"compiler/identities" "compiler/identities" "compiler/optimizer"
} run-tests ; } run-tests ;