From ceb15dbe5dc0e7c7d79e192148126b842aba0393 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 7 Dec 2005 02:34:18 +0000 Subject: [PATCH] load primitive types in stage 1 --- library/bootstrap/boot-stage1.factor | 1 + library/bootstrap/boot-stage2.factor | 32 ++++++++++------------ library/compiler/amd64/architecture.factor | 2 ++ library/compiler/x86/architecture.factor | 2 ++ library/compiler/x86/fixnum.factor | 26 ++++++++++-------- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/library/bootstrap/boot-stage1.factor b/library/bootstrap/boot-stage1.factor index 42c404c22f..f8fbbbe885 100644 --- a/library/bootstrap/boot-stage1.factor +++ b/library/bootstrap/boot-stage1.factor @@ -136,6 +136,7 @@ vectors words ; "/library/compiler/compiler.factor" "/library/alien/c-types.factor" + "/library/alien/primitive-types.factor" "/library/alien/structs.factor" "/library/alien/compiler.factor" "/library/alien/syntax.factor" diff --git a/library/bootstrap/boot-stage2.factor b/library/bootstrap/boot-stage2.factor index b011f37a02..7b4676b1c4 100644 --- a/library/bootstrap/boot-stage2.factor +++ b/library/bootstrap/boot-stage2.factor @@ -5,27 +5,23 @@ errors generic hashtables io io-internals kernel kernel-internals lists math memory namespaces optimizer parser sequences sequences-internals words ; -: pull-in ( ? list -- ) - swap [ [ dup print run-resource ] each ] [ drop ] if ; - "Loading compiler backend..." print cpu "x86" = [ - "/library/compiler/x86/load.factor" -] pull-in + "/library/compiler/x86/load.factor" run-resource +] when cpu "ppc" = [ - "/library/compiler/ppc/load.factor" -] pull-in + "/library/compiler/ppc/load.factor" run-resource +] when cpu "amd64" = [ - "/library/compiler/amd64/load.factor" -] pull-in + "/library/compiler/amd64/load.factor" run-resource +] when "Loading more library code..." print -t [ - "/library/alien/primitive-types.factor" +[ "/library/alien/malloc.factor" "/library/io/buffer.factor" @@ -34,19 +30,21 @@ t [ "/library/freetype/load.factor" "/library/ui/load.factor" "/library/help/load.factor" -] pull-in +] [ + dup print run-resource +] each ! Handle -libraries:... overrides parse-command-line "compile" get supported-cpu? and [ unix? [ - "/library/unix/load.factor" - ] pull-in + "/library/unix/load.factor" run-resource + ] when os "win32" = [ - "/library/win32/load.factor" - ] pull-in + "/library/win32/load.factor" run-resource + ] when "Compiling base..." print @@ -96,5 +94,3 @@ number>string write " ms" print "factor.image" save-image 0 exit - -FORGET: pull-in diff --git a/library/compiler/amd64/architecture.factor b/library/compiler/amd64/architecture.factor index 677ad0d0db..5e481e2422 100644 --- a/library/compiler/amd64/architecture.factor +++ b/library/compiler/amd64/architecture.factor @@ -28,3 +28,5 @@ M: float-regs fastcall-regs drop 0 ; 0 scratch [ swap MOV ] keep ; inline : fixnum>slot@ drop ; inline + +: return-register RAX ; inline diff --git a/library/compiler/x86/architecture.factor b/library/compiler/x86/architecture.factor index c2e4ca4359..ff00dc530d 100644 --- a/library/compiler/x86/architecture.factor +++ b/library/compiler/x86/architecture.factor @@ -28,3 +28,5 @@ M: float-regs fastcall-regs drop 0 ; ; inline : fixnum>slot@ 1 SHR ; inline + +: return-register EAX ; inline diff --git a/library/compiler/x86/fixnum.factor b/library/compiler/x86/fixnum.factor index 8a06f2c993..b70d68ebd5 100644 --- a/library/compiler/x86/fixnum.factor +++ b/library/compiler/x86/fixnum.factor @@ -29,7 +29,7 @@ math-internals memory namespaces words ; "s48_long_to_bignum" f compile-c-call ! An untagged pointer to the bignum is now in EAX; tag it EAX bignum-tag OR - ESP 4 ADD + 0 scratch POP "end" get save-xt ; inline M: %fixnum+ generate-node ( vop -- ) @@ -111,32 +111,33 @@ M: %fixnum-bitnot generate-node ( vop -- ) 0 output-operand tag-mask XOR ; M: %fixnum<< generate-node + #! This has specific register requirements. drop - ! This has specific register requirements.