Reorganising bootstrap files

All the bootstrap.factor scripts in cpu/ are run by the bootstrap to
make boot images, but aren't used otherwise. So I think it's cleaner to
put them in one directory inside the bootstrap hierarchy.
db4
Björn Lindqvist 2015-05-17 10:11:48 +02:00 committed by Doug Coleman
parent cf3ccd0abe
commit 6ca83e7588
20 changed files with 38 additions and 35 deletions

View File

@ -69,5 +69,5 @@ CONSTANT: frame-reg 31
: param-size ( -- n ) 32 ; : param-size ( -- n ) 32 ;
: saved-int-regs-size ( -- n ) 96 ; : saved-int-regs-size ( -- n ) 96 ;
<< "vocab:cpu/ppc/bootstrap.factor" parse-file suffix! >> << "vocab:bootstrap/assembler/ppc.factor" parse-file suffix! >>
call call

View File

@ -76,5 +76,5 @@ CONSTANT: frame-reg 31
: param-size ( -- n ) 64 ; : param-size ( -- n ) 64 ;
: saved-int-regs-size ( -- n ) 192 ; : saved-int-regs-size ( -- n ) 192 ;
<< "vocab:cpu/ppc/bootstrap.factor" parse-file suffix! >> << "vocab:bootstrap/assembler/ppc.factor" parse-file suffix! >>
call call

View File

@ -0,0 +1,8 @@
! Copyright (C) 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel parser sequences ;
IN: bootstrap.x86
<< "vocab:bootstrap/assembler/x86.unix.factor" parse-file suffix! >> call
<< "vocab:bootstrap/assembler/x86.32.factor" parse-file suffix! >> call
<< "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call

View File

@ -9,7 +9,7 @@ IN: bootstrap.x86
: tib-segment ( -- ) FS ; : tib-segment ( -- ) FS ;
: tib-temp ( -- reg ) EAX ; : tib-temp ( -- reg ) EAX ;
<< "vocab:cpu/x86/windows/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.windows.factor" parse-file suffix! >> call
: jit-install-seh ( -- ) : jit-install-seh ( -- )
! Create a new exception record and store it in the TIB. ! Create a new exception record and store it in the TIB.
@ -33,5 +33,5 @@ IN: bootstrap.x86
! Store exception record in TIB. ! Store exception record in TIB.
tib-exception-list-offset [] tib-temp tib-segment MOV ; tib-exception-list-offset [] tib-temp tib-segment MOV ;
<< "vocab:cpu/x86/32/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.32.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call

View File

@ -10,12 +10,15 @@ IN: bootstrap.x86
: stack-frame-size ( -- n ) 4 bootstrap-cells ; : stack-frame-size ( -- n ) 4 bootstrap-cells ;
: nv-regs ( -- seq ) { RBX R12 R13 R14 R15 } ; : nv-regs ( -- seq ) { RBX R12 R13 R14 R15 } ;
: volatile-regs ( -- seq ) { RAX RCX RDX RSI RDI R8 R9 R10 R11 } ; : volatile-regs ( -- seq ) { RAX RCX RDX RSI RDI R8 R9 R10 R11 } ;
! The first four parameter registers according to the Unix 64bit
! calling convention.
: arg1 ( -- reg ) RDI ; : arg1 ( -- reg ) RDI ;
: arg2 ( -- reg ) RSI ; : arg2 ( -- reg ) RSI ;
: arg3 ( -- reg ) RDX ; : arg3 ( -- reg ) RDX ;
: arg4 ( -- reg ) RCX ; : arg4 ( -- reg ) RCX ;
: red-zone-size ( -- n ) 128 ; : red-zone-size ( -- n ) 128 ;
<< "vocab:cpu/x86/unix/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.unix.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.64.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call

View File

@ -25,6 +25,6 @@ DEFER: stack-reg
: red-zone-size ( -- n ) 0 ; : red-zone-size ( -- n ) 0 ;
<< "vocab:cpu/x86/windows/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.windows.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.64.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call << "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call

View File

@ -1,8 +0,0 @@
! Copyright (C) 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel parser sequences ;
IN: bootstrap.x86
<< "vocab:cpu/x86/unix/bootstrap.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/32/bootstrap.factor" parse-file suffix! >> call
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call

View File

