From 0528c5a89c42bf10dba06ffb67461fe044b6135f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 10 Dec 2005 06:27:41 +0000 Subject: [PATCH] working on AMD64 overflow checks --- library/compiler/amd64/architecture.factor | 6 ++++-- library/compiler/x86/architecture.factor | 6 ++++-- library/compiler/x86/generator.factor | 3 --- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/library/compiler/amd64/architecture.factor b/library/compiler/amd64/architecture.factor index 21b8966133..9da1279ec0 100644 --- a/library/compiler/amd64/architecture.factor +++ b/library/compiler/amd64/architecture.factor @@ -1,5 +1,6 @@ IN: compiler-backend -USING: assembler compiler-backend kernel sequences ; +USING: alien assembler compiler compiler-backend kernel +sequences ; ! AMD64 register assignments ! RAX RCX RDX RSI RDI R8 R9 R10 R11 vregs @@ -19,7 +20,8 @@ USING: assembler compiler-backend kernel sequences ; : param-regs { R9 R8 RCX RDX RSI RDI } ; -DEFER: compile-c-call +: compile-c-call ( symbol dll -- ) + 2dup dlsym 0 scratch swap MOV 0 0 rel-dlsym 0 scratch CALL ; : compile-c-call* ( symbol dll -- operands ) param-regs swap [ MOV ] 2each compile-c-call ; diff --git a/library/compiler/x86/architecture.factor b/library/compiler/x86/architecture.factor index 35c739c9fa..0078e8a92d 100644 --- a/library/compiler/x86/architecture.factor +++ b/library/compiler/x86/architecture.factor @@ -1,5 +1,6 @@ IN: compiler-backend -USING: assembler compiler-backend kernel sequences ; +USING: alien assembler compiler compiler-backend kernel +sequences ; ! x86 register assignments ! EAX, ECX, EDX vregs @@ -17,7 +18,8 @@ USING: assembler compiler-backend kernel sequences ; : vregs { EAX ECX EDX } ; inline -DEFER: compile-c-call +: compile-c-call ( symbol dll -- ) + 2dup dlsym CALL 1 0 rel-dlsym ; : compile-c-call* ( symbol dll args -- operands ) [ [ PUSH ] each compile-c-call ] keep diff --git a/library/compiler/x86/generator.factor b/library/compiler/x86/generator.factor index 519d4adb7a..9211310b33 100644 --- a/library/compiler/x86/generator.factor +++ b/library/compiler/x86/generator.factor @@ -7,9 +7,6 @@ kernel-internals lists math memory namespaces sequences words ; ! Not used on x86 M: %prologue generate-node drop ; -: compile-c-call ( symbol dll -- ) - 2dup dlsym CALL 1 0 rel-dlsym ; - : (call-label) label dup postpone-word dup primitive? [ address-operand ] when ;