bootstrap.image.primitives: the primitive_ prefix is implied

So it can be removed from the big list, making primitive declarations simpler.
locals-and-roots
Björn Lindqvist 2016-03-29 15:53:51 +02:00
parent eca6dfac15
commit 2a9c95040c
3 changed files with 179 additions and 160 deletions

View File

@ -1,9 +1,13 @@
USING: assocs help.markup help.syntax strings ; USING: assocs help.markup help.syntax quotations strings words ;
IN: bootstrap.image.primitives IN: bootstrap.image.primitives
HELP: all-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 }. If 'vm-func' 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/'." } ; { $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 }. If 'vm-func' 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/'." } ;
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" 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" } "This vocab contains utilities for declaring primitives to be added to the bootstrap image. It is used by " { $vocab-link "bootstrap.primitives" }
$nl $nl

View File

@ -0,0 +1,13 @@
USING: bootstrap.image.primitives kernel.private tools.test 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

View File

@ -6,87 +6,87 @@ CONSTANT: all-primitives {
{ {
"alien" "alien"
{ {
{ "<callback>" ( word return-rewind -- alien ) "primitive_callback" } { "<callback>" ( word return-rewind -- alien ) "callback" }
{ "<displaced-alien>" ( displacement c-ptr -- alien ) "primitive_displaced_alien" } { "<displaced-alien>" ( displacement c-ptr -- alien ) "displaced_alien" }
{ "alien-address" ( c-ptr -- addr ) "primitive_alien_address" } { "alien-address" ( c-ptr -- addr ) "alien_address" }
{ "free-callback" ( alien -- ) "primitive_free_callback" } { "free-callback" ( alien -- ) "free_callback" }
} }
} }
{ {
"alien.private" "alien.private"
{ {
{ "current-callback" ( -- n ) "primitive_current_callback" } { "current-callback" ( -- n ) "current_callback" }
} }
} }
{ {
"alien.accessors" "alien.accessors"
{ {
{ "alien-cell" ( c-ptr n -- value ) "primitive_alien_cell" } { "alien-cell" ( c-ptr n -- value ) "alien_cell" }
{ "alien-double" ( c-ptr n -- value ) "primitive_alien_double" } { "alien-double" ( c-ptr n -- value ) "alien_double" }
{ "alien-float" ( c-ptr n -- value ) "primitive_alien_float" } { "alien-float" ( c-ptr n -- value ) "alien_float" }
{ "alien-signed-1" ( c-ptr n -- value ) "primitive_alien_signed_1" } { "alien-signed-1" ( c-ptr n -- value ) "alien_signed_1" }
{ "alien-signed-2" ( c-ptr n -- value ) "primitive_alien_signed_2" } { "alien-signed-2" ( c-ptr n -- value ) "alien_signed_2" }
{ "alien-signed-4" ( c-ptr n -- value ) "primitive_alien_signed_4" } { "alien-signed-4" ( c-ptr n -- value ) "alien_signed_4" }
{ "alien-signed-8" ( c-ptr n -- value ) "primitive_alien_signed_8" } { "alien-signed-8" ( c-ptr n -- value ) "alien_signed_8" }
{ "alien-signed-cell" ( c-ptr n -- value ) "primitive_alien_signed_cell" } { "alien-signed-cell" ( c-ptr n -- value ) "alien_signed_cell" }
{ "alien-unsigned-1" ( c-ptr n -- value ) "primitive_alien_unsigned_1" } { "alien-unsigned-1" ( c-ptr n -- value ) "alien_unsigned_1" }
{ "alien-unsigned-2" ( c-ptr n -- value ) "primitive_alien_unsigned_2" } { "alien-unsigned-2" ( c-ptr n -- value ) "alien_unsigned_2" }
{ "alien-unsigned-4" ( c-ptr n -- value ) "primitive_alien_unsigned_4" } { "alien-unsigned-4" ( c-ptr n -- value ) "alien_unsigned_4" }
{ "alien-unsigned-8" ( c-ptr n -- value ) "primitive_alien_unsigned_8" } { "alien-unsigned-8" ( c-ptr n -- value ) "alien_unsigned_8" }
{ "alien-unsigned-cell" ( c-ptr n -- value ) "primitive_alien_unsigned_cell" } { "alien-unsigned-cell" ( c-ptr n -- value ) "alien_unsigned_cell" }
{ "set-alien-cell" ( value c-ptr n -- ) "primitive_set_alien_cell" } { "set-alien-cell" ( value c-ptr n -- ) "set_alien_cell" }
{ "set-alien-double" ( value c-ptr n -- ) "primitive_set_alien_double" } { "set-alien-double" ( value c-ptr n -- ) "set_alien_double" }
{ "set-alien-float" ( value c-ptr n -- ) "primitive_set_alien_float" } { "set-alien-float" ( value c-ptr n -- ) "set_alien_float" }
{ "set-alien-signed-1" ( value c-ptr n -- ) "primitive_set_alien_signed_1" } { "set-alien-signed-1" ( value c-ptr n -- ) "set_alien_signed_1" }
{ "set-alien-signed-2" ( value c-ptr n -- ) "primitive_set_alien_signed_2" } { "set-alien-signed-2" ( value c-ptr n -- ) "set_alien_signed_2" }
{ "set-alien-signed-4" ( value c-ptr n -- ) "primitive_set_alien_signed_4" } { "set-alien-signed-4" ( value c-ptr n -- ) "set_alien_signed_4" }
{ "set-alien-signed-8" ( value c-ptr n -- ) "primitive_set_alien_signed_8" } { "set-alien-signed-8" ( value c-ptr n -- ) "set_alien_signed_8" }
{ "set-alien-signed-cell" ( value c-ptr n -- ) "primitive_set_alien_signed_cell" } { "set-alien-signed-cell" ( value c-ptr n -- ) "set_alien_signed_cell" }
{ "set-alien-unsigned-1" ( value c-ptr n -- ) "primitive_set_alien_unsigned_1" } { "set-alien-unsigned-1" ( value c-ptr n -- ) "set_alien_unsigned_1" }
{ "set-alien-unsigned-2" ( value c-ptr n -- ) "primitive_set_alien_unsigned_2" } { "set-alien-unsigned-2" ( value c-ptr n -- ) "set_alien_unsigned_2" }
{ "set-alien-unsigned-4" ( value c-ptr n -- ) "primitive_set_alien_unsigned_4" } { "set-alien-unsigned-4" ( value c-ptr n -- ) "set_alien_unsigned_4" }
{ "set-alien-unsigned-8" ( value c-ptr n -- ) "primitive_set_alien_unsigned_8" } { "set-alien-unsigned-8" ( value c-ptr n -- ) "set_alien_unsigned_8" }
{ "set-alien-unsigned-cell" ( value c-ptr n -- ) "primitive_set_alien_unsigned_cell" } { "set-alien-unsigned-cell" ( value c-ptr n -- ) "set_alien_unsigned_cell" }
} }
} }
{ {
"alien.libraries" "alien.libraries"
{ {
{ "(dlopen)" ( path -- dll ) "primitive_dlopen" } { "(dlopen)" ( path -- dll ) "dlopen" }
{ "(dlsym)" ( name dll -- alien ) "primitive_dlsym" } { "(dlsym)" ( name dll -- alien ) "dlsym" }
{ "(dlsym-raw)" ( name dll -- alien ) "primitive_dlsym_raw" } { "(dlsym-raw)" ( name dll -- alien ) "dlsym_raw" }
{ "dlclose" ( dll -- ) "primitive_dlclose" } { "dlclose" ( dll -- ) "dlclose" }
{ "dll-valid?" ( dll -- ? ) "primitive_dll_validp" } { "dll-valid?" ( dll -- ? ) "dll_validp" }
} }
} }
{ {
"arrays" "arrays"
{ {
{ "<array>" ( n elt -- array ) "primitive_array" } { "<array>" ( n elt -- array ) "array" }
{ "resize-array" ( n array -- new-array ) "primitive_resize_array" } { "resize-array" ( n array -- new-array ) "resize_array" }
} }
} }
{ {
"byte-arrays" "byte-arrays"
{ {
{ "(byte-array)" ( n -- byte-array ) "primitive_uninitialized_byte_array" } { "(byte-array)" ( n -- byte-array ) "uninitialized_byte_array" }
{ "<byte-array>" ( n -- byte-array ) "primitive_byte_array" } { "<byte-array>" ( n -- byte-array ) "byte_array" }
{ {
"resize-byte-array" ( n byte-array -- new-byte-array ) "resize-byte-array" ( n byte-array -- new-byte-array )
"primitive_resize_byte_array" "resize_byte_array"
} }
} }
} }
{ {
"classes.tuple.private" "classes.tuple.private"
{ {
{ "<tuple-boa>" ( slots... layout -- tuple ) "primitive_tuple_boa" } { "<tuple-boa>" ( slots... layout -- tuple ) "tuple_boa" }
{ "<tuple>" ( layout -- tuple ) "primitive_tuple" } { "<tuple>" ( layout -- tuple ) "tuple" }
} }
} }
{ {
@ -94,7 +94,7 @@ CONSTANT: all-primitives {
{ {
{ {
"modify-code-heap" ( alist update-existing? reset-pics? -- ) "modify-code-heap" ( alist update-existing? reset-pics? -- )
"primitive_modify_code_heap" "modify_code_heap"
} }
} }
} }
@ -103,38 +103,38 @@ CONSTANT: all-primitives {
{ {
{ "inline-cache-miss" ( generic methods index cache -- ) f } { "inline-cache-miss" ( generic methods index cache -- ) f }
{ "inline-cache-miss-tail" ( generic methods index cache -- ) f } { "inline-cache-miss-tail" ( generic methods index cache -- ) f }
{ "lookup-method" ( object methods -- method ) "primitive_lookup_method" } { "lookup-method" ( object methods -- method ) "lookup_method" }
{ "mega-cache-lookup" ( methods index cache -- ) f } { "mega-cache-lookup" ( methods index cache -- ) f }
{ "mega-cache-miss" ( methods index cache -- method ) "primitive_mega_cache_miss" } { "mega-cache-miss" ( methods index cache -- method ) "mega_cache_miss" }
} }
} }
{ {
"io.files.private" "io.files.private"
{ {
{ "(exists?)" ( path -- ? ) "primitive_existsp" } { "(exists?)" ( path -- ? ) "existsp" }
} }
} }
{ {
"io.streams.c" "io.streams.c"
{ {
{ "(fopen)" ( path mode -- alien ) "primitive_fopen" } { "(fopen)" ( path mode -- alien ) "fopen" }
{ "fclose" ( alien -- ) "primitive_fclose" } { "fclose" ( alien -- ) "fclose" }
{ "fflush" ( alien -- ) "primitive_fflush" } { "fflush" ( alien -- ) "fflush" }
{ "fgetc" ( alien -- byte/f ) "primitive_fgetc" } { "fgetc" ( alien -- byte/f ) "fgetc" }
{ "fputc" ( byte alien -- ) "primitive_fputc" } { "fputc" ( byte alien -- ) "fputc" }
{ "fread-unsafe" ( n buf alien -- count ) "primitive_fread" } { "fread-unsafe" ( n buf alien -- count ) "fread" }
{ "fseek" ( alien offset whence -- ) "primitive_fseek" } { "fseek" ( alien offset whence -- ) "fseek" }
{ "ftell" ( alien -- n ) "primitive_ftell" } { "ftell" ( alien -- n ) "ftell" }
{ "fwrite" ( data length alien -- ) "primitive_fwrite" } { "fwrite" ( data length alien -- ) "fwrite" }
} }
} }
{ {
"kernel" "kernel"
{ {
{ "(clone)" ( obj -- newobj ) "primitive_clone" } { "(clone)" ( obj -- newobj ) "clone" }
{ "<wrapper>" ( obj -- wrapper ) "primitive_wrapper" } { "<wrapper>" ( obj -- wrapper ) "wrapper" }
{ "callstack>array" ( callstack -- array ) "primitive_callstack_to_array" } { "callstack>array" ( callstack -- array ) "callstack_to_array" }
{ "die" ( -- ) "primitive_die" } { "die" ( -- ) "die" }
{ "drop" ( x -- ) f } { "drop" ( x -- ) f }
{ "2drop" ( x y -- ) f } { "2drop" ( x y -- ) f }
{ "3drop" ( x y z -- ) f } { "3drop" ( x y z -- ) f }
@ -170,34 +170,34 @@ CONSTANT: all-primitives {
{ "tag" ( object -- n ) f } { "tag" ( object -- n ) f }
{ "unwind-native-frames" ( -- ) f } { "unwind-native-frames" ( -- ) f }
{ "callstack-for" ( context -- array ) "primitive_callstack_for" } { "callstack-for" ( context -- array ) "callstack_for" }
{ "datastack-for" ( context -- array ) "primitive_datastack_for" } { "datastack-for" ( context -- array ) "datastack_for" }
{ "retainstack-for" ( context -- array ) "primitive_retainstack_for" } { "retainstack-for" ( context -- array ) "retainstack_for" }
{ "(identity-hashcode)" ( obj -- code ) "primitive_identity_hashcode" } { "(identity-hashcode)" ( obj -- code ) "identity_hashcode" }
{ "become" ( old new -- ) "primitive_become" } { "become" ( old new -- ) "become" }
{ "callstack-bounds" ( -- start end ) "primitive_callstack_bounds" } { "callstack-bounds" ( -- start end ) "callstack_bounds" }
{ "check-datastack" ( array in# out# -- ? ) "primitive_check_datastack" } { "check-datastack" ( array in# out# -- ? ) "check_datastack" }
{ "compute-identity-hashcode" ( obj -- ) "primitive_compute_identity_hashcode" } { "compute-identity-hashcode" ( obj -- ) "compute_identity_hashcode" }
{ "context-object" ( n -- obj ) "primitive_context_object" } { "context-object" ( n -- obj ) "context_object" }
{ {
"innermost-frame-executing" ( callstack -- obj ) "innermost-frame-executing" ( callstack -- obj )
"primitive_innermost_stack_frame_executing" "innermost_stack_frame_executing"
} }
{ {
"innermost-frame-scan" ( callstack -- n ) "innermost-frame-scan" ( callstack -- n )
"primitive_innermost_stack_frame_scan" "innermost_stack_frame_scan"
} }
{ "set-context-object" ( obj n -- ) "primitive_set_context_object" } { "set-context-object" ( obj n -- ) "set_context_object" }
{ "set-datastack" ( array -- ) "primitive_set_datastack" } { "set-datastack" ( array -- ) "set_datastack" }
{ {
"set-innermost-frame-quotation" ( n callstack -- ) "set-innermost-frame-quotation" ( n callstack -- )
"primitive_set_innermost_stack_frame_quotation" "set_innermost_stack_frame_quotation"
} }
{ "set-retainstack" ( array -- ) "primitive_set_retainstack" } { "set-retainstack" ( array -- ) "set_retainstack" }
{ "set-special-object" ( obj n -- ) "primitive_set_special_object" } { "set-special-object" ( obj n -- ) "set_special_object" }
{ "special-object" ( n -- obj ) "primitive_special_object" } { "special-object" ( n -- obj ) "special_object" }
{ "strip-stack-traces" ( -- ) "primitive_strip_stack_traces" } { "strip-stack-traces" ( -- ) "strip_stack_traces" }
{ "unimplemented" ( -- * ) "primitive_unimplemented" } { "unimplemented" ( -- * ) "unimplemented" }
} }
} }
{ {
@ -206,16 +206,16 @@ CONSTANT: all-primitives {
{ "drop-locals" ( n -- ) f } { "drop-locals" ( n -- ) f }
{ "get-local" ( n -- obj ) f } { "get-local" ( n -- obj ) f }
{ "load-local" ( obj -- ) f } { "load-local" ( obj -- ) f }
{ "load-locals" ( ... n -- ) "primitive_load_locals" } { "load-locals" ( ... n -- ) "load_locals" }
} }
} }
{ {
"math" "math"
{ {
{ "bits>double" ( n -- x ) "primitive_bits_double" } { "bits>double" ( n -- x ) "bits_double" }
{ "bits>float" ( n -- x ) "primitive_bits_float" } { "bits>float" ( n -- x ) "bits_float" }
{ "double>bits" ( x -- n ) "primitive_double_bits" } { "double>bits" ( x -- n ) "double_bits" }
{ "float>bits" ( x -- n ) "primitive_float_bits" } { "float>bits" ( x -- n ) "float_bits" }
} }
} }
{ {
@ -223,7 +223,7 @@ CONSTANT: all-primitives {
{ {
{ {
"(format-float)" ( n fill width precision format locale -- byte-array ) "(format-float)" ( n fill width precision format locale -- byte-array )
"primitive_format_float" "format_float"
} }
} }
} }
@ -250,161 +250,163 @@ CONSTANT: all-primitives {
{ "fixnum>" ( x y -- ? ) f } { "fixnum>" ( x y -- ? ) f }
{ "fixnum>=" ( x y -- ? ) f } { "fixnum>=" ( x y -- ? ) f }
{ "bignum*" ( x y -- z ) "primitive_bignum_multiply" } { "bignum*" ( x y -- z ) "bignum_multiply" }
{ "bignum+" ( x y -- z ) "primitive_bignum_add" } { "bignum+" ( x y -- z ) "bignum_add" }
{ "bignum-" ( x y -- z ) "primitive_bignum_subtract" } { "bignum-" ( x y -- z ) "bignum_subtract" }
{ "bignum-bit?" ( x n -- ? ) "primitive_bignum_bitp" } { "bignum-bit?" ( x n -- ? ) "bignum_bitp" }
{ "bignum-bitand" ( x y -- z ) "primitive_bignum_and" } { "bignum-bitand" ( x y -- z ) "bignum_and" }
{ "bignum-bitnot" ( x -- y ) "primitive_bignum_not" } { "bignum-bitnot" ( x -- y ) "bignum_not" }
{ "bignum-bitor" ( x y -- z ) "primitive_bignum_or" } { "bignum-bitor" ( x y -- z ) "bignum_or" }
{ "bignum-bitxor" ( x y -- z ) "primitive_bignum_xor" } { "bignum-bitxor" ( x y -- z ) "bignum_xor" }
{ "bignum-log2" ( x -- n ) "primitive_bignum_log2" } { "bignum-log2" ( x -- n ) "bignum_log2" }
{ "bignum-mod" ( x y -- z ) "primitive_bignum_mod" } { "bignum-mod" ( x y -- z ) "bignum_mod" }
{ "bignum-gcd" ( x y -- z ) "primitive_bignum_gcd" } { "bignum-gcd" ( x y -- z ) "bignum_gcd" }
{ "bignum-shift" ( x y -- z ) "primitive_bignum_shift" } { "bignum-shift" ( x y -- z ) "bignum_shift" }
{ "bignum/i" ( x y -- z ) "primitive_bignum_divint" } { "bignum/i" ( x y -- z ) "bignum_divint" }
{ "bignum/mod" ( x y -- z w ) "primitive_bignum_divmod" } { "bignum/mod" ( x y -- z w ) "bignum_divmod" }
{ "bignum<" ( x y -- ? ) "primitive_bignum_less" } { "bignum<" ( x y -- ? ) "bignum_less" }
{ "bignum<=" ( x y -- ? ) "primitive_bignum_lesseq" } { "bignum<=" ( x y -- ? ) "bignum_lesseq" }
{ "bignum=" ( x y -- ? ) "primitive_bignum_eq" } { "bignum=" ( x y -- ? ) "bignum_eq" }
{ "bignum>" ( x y -- ? ) "primitive_bignum_greater" } { "bignum>" ( x y -- ? ) "bignum_greater" }
{ "bignum>=" ( x y -- ? ) "primitive_bignum_greatereq" } { "bignum>=" ( x y -- ? ) "bignum_greatereq" }
{ "bignum>fixnum" ( x -- y ) "primitive_bignum_to_fixnum" } { "bignum>fixnum" ( x -- y ) "bignum_to_fixnum" }
{ "bignum>fixnum-strict" ( x -- y ) "primitive_bignum_to_fixnum_strict" } { "bignum>fixnum-strict" ( x -- y ) "bignum_to_fixnum_strict" }
{ "fixnum-shift" ( x y -- z ) "primitive_fixnum_shift" } { "fixnum-shift" ( x y -- z ) "fixnum_shift" }
{ "fixnum/i" ( x y -- z ) "primitive_fixnum_divint" } { "fixnum/i" ( x y -- z ) "fixnum_divint" }
{ "fixnum/mod" ( x y -- z w ) "primitive_fixnum_divmod" } { "fixnum/mod" ( x y -- z w ) "fixnum_divmod" }
{ "fixnum>bignum" ( x -- y ) "primitive_fixnum_to_bignum" } { "fixnum>bignum" ( x -- y ) "fixnum_to_bignum" }
{ "fixnum>float" ( x -- y ) "primitive_fixnum_to_float" } { "fixnum>float" ( x -- y ) "fixnum_to_float" }
{ "float*" ( x y -- z ) "primitive_float_multiply" } { "float*" ( x y -- z ) "float_multiply" }
{ "float+" ( x y -- z ) "primitive_float_add" } { "float+" ( x y -- z ) "float_add" }
{ "float-" ( x y -- z ) "primitive_float_subtract" } { "float-" ( x y -- z ) "float_subtract" }
{ "float-u<" ( x y -- ? ) "primitive_float_less" } { "float-u<" ( x y -- ? ) "float_less" }
{ "float-u<=" ( x y -- ? ) "primitive_float_lesseq" } { "float-u<=" ( x y -- ? ) "float_lesseq" }
{ "float-u>" ( x y -- ? ) "primitive_float_greater" } { "float-u>" ( x y -- ? ) "float_greater" }
{ "float-u>=" ( x y -- ? ) "primitive_float_greatereq" } { "float-u>=" ( x y -- ? ) "float_greatereq" }
{ "float/f" ( x y -- z ) "primitive_float_divfloat" } { "float/f" ( x y -- z ) "float_divfloat" }
{ "float<" ( x y -- ? ) "primitive_float_less" } { "float<" ( x y -- ? ) "float_less" }
{ "float<=" ( x y -- ? ) "primitive_float_lesseq" } { "float<=" ( x y -- ? ) "float_lesseq" }
{ "float=" ( x y -- ? ) "primitive_float_eq" } { "float=" ( x y -- ? ) "float_eq" }
{ "float>" ( x y -- ? ) "primitive_float_greater" } { "float>" ( x y -- ? ) "float_greater" }
{ "float>=" ( x y -- ? ) "primitive_float_greatereq" } { "float>=" ( x y -- ? ) "float_greatereq" }
{ "float>bignum" ( x -- y ) "primitive_float_to_bignum" } { "float>bignum" ( x -- y ) "float_to_bignum" }
{ "float>fixnum" ( x -- y ) "primitive_float_to_fixnum" } { "float>fixnum" ( x -- y ) "float_to_fixnum" }
} }
} }
{ {
"memory" "memory"
{ {
{ "all-instances" ( -- array ) "primitive_all_instances" } { "all-instances" ( -- array ) "all_instances" }
{ "compact-gc" ( -- ) "primitive_compact_gc" } { "compact-gc" ( -- ) "compact_gc" }
{ "gc" ( -- ) "primitive_full_gc" } { "gc" ( -- ) "full_gc" }
{ "minor-gc" ( -- ) "primitive_minor_gc" } { "minor-gc" ( -- ) "minor_gc" }
{ "size" ( obj -- n ) "primitive_size" } { "size" ( obj -- n ) "size" }
} }
} }
{ {
"memory.private" "memory.private"
{ {
{ "(save-image)" ( path1 path2 then-die? -- ) "primitive_save_image" } { "(save-image)" ( path1 path2 then-die? -- ) "save_image" }
} }
} }
{ {
"quotations" "quotations"
{ {
{ "jit-compile" ( quot -- ) "primitive_jit_compile" } { "jit-compile" ( quot -- ) "jit_compile" }
{ "quotation-code" ( quot -- start end ) "primitive_quotation_code" } { "quotation-code" ( quot -- start end ) "quotation_code" }
{ "quotation-compiled?" ( quot -- ? ) "primitive_quotation_compiled_p" } { "quotation-compiled?" ( quot -- ? ) "quotation_compiled_p" }
} }
} }
{ {
"quotations.private" "quotations.private"
{ {
{ "array>quotation" ( array -- quot ) "primitive_array_to_quotation" } { "array>quotation" ( array -- quot ) "array_to_quotation" }
} }
} }
{ {
"slots.private" "slots.private"
{ {
{ "set-slot" ( value obj n -- ) "primitive_set_slot" } { "set-slot" ( value obj n -- ) "set_slot" }
{ "slot" ( obj m -- value ) f } { "slot" ( obj m -- value ) f }
} }
} }
{ {
"strings" "strings"
{ {
{ "<string>" ( n ch -- string ) "primitive_string" } { "<string>" ( n ch -- string ) "string" }
{ "resize-string" ( n str -- newstr ) "primitive_resize_string" } { "resize-string" ( n str -- newstr ) "resize_string" }
} }
} }
{ {
"strings.private" "strings.private"
{ {
{ "set-string-nth-fast" ( ch n string -- ) "primitive_set_string_nth_fast" } { "set-string-nth-fast" ( ch n string -- ) "set_string_nth_fast" }
{ "string-nth-fast" ( n string -- ch ) f } { "string-nth-fast" ( n string -- ch ) f }
} }
} }
{ {
"system" "system"
{ {
{ "(exit)" ( n -- * ) "primitive_exit" } { "(exit)" ( n -- * ) "exit" }
{ "nano-count" ( -- ns ) "primitive_nano_count" } { "nano-count" ( -- ns ) "nano_count" }
} }
} }
{ {
"threads.private" "threads.private"
{ {
{ "(sleep)" ( nanos -- ) "primitive_sleep" } { "(sleep)" ( nanos -- ) "sleep" }
{ "(set-context)" ( obj context -- obj' ) f } { "(set-context)" ( obj context -- obj' ) f }
{ "(set-context-and-delete)" ( obj context -- * ) f } { "(set-context-and-delete)" ( obj context -- * ) f }
{ "(start-context)" ( obj quot -- obj' ) f } { "(start-context)" ( obj quot -- obj' ) f }
{ "(start-context-and-delete)" ( obj quot -- * ) f } { "(start-context-and-delete)" ( obj quot -- * ) f }
{ "context-object-for" ( n context -- obj ) "primitive_context_object_for" } { "context-object-for" ( n context -- obj ) "context_object_for" }
} }
} }
{ {
"tools.dispatch.private" "tools.dispatch.private"
{ {
{ "dispatch-stats" ( -- stats ) "primitive_dispatch_stats" } { "dispatch-stats" ( -- stats ) "dispatch_stats" }
{ "reset-dispatch-stats" ( -- ) "primitive_reset_dispatch_stats" } { "reset-dispatch-stats" ( -- ) "reset_dispatch_stats" }
} }
} }
{ {
"tools.memory.private" "tools.memory.private"
{ {
{ "(callback-room)" ( -- allocator-room ) "primitive_callback_room" } { "(callback-room)" ( -- allocator-room ) "callback_room" }
{ "(code-blocks)" ( -- array ) "primitive_code_blocks" } { "(code-blocks)" ( -- array ) "code_blocks" }
{ "(code-room)" ( -- allocator-room ) "primitive_code_room" } { "(code-room)" ( -- allocator-room ) "code_room" }
{ "(data-room)" ( -- data-room ) "primitive_data_room" } { "(data-room)" ( -- data-room ) "data_room" }
{ "disable-gc-events" ( -- events ) "primitive_disable_gc_events" } { "disable-gc-events" ( -- events ) "disable_gc_events" }
{ "enable-gc-events" ( -- ) "primitive_enable_gc_events" } { "enable-gc-events" ( -- ) "enable_gc_events" }
} }
} }
{ {
"tools.profiler.sampling.private" "tools.profiler.sampling.private"
{ {
{ "profiling" ( ? -- ) "primitive_sampling_profiler" } { "profiling" ( ? -- ) "sampling_profiler" }
{ "(get-samples)" ( -- samples/f ) "primitive_get_samples" } { "(get-samples)" ( -- samples/f ) "get_samples" }
{ "(clear-samples)" ( -- ) "primitive_clear_samples" } { "(clear-samples)" ( -- ) "clear_samples" }
} }
} }
{ {
"words" "words"
{ {
{ "word-code" ( word -- start end ) "primitive_word_code" } { "word-code" ( word -- start end ) "word_code" }
{ "word-optimized?" ( word -- ? ) "primitive_word_optimized_p" } { "word-optimized?" ( word -- ? ) "word_optimized_p" }
} }
} }
{ {
"words.private" "words.private"
{ {
{ "(word)" ( name vocab hashcode -- word ) "primitive_word" } { "(word)" ( name vocab hashcode -- word ) "word" }
} }
} }
} }
: primitive-quot ( word vm-func -- quot ) : primitive-quot ( word vm-func -- quot )
[ nip ascii string>alien [ do-primitive ] curry ] [ 1quotation ] if* ; [
nip "primitive_" prepend ascii string>alien [ do-primitive ] curry
] [ 1quotation ] if* ;
: primitive-word ( name vocab -- word ) : primitive-word ( name vocab -- word )
create-word dup t "primitive" set-word-prop ; create-word dup t "primitive" set-word-prop ;