@ -18,14 +18,14 @@ H{ } clone sub-primitives set
"vocab:bootstrap/syntax.factor" parse-file "vocab:bootstrap/syntax.factor" parse-file
architecture get { architecture get {
{ "windows-x86.32" "x86/32/windows" } { "windows-x86.32" "x86.32.windows" }
{ "windows-x86.64" "x86/64/windows" } { "windows-x86.64" "x86.64.windows" }
{ "unix-x86.32" "x86/32/unix" } { "unix-x86.32" "x86.32.unix" }
{ "unix-x86.64" "x86/64/unix" } { "unix-x86.64" "x86.64.unix" }
{ "linux-ppc.32" "ppc/32/linux" } { "linux-ppc.32" "ppc.32.linux" }
{ "linux-ppc.64" "ppc/64/linux" } { "linux-ppc.64" "ppc.64.linux" }
} ?at [ "Bad architecture: " prepend throw ] unless } ?at [ "Bad architecture: " prepend throw ] unless
"vocab:cpu/" "/bootstrap.factor" surround parse-file "vocab:bootstrap/assembler/" ".factor" surround parse-file
"vocab:bootstrap/layouts/layouts.factor" parse-file "vocab:bootstrap/layouts/layouts.factor" parse-file

View File

@ -3,7 +3,7 @@ namespace factor {
#define FACTOR_CPU_STRING "x86.32" #define FACTOR_CPU_STRING "x86.32"
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, /* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
and stack-frame-size constants in cpu/x86/32/bootstrap.factor */ and stack-frame-size constants in bootstrap/assembler/x86.32.factor */
static const unsigned LEAF_FRAME_SIZE = 16; static const unsigned LEAF_FRAME_SIZE = 16;
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 48; static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 48;
static const unsigned JIT_FRAME_SIZE = 32; static const unsigned JIT_FRAME_SIZE = 32;

View File

@ -28,7 +28,7 @@ inline static void uap_clear_fpu_status(void* uap) {
#define UAP_STACK_POINTER_TYPE greg_t #define UAP_STACK_POINTER_TYPE greg_t
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, /* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
and stack-frame-size constants in basis/cpu/x86/64/unix/bootstrap.factor */ and stack-frame-size constants in bootstrap/assembler/x86.64.unix.factor */
static const unsigned LEAF_FRAME_SIZE = 16; static const unsigned LEAF_FRAME_SIZE = 16;
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160; static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160;
static const unsigned JIT_FRAME_SIZE = 32; static const unsigned JIT_FRAME_SIZE = 32;

View File

@ -68,7 +68,7 @@ inline static void uap_clear_fpu_status(void* uap) {
} }
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, /* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
and stack-frame-size constants in basis/cpu/x86/64/unix/bootstrap.factor */ and stack-frame-size constants in basis/bootstrap/assembler/x86.64.unix.factor */
static const unsigned LEAF_FRAME_SIZE = 16; static const unsigned LEAF_FRAME_SIZE = 16;
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160; static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160;
static const unsigned JIT_FRAME_SIZE = 32; static const unsigned JIT_FRAME_SIZE = 32;

View File

@ -3,7 +3,7 @@
namespace factor { namespace factor {
void factor_vm::c_to_factor_toplevel(cell quot) { void factor_vm::c_to_factor_toplevel(cell quot) {
/* 32-bit Windows SEH set up in basis/cpu/x86/32/windows/bootstrap.factor */ /* 32-bit Windows SEH set up in basis/bootstrap/assembler/x86.32.windows.factor */
c_to_factor(quot); c_to_factor(quot);
} }

View File

@ -8,8 +8,7 @@ namespace factor {
#define MXCSR(ctx) (ctx)->MxCsr #define MXCSR(ctx) (ctx)->MxCsr
/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, /* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size,
and stack-frame-size constants in basis/cpu/x86/64/windows/bootstrap.factor */ and stack-frame-size constants in basis/bootstap/assembler/x86.64.windows.factor */
static const unsigned LEAF_FRAME_SIZE = 16; static const unsigned LEAF_FRAME_SIZE = 16;
static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 192; static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 192;
static const unsigned JIT_FRAME_SIZE = 64; static const unsigned JIT_FRAME_SIZE = 64;

View File

@ -8,9 +8,10 @@ This is one of the two compilers implementing Factor; the second one is written
in Factor and performs advanced optimizations. See in Factor and performs advanced optimizations. See
basis/compiler/compiler.factor. basis/compiler/compiler.factor.
The non-optimizing compiler compiles a quotation at a time by concatenating The non-optimizing compiler compiles a quotation at a time by
machine code chunks; prolog, epilog, call word, jump to word, etc. These machine concatenating machine code chunks; prolog, epilog, call word, jump to
code chunks are generated from Factor code in basis/cpu/.../bootstrap.factor. word, etc. These machine code chunks are generated from Factor code in
basis/bootstrap/assembler/.
Calls to words and constant quotations (referenced by conditionals and dips) Calls to words and constant quotations (referenced by conditionals and dips)
are direct jumps to machine code blocks. Literals are also referenced directly are direct jumps to machine code blocks. Literals are also referenced directly