Revert "bootstrap: trying to undo changes from"

This reverts commit 7b3fb61ebd.
char-rename
Björn Lindqvist 2016-11-13 00:22:21 +01:00
parent b4085d0f8a
commit 56079afcfb
8 changed files with 908 additions and 450 deletions

View File

@ -0,0 +1,26 @@
USING: assocs help.markup help.syntax quotations strings words ;
IN: bootstrap.image.primitives
HELP: all-primitives
{ $description "A constant " { $link assoc } " containing all primitives. Keys are vocab names and values are sequences of tuples declaring words. The format of the tuples are { name effect vm-func inputs outputs extra-props }:"
{ $list
{ "name: Name of the primitive." }
{ "effect: The primitives stack effect." }
{ "vm-func: If it is a " { $link string } " then the primitive will call a function implemented in C++ code. If 'vm-func' is " { $link f } " then it is a sub-primitive and implemented in one of the files in 'basis/bootstrap/assembler/'." }
{ "inputs: The primitives \"input-classes\", if any." }
{ "outputs: The primitives \"output-classes\", if any." }
{ "extra-word: An " { $link word } " that is run with the created word as argument to add extra properties to it. Usually, it would be " { $link make-foldable } " or " { $link make-flushable } " to make the word foldable or flushable respectively." }
}
}
"See " { $link "word-props" } " for documentation of what all word properties do." ;
HELP: primitive-quot
{ $values { "word" word } { "vm-func" $maybe { string } } { "quot" quotation } }
{ $description "Creates the defining quotation for the primitive. If 'vm-func' is a string, then it is prefixed with 'primitive_' and a quotation calling that C++ function is generated." } ;
ARTICLE: "bootstrap.image.primitives" "Bootstrap primitives"
"This vocab contains utilities for declaring primitives to be added to the bootstrap image. It is used by " { $vocab-link "bootstrap.primitives" }
$nl
{ $link all-primitives } " is an assoc where all primitives are declared. See that constant for a description of the format." ;
ABOUT: "bootstrap.image.primitives"

View File

@ -0,0 +1,18 @@
USING: bootstrap.image.primitives kernel.private sequences tools.test
vocabs words ;
IN: bootstrap.image.primitives.tests
{
[
B{
112 114 105 109 105 116 105 118 101 95 104 101 108 108 111 0
}
do-primitive
]
} [
gensym "hello" primitive-quot
] unit-test
{ t } [
all-words [ primitive? ] filter [ foldable? ] filter [ flushable? ] all?
] unit-test

View File

@ -0,0 +1,832 @@
USING: alien alien.strings arrays assocs byte-arrays
io.encodings.ascii kernel kernel.private locals math quotations
sequences sequences.generalizations sequences.private strings words ;
IN: bootstrap.image.primitives
CONSTANT: all-primitives {
{
"alien"
{
{
"<callback>" ( word return-rewind -- alien ) "callback"
{ word integer } { alien } f
}
{
"<displaced-alien>" ( displacement c-ptr -- alien ) "displaced_alien"
{ integer c-ptr } { c-ptr } make-flushable
}
{
"alien-address" ( c-ptr -- addr ) "alien_address"
{ alien } { integer } make-flushable
}
{ "free-callback" ( alien -- ) "free_callback" { alien } { } f }
}
}
{
"alien.private"
{
{ "current-callback" ( -- n ) "current_callback" { } { fixnum } make-flushable }
}
}
{
"alien.accessors"
{
{
"alien-cell" ( c-ptr n -- value ) "alien_cell"
{ c-ptr integer } { pinned-c-ptr } make-flushable
}
{
"alien-double" ( c-ptr n -- value ) "alien_double"
{ c-ptr integer } { float } make-flushable
}
{
"alien-float" ( c-ptr n -- value ) "alien_float"
{ c-ptr integer } { float } make-flushable
}
{
"alien-signed-1" ( c-ptr n -- value ) "alien_signed_1"
{ c-ptr integer } { fixnum } make-flushable
}
{
"alien-signed-2" ( c-ptr n -- value ) "alien_signed_2"
{ c-ptr integer } { fixnum } make-flushable
}
{
"alien-signed-4" ( c-ptr n -- value ) "alien_signed_4"
{ c-ptr integer } { integer } make-flushable
}
{
"alien-signed-8" ( c-ptr n -- value ) "alien_signed_8"
{ c-ptr integer } { integer } make-flushable
}
{
"alien-signed-cell" ( c-ptr n -- value ) "alien_signed_cell"
{ c-ptr integer } { integer } make-flushable
}
{
"alien-unsigned-1" ( c-ptr n -- value ) "alien_unsigned_1"
{ c-ptr integer } { fixnum } make-flushable
}
{
"alien-unsigned-2" ( c-ptr n -- value ) "alien_unsigned_2"
{ c-ptr integer } { fixnum } make-flushable
}
{
"alien-unsigned-4" ( c-ptr n -- value ) "alien_unsigned_4"
{ c-ptr integer } { integer } make-flushable
}
{
"alien-unsigned-8" ( c-ptr n -- value ) "alien_unsigned_8"
{ c-ptr integer } { integer } make-flushable
}
{
"alien-unsigned-cell" ( c-ptr n -- value ) "alien_unsigned_cell"
{ c-ptr integer } { integer } make-flushable
}
{
"set-alien-cell" ( value c-ptr n -- ) "set_alien_cell"
{ c-ptr c-ptr integer } { } f
}
{
"set-alien-double" ( value c-ptr n -- ) "set_alien_double"
{ float c-ptr integer } { } f
}
{
"set-alien-float" ( value c-ptr n -- ) "set_alien_float"
{ float c-ptr integer } { } f
}
{
"set-alien-signed-1" ( value c-ptr n -- ) "set_alien_signed_1"
{ integer c-ptr integer } { } f
}
{
"set-alien-signed-2" ( value c-ptr n -- ) "set_alien_signed_2"
{ integer c-ptr integer } { } f
}
{
"set-alien-signed-4" ( value c-ptr n -- ) "set_alien_signed_4"
{ integer c-ptr integer } { } f
}
{
"set-alien-signed-8" ( value c-ptr n -- ) "set_alien_signed_8"
{ integer c-ptr integer } { } f
}
{
"set-alien-signed-cell" ( value c-ptr n -- ) "set_alien_signed_cell"
{ integer c-ptr integer } { } f
}
{
"set-alien-unsigned-1" ( value c-ptr n -- ) "set_alien_unsigned_1"
{ integer c-ptr integer } { } f
}
{
"set-alien-unsigned-2" ( value c-ptr n -- ) "set_alien_unsigned_2"
{ integer c-ptr integer } { } f
}
{
"set-alien-unsigned-4" ( value c-ptr n -- ) "set_alien_unsigned_4"
{ integer c-ptr integer } { } f
}
{
"set-alien-unsigned-8" ( value c-ptr n -- ) "set_alien_unsigned_8"
{ integer c-ptr integer } { } f
}
{
"set-alien-unsigned-cell" ( value c-ptr n -- ) "set_alien_unsigned_cell"
{ integer c-ptr integer } { } f
}
}
}
{
"alien.libraries"
{
{ "(dlopen)" ( path -- dll ) "dlopen" { byte-array } { dll } f }
{ "(dlsym)" ( name dll -- alien ) "dlsym" { byte-array object } { c-ptr } f }
{
"(dlsym-raw)" ( name dll -- alien ) "dlsym_raw"
{ byte-array object } { c-ptr } f
}
{ "dlclose" ( dll -- ) "dlclose" { dll } { } f }
{ "dll-valid?" ( dll -- ? ) "dll_validp" { object } { object } f }
}
}
{
"arrays"
{
{
"<array>" ( n elt -- array ) "array"
{ integer-array-capacity object } { array } make-flushable
}
{
"resize-array" ( n array -- new-array ) "resize_array"
{ integer array } { array } f
}
}
}
{
"byte-arrays"
{
{
"(byte-array)" ( n -- byte-array ) "uninitialized_byte_array"
{ integer-array-capacity } { byte-array } make-flushable
}
{
"<byte-array>" ( n -- byte-array ) "byte_array"
{ integer-array-capacity } { byte-array } make-flushable
}
{
"resize-byte-array" ( n byte-array -- new-byte-array )
"resize_byte_array"
{ integer-array-capacity byte-array } { byte-array } f
}
}
}
{
"classes.tuple.private"
{
{
"<tuple-boa>" ( slots... layout -- tuple ) "tuple_boa"
f f make-flushable
}
{
"<tuple>" ( layout -- tuple ) "tuple"
{ array } { tuple } make-flushable
}
}
}
{
"compiler.units"
{
{
"modify-code-heap" ( alist update-existing? reset-pics? -- )
"modify_code_heap"
{ array object object } { } f
}
}
}
{
"generic.single.private"
{
{ "inline-cache-miss" ( generic methods index cache -- ) f f f f }
{ "inline-cache-miss-tail" ( generic methods index cache -- ) f f f f }
{
"lookup-method" ( object methods -- method ) "lookup_method"
{ object array } { word } f
}
{ "mega-cache-lookup" ( methods index cache -- ) f f f f }
{ "mega-cache-miss" ( methods index cache -- method ) "mega_cache_miss" f f f }
}
}
{
"io.files.private"
{
{ "(exists?)" ( path -- ? ) "existsp" { string } { object } f }
}
}
{
"io.streams.c"
{
{
"(fopen)" ( path mode -- alien ) "fopen"
{ byte-array byte-array } { alien } f
}
{ "fclose" ( alien -- ) "fclose" { alien } { } f }
{ "fflush" ( alien -- ) "fflush" { alien } { } f }
{ "fgetc" ( alien -- byte/f ) "fgetc" { alien } { object } f }
{ "fputc" ( byte alien -- ) "fputc" { object alien } { } f }
{
"fread-unsafe" ( n buf alien -- count ) "fread"
{ integer c-ptr alien } { integer } f
}
{
"fseek" ( alien offset whence -- ) "fseek"
{ integer integer alien } { } f
}
{ "ftell" ( alien -- n ) "ftell" { alien } { integer } f }
{ "fwrite" ( data length alien -- ) "fwrite" { c-ptr integer alien } { } f }
}
}
{
"kernel"
{
{ "(clone)" ( obj -- newobj ) "clone" { object } { object } make-flushable }
{
"<wrapper>" ( obj -- wrapper ) "wrapper"
{ object } { wrapper } make-foldable
}
{
"callstack>array" ( callstack -- array ) "callstack_to_array"
{ callstack } { array } make-flushable
}
{ "die" ( -- ) "die" { } { } f }
{ "drop" ( x -- ) f f f f }
{ "2drop" ( x y -- ) f f f f }
{ "3drop" ( x y z -- ) f f f f }
{ "4drop" ( w x y z -- ) f f f f }
{ "dup" ( x -- x x ) f f f f }
{ "2dup" ( x y -- x y x y ) f f f f }
{ "3dup" ( x y z -- x y z x y z ) f f f f }
{ "4dup" ( w x y z -- w x y z w x y z ) f f f f }
{ "rot" ( x y z -- y z x ) f f f f }
{ "-rot" ( x y z -- z x y ) f f f f }
{ "dupd" ( x y -- x x y ) f f f f }
{ "swapd" ( x y z -- y x z ) f f f f }
{ "nip" ( x y -- y ) f f f f }
{ "2nip" ( x y z -- z ) f f f f }
{ "over" ( x y -- x y x ) f f f f }
{ "pick" ( x y z -- x y z x ) f f f f }
{ "swap" ( x y -- y x ) f f f f }
{ "eq?" ( obj1 obj2 -- ? ) f { object object } { object } make-foldable }
}
}
{
"kernel.private"
{
{ "(call)" ( quot -- ) f f f f }
{ "(execute)" ( word -- ) f f f f }
{ "c-to-factor" ( -- ) f f f f }
{ "fpu-state" ( -- ) f { } { } f }
{ "lazy-jit-compile" ( -- ) f f f f }
{ "leaf-signal-handler" ( -- ) f { } { } f }
{ "set-callstack" ( callstack -- * ) f f f f }
{ "set-fpu-state" ( -- ) f { } { } f }
{ "signal-handler" ( -- ) f { } { } f }
{
"tag" ( object -- n ) f
{ object } { fixnum } make-foldable
}
{ "unwind-native-frames" ( -- ) f f f f }
{
"callstack-for" ( context -- array ) "callstack_for"
{ c-ptr } { callstack } make-flushable
}
{
"datastack-for" ( context -- array ) "datastack_for"
{ c-ptr } { array } make-flushable
}
{
"retainstack-for" ( context -- array ) "retainstack_for"
{ c-ptr } { array } make-flushable
}
{
"(identity-hashcode)" ( obj -- code ) "identity_hashcode"
{ object } { fixnum } f
}
{ "become" ( old new -- ) "become" { array array } { } f }
{
"callstack-bounds" ( -- start end ) "callstack_bounds"
{ } { alien alien } make-flushable
}
{
"check-datastack" ( array in# out# -- ? ) "check_datastack"
{ array integer integer } { object } make-flushable
}
{
"compute-identity-hashcode" ( obj -- ) "compute_identity_hashcode"
{ object } { } f
}
{
"context-object" ( n -- obj ) "context_object"
{ fixnum } { object } make-flushable
}
{
"innermost-frame-executing" ( callstack -- obj )
"innermost_stack_frame_executing"
{ callstack } { object } f
}
{
"innermost-frame-scan" ( callstack -- n ) "innermost_stack_frame_scan"
{ callstack } { fixnum } f
}
{
"set-context-object" ( obj n -- ) "set_context_object"
{ object fixnum } { } f
}
{ "set-datastack" ( array -- ) "set_datastack" f f f }
{
"set-innermost-frame-quotation" ( n callstack -- )
"set_innermost_stack_frame_quotation"
{ quotation callstack } { } f
}
{ "set-retainstack" ( array -- ) "set_retainstack" f f f }
{
"set-special-object" ( obj n -- ) "set_special_object"
{ object fixnum } { } f
}
{
"special-object" ( n -- obj ) "special_object"
{ fixnum } { object } make-flushable
}
{
"strip-stack-traces" ( -- ) "strip_stack_traces"
{ } { } f
}
{
"unimplemented" ( -- * ) "unimplemented"
{ } { } f
}
}
}
{
"locals.backend"
{
{ "drop-locals" ( n -- ) f f f f }
{ "get-local" ( n -- obj ) f f f f }
{ "load-local" ( obj -- ) f f f f }
{ "load-locals" ( ... n -- ) "load_locals" f f f }
}
}
{
"math"
{
{
"bits>double" ( n -- x ) "bits_double"
{ integer } { float } make-foldable
}
{
"bits>float" ( n -- x ) "bits_float"
{ integer } { float } make-foldable
}
{
"double>bits" ( x -- n ) "double_bits"
{ real } { integer } make-foldable
}
{
"float>bits" ( x -- n ) "float_bits"
{ real } { integer } make-foldable
}
}
}
{
"math.parser.private"
{
{
"(format-float)" ( n fill width precision format locale -- byte-array )
"format_float"
{ float byte-array fixnum fixnum byte-array byte-array } { byte-array }
make-flushable
}
}
}
{
"math.private"
{
{ "both-fixnums?" ( x y -- ? ) f { object object } { object } f }
{
"fixnum+fast" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum-fast" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum*fast" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum-bitand" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum-bitor" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum-bitxor" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum-bitnot" ( x -- y ) f
{ fixnum } { fixnum } make-foldable
}
{
"fixnum-mod" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum-shift" ( x y -- z ) "fixnum_shift"
{ fixnum fixnum } { integer } make-foldable
}
{
"fixnum-shift-fast" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum/i-fast" ( x y -- z ) f
{ fixnum fixnum } { fixnum } make-foldable
}
{
"fixnum/mod" ( x y -- z w ) "fixnum_divmod"
{ fixnum fixnum } { integer fixnum } make-foldable
}
{
"fixnum/mod-fast" ( x y -- z w ) f
{ fixnum fixnum } { fixnum fixnum } make-foldable
}
{
"fixnum+" ( x y -- z ) f
{ fixnum fixnum } { integer } make-foldable
}
{
"fixnum-" ( x y -- z ) f
{ fixnum fixnum } { integer } make-foldable
}
{
"fixnum*" ( x y -- z ) f
{ fixnum fixnum } { integer } make-foldable
}
{
"fixnum<" ( x y -- ? ) f
{ fixnum fixnum } { object } make-foldable
}
{
"fixnum<=" ( x y -- z ) f
{ fixnum fixnum } { object } make-foldable
}
{
"fixnum>" ( x y -- ? ) f
{ fixnum fixnum } { object } make-foldable
}
{
"fixnum>=" ( x y -- ? ) f
{ fixnum fixnum } { object } make-foldable
}
{
"bignum*" ( x y -- z ) "bignum_multiply"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum+" ( x y -- z ) "bignum_add"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum-" ( x y -- z ) "bignum_subtract"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum-bit?" ( x n -- ? ) "bignum_bitp"
{ bignum integer } { object } make-foldable
}
{
"bignum-bitand" ( x y -- z ) "bignum_and"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum-bitnot" ( x -- y ) "bignum_not"
{ bignum } { bignum } make-foldable
}
{
"bignum-bitor" ( x y -- z ) "bignum_or"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum-bitxor" ( x y -- z ) "bignum_xor"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum-log2" ( x -- n ) "bignum_log2"
{ bignum } { bignum } make-foldable
}
{
"bignum-mod" ( x y -- z ) "bignum_mod"
{ bignum bignum } { integer } make-foldable
}
{
"bignum-gcd" ( x y -- z ) "bignum_gcd"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum-shift" ( x y -- z ) "bignum_shift"
{ bignum fixnum } { bignum } make-foldable
}
{
"bignum/i" ( x y -- z ) "bignum_divint"
{ bignum bignum } { bignum } make-foldable
}
{
"bignum/mod" ( x y -- z w ) "bignum_divmod"
{ bignum bignum } { bignum integer } make-foldable
}
{
"bignum<" ( x y -- ? ) "bignum_less"
{ bignum bignum } { object } make-foldable
}
{
"bignum<=" ( x y -- ? ) "bignum_lesseq"
{ bignum bignum } { object } make-foldable
}
{
"bignum=" ( x y -- ? ) "bignum_eq"
{ bignum bignum } { object } make-foldable
}
{
"bignum>" ( x y -- ? ) "bignum_greater"
{ bignum bignum } { object } make-foldable
}
{
"bignum>=" ( x y -- ? ) "bignum_greatereq"
{ bignum bignum } { object } make-foldable
}
{
"bignum>fixnum" ( x -- y ) "bignum_to_fixnum"
{ bignum } { fixnum } make-foldable
}
{
"bignum>fixnum-strict" ( x -- y ) "bignum_to_fixnum_strict"
{ bignum } { fixnum } make-foldable
}
{
"fixnum/i" ( x y -- z ) "fixnum_divint"
{ fixnum fixnum } { integer } make-foldable
}
{
"fixnum>bignum" ( x -- y ) "fixnum_to_bignum"
{ fixnum } { bignum } make-foldable
}
{
"fixnum>float" ( x -- y ) "fixnum_to_float"
{ fixnum } { float } make-foldable
}
{
"float*" ( x y -- z ) "float_multiply"
{ float float } { float } make-foldable
}
{
"float+" ( x y -- z ) "float_add"
{ float float } { float } make-foldable
}
{
"float-" ( x y -- z ) "float_subtract"
{ float float } { float } make-foldable
}
! -u ones redundant?
{
"float-u<" ( x y -- ? ) "float_less"
{ float float } { object } make-foldable
}
{
"float-u<=" ( x y -- ? ) "float_lesseq"
{ float float } { object } make-foldable
}
{
"float-u>" ( x y -- ? ) "float_greater"
{ float float } { object } make-foldable
}
{
"float-u>=" ( x y -- ? ) "float_greatereq"
{ float float } { object } make-foldable
}
{
"float/f" ( x y -- z ) "float_divfloat"
{ float float } { float } make-foldable
}
{
"float<" ( x y -- ? ) "float_less"
{ float float } { object } make-foldable
}
{
"float<=" ( x y -- ? ) "float_lesseq"
{ float float } { object } make-foldable
}
{
"float=" ( x y -- ? ) "float_eq"
{ float float } { object } make-foldable
}
{
"float>" ( x y -- ? ) "float_greater"
{ float float } { object } make-foldable
}
{
"float>=" ( x y -- ? ) "float_greatereq"
{ float float } { object } make-foldable
}
{
"float>bignum" ( x -- y ) "float_to_bignum"
{ float } { bignum } make-foldable
}
{
"float>fixnum" ( x -- y ) "float_to_fixnum"
{ float } { fixnum } make-foldable
}
}
}
{
"memory"
{
{ "all-instances" ( -- array ) "all_instances" { } { array } f }
{ "compact-gc" ( -- ) "compact_gc" { } { } f }
{ "gc" ( -- ) "full_gc" { } { } f }
{ "minor-gc" ( -- ) "minor_gc" { } { } f }
{ "size" ( obj -- n ) "size" { object } { fixnum } make-flushable }
}
}
{
"memory.private"
{
{
"(save-image)" ( path1 path2 then-die? -- ) "save_image"
{ byte-array byte-array object } { } f
}
}
}
{
"quotations"
{
{ "jit-compile" ( quot -- ) "jit_compile" { quotation } { } f }
{
"quotation-code" ( quot -- start end ) "quotation_code"
{ quotation } { integer integer } make-flushable
}
{
"quotation-compiled?" ( quot -- ? ) "quotation_compiled_p"
{ quotation } { object } f
}
}
}
{
"quotations.private"
{
{
"array>quotation" ( array -- quot ) "array_to_quotation"
{ array } { quotation } make-flushable
}
}
}
{
"slots.private"
{
{ "set-slot" ( value obj n -- ) "set_slot" { object object fixnum } { } f }
{ "slot" ( obj m -- value ) f { object fixnum } { object } make-flushable }
}
}
{
"strings"
{
{
"<string>" ( n ch -- string ) "string"
{ integer-array-capacity integer } { string } make-flushable
}
{
"resize-string" ( n str -- newstr ) "resize_string"
{ integer string } { string } f
}
}
}
{
"strings.private"
{
{
"set-string-nth-fast" ( ch n string -- ) "set_string_nth_fast"
{ fixnum fixnum string } { } f
}
{
"string-nth-fast" ( n string -- ch ) f
{ fixnum string } { fixnum } make-flushable
}
}
}
{
"system"
{
{ "(exit)" ( n -- * ) "exit" { integer } { } f }
{ "disable-ctrl-break" ( -- ) "disable_ctrl_break" { } { } f }
{ "enable-ctrl-break" ( -- ) "enable_ctrl_break" { } { } f }
{ "nano-count" ( -- ns ) "nano_count" { } { integer } make-flushable }
}
}
{
"threads.private"
{
{ "(sleep)" ( nanos -- ) "sleep" { integer } { } f }
{ "(set-context)" ( obj context -- obj' ) f { object alien } { object } f }
{ "(set-context-and-delete)" ( obj context -- * ) f { object alien } { } f }
{ "(start-context)" ( obj quot -- obj' ) f { object quotation } { object } f }
{ "(start-context-and-delete)" ( obj quot -- * ) f { object quotation } { } f }
{
"context-object-for" ( n context -- obj ) "context_object_for"
{ fixnum c-ptr } { object } make-flushable
}
}
}
{
"tools.dispatch.private"
{
{ "dispatch-stats" ( -- stats ) "dispatch_stats" { } { byte-array } f }
{ "reset-dispatch-stats" ( -- ) "reset_dispatch_stats" { } { } f }
}
}
{
"tools.memory.private"
{
{
"(callback-room)" ( -- allocator-room ) "callback_room"
{ } { byte-array } make-flushable
}
{
"(code-blocks)" ( -- array ) "code_blocks"
{ } { array } make-flushable
}
{
"(code-room)" ( -- allocator-room ) "code_room"
{ } { byte-array } make-flushable
}
{
"(data-room)" ( -- data-room ) "data_room"
{ } { byte-array } make-flushable
}
{ "disable-gc-events" ( -- events ) "disable_gc_events" { } { object } f }
{ "enable-gc-events" ( -- ) "enable_gc_events" { } { } f }
}
}
{
"tools.profiler.sampling.private"
{
{ "profiling" ( n -- ) "sampling_profiler" { object } { } f }
{ "(get-samples)" ( -- samples/f ) "get_samples" { } { object } f }
}
}
{
"words"
{
{
"word-code" ( word -- start end ) "word_code"
{ word } { integer integer } make-flushable
}
{ "word-optimized?" ( word -- ? ) "word_optimized_p" { word } { object } f }
}
}
{
"words.private"
{
{
"(word)" ( name vocab hashcode -- word ) "word"
{ object object object } { word } make-flushable
}
}
}
}
: primitive-quot ( word vm-func -- quot )
[
nip "primitive_" prepend ascii string>alien [ do-primitive ] curry
] [ 1quotation ] if* ;
: primitive-word ( name vocab -- word )
create-word dup t "primitive" set-word-prop ;
: set-extra-props ( word extra-props -- )
[ rot set-word-prop ] with assoc-each ;
:: create-primitive ( vocab word effect vm-func inputs outputs extra-word -- )
word vocab primitive-word :> word
word vm-func primitive-quot :> quot
word quot effect define-declared
word inputs "input-classes" set-word-prop
word outputs "default-output-classes" set-word-prop
word extra-word [ execute( x -- ) ] [ drop ] if* ;
: create-primitives ( assoc -- )
[
[ 6 firstn create-primitive ] with each
] assoc-each ;

View File

@ -178,8 +178,6 @@ M: object infer-call* \ call bad-macro-input ;
\ <tuple-boa> [ infer-<tuple-boa> ] "special" set-word-prop \ <tuple-boa> [ infer-<tuple-boa> ] "special" set-word-prop
\ <tuple-boa> t "flushable" set-word-prop
: infer-effect-unsafe ( word -- ) : infer-effect-unsafe ( word -- )
pop-literal pop-literal
add-effect-input add-effect-input
@ -272,200 +270,3 @@ M: object infer-call* \ call bad-macro-input ;
! More words not to compile ! More words not to compile
\ clear t "no-compile" set-word-prop \ clear t "no-compile" set-word-prop
: define-primitive ( word inputs outputs -- )
[ "input-classes" set-word-prop ]
[ "default-output-classes" set-word-prop ]
bi-curry* bi ;
\ (byte-array) { integer-array-capacity } { byte-array } define-primitive \ (byte-array) make-flushable
\ (clone) { object } { object } define-primitive \ (clone) make-flushable
\ (code-blocks) { } { array } define-primitive \ (code-blocks) make-flushable
\ (dlopen) { byte-array } { dll } define-primitive
\ (dlsym) { byte-array object } { c-ptr } define-primitive
\ (dlsym-raw) { byte-array object } { c-ptr } define-primitive
\ (exists?) { string } { object } define-primitive
\ (exit) { integer } { } define-primitive
\ (format-float) { float byte-array fixnum fixnum byte-array byte-array } { byte-array } define-primitive \ (format-float) make-foldable
\ (fopen) { byte-array byte-array } { alien } define-primitive
\ (identity-hashcode) { object } { fixnum } define-primitive
\ (save-image) { byte-array byte-array object } { } define-primitive
\ (set-context) { object alien } { object } define-primitive
\ (set-context-and-delete) { object alien } { } define-primitive
\ (sleep) { integer } { } define-primitive
\ (start-context) { object quotation } { object } define-primitive
\ (start-context-and-delete) { object quotation } { } define-primitive
\ (word) { object object object } { word } define-primitive \ (word) make-flushable
\ <array> { integer-array-capacity object } { array } define-primitive \ <array> make-flushable
\ <byte-array> { integer-array-capacity } { byte-array } define-primitive \ <byte-array> make-flushable
\ <callback> { word integer } { alien } define-primitive
\ <displaced-alien> { integer c-ptr } { c-ptr } define-primitive \ <displaced-alien> make-flushable
\ <string> { integer-array-capacity integer } { string } define-primitive \ <string> make-flushable
\ <tuple> { array } { tuple } define-primitive \ <tuple> make-flushable
\ <wrapper> { object } { wrapper } define-primitive \ <wrapper> make-foldable
\ alien-address { alien } { integer } define-primitive \ alien-address make-flushable
\ alien-cell { c-ptr integer } { pinned-c-ptr } define-primitive \ alien-cell make-flushable
\ alien-double { c-ptr integer } { float } define-primitive \ alien-double make-flushable
\ alien-float { c-ptr integer } { float } define-primitive \ alien-float make-flushable
\ alien-signed-1 { c-ptr integer } { fixnum } define-primitive \ alien-signed-1 make-flushable
\ alien-signed-2 { c-ptr integer } { fixnum } define-primitive \ alien-signed-2 make-flushable
\ alien-signed-4 { c-ptr integer } { integer } define-primitive \ alien-signed-4 make-flushable
\ alien-signed-8 { c-ptr integer } { integer } define-primitive \ alien-signed-8 make-flushable
\ alien-signed-cell { c-ptr integer } { integer } define-primitive \ alien-signed-cell make-flushable
\ alien-unsigned-1 { c-ptr integer } { fixnum } define-primitive \ alien-unsigned-1 make-flushable
\ alien-unsigned-2 { c-ptr integer } { fixnum } define-primitive \ alien-unsigned-2 make-flushable
\ alien-unsigned-4 { c-ptr integer } { integer } define-primitive \ alien-unsigned-4 make-flushable
\ alien-unsigned-8 { c-ptr integer } { integer } define-primitive \ alien-unsigned-8 make-flushable
\ alien-unsigned-cell { c-ptr integer } { integer } define-primitive \ alien-unsigned-cell make-flushable
\ all-instances { } { array } define-primitive
\ array>quotation { array } { quotation } define-primitive \ array>quotation make-foldable
\ become { array array } { } define-primitive
\ bignum* { bignum bignum } { bignum } define-primitive \ bignum* make-foldable
\ bignum+ { bignum bignum } { bignum } define-primitive \ bignum+ make-foldable
\ bignum- { bignum bignum } { bignum } define-primitive \ bignum- make-foldable
\ bignum-bit? { bignum integer } { object } define-primitive \ bignum-bit? make-foldable
\ bignum-bitand { bignum bignum } { bignum } define-primitive \ bignum-bitand make-foldable
\ bignum-bitnot { bignum } { bignum } define-primitive \ bignum-bitnot make-foldable
\ bignum-bitor { bignum bignum } { bignum } define-primitive \ bignum-bitor make-foldable
\ bignum-bitxor { bignum bignum } { bignum } define-primitive \ bignum-bitxor make-foldable
\ bignum-log2 { bignum } { bignum } define-primitive \ bignum-log2 make-foldable
\ bignum-mod { bignum bignum } { integer } define-primitive \ bignum-mod make-foldable
\ bignum-gcd { bignum bignum } { bignum } define-primitive \ bignum-gcd make-foldable
\ bignum-shift { bignum fixnum } { bignum } define-primitive \ bignum-shift make-foldable
\ bignum/i { bignum bignum } { bignum } define-primitive \ bignum/i make-foldable
\ bignum/mod { bignum bignum } { bignum integer } define-primitive \ bignum/mod make-foldable
\ bignum< { bignum bignum } { object } define-primitive \ bignum< make-foldable
\ bignum<= { bignum bignum } { object } define-primitive \ bignum<= make-foldable
\ bignum= { bignum bignum } { object } define-primitive \ bignum= make-foldable
\ bignum> { bignum bignum } { object } define-primitive \ bignum> make-foldable
\ bignum>= { bignum bignum } { object } define-primitive \ bignum>= make-foldable
\ bignum>fixnum { bignum } { fixnum } define-primitive \ bignum>fixnum make-foldable
\ bignum>fixnum-strict { bignum } { fixnum } define-primitive \ bignum>fixnum-strict make-foldable
\ bits>double { integer } { float } define-primitive \ bits>double make-foldable
\ bits>float { integer } { float } define-primitive \ bits>float make-foldable
\ both-fixnums? { object object } { object } define-primitive
\ callstack-bounds { } { alien alien } define-primitive \ callstack-bounds make-flushable
\ callstack-for { c-ptr } { callstack } define-primitive \ callstack make-flushable
\ callstack>array { callstack } { array } define-primitive \ callstack>array make-flushable
\ check-datastack { array integer integer } { object } define-primitive \ check-datastack make-flushable
\ (code-room) { } { byte-array } define-primitive \ (code-room) make-flushable
\ compact-gc { } { } define-primitive
\ compute-identity-hashcode { object } { } define-primitive
\ context-object { fixnum } { object } define-primitive \ context-object make-flushable
\ context-object-for { fixnum c-ptr } { object } define-primitive \ context-object-for make-flushable
\ current-callback { } { fixnum } define-primitive \ current-callback make-flushable
\ (callback-room) { } { byte-array } define-primitive \ (callback-room) make-flushable
\ (data-room) { } { byte-array } define-primitive \ (data-room) make-flushable
\ datastack-for { c-ptr } { array } define-primitive \ datastack-for make-flushable
\ die { } { } define-primitive
\ disable-gc-events { } { object } define-primitive
\ dispatch-stats { } { byte-array } define-primitive
\ dlclose { dll } { } define-primitive
\ dll-valid? { object } { object } define-primitive
\ double>bits { real } { integer } define-primitive \ double>bits make-foldable
\ enable-gc-events { } { } define-primitive
\ eq? { object object } { object } define-primitive \ eq? make-foldable
\ fclose { alien } { } define-primitive
\ fflush { alien } { } define-primitive
\ fgetc { alien } { object } define-primitive
\ fixnum* { fixnum fixnum } { integer } define-primitive \ fixnum* make-foldable
\ fixnum*fast { fixnum fixnum } { fixnum } define-primitive \ fixnum*fast make-foldable
\ fixnum+ { fixnum fixnum } { integer } define-primitive \ fixnum+ make-foldable
\ fixnum+fast { fixnum fixnum } { fixnum } define-primitive \ fixnum+fast make-foldable
\ fixnum- { fixnum fixnum } { integer } define-primitive \ fixnum- make-foldable
\ fixnum-bitand { fixnum fixnum } { fixnum } define-primitive \ fixnum-bitand make-foldable
\ fixnum-bitnot { fixnum } { fixnum } define-primitive \ fixnum-bitnot make-foldable
\ fixnum-bitor { fixnum fixnum } { fixnum } define-primitive \ fixnum-bitor make-foldable
\ fixnum-bitxor { fixnum fixnum } { fixnum } define-primitive \ fixnum-bitxor make-foldable
\ fixnum-fast { fixnum fixnum } { fixnum } define-primitive \ fixnum-fast make-foldable
\ fixnum-mod { fixnum fixnum } { fixnum } define-primitive \ fixnum-mod make-foldable
\ fixnum-shift { fixnum fixnum } { integer } define-primitive \ fixnum-shift make-foldable
\ fixnum-shift-fast { fixnum fixnum } { fixnum } define-primitive \ fixnum-shift-fast make-foldable
\ fixnum/i { fixnum fixnum } { integer } define-primitive \ fixnum/i make-foldable
\ fixnum/i-fast { fixnum fixnum } { fixnum } define-primitive \ fixnum/i-fast make-foldable
\ fixnum/mod { fixnum fixnum } { integer fixnum } define-primitive \ fixnum/mod make-foldable
\ fixnum/mod-fast { fixnum fixnum } { fixnum fixnum } define-primitive \ fixnum/mod-fast make-foldable
\ fixnum< { fixnum fixnum } { object } define-primitive \ fixnum< make-foldable
\ fixnum<= { fixnum fixnum } { object } define-primitive \ fixnum<= make-foldable
\ fixnum> { fixnum fixnum } { object } define-primitive \ fixnum> make-foldable
\ fixnum>= { fixnum fixnum } { object } define-primitive \ fixnum>= make-foldable
\ fixnum>bignum { fixnum } { bignum } define-primitive \ fixnum>bignum make-foldable
\ fixnum>float { fixnum } { float } define-primitive \ fixnum>float make-foldable
\ float* { float float } { float } define-primitive \ float* make-foldable
\ float+ { float float } { float } define-primitive \ float+ make-foldable
\ float- { float float } { float } define-primitive \ float- make-foldable
\ float-u< { float float } { object } define-primitive \ float-u< make-foldable
\ float-u<= { float float } { object } define-primitive \ float-u<= make-foldable
\ float-u> { float float } { object } define-primitive \ float-u> make-foldable
\ float-u>= { float float } { object } define-primitive \ float-u>= make-foldable
\ float/f { float float } { float } define-primitive \ float/f make-foldable
\ float< { float float } { object } define-primitive \ float< make-foldable
\ float<= { float float } { object } define-primitive \ float<= make-foldable
\ float= { float float } { object } define-primitive \ float= make-foldable
\ float> { float float } { object } define-primitive \ float> make-foldable
\ float>= { float float } { object } define-primitive \ float>= make-foldable
\ float>bignum { float } { bignum } define-primitive \ float>bignum make-foldable
\ float>bits { real } { integer } define-primitive \ float>bits make-foldable
\ float>fixnum { float } { fixnum } define-primitive \ float>fixnum make-foldable
\ fpu-state { } { } define-primitive
\ fputc { object alien } { } define-primitive
\ fread-unsafe { integer c-ptr alien } { integer } define-primitive
\ free-callback { alien } { } define-primitive
\ fseek { integer integer alien } { } define-primitive
\ ftell { alien } { integer } define-primitive
\ fwrite { c-ptr integer alien } { } define-primitive
\ gc { } { } define-primitive
\ innermost-frame-executing { callstack } { object } define-primitive
\ innermost-frame-scan { callstack } { fixnum } define-primitive
\ jit-compile { quotation } { } define-primitive
\ leaf-signal-handler { } { } define-primitive
\ gsp:lookup-method { object array } { word } define-primitive
\ minor-gc { } { } define-primitive
\ modify-code-heap { array object object } { } define-primitive
\ nano-count { } { integer } define-primitive \ nano-count make-flushable
\ profiling { object } { } define-primitive
\ (get-samples) { } { object } define-primitive
\ quotation-code { quotation } { integer integer } define-primitive \ quotation-code make-flushable
\ quotation-compiled? { quotation } { object } define-primitive
\ reset-dispatch-stats { } { } define-primitive
\ resize-array { integer array } { array } define-primitive
\ resize-byte-array { integer-array-capacity byte-array } { byte-array } define-primitive
\ resize-string { integer string } { string } define-primitive
\ retainstack-for { c-ptr } { array } define-primitive \ retainstack-for make-flushable
\ set-alien-cell { c-ptr c-ptr integer } { } define-primitive
\ set-alien-double { float c-ptr integer } { } define-primitive
\ set-alien-float { float c-ptr integer } { } define-primitive
\ set-alien-signed-1 { integer c-ptr integer } { } define-primitive
\ set-alien-signed-2 { integer c-ptr integer } { } define-primitive
\ set-alien-signed-4 { integer c-ptr integer } { } define-primitive
\ set-alien-signed-8 { integer c-ptr integer } { } define-primitive
\ set-alien-signed-cell { integer c-ptr integer } { } define-primitive
\ set-alien-unsigned-1 { integer c-ptr integer } { } define-primitive
\ set-alien-unsigned-2 { integer c-ptr integer } { } define-primitive
\ set-alien-unsigned-4 { integer c-ptr integer } { } define-primitive
\ set-alien-unsigned-8 { integer c-ptr integer } { } define-primitive
\ set-alien-unsigned-cell { integer c-ptr integer } { } define-primitive
\ set-context-object { object fixnum } { } define-primitive
\ set-fpu-state { } { } define-primitive
\ set-innermost-frame-quotation { quotation callstack } { } define-primitive
\ set-slot { object object fixnum } { } define-primitive
\ set-special-object { object fixnum } { } define-primitive
\ set-string-nth-fast { fixnum fixnum string } { } define-primitive
\ signal-handler { } { } define-primitive
\ size { object } { fixnum } define-primitive \ size make-flushable
\ slot { object fixnum } { object } define-primitive \ slot make-flushable
\ special-object { fixnum } { object } define-primitive \ special-object make-flushable
\ string-nth-fast { fixnum string } { fixnum } define-primitive \ string-nth-fast make-flushable
\ strip-stack-traces { } { } define-primitive
\ tag { object } { fixnum } define-primitive \ tag make-foldable
\ unimplemented { } { } define-primitive
\ word-code { word } { integer integer } define-primitive \ word-code make-flushable
\ word-optimized? { word } { object } define-primitive
\ disable-ctrl-break { } { } define-primitive
\ enable-ctrl-break { } { } define-primitive

View File

@ -2,6 +2,6 @@ USING: bootstrap.image.private effects help.markup help.syntax strings ;
IN: bootstrap.primitives IN: bootstrap.primitives
ARTICLE: "bootstrap.primitives" "Bootstrap primitives" ARTICLE: "bootstrap.primitives" "Bootstrap primitives"
"A script file run to create the bootstrap image." ; "A script file run to create the bootstrap image. Also see the vocab " { $link "bootstrap.image.primitives" } "." ;
ABOUT: "bootstrap.primitives" ABOUT: "bootstrap.primitives"

View File

@ -1,11 +1,12 @@
! Copyright (C) 2004, 2010 Slava Pestov. ! Copyright (C) 2004, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.strings arrays assocs bootstrap.image.private classes classes.builtin USING: arrays assocs bootstrap.image.primitives
classes.intersection classes.predicate classes.private classes.singleton bootstrap.image.private classes classes.builtin classes.intersection
classes.tuple classes.tuple.private classes.union combinators compiler.units classes.predicate classes.private classes.singleton classes.tuple
io io.encodings.ascii kernel kernel.private layouts make math math.private classes.tuple.private classes.union combinators compiler.units io
namespaces parser quotations sequences slots source-files splitting vocabs kernel kernel.private layouts make math math.private namespaces parser
vocabs.loader words ; quotations sequences slots source-files splitting vocabs vocabs.loader
words ;
IN: bootstrap.primitives IN: bootstrap.primitives
"* Creating primitives and basic runtime structures..." print flush "* Creating primitives and basic runtime structures..." print flush
@ -323,250 +324,7 @@ tuple
( quot1 quot2 -- compose ) define-declared ( quot1 quot2 -- compose ) define-declared
"* Declaring primitives..." print flush "* Declaring primitives..." print flush
all-primitives create-primitives
! Sub-primitive words
: make-sub-primitive ( word vocab effect -- )
[
create-word
dup t "primitive" set-word-prop
dup 1quotation
] dip define-declared ;
{
{ "mega-cache-lookup" "generic.single.private" ( methods index cache -- ) }
{ "inline-cache-miss" "generic.single.private" ( generic methods index cache -- ) }
{ "inline-cache-miss-tail" "generic.single.private" ( generic methods index cache -- ) }
{ "drop" "kernel" ( x -- ) }
{ "2drop" "kernel" ( x y -- ) }
{ "3drop" "kernel" ( x y z -- ) }
{ "4drop" "kernel" ( w x y z -- ) }
{ "dup" "kernel" ( x -- x x ) }
{ "2dup" "kernel" ( x y -- x y x y ) }
{ "3dup" "kernel" ( x y z -- x y z x y z ) }
{ "4dup" "kernel" ( w x y z -- w x y z w x y z ) }
{ "rot" "kernel" ( x y z -- y z x ) }
{ "-rot" "kernel" ( x y z -- z x y ) }
{ "dupd" "kernel" ( x y -- x x y ) }
{ "swapd" "kernel" ( x y z -- y x z ) }
{ "nip" "kernel" ( x y -- y ) }
{ "2nip" "kernel" ( x y z -- z ) }
{ "over" "kernel" ( x y -- x y x ) }
{ "pick" "kernel" ( x y z -- x y z x ) }
{ "swap" "kernel" ( x y -- y x ) }
{ "eq?" "kernel" ( obj1 obj2 -- ? ) }
{ "tag" "kernel.private" ( object -- n ) }
{ "(execute)" "kernel.private" ( word -- ) }
{ "(call)" "kernel.private" ( quot -- ) }
{ "fpu-state" "kernel.private" ( -- ) }
{ "set-fpu-state" "kernel.private" ( -- ) }
{ "signal-handler" "kernel.private" ( -- ) }
{ "leaf-signal-handler" "kernel.private" ( -- ) }
{ "unwind-native-frames" "kernel.private" ( -- ) }
{ "set-callstack" "kernel.private" ( callstack -- * ) }
{ "lazy-jit-compile" "kernel.private" ( -- ) }
{ "c-to-factor" "kernel.private" ( -- ) }
{ "slot" "slots.private" ( obj m -- value ) }
{ "get-local" "locals.backend" ( n -- obj ) }
{ "load-local" "locals.backend" ( obj -- ) }
{ "drop-locals" "locals.backend" ( n -- ) }
{ "both-fixnums?" "math.private" ( x y -- ? ) }
{ "fixnum+fast" "math.private" ( x y -- z ) }
{ "fixnum-fast" "math.private" ( x y -- z ) }
{ "fixnum*fast" "math.private" ( x y -- z ) }
{ "fixnum-bitand" "math.private" ( x y -- z ) }
{ "fixnum-bitor" "math.private" ( x y -- z ) }
{ "fixnum-bitxor" "math.private" ( x y -- z ) }
{ "fixnum-bitnot" "math.private" ( x -- y ) }
{ "fixnum-mod" "math.private" ( x y -- z ) }
{ "fixnum-shift-fast" "math.private" ( x y -- z ) }
{ "fixnum/i-fast" "math.private" ( x y -- z ) }
{ "fixnum/mod-fast" "math.private" ( x y -- z w ) }
{ "fixnum+" "math.private" ( x y -- z ) }
{ "fixnum-" "math.private" ( x y -- z ) }
{ "fixnum*" "math.private" ( x y -- z ) }
{ "fixnum<" "math.private" ( x y -- ? ) }
{ "fixnum<=" "math.private" ( x y -- z ) }
{ "fixnum>" "math.private" ( x y -- ? ) }
{ "fixnum>=" "math.private" ( x y -- ? ) }
{ "string-nth-fast" "strings.private" ( n string -- ch ) }
{ "(set-context)" "threads.private" ( obj context -- obj' ) }
{ "(set-context-and-delete)" "threads.private" ( obj context -- * ) }
{ "(start-context)" "threads.private" ( obj quot -- obj' ) }
{ "(start-context-and-delete)" "threads.private" ( obj quot -- * ) }
} [ first3 make-sub-primitive ] each
: make-primitive ( word vocab function effect -- )
[
[
create-word
dup reset-word
dup t "primitive" set-word-prop
] dip
ascii string>alien [ do-primitive ] curry
] dip define-declared ;
{
{ "<callback>" "alien" "primitive_callback" ( word return-rewind -- alien ) }
{ "<displaced-alien>" "alien" "primitive_displaced_alien" ( displacement c-ptr -- alien ) }
{ "alien-address" "alien" "primitive_alien_address" ( c-ptr -- addr ) }
{ "alien-cell" "alien.accessors" "primitive_alien_cell" ( c-ptr n -- value ) }
{ "alien-double" "alien.accessors" "primitive_alien_double" ( c-ptr n -- value ) }
{ "alien-float" "alien.accessors" "primitive_alien_float" ( c-ptr n -- value ) }
{ "alien-signed-1" "alien.accessors" "primitive_alien_signed_1" ( c-ptr n -- value ) }
{ "alien-signed-2" "alien.accessors" "primitive_alien_signed_2" ( c-ptr n -- value ) }
{ "alien-signed-4" "alien.accessors" "primitive_alien_signed_4" ( c-ptr n -- value ) }
{ "alien-signed-8" "alien.accessors" "primitive_alien_signed_8" ( c-ptr n -- value ) }
{ "alien-signed-cell" "alien.accessors" "primitive_alien_signed_cell" ( c-ptr n -- value ) }
{ "alien-unsigned-1" "alien.accessors" "primitive_alien_unsigned_1" ( c-ptr n -- value ) }
{ "alien-unsigned-2" "alien.accessors" "primitive_alien_unsigned_2" ( c-ptr n -- value ) }
{ "alien-unsigned-4" "alien.accessors" "primitive_alien_unsigned_4" ( c-ptr n -- value ) }
{ "alien-unsigned-8" "alien.accessors" "primitive_alien_unsigned_8" ( c-ptr n -- value ) }
{ "alien-unsigned-cell" "alien.accessors" "primitive_alien_unsigned_cell" ( c-ptr n -- value ) }
{ "set-alien-cell" "alien.accessors" "primitive_set_alien_cell" ( value c-ptr n -- ) }
{ "set-alien-double" "alien.accessors" "primitive_set_alien_double" ( value c-ptr n -- ) }
{ "set-alien-float" "alien.accessors" "primitive_set_alien_float" ( value c-ptr n -- ) }
{ "set-alien-signed-1" "alien.accessors" "primitive_set_alien_signed_1" ( value c-ptr n -- ) }
{ "set-alien-signed-2" "alien.accessors" "primitive_set_alien_signed_2" ( value c-ptr n -- ) }
{ "set-alien-signed-4" "alien.accessors" "primitive_set_alien_signed_4" ( value c-ptr n -- ) }
{ "set-alien-signed-8" "alien.accessors" "primitive_set_alien_signed_8" ( value c-ptr n -- ) }
{ "set-alien-signed-cell" "alien.accessors" "primitive_set_alien_signed_cell" ( value c-ptr n -- ) }
{ "set-alien-unsigned-1" "alien.accessors" "primitive_set_alien_unsigned_1" ( value c-ptr n -- ) }
{ "set-alien-unsigned-2" "alien.accessors" "primitive_set_alien_unsigned_2" ( value c-ptr n -- ) }
{ "set-alien-unsigned-4" "alien.accessors" "primitive_set_alien_unsigned_4" ( value c-ptr n -- ) }
{ "set-alien-unsigned-8" "alien.accessors" "primitive_set_alien_unsigned_8" ( value c-ptr n -- ) }
{ "set-alien-unsigned-cell" "alien.accessors" "primitive_set_alien_unsigned_cell" ( value c-ptr n -- ) }
{ "(dlopen)" "alien.libraries" "primitive_dlopen" ( path -- dll ) }
{ "(dlsym)" "alien.libraries" "primitive_dlsym" ( name dll -- alien ) }
{ "(dlsym-raw)" "alien.libraries" "primitive_dlsym_raw" ( name dll -- alien ) }
{ "dlclose" "alien.libraries" "primitive_dlclose" ( dll -- ) }
{ "dll-valid?" "alien.libraries" "primitive_dll_validp" ( dll -- ? ) }
{ "current-callback" "alien.private" "primitive_current_callback" ( -- n ) }
{ "<array>" "arrays" "primitive_array" ( n elt -- array ) }
{ "resize-array" "arrays" "primitive_resize_array" ( n array -- new-array ) }
{ "(byte-array)" "byte-arrays" "primitive_uninitialized_byte_array" ( n -- byte-array ) }
{ "<byte-array>" "byte-arrays" "primitive_byte_array" ( n -- byte-array ) }
{ "resize-byte-array" "byte-arrays" "primitive_resize_byte_array" ( n byte-array -- new-byte-array ) }
{ "<tuple-boa>" "classes.tuple.private" "primitive_tuple_boa" ( slots... layout -- tuple ) }
{ "<tuple>" "classes.tuple.private" "primitive_tuple" ( layout -- tuple ) }
{ "modify-code-heap" "compiler.units" "primitive_modify_code_heap" ( alist update-existing? reset-pics? -- ) }
{ "lookup-method" "generic.single.private" "primitive_lookup_method" ( object methods -- method ) }
{ "mega-cache-miss" "generic.single.private" "primitive_mega_cache_miss" ( methods index cache -- method ) }
{ "(exists?)" "io.files.private" "primitive_existsp" ( path -- ? ) }
{ "(fopen)" "io.streams.c" "primitive_fopen" ( path mode -- alien ) }
{ "fclose" "io.streams.c" "primitive_fclose" ( alien -- ) }
{ "fflush" "io.streams.c" "primitive_fflush" ( alien -- ) }
{ "fgetc" "io.streams.c" "primitive_fgetc" ( alien -- byte/f ) }
{ "fputc" "io.streams.c" "primitive_fputc" ( byte alien -- ) }
{ "fread-unsafe" "io.streams.c" "primitive_fread" ( n buf alien -- count ) }
{ "free-callback" "alien" "primitive_free_callback" ( alien -- ) }
{ "fseek" "io.streams.c" "primitive_fseek" ( alien offset whence -- ) }
{ "ftell" "io.streams.c" "primitive_ftell" ( alien -- n ) }
{ "fwrite" "io.streams.c" "primitive_fwrite" ( data length alien -- ) }
{ "(clone)" "kernel" "primitive_clone" ( obj -- newobj ) }
{ "<wrapper>" "kernel" "primitive_wrapper" ( obj -- wrapper ) }
{ "callstack>array" "kernel" "primitive_callstack_to_array" ( callstack -- array ) }
{ "die" "kernel" "primitive_die" ( -- ) }
{ "callstack-for" "kernel.private" "primitive_callstack_for" ( context -- array ) }
{ "datastack-for" "kernel.private" "primitive_datastack_for" ( context -- array ) }
{ "retainstack-for" "kernel.private" "primitive_retainstack_for" ( context -- array ) }
{ "(identity-hashcode)" "kernel.private" "primitive_identity_hashcode" ( obj -- code ) }
{ "become" "kernel.private" "primitive_become" ( old new -- ) }
{ "callstack-bounds" "kernel.private" "primitive_callstack_bounds" ( -- start end ) }
{ "check-datastack" "kernel.private" "primitive_check_datastack" ( array in# out# -- ? ) }
{ "compute-identity-hashcode" "kernel.private" "primitive_compute_identity_hashcode" ( obj -- ) }
{ "context-object" "kernel.private" "primitive_context_object" ( n -- obj ) }
{ "innermost-frame-executing" "kernel.private" "primitive_innermost_stack_frame_executing" ( callstack -- obj ) }
{ "innermost-frame-scan" "kernel.private" "primitive_innermost_stack_frame_scan" ( callstack -- n ) }
{ "set-context-object" "kernel.private" "primitive_set_context_object" ( obj n -- ) }
{ "set-datastack" "kernel.private" "primitive_set_datastack" ( array -- ) }
{ "set-innermost-frame-quotation" "kernel.private" "primitive_set_innermost_stack_frame_quotation" ( n callstack -- ) }
{ "set-retainstack" "kernel.private" "primitive_set_retainstack" ( array -- ) }
{ "set-special-object" "kernel.private" "primitive_set_special_object" ( obj n -- ) }
{ "special-object" "kernel.private" "primitive_special_object" ( n -- obj ) }
{ "strip-stack-traces" "kernel.private" "primitive_strip_stack_traces" ( -- ) }
{ "unimplemented" "kernel.private" "primitive_unimplemented" ( -- * ) }
{ "load-locals" "locals.backend" "primitive_load_locals" ( ... n -- ) }
{ "bits>double" "math" "primitive_bits_double" ( n -- x ) }
{ "bits>float" "math" "primitive_bits_float" ( n -- x ) }
{ "double>bits" "math" "primitive_double_bits" ( x -- n ) }
{ "float>bits" "math" "primitive_float_bits" ( x -- n ) }
{ "(format-float)" "math.parser.private" "primitive_format_float" ( n fill width precision format locale -- byte-array ) }
{ "bignum*" "math.private" "primitive_bignum_multiply" ( x y -- z ) }
{ "bignum+" "math.private" "primitive_bignum_add" ( x y -- z ) }
{ "bignum-" "math.private" "primitive_bignum_subtract" ( x y -- z ) }
{ "bignum-bit?" "math.private" "primitive_bignum_bitp" ( x n -- ? ) }
{ "bignum-bitand" "math.private" "primitive_bignum_and" ( x y -- z ) }
{ "bignum-bitnot" "math.private" "primitive_bignum_not" ( x -- y ) }
{ "bignum-bitor" "math.private" "primitive_bignum_or" ( x y -- z ) }
{ "bignum-bitxor" "math.private" "primitive_bignum_xor" ( x y -- z ) }
{ "bignum-log2" "math.private" "primitive_bignum_log2" ( x -- n ) }
{ "bignum-mod" "math.private" "primitive_bignum_mod" ( x y -- z ) }
{ "bignum-gcd" "math.private" "primitive_bignum_gcd" ( x y -- z ) }
{ "bignum-shift" "math.private" "primitive_bignum_shift" ( x y -- z ) }
{ "bignum/i" "math.private" "primitive_bignum_divint" ( x y -- z ) }
{ "bignum/mod" "math.private" "primitive_bignum_divmod" ( x y -- z w ) }
{ "bignum<" "math.private" "primitive_bignum_less" ( x y -- ? ) }
{ "bignum<=" "math.private" "primitive_bignum_lesseq" ( x y -- ? ) }
{ "bignum=" "math.private" "primitive_bignum_eq" ( x y -- ? ) }
{ "bignum>" "math.private" "primitive_bignum_greater" ( x y -- ? ) }
{ "bignum>=" "math.private" "primitive_bignum_greatereq" ( x y -- ? ) }
{ "bignum>fixnum" "math.private" "primitive_bignum_to_fixnum" ( x -- y ) }
{ "bignum>fixnum-strict" "math.private" "primitive_bignum_to_fixnum_strict" ( x -- y ) }
{ "fixnum-shift" "math.private" "primitive_fixnum_shift" ( x y -- z ) }
{ "fixnum/i" "math.private" "primitive_fixnum_divint" ( x y -- z ) }
{ "fixnum/mod" "math.private" "primitive_fixnum_divmod" ( x y -- z w ) }
{ "fixnum>bignum" "math.private" "primitive_fixnum_to_bignum" ( x -- y ) }
{ "fixnum>float" "math.private" "primitive_fixnum_to_float" ( x -- y ) }
{ "float*" "math.private" "primitive_float_multiply" ( x y -- z ) }
{ "float+" "math.private" "primitive_float_add" ( x y -- z ) }
{ "float-" "math.private" "primitive_float_subtract" ( x y -- z ) }
{ "float-u<" "math.private" "primitive_float_less" ( x y -- ? ) }
{ "float-u<=" "math.private" "primitive_float_lesseq" ( x y -- ? ) }
{ "float-u>" "math.private" "primitive_float_greater" ( x y -- ? ) }
{ "float-u>=" "math.private" "primitive_float_greatereq" ( x y -- ? ) }
{ "float/f" "math.private" "primitive_float_divfloat" ( x y -- z ) }
{ "float<" "math.private" "primitive_float_less" ( x y -- ? ) }
{ "float<=" "math.private" "primitive_float_lesseq" ( x y -- ? ) }
{ "float=" "math.private" "primitive_float_eq" ( x y -- ? ) }
{ "float>" "math.private" "primitive_float_greater" ( x y -- ? ) }
{ "float>=" "math.private" "primitive_float_greatereq" ( x y -- ? ) }
{ "float>bignum" "math.private" "primitive_float_to_bignum" ( x -- y ) }
{ "float>fixnum" "math.private" "primitive_float_to_fixnum" ( x -- y ) }
{ "all-instances" "memory" "primitive_all_instances" ( -- array ) }
{ "(code-blocks)" "tools.memory.private" "primitive_code_blocks" ( -- array ) }
{ "(code-room)" "tools.memory.private" "primitive_code_room" ( -- allocator-room ) }
{ "compact-gc" "memory" "primitive_compact_gc" ( -- ) }
{ "(callback-room)" "tools.memory.private" "primitive_callback_room" ( -- allocator-room ) }
{ "(data-room)" "tools.memory.private" "primitive_data_room" ( -- data-room ) }
{ "disable-gc-events" "tools.memory.private" "primitive_disable_gc_events" ( -- events ) }
{ "enable-gc-events" "tools.memory.private" "primitive_enable_gc_events" ( -- ) }
{ "gc" "memory" "primitive_full_gc" ( -- ) }
{ "minor-gc" "memory" "primitive_minor_gc" ( -- ) }
{ "size" "memory" "primitive_size" ( obj -- n ) }
{ "(save-image)" "memory.private" "primitive_save_image" ( path1 path2 then-die? -- ) }
{ "jit-compile" "quotations" "primitive_jit_compile" ( quot -- ) }
{ "quotation-code" "quotations" "primitive_quotation_code" ( quot -- start end ) }
{ "quotation-compiled?" "quotations" "primitive_quotation_compiled_p" ( quot -- ? ) }
{ "array>quotation" "quotations.private" "primitive_array_to_quotation" ( array -- quot ) }
{ "set-slot" "slots.private" "primitive_set_slot" ( value obj n -- ) }
{ "<string>" "strings" "primitive_string" ( n ch -- string ) }
{ "resize-string" "strings" "primitive_resize_string" ( n str -- newstr ) }
{ "set-string-nth-fast" "strings.private" "primitive_set_string_nth_fast" ( ch n string -- ) }
{ "(exit)" "system" "primitive_exit" ( n -- * ) }
{ "nano-count" "system" "primitive_nano_count" ( -- ns ) }
{ "(sleep)" "threads.private" "primitive_sleep" ( nanos -- ) }
{ "context-object-for" "threads.private" "primitive_context_object_for" ( n context -- obj ) }
{ "dispatch-stats" "tools.dispatch.private" "primitive_dispatch_stats" ( -- stats ) }
{ "reset-dispatch-stats" "tools.dispatch.private" "primitive_reset_dispatch_stats" ( -- ) }
{ "word-code" "words" "primitive_word_code" ( word -- start end ) }
{ "word-optimized?" "words" "primitive_word_optimized_p" ( word -- ? ) }
{ "(word)" "words.private" "primitive_word" ( name vocab hashcode -- word ) }
{ "profiling" "tools.profiler.sampling.private" "primitive_sampling_profiler" ( n -- ) }
{ "(get-samples)" "tools.profiler.sampling.private" "primitive_get_samples" ( -- samples/f ) }
{ "disable-ctrl-break" "system" "primitive_disable_ctrl_break" ( -- ) }
{ "enable-ctrl-break" "system" "primitive_enable_ctrl_break" ( -- ) }
} [ first4 make-primitive ] each
! Bump build number ! Bump build number
"build" "kernel" create-word build 1 + [ ] curry ( -- n ) define-declared "build" "kernel" create-word build 1 + [ ] curry ( -- n ) define-declared

View File

@ -474,3 +474,16 @@ unit-test
{ "" } [ { "" } [
33.4 "" 4 4 "f" "missing" format-float 33.4 "" 4 4 "f" "missing" format-float
] unit-test ] unit-test
! Literal byte arrays are mutable, so (format-float) isn't foldable.
: trouble ( -- str ba )
155000.0 B{ } -1 3 B{ 69 0 } [
B{ 67 0 } (format-float) >string
] keep ;
{
"1.55E+05"
"1.550e+05"
} [
trouble CHAR: e 0 rot set-nth trouble drop
] unit-test

View File

@ -16,3 +16,13 @@ IN: quotations
{ [ "hi" ] } [ "hi" 1quotation ] unit-test { [ "hi" ] } [ "hi" 1quotation ] unit-test
[ 1 \ + curry ] must-fail [ 1 \ + curry ] must-fail
: trouble ( -- arr quot ) { 123 } dup array>quotation ;
{ 999 } [
! Call the quotation which compiles it.
trouble call drop
! Change the array used for it.
999 0 rot set-nth
trouble nip call
] unit-test