diff --git a/basis/cpu/ppc/32/linux/bootstrap.factor b/basis/bootstrap/assembler/ppc.32.linux.factor similarity index 97% rename from basis/cpu/ppc/32/linux/bootstrap.factor rename to basis/bootstrap/assembler/ppc.32.linux.factor index 7a4b6acd1e..a9f55b6a16 100644 --- a/basis/cpu/ppc/32/linux/bootstrap.factor +++ b/basis/bootstrap/assembler/ppc.32.linux.factor @@ -69,5 +69,5 @@ CONSTANT: frame-reg 31 : param-size ( -- n ) 32 ; : saved-int-regs-size ( -- n ) 96 ; -<< "vocab:cpu/ppc/bootstrap.factor" parse-file suffix! >> +<< "vocab:bootstrap/assembler/ppc.factor" parse-file suffix! >> call diff --git a/basis/cpu/ppc/64/linux/bootstrap.factor b/basis/bootstrap/assembler/ppc.64.linux.factor similarity index 97% rename from basis/cpu/ppc/64/linux/bootstrap.factor rename to basis/bootstrap/assembler/ppc.64.linux.factor index 8d2ded480d..831b95b7eb 100644 --- a/basis/cpu/ppc/64/linux/bootstrap.factor +++ b/basis/bootstrap/assembler/ppc.64.linux.factor @@ -76,5 +76,5 @@ CONSTANT: frame-reg 31 : param-size ( -- n ) 64 ; : saved-int-regs-size ( -- n ) 192 ; -<< "vocab:cpu/ppc/bootstrap.factor" parse-file suffix! >> +<< "vocab:bootstrap/assembler/ppc.factor" parse-file suffix! >> call diff --git a/basis/cpu/ppc/bootstrap.factor b/basis/bootstrap/assembler/ppc.factor similarity index 100% rename from basis/cpu/ppc/bootstrap.factor rename to basis/bootstrap/assembler/ppc.factor diff --git a/basis/cpu/x86/32/bootstrap.factor b/basis/bootstrap/assembler/x86.32.factor old mode 100755 new mode 100644 similarity index 100% rename from basis/cpu/x86/32/bootstrap.factor rename to basis/bootstrap/assembler/x86.32.factor diff --git a/basis/bootstrap/assembler/x86.32.unix.factor b/basis/bootstrap/assembler/x86.32.unix.factor new file mode 100644 index 0000000000..74ac2516fb --- /dev/null +++ b/basis/bootstrap/assembler/x86.32.unix.factor @@ -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 diff --git a/basis/cpu/x86/32/windows/bootstrap.factor b/basis/bootstrap/assembler/x86.32.windows.factor similarity index 83% rename from basis/cpu/x86/32/windows/bootstrap.factor rename to basis/bootstrap/assembler/x86.32.windows.factor index 801818e59b..fb3efc8df2 100644 --- a/basis/cpu/x86/32/windows/bootstrap.factor +++ b/basis/bootstrap/assembler/x86.32.windows.factor @@ -9,7 +9,7 @@ IN: bootstrap.x86 : tib-segment ( -- ) FS ; : 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 ( -- ) ! Create a new exception record and store it in the TIB. @@ -33,5 +33,5 @@ IN: bootstrap.x86 ! Store exception record in TIB. tib-exception-list-offset [] tib-temp tib-segment MOV ; -<< "vocab:cpu/x86/32/bootstrap.factor" parse-file suffix! >> call -<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.32.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call diff --git a/basis/cpu/x86/64/bootstrap.factor b/basis/bootstrap/assembler/x86.64.factor old mode 100755 new mode 100644 similarity index 100% rename from basis/cpu/x86/64/bootstrap.factor rename to basis/bootstrap/assembler/x86.64.factor diff --git a/basis/cpu/x86/64/unix/bootstrap.factor b/basis/bootstrap/assembler/x86.64.unix.factor similarity index 68% rename from basis/cpu/x86/64/unix/bootstrap.factor rename to basis/bootstrap/assembler/x86.64.unix.factor index c4abe962cf..2b665555c7 100644 --- a/basis/cpu/x86/64/unix/bootstrap.factor +++ b/basis/bootstrap/assembler/x86.64.unix.factor @@ -10,12 +10,15 @@ IN: bootstrap.x86 : stack-frame-size ( -- n ) 4 bootstrap-cells ; : nv-regs ( -- seq ) { RBX R12 R13 R14 R15 } ; : 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 ; : arg2 ( -- reg ) RSI ; : arg3 ( -- reg ) RDX ; : arg4 ( -- reg ) RCX ; : red-zone-size ( -- n ) 128 ; -<< "vocab:cpu/x86/unix/bootstrap.factor" parse-file suffix! >> call -<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >> call -<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.unix.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.64.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call diff --git a/basis/cpu/x86/64/windows/bootstrap.factor b/basis/bootstrap/assembler/x86.64.windows.factor similarity index 78% rename from basis/cpu/x86/64/windows/bootstrap.factor rename to basis/bootstrap/assembler/x86.64.windows.factor index d622161f32..6cec39ec17 100644 --- a/basis/cpu/x86/64/windows/bootstrap.factor +++ b/basis/bootstrap/assembler/x86.64.windows.factor @@ -25,6 +25,6 @@ DEFER: stack-reg : red-zone-size ( -- n ) 0 ; -<< "vocab:cpu/x86/windows/bootstrap.factor" parse-file suffix! >> call -<< "vocab:cpu/x86/64/bootstrap.factor" parse-file suffix! >> call -<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.windows.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.64.factor" parse-file suffix! >> call +<< "vocab:bootstrap/assembler/x86.factor" parse-file suffix! >> call diff --git a/basis/cpu/x86/bootstrap.factor b/basis/bootstrap/assembler/x86.factor similarity index 100% rename from basis/cpu/x86/bootstrap.factor rename to basis/bootstrap/assembler/x86.factor diff --git a/basis/cpu/x86/unix/bootstrap.factor b/basis/bootstrap/assembler/x86.unix.factor similarity index 100% rename from basis/cpu/x86/unix/bootstrap.factor rename to basis/bootstrap/assembler/x86.unix.factor diff --git a/basis/cpu/x86/windows/bootstrap.factor b/basis/bootstrap/assembler/x86.windows.factor similarity index 100% rename from basis/cpu/x86/windows/bootstrap.factor rename to basis/bootstrap/assembler/x86.windows.factor diff --git a/basis/cpu/x86/32/unix/bootstrap.factor b/basis/cpu/x86/32/unix/bootstrap.factor deleted file mode 100644 index 56d18511e4..0000000000 --- a/basis/cpu/x86/32/unix/bootstrap.factor +++ /dev/null @@ -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 diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor index b36364a4d6..04c34f9609 100755 --- a/core/bootstrap/primitives.factor +++ b/core/bootstrap/primitives.factor @@ -18,14 +18,14 @@ H{ } clone sub-primitives set "vocab:bootstrap/syntax.factor" parse-file architecture get { - { "windows-x86.32" "x86/32/windows" } - { "windows-x86.64" "x86/64/windows" } - { "unix-x86.32" "x86/32/unix" } - { "unix-x86.64" "x86/64/unix" } - { "linux-ppc.32" "ppc/32/linux" } - { "linux-ppc.64" "ppc/64/linux" } + { "windows-x86.32" "x86.32.windows" } + { "windows-x86.64" "x86.64.windows" } + { "unix-x86.32" "x86.32.unix" } + { "unix-x86.64" "x86.64.unix" } + { "linux-ppc.32" "ppc.32.linux" } + { "linux-ppc.64" "ppc.64.linux" } } ?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 diff --git a/vm/cpu-x86.32.hpp b/vm/cpu-x86.32.hpp index 495922b840..38dcb7700a 100644 --- a/vm/cpu-x86.32.hpp +++ b/vm/cpu-x86.32.hpp @@ -3,7 +3,7 @@ namespace factor { #define FACTOR_CPU_STRING "x86.32" /* 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 SIGNAL_HANDLER_STACK_FRAME_SIZE = 48; static const unsigned JIT_FRAME_SIZE = 32; diff --git a/vm/os-linux-x86.64.hpp b/vm/os-linux-x86.64.hpp index 662ffca9bb..614e9420f8 100644 --- a/vm/os-linux-x86.64.hpp +++ b/vm/os-linux-x86.64.hpp @@ -28,7 +28,7 @@ inline static void uap_clear_fpu_status(void* uap) { #define UAP_STACK_POINTER_TYPE greg_t /* 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 SIGNAL_HANDLER_STACK_FRAME_SIZE = 160; static const unsigned JIT_FRAME_SIZE = 32; diff --git a/vm/os-macosx-x86.64.hpp b/vm/os-macosx-x86.64.hpp index 7ae3cb8d1b..d1787bf6b9 100644 --- a/vm/os-macosx-x86.64.hpp +++ b/vm/os-macosx-x86.64.hpp @@ -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, -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 SIGNAL_HANDLER_STACK_FRAME_SIZE = 160; static const unsigned JIT_FRAME_SIZE = 32; diff --git a/vm/os-windows-x86.32.cpp b/vm/os-windows-x86.32.cpp index c564e13958..244aa0a7a4 100644 --- a/vm/os-windows-x86.32.cpp +++ b/vm/os-windows-x86.32.cpp @@ -3,7 +3,7 @@ namespace factor { 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); } diff --git a/vm/os-windows.64.hpp b/vm/os-windows.64.hpp index ef4c8cae41..06a0d33bb5 100644 --- a/vm/os-windows.64.hpp +++ b/vm/os-windows.64.hpp @@ -8,8 +8,7 @@ namespace factor { #define MXCSR(ctx) (ctx)->MxCsr /* 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 SIGNAL_HANDLER_STACK_FRAME_SIZE = 192; static const unsigned JIT_FRAME_SIZE = 64; diff --git a/vm/quotations.cpp b/vm/quotations.cpp index 8deeecdeb2..45f3aa074f 100644 --- a/vm/quotations.cpp +++ b/vm/quotations.cpp @@ -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 basis/compiler/compiler.factor. -The non-optimizing compiler compiles a quotation at a time by concatenating -machine code chunks; prolog, epilog, call word, jump to word, etc. These machine -code chunks are generated from Factor code in basis/cpu/.../bootstrap.factor. +The non-optimizing compiler compiles a quotation at a time by +concatenating machine code chunks; prolog, epilog, call word, jump to +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) are direct jumps to machine code blocks. Literals are also referenced directly