diff --git a/basis/compiler/cfg/instructions/instructions-doc.factor b/basis/compiler/cfg/instructions/instructions-doc.factor index 20c6f4ceb7..d3531537fd 100644 --- a/basis/compiler/cfg/instructions/instructions-doc.factor +++ b/basis/compiler/cfg/instructions/instructions-doc.factor @@ -1,4 +1,4 @@ -USING: help.markup help.syntax kernel layouts slots.private ; +USING: compiler.cfg help.markup help.syntax kernel layouts slots.private ; IN: compiler.cfg.instructions HELP: insn @@ -72,6 +72,19 @@ HELP: ##peek HELP: ##safepoint { $class-description "Instruction that inserts a safe point in the generated code." } ; +HELP: ##check-nursery-branch +{ $class-description + "Instruction that inserts a conditional branch to a " { $link basic-block } " that garbage collects the nursery. The " { $vocab-link "compiler.cfg.gc-checks" } " vocab goes through each block in the " { $link cfg } " and checks if it allocates memory. If it does, then this instruction is inserted in the cfg before that block and checks if there is enough available space in the nursery. If it isn't, then a basic block containing code for garbage collecting the nursery is executed." + $nl + "It has the following slots:" + { $table + { { $slot "size" } { "Number of bytes the next block in the cfg will allocate." } } + { { $slot "cc" } { "A comparison symbol." } } + { { $slot "temp1" } { "Register symbol." } } + { { $slot "temp2" } { "Register symbol." } } + } +} ; + HELP: ##return { $class-description "Instruction that returns from a procedure call." } ; diff --git a/basis/compiler/cfg/save-contexts/save-contexts.factor b/basis/compiler/cfg/save-contexts/save-contexts.factor index f51499d791..0622ca7201 100644 --- a/basis/compiler/cfg/save-contexts/save-contexts.factor +++ b/basis/compiler/cfg/save-contexts/save-contexts.factor @@ -12,7 +12,7 @@ GENERIC: needs-save-context? ( insn -- ? ) M: gc-map-insn needs-save-context? drop t ; M: insn needs-save-context? drop f ; -: bb-needs-save-context? ( insn -- ? ) +: bb-needs-save-context? ( bb -- ? ) { [ kill-block?>> not ] [ instructions>> [ needs-save-context? ] any? ] diff --git a/basis/cpu/architecture/architecture-docs.factor b/basis/cpu/architecture/architecture-docs.factor index f229278e11..3cfb9bd01f 100644 --- a/basis/cpu/architecture/architecture-docs.factor +++ b/basis/cpu/architecture/architecture-docs.factor @@ -1,5 +1,6 @@ -USING: assocs cpu.x86.assembler help.markup help.syntax kernel -literals math multiline system words ; +USING: assocs classes compiler.cfg.instructions cpu.x86.assembler +cpu.x86.assembler.operands help.markup help.syntax layouts literals math +multiline system words ; IN: cpu.architecture << @@ -19,8 +20,17 @@ init-fixup init-relocation [ RAX RBX RCX %box-alien ] B{ } make disassemble 000000e9fcc720d9: 48895812 mov [rax+0x12], rbx 000000e9fcc720dd: 4889581a mov [rax+0x1a], rbx ; ->> +STRING: ex-%allot +USING: cpu.architecture make ; +[ RAX 40 tuple RCX %allot ] B{ } make disassemble +0000000002270cc0: 498d4d10 lea rcx, [r13+0x10] +0000000002270cc4: 488b01 mov rax, [rcx] +0000000002270cc7: 48c7001c000000 mov qword [rax], 0x1c +0000000002270cce: 4883c807 or rax, 0x7 +0000000002270cd2: 48830130 add qword [rcx], 0x30 +; +>> HELP: signed-rep { $values { "rep" representation } { "rep'" representation } } @@ -59,8 +69,22 @@ HELP: %call HELP: %box-alien { $values { "dst" "destination register" } { "src" "source register" } { "temp" "temporary register" } } -{ $description "Emits machine code for boxing an alien value." } -{ $examples { $unchecked-example $[ ex-%box-alien ] } } ; +{ $description "Emits machine code for boxing an alien value. Internally, this word will allocate five " { $link cells } " which wraps the alien." } +{ $examples { $unchecked-example $[ ex-%box-alien ] } } +{ $see-also ##box-alien %allot } ; + +HELP: %allot +{ $values + { "dst" "destination register symbol" } + { "size" "number of bytes to allocate" } + { "class" "one of the built-in classes listed in " { $link type-numbers } } + { "temp" "temporary register symbol" } +} +{ $description "Emits machine code for allocating memory." } +{ $examples + "In this example 40 bytes is allocated and a tagged pointer to the memory is put in " { $link RAX } ":" + { $unchecked-example $[ ex-%allot ] } +} ; HELP: fused-unboxing? { $values { "?" boolean } }