bootstrap.image: docs

db4
Björn Lindqvist 2016-02-28 18:49:41 +01:00
parent 67eb64cf00
commit b0a201165a
2 changed files with 45 additions and 18 deletions

View File

@ -1,7 +1,45 @@
USING: bootstrap.image.private help.markup help.syntax io io.files
io.pathnames quotations strings words ;
USING: bootstrap.image.private byte-arrays help.markup help.syntax
io.pathnames math quotations sequences strings words ;
IN: bootstrap.image
HELP: architecture
{ $var-description "Bootstrap architecture name" } ;
HELP: define-sub-primitive
{ $values { "quot" quotation } { "word" word } }
{ $description "Defines a sub primitive by running the quotation which is supposed to output assembler code. The word is then used to call the assembly." }
{ $see-also sub-primitives } ;
HELP: jit-define
{ $values { "quot" quotation } { "n" integer } }
{ $description "Runs a quotation generating assembly code. The code is added to the special-objects table being constructed for the bootstrap image." } ;
HELP: make-image
{ $values { "arch" string } }
{ $description "Creates a bootstrap image from sources, where " { $snippet "architecture" } " is one of the following:"
{ $code "\"x86.32\"" "\"unix-x86.64\"" "\"windows-x86.64\"" "\"linux-ppc\"" }
"The new image file is written to the " { $link resource-path } " and is named " { $snippet "boot." { $emphasis "architecture" } ".image" } "." } ;
HELP: make-jit
{ $values
{ "quot" quotation }
{ "parameters" sequence }
{ "literals" sequence }
{ "code" "a { relocation insns } pair" }
}
{ $description "Runs the quotation to generate machine code. Code is a 2-tuple, where the first element is a " { $link byte-array } " of relocations and the second element the generated code." } ;
HELP: make-jit-no-params
{ $values
{ "quot" quotation }
{ "code" sequence }
}
{ $description "Like " { $link make-jit } ", except the assembler code can't contain any relocation parameters. The word is used to generate the code templatees that the JIT uses to compile quotations." } ;
HELP: sub-primitives
{ $var-description "An assoc that is set during bootstrapping. It contains symbols defining sub primitives as key, and generated assembly code for those symbols as values." } ;
ARTICLE: "bootstrap.image" "Bootstrapping new images"
"A new image can be built from source; this is known as " { $emphasis "bootstrap" } ". Bootstrap is a two-step process. The first stage is the creation of a bootstrap image from a running Factor instance:"
{ $subsections make-image }
@ -13,16 +51,3 @@ $nl
{ $see-also "runtime-cli-args" "bootstrap-cli-args" } ;
ABOUT: "bootstrap.image"
HELP: architecture
{ $var-description "Bootstrap architecture name" } ;
HELP: define-sub-primitive
{ $values { "quot" quotation } { "word" word } }
{ $description "Defines a sub primitive by running the quotation which is supposed to output assembler code. The word is then used to call the assembly." } ;
HELP: make-image
{ $values { "arch" string } }
{ $description "Creates a bootstrap image from sources, where " { $snippet "architecture" } " is one of the following:"
{ $code "\"x86.32\"" "\"unix-x86.64\"" "\"windows-x86.64\"" "\"linux-ppc\"" }
"The new image file is written to the " { $link resource-path } " and is named " { $snippet "boot." { $emphasis "architecture" } ".image" } "." } ;

View File

@ -108,7 +108,6 @@ SYMBOL: special-objects
[ length test-quot call ] [ % ] bi ; inline
: make-jit ( quot -- parameters literals code )
! code is a { relocation insns } pair
[
0 extra-offset set
init-relocation
@ -428,7 +427,7 @@ M: quotation prepare-object
1 >bignum OBJ-BIGNUM-POS-ONE special-objects get set-at
-1 >bignum OBJ-BIGNUM-NEG-ONE special-objects get set-at ;
: emit-global ( -- )
: create-global-hashtable ( -- global-hashtable )
{
dictionary source-files builtins
update-map implementors-map
@ -437,7 +436,10 @@ M: quotation prepare-object
class<=-cache class-not-cache classes-intersect-cache
class-and-cache class-or-cache next-method-quot-cache
} [ H{ } clone global-box boa ] H{ } map>assoc assoc-union
global-hashtable boa
global-hashtable boa ;
: emit-global ( -- )
create-global-hashtable
OBJ-GLOBAL special-objects get set-at ;
: emit-jit-data ( -- )