From 5ca23c4793f634ae7a3d101c5e1a4450555a309d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Thu, 30 Apr 2015 04:51:58 +0200 Subject: [PATCH] compiler.*: a few extra doc fixes --- .../cfg/builder/alien/alien-docs.factor | 7 +++- .../cfg/instructions/instructions-docs.factor | 26 +++++++++--- .../cfg/intrinsics/fixnum/fixnum-docs.factor | 6 +++ basis/compiler/cfg/rpo/rpo-docs.factor | 4 ++ .../compiler/constants/constants-docs.factor | 42 ++++++++++++++++++- basis/compiler/constants/constants.factor | 2 - 6 files changed, 77 insertions(+), 10 deletions(-) create mode 100644 basis/compiler/cfg/intrinsics/fixnum/fixnum-docs.factor diff --git a/basis/compiler/cfg/builder/alien/alien-docs.factor b/basis/compiler/cfg/builder/alien/alien-docs.factor index 0899fd4918..fa22861bca 100644 --- a/basis/compiler/cfg/builder/alien/alien-docs.factor +++ b/basis/compiler/cfg/builder/alien/alien-docs.factor @@ -1,4 +1,5 @@ -USING: help.markup help.syntax literals make multiline stack-checker.alien ; +USING: help.markup help.syntax literals make multiline sequences +stack-checker.alien ; IN: compiler.cfg.builder.alien << @@ -19,3 +20,7 @@ HELP: caller-return { $values { "params" alien-node-params } } { $description "If the last alien call returns a value, then this word will emit an instruction to the current sequence being constructed by " { $link make } " that boxes it." } { $examples { $unchecked-example $[ ex-caller-return ] } } ; + +HELP: unbox-parameters +{ $values { "parameters" sequence } { "vregs" sequence } { "reps" sequence } } +{ $description "Unboxes a sequence of parameters to send to an ffi function." } ; diff --git a/basis/compiler/cfg/instructions/instructions-docs.factor b/basis/compiler/cfg/instructions/instructions-docs.factor index 5f6ba66db6..c9bf94ab72 100644 --- a/basis/compiler/cfg/instructions/instructions-docs.factor +++ b/basis/compiler/cfg/instructions/instructions-docs.factor @@ -1,6 +1,7 @@ -USING: alien arrays assocs classes compiler.cfg compiler.cfg.ssa.destruction -compiler.cfg.value-numbering compiler.codegen.gc-maps cpu.architecture -help.markup help.syntax kernel layouts sequences slots.private system ; +USING: alien arrays assocs classes compiler.cfg compiler.cfg.intrinsics.fixnum +compiler.cfg.ssa.destruction compiler.cfg.value-numbering +compiler.codegen.gc-maps cpu.architecture help.markup help.syntax kernel layouts +math sequences slots.private system ; IN: compiler.cfg.instructions HELP: ##alien-invoke @@ -66,7 +67,8 @@ HELP: ##compare-float-ordered-branch } ; HELP: ##compare-integer -{ $class-description "This instruction is emitted for integer comparisons." } ; +{ $class-description "This instruction is emitted for integer (" { $link fixnum } ") comparisons." } +{ $see-also emit-fixnum-comparison } ; HELP: ##copy { $class-description "Instruction that copies a value from one register to another of the same type. For example, you can copy between two gprs or two simd registers but not across. It has the following slots:" @@ -75,6 +77,10 @@ HELP: ##copy } } ; +HELP: ##fixnum-add +{ $class-description "Instruction for adding two fixnums together." } +{ $see-also emit-fixnum+ } ; + HELP: ##inc { $class-description "An instruction that increases or decreases a stacks height by n. For example, " { $link 2drop } " decreases the datastacks height by two and pushing an item increases it by one." @@ -196,7 +202,17 @@ HELP: ##spill { $class-description "Instruction that copies a value from a register to a " { $link spill-slot } "." } ; HELP: ##store-memory-imm -{ $class-description "Instruction that copies an 8 byte value from a XMM register to a memory location addressed by a normal register. This instruction is often turned into a cheaper " { $link ##store-memory } " instruction in the " { $link value-numbering } " pass." } ; +{ $class-description "Instruction that copies an 8 byte value from a XMM register to a memory location addressed by a normal register. This instruction is often turned into a cheaper " { $link ##store-memory } " instruction in the " { $link value-numbering } " pass." + { $table + { { $slot "base" } { "Vreg that contains the base address." } } + { + { $slot "offset" } + { "Offset in bytes from the address to where the data should be written." } + } + { { $slot "src" } { "Vreg that contains the item to set." } } + } +} +{ $see-also %store-memory-imm } ; HELP: ##vector>scalar { $class-description diff --git a/basis/compiler/cfg/intrinsics/fixnum/fixnum-docs.factor b/basis/compiler/cfg/intrinsics/fixnum/fixnum-docs.factor new file mode 100644 index 0000000000..948d26d2fa --- /dev/null +++ b/basis/compiler/cfg/intrinsics/fixnum/fixnum-docs.factor @@ -0,0 +1,6 @@ +USING: compiler.cfg.instructions help.markup help.syntax ; +IN: compiler.cfg.intrinsics.fixnum + +HELP: emit-fixnum-comparison +{ $values { "cc" "comparison symbol" } } +{ $description "Emits a " { $link ##compare-integer } " instruction to the make sequence." } ; diff --git a/basis/compiler/cfg/rpo/rpo-docs.factor b/basis/compiler/cfg/rpo/rpo-docs.factor index dde89bc9b9..a74e5f33dd 100644 --- a/basis/compiler/cfg/rpo/rpo-docs.factor +++ b/basis/compiler/cfg/rpo/rpo-docs.factor @@ -27,3 +27,7 @@ HELP: optimize-basic-block HELP: simple-analysis { $values { "cfg" cfg } { "quot" quotation } } { $description "Applies a quotation to each sequence of instructions in each " { $link basic-block } " in the cfg." } ; + +HELP: simple-optimization +{ $values { "cfg" cfg } { "quot" quotation } } +{ $description "Runs a quotation that optimizes each " { $link basic-block } " in the cfg, excluding the kill blocks. The quotation takes the blocks instruction sequence and returns them back in optimized form. The blocks are iterated in " { $link reverse-post-order } "." } ; diff --git a/basis/compiler/constants/constants-docs.factor b/basis/compiler/constants/constants-docs.factor index 567dcfb612..cf0ec8749f 100644 --- a/basis/compiler/constants/constants-docs.factor +++ b/basis/compiler/constants/constants-docs.factor @@ -1,4 +1,4 @@ -USING: compiler.codegen.relocation help.markup help.syntax ; +USING: compiler.codegen.relocation help.markup help.syntax math ; IN: compiler.constants HELP: rt-cards-offset @@ -9,7 +9,45 @@ HELP: rt-decks-offset { $description "Relocation offset type for the decks table." } { $see-also rel-decks-offset } ; +HELP: string-offset +{ $values { "n" integer } } +{ $description "hm" } ; -ARTICLE: "compiler.constants" "VM memory layout constants" "Common constants" ; + +ARTICLE: "compiler.constants" "VM memory layout constants" +"Common constants." +$nl +"Constants that must match vm/memory.hpp:" +{ $subsections card-bits card-mark deck-bits } +"Constants that must match vm/layouts.hpp:" +{ $subsections + alien-offset + array-start-offset + byte-array-offset + callstack-length-offset + callstack-top-offset + context-callstack-bottom-offset + context-callstack-save-offset + context-callstack-seg-offset + context-datastack-offset + context-callstack-top-offset + context-retainstack-offset + float-offset + profile-count-offset + quot-entry-point-offset + segment-end-offset + segment-size-offset + segment-start-offset + slot-offset + string-aux-offset + string-offset + tuple-class-offset + underlying-alien-offset + vm-context-offset + vm-fault-flag-offset + vm-signal-handler-addr-offset + vm-spare-context-offset + word-entry-point-offset +} ; ABOUT: "compiler.constants" diff --git a/basis/compiler/constants/constants.factor b/basis/compiler/constants/constants.factor index c044eddedc..80aafc609a 100644 --- a/basis/compiler/constants/constants.factor +++ b/basis/compiler/constants/constants.factor @@ -4,12 +4,10 @@ USING: alien arrays byte-arrays kernel layouts literals math quotations sequences strings words ; IN: compiler.constants -! These constants must match vm/memory.h CONSTANT: card-bits 8 CONSTANT: deck-bits 18 : card-mark ( -- n ) 0x40 0x80 bitor ; inline -! These constants must match vm/layouts.h : slot-offset ( slot tag -- n ) [ bootstrap-cells ] dip - ; inline : float-offset ( -- n ) 8 float type-number - ; inline