fix generic word error
parent
2c756975ae
commit
35b40a0f10
|
@ -16,8 +16,6 @@ word help sections:
|
|||
parsing word sections:
|
||||
- syntax
|
||||
|
||||
- sort out types on 64-bit platforms -- on win64, long is 4 bytes,
|
||||
on linux, 8
|
||||
- malloc, free, realloc, memcpy: aliens
|
||||
- check 'see'
|
||||
- intrinsic char-slot set-char-slot for x86
|
||||
|
|
|
@ -6,13 +6,15 @@ USING: assembler compiler-backend kernel sequences ;
|
|||
! R14 datastack
|
||||
! R15 callstack
|
||||
|
||||
: ds-reg R14 ; inline
|
||||
: cs-reg R15 ; inline
|
||||
|
||||
: fixnum-imm? ( -- ? )
|
||||
#! Can fixnum operations take immediate operands?
|
||||
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
|
||||
|
||||
! FIXME
|
||||
|
@ -28,7 +30,3 @@ M: float-regs fastcall-regs drop 0 ;
|
|||
0 scratch [ swap MOV ] keep ; inline
|
||||
|
||||
: fixnum>slot@ drop ; inline
|
||||
|
||||
: return-register RAX ; inline
|
||||
|
||||
: remainder-reg RDX ; inline
|
||||
|
|
|
@ -7,6 +7,7 @@ USING: io kernel parser sequences ;
|
|||
"/library/compiler/x86/generator.factor"
|
||||
"/library/compiler/x86/slots.factor"
|
||||
"/library/compiler/x86/stack.factor"
|
||||
"/library/compiler/x86/fixnum.factor"
|
||||
] [
|
||||
dup print run-resource
|
||||
] each
|
||||
|
|
|
@ -6,13 +6,15 @@ USING: assembler compiler-backend kernel sequences ;
|
|||
! ESI datastack
|
||||
! EBX callstack
|
||||
|
||||
: ds-reg ESI ; inline
|
||||
: cs-reg EBX ; inline
|
||||
|
||||
: fixnum-imm? ( -- ? )
|
||||
#! Can fixnum operations take immediate operands?
|
||||
t ; inline
|
||||
|
||||
: ds-reg ESI ; inline
|
||||
: cs-reg EBX ; inline
|
||||
: return-register EAX ; inline
|
||||
: remainder-reg EDX ; inline
|
||||
|
||||
: vregs { EAX ECX EDX } ; inline
|
||||
|
||||
! On x86, parameters are never passed in registers.
|
||||
|
@ -28,7 +30,3 @@ M: float-regs fastcall-regs drop 0 ;
|
|||
; inline
|
||||
|
||||
: fixnum>slot@ 1 SHR ; inline
|
||||
|
||||
: return-register EAX ; inline
|
||||
|
||||
: remainder-reg EDX ; inline
|
||||
|
|
|
@ -148,11 +148,13 @@ UNION: operand register indirect displaced disp-only ;
|
|||
#! Relative to after next 32-bit immediate.
|
||||
compiled-offset - 4 - ;
|
||||
|
||||
PREDICATE: word callable register? not ;
|
||||
|
||||
( Moving stuff )
|
||||
GENERIC: PUSH ( op -- )
|
||||
M: register PUSH f HEX: 50 short-operand ;
|
||||
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 ;
|
||||
|
||||
GENERIC: POP ( op -- )
|
||||
|
@ -166,24 +168,24 @@ M: operand (MOV-I) BIN: 000 t HEX: c7 1-operand assemble-4 ;
|
|||
|
||||
GENERIC: MOV ( dst src -- )
|
||||
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 ;
|
||||
|
||||
( Control flow )
|
||||
GENERIC: JMP ( op -- )
|
||||
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: word JMP 0 JMP relative-4 ;
|
||||
|
||||
GENERIC: CALL ( op -- )
|
||||
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: word CALL 0 CALL relative-4 ;
|
||||
|
||||
GENERIC: JUMPcc ( opcode addr -- )
|
||||
M: integer JUMPcc ( opcode addr -- )
|
||||
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 ;
|
||||
|
||||
: JO HEX: 80 swap JUMPcc ;
|
||||
|
|
|
@ -108,10 +108,10 @@ SYMBOL: failures
|
|||
|
||||
: compiler-tests
|
||||
{
|
||||
"io/buffer" "compiler/optimizer"
|
||||
"io/buffer"
|
||||
"compiler/simple"
|
||||
"compiler/stack" "compiler/ifte"
|
||||
"compiler/generic" "compiler/bail-out"
|
||||
"compiler/linearizer" "compiler/intrinsics"
|
||||
"compiler/identities"
|
||||
"compiler/identities" "compiler/optimizer"
|
||||
} run-tests ;
|
||||
|
|
Loading…
Reference in New Issue