]> gitweb.factorcode.org Git - factor.git/blob - core/bootstrap/primitives.factor
1ef404a9b7549fcd344160d42f96ba97d7bc8eae
[factor.git] / core / bootstrap / primitives.factor
1 ! Copyright (C) 2004, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien alien.strings arrays assocs byte-arrays classes
4 classes.intersection classes.union combinators generic hashtables
5 hashtables.private io io.encodings.ascii kernel math math.private math.order
6 namespaces make parser quotations sequences strings vectors words layouts
7 classes.private classes.builtin classes.singleton classes.tuple
8 classes.tuple.private kernel.private vocabs vocabs.loader
9 source-files definitions slots  classes.predicate compiler.units
10 bootstrap.image.private io.files splitting ;
11 IN: bootstrap.primitives
12
13 "Creating primitives and basic runtime structures..." print flush
14
15 H{ } clone sub-primitives set
16
17 "vocab:bootstrap/syntax.factor" parse-file
18
19 : asm-file ( arch -- file )
20     "-" split reverse "." join
21     "vocab:bootstrap/assembler/" ".factor" surround ;
22
23 architecture get asm-file parse-file
24
25 "vocab:bootstrap/layouts/layouts.factor" parse-file
26
27 ! Now we have ( syntax-quot arch-quot layouts-quot ) on the stack
28
29 ! Bring up a bare cross-compiling vocabulary.
30 "syntax" lookup-vocab vocab-words bootstrap-syntax set
31
32 H{ } clone dictionary set
33 H{ } clone root-cache set
34 H{ } clone source-files set
35 H{ } clone update-map set
36 H{ } clone implementors-map set
37
38 init-caches
39
40 bootstrapping? on
41
42 call( -- ) ! layouts quot
43 call( -- ) ! arch quot
44
45 ! Vocabulary for slot accessors
46 "accessors" create-vocab drop
47
48 ! After we execute bootstrap/layouts
49 num-types get f <array> builtins set
50
51 [
52
53 call( -- ) ! syntax-quot
54
55 ! Create some empty vocabs where the below primitives and
56 ! classes will go
57 {
58     "alien"
59     "alien.accessors"
60     "alien.libraries"
61     "alien.private"
62     "arrays"
63     "byte-arrays"
64     "classes.private"
65     "classes.tuple"
66     "classes.tuple.private"
67     "classes.predicate"
68     "compiler.units"
69     "continuations.private"
70     "generic.single"
71     "generic.single.private"
72     "growable"
73     "hashtables"
74     "hashtables.private"
75     "io"
76     "io.files"
77     "io.files.private"
78     "io.streams.c"
79     "locals.backend"
80     "kernel"
81     "kernel.private"
82     "math"
83     "math.parser.private"
84     "math.private"
85     "memory"
86     "memory.private"
87     "quotations"
88     "quotations.private"
89     "sbufs"
90     "sbufs.private"
91     "scratchpad"
92     "sequences"
93     "sequences.private"
94     "slots.private"
95     "strings"
96     "strings.private"
97     "system"
98     "system.private"
99     "threads.private"
100     "tools.dispatch.private"
101     "tools.memory.private"
102     "tools.profiler.sampling.private"
103     "words"
104     "words.private"
105     "vectors"
106     "vectors.private"
107     "vm"
108 } [ create-vocab drop ] each
109
110 ! Builtin classes
111 : lookup-type-number ( word -- n )
112     [ target-word ] with-global type-number ;
113
114 : register-builtin ( class -- )
115     [ dup lookup-type-number "type" set-word-prop ]
116     [ dup "type" word-prop builtins get set-nth ]
117     [ f f f builtin-class define-class ]
118     tri ;
119
120 : prepare-slots ( slots -- slots' )
121     [ [ dup pair? [ first2 create ] when ] map ] map ;
122
123 : define-builtin-slots ( class slots -- )
124     prepare-slots make-slots 1 finalize-slots
125     [ "slots" set-word-prop ] [ define-accessors ] 2bi ;
126
127 : define-builtin-predicate ( class -- )
128     dup class>type [ eq? ] curry [ tag ] prepend define-predicate ;
129
130 : define-builtin ( symbol slotspec -- )
131     [ [ define-builtin-predicate ] keep ] dip define-builtin-slots ;
132
133 "fixnum" "math" create register-builtin
134 "bignum" "math" create register-builtin
135 "tuple" "kernel" create register-builtin
136 "float" "math" create register-builtin
137 "f" "syntax" lookup-word register-builtin
138 "array" "arrays" create register-builtin
139 "wrapper" "kernel" create register-builtin
140 "callstack" "kernel" create register-builtin
141 "string" "strings" create register-builtin
142 "quotation" "quotations" create register-builtin
143 "dll" "alien" create register-builtin
144 "alien" "alien" create register-builtin
145 "word" "words" create register-builtin
146 "byte-array" "byte-arrays" create register-builtin
147
148 ! We need this before defining c-ptr below
149 "f" "syntax" lookup-word { } define-builtin
150
151 "f" "syntax" create [ not ] "predicate" set-word-prop
152 "f?" "syntax" vocab-words delete-at
153
154 "t" "syntax" lookup-word define-singleton-class
155
156 ! Some unions
157 "c-ptr" "alien" create [
158     "alien" "alien" lookup-word ,
159     "f" "syntax" lookup-word ,
160     "byte-array" "byte-arrays" lookup-word ,
161 ] { } make define-union-class
162
163 ! A predicate class used for declarations
164 "array-capacity" "sequences.private" create
165 "fixnum" "math" lookup-word
166 [
167     [ dup 0 fixnum>= ] %
168     bootstrap-max-array-capacity <fake-bignum> [ fixnum<= ] curry ,
169     [ [ drop f ] if ] %
170 ] [ ] make
171 define-predicate-class
172
173 "array-capacity" "sequences.private" lookup-word
174 [ >fixnum ] bootstrap-max-array-capacity <fake-bignum> [ fixnum-bitand ] curry append
175 "coercer" set-word-prop
176
177 ! Catch-all class for providing a default method.
178 "object" "kernel" create
179 [ f f { } intersection-class define-class ]
180 [ [ drop t ] "predicate" set-word-prop ]
181 bi
182
183 "object?" "kernel" vocab-words delete-at
184
185 ! Empty class with no instances
186 "null" "kernel" create
187 [ f { } f union-class define-class ]
188 [ [ drop f ] "predicate" set-word-prop ]
189 bi
190
191 "null?" "kernel" vocab-words delete-at
192
193 "fixnum" "math" create { } define-builtin
194 "fixnum" "math" create "integer>fixnum-strict" "math" create 1quotation "coercer" set-word-prop
195
196 "bignum" "math" create { } define-builtin
197 "bignum" "math" create ">bignum" "math" create 1quotation "coercer" set-word-prop
198
199 "float" "math" create { } define-builtin
200 "float" "math" create ">float" "math" create 1quotation "coercer" set-word-prop
201
202 "array" "arrays" create {
203     { "length" { "array-capacity" "sequences.private" } read-only }
204 } define-builtin
205
206 "wrapper" "kernel" create {
207     { "wrapped" read-only }
208 } define-builtin
209
210 "string" "strings" create {
211     { "length" { "array-capacity" "sequences.private" } read-only }
212     "aux"
213 } define-builtin
214
215 "quotation" "quotations" create {
216     { "array" { "array" "arrays" } read-only }
217     "cached-effect"
218     "cache-counter"
219 } define-builtin
220
221 "dll" "alien" create {
222     { "path" { "byte-array" "byte-arrays" } read-only }
223 } define-builtin
224
225 "alien" "alien" create {
226     { "underlying" { "c-ptr" "alien" } read-only }
227     "expired"
228 } define-builtin
229
230 "word" "words" create {
231     { "hashcode" { "fixnum" "math" } }
232     "name"
233     "vocabulary"
234     { "def" { "quotation" "quotations" } initial: [ ] }
235     "props"
236     "pic-def"
237     "pic-tail-def"
238     { "sub-primitive" read-only }
239 } define-builtin
240
241 "byte-array" "byte-arrays" create {
242     { "length" { "array-capacity" "sequences.private" } read-only }
243 } define-builtin
244
245 "callstack" "kernel" create { } define-builtin
246
247 "tuple" "kernel" create
248 [ { } define-builtin ]
249 [ define-tuple-layout ]
250 bi
251
252 ! Create special tombstone values
253 "tombstone" "hashtables.private" create
254 tuple
255 { "state" } define-tuple-class
256
257 "((empty))" "hashtables.private" create
258 { f } "tombstone" "hashtables.private" lookup-word
259 slots>tuple 1quotation ( -- value ) define-inline
260
261 "((tombstone))" "hashtables.private" create
262 { t } "tombstone" "hashtables.private" lookup-word
263 slots>tuple 1quotation ( -- value ) define-inline
264
265 ! Some tuple classes
266 "curry" "kernel" create
267 tuple
268 {
269     { "obj" read-only }
270     { "quot" read-only }
271 } prepare-slots define-tuple-class
272
273 "curry" "kernel" lookup-word
274 {
275     [ f "inline" set-word-prop ]
276     [ make-flushable ]
277     [ ]
278     [
279         [
280             callable instance-check-quot %
281             tuple-layout ,
282             \ <tuple-boa> ,
283         ] [ ] make
284     ]
285 } cleave
286 ( obj quot -- curry ) define-declared
287
288 "compose" "kernel" create
289 tuple
290 {
291     { "first" read-only }
292     { "second" read-only }
293 } prepare-slots define-tuple-class
294
295 "compose" "kernel" lookup-word
296 {
297     [ f "inline" set-word-prop ]
298     [ make-flushable ]
299     [ ]
300     [
301         [
302             callable instance-check-quot [ dip ] curry %
303             callable instance-check-quot %
304             tuple-layout ,
305             \ <tuple-boa> ,
306         ] [ ] make
307     ]
308 } cleave
309 ( quot1 quot2 -- compose ) define-declared
310
311 ! Sub-primitive words
312 : make-sub-primitive ( word vocab effect -- )
313     [
314         create
315         dup t "primitive" set-word-prop
316         dup 1quotation
317     ] dip define-declared ;
318
319 {
320     { "mega-cache-lookup" "generic.single.private" ( methods index cache -- ) }
321     { "inline-cache-miss" "generic.single.private" ( generic methods index cache -- ) }
322     { "inline-cache-miss-tail" "generic.single.private" ( generic methods index cache -- ) }
323     { "drop" "kernel" ( x -- ) }
324     { "2drop" "kernel" ( x y -- ) }
325     { "3drop" "kernel" ( x y z -- ) }
326     { "4drop" "kernel" ( w x y z -- ) }
327     { "dup" "kernel" ( x -- x x ) }
328     { "2dup" "kernel" ( x y -- x y x y ) }
329     { "3dup" "kernel" ( x y z -- x y z x y z ) }
330     { "4dup" "kernel" ( w x y z -- w x y z w x y z ) }
331     { "rot" "kernel" ( x y z -- y z x ) }
332     { "-rot" "kernel" ( x y z -- z x y ) }
333     { "dupd" "kernel" ( x y -- x x y ) }
334     { "swapd" "kernel" ( x y z -- y x z ) }
335     { "nip" "kernel" ( x y -- y ) }
336     { "2nip" "kernel" ( x y z -- z ) }
337     { "over" "kernel" ( x y -- x y x ) }
338     { "pick" "kernel" ( x y z -- x y z x ) }
339     { "swap" "kernel" ( x y -- y x ) }
340     { "eq?" "kernel" ( obj1 obj2 -- ? ) }
341     { "tag" "kernel.private" ( object -- n ) }
342     { "(execute)" "kernel.private" ( word -- ) }
343     { "(call)" "kernel.private" ( quot -- ) }
344     { "fpu-state" "kernel.private" ( -- ) }
345     { "set-fpu-state" "kernel.private" ( -- ) }
346     { "signal-handler" "kernel.private" ( -- ) }
347     { "leaf-signal-handler" "kernel.private" ( -- ) }
348     { "ffi-signal-handler" "kernel.private" ( -- ) }
349     { "ffi-leaf-signal-handler" "kernel.private" ( -- ) }
350     { "unwind-native-frames" "kernel.private" ( -- ) }
351     { "set-callstack" "kernel.private" ( callstack -- * ) }
352     { "lazy-jit-compile" "kernel.private" ( -- ) }
353     { "c-to-factor" "kernel.private" ( -- ) }
354     { "slot" "slots.private" ( obj m -- value ) }
355     { "get-local" "locals.backend" ( n -- obj ) }
356     { "load-local" "locals.backend" ( obj -- ) }
357     { "drop-locals" "locals.backend" ( n -- ) }
358     { "both-fixnums?" "math.private" ( x y -- ? ) }
359     { "fixnum+fast" "math.private" ( x y -- z ) }
360     { "fixnum-fast" "math.private" ( x y -- z ) }
361     { "fixnum*fast" "math.private" ( x y -- z ) }
362     { "fixnum-bitand" "math.private" ( x y -- z ) }
363     { "fixnum-bitor" "math.private" ( x y -- z ) }
364     { "fixnum-bitxor" "math.private" ( x y -- z ) }
365     { "fixnum-bitnot" "math.private" ( x -- y ) }
366     { "fixnum-mod" "math.private" ( x y -- z ) }
367     { "fixnum-shift-fast" "math.private" ( x y -- z ) }
368     { "fixnum/i-fast" "math.private" ( x y -- z ) }
369     { "fixnum/mod-fast" "math.private" ( x y -- z w ) }
370     { "fixnum+" "math.private" ( x y -- z ) }
371     { "fixnum-" "math.private" ( x y -- z ) }
372     { "fixnum*" "math.private" ( x y -- z ) }
373     { "fixnum<" "math.private" ( x y -- ? ) }
374     { "fixnum<=" "math.private" ( x y -- z ) }
375     { "fixnum>" "math.private" ( x y -- ? ) }
376     { "fixnum>=" "math.private" ( x y -- ? ) }
377     { "string-nth-fast" "strings.private" ( n string -- ch ) }
378     { "(set-context)" "threads.private" ( obj context -- obj' ) }
379     { "(set-context-and-delete)" "threads.private" ( obj context -- * ) }
380     { "(start-context)" "threads.private" ( obj quot -- obj' ) }
381     { "(start-context-and-delete)" "threads.private" ( obj quot -- * ) }
382 } [ first3 make-sub-primitive ] each
383
384 ! Primitive words
385 : make-primitive ( word vocab function effect -- )
386     [
387         [
388             create
389             dup reset-word
390             dup t "primitive" set-word-prop
391         ] dip
392         ascii string>alien [ do-primitive ] curry
393     ] dip define-declared ;
394
395 {
396     { "<callback>" "alien" "primitive_callback" ( word return-rewind -- alien ) }
397     { "<displaced-alien>" "alien" "primitive_displaced_alien" ( displacement c-ptr -- alien ) }
398     { "alien-address" "alien" "primitive_alien_address" ( c-ptr -- addr ) }
399     { "alien-cell" "alien.accessors" "primitive_alien_cell" ( c-ptr n -- value ) }
400     { "alien-double" "alien.accessors" "primitive_alien_double" ( c-ptr n -- value ) }
401     { "alien-float" "alien.accessors" "primitive_alien_float" ( c-ptr n -- value ) }
402     { "alien-signed-1" "alien.accessors" "primitive_alien_signed_1" ( c-ptr n -- value ) }
403     { "alien-signed-2" "alien.accessors" "primitive_alien_signed_2" ( c-ptr n -- value ) }
404     { "alien-signed-4" "alien.accessors" "primitive_alien_signed_4" ( c-ptr n -- value ) }
405     { "alien-signed-8" "alien.accessors" "primitive_alien_signed_8" ( c-ptr n -- value ) }
406     { "alien-signed-cell" "alien.accessors" "primitive_alien_signed_cell" ( c-ptr n -- value ) }
407     { "alien-unsigned-1" "alien.accessors" "primitive_alien_unsigned_1" ( c-ptr n -- value ) }
408     { "alien-unsigned-2" "alien.accessors" "primitive_alien_unsigned_2" ( c-ptr n -- value ) }
409     { "alien-unsigned-4" "alien.accessors" "primitive_alien_unsigned_4" ( c-ptr n -- value ) }
410     { "alien-unsigned-8" "alien.accessors" "primitive_alien_unsigned_8" ( c-ptr n -- value ) }
411     { "alien-unsigned-cell" "alien.accessors" "primitive_alien_unsigned_cell" ( c-ptr n -- value ) }
412     { "set-alien-cell" "alien.accessors" "primitive_set_alien_cell" ( value c-ptr n -- ) }
413     { "set-alien-double" "alien.accessors" "primitive_set_alien_double" ( value c-ptr n -- ) }
414     { "set-alien-float" "alien.accessors" "primitive_set_alien_float" ( value c-ptr n -- ) }
415     { "set-alien-signed-1" "alien.accessors" "primitive_set_alien_signed_1" ( value c-ptr n -- ) }
416     { "set-alien-signed-2" "alien.accessors" "primitive_set_alien_signed_2" ( value c-ptr n -- ) }
417     { "set-alien-signed-4" "alien.accessors" "primitive_set_alien_signed_4" ( value c-ptr n -- ) }
418     { "set-alien-signed-8" "alien.accessors" "primitive_set_alien_signed_8" ( value c-ptr n -- ) }
419     { "set-alien-signed-cell" "alien.accessors" "primitive_set_alien_signed_cell" ( value c-ptr n -- ) }
420     { "set-alien-unsigned-1" "alien.accessors" "primitive_set_alien_unsigned_1" ( value c-ptr n -- ) }
421     { "set-alien-unsigned-2" "alien.accessors" "primitive_set_alien_unsigned_2" ( value c-ptr n -- ) }
422     { "set-alien-unsigned-4" "alien.accessors" "primitive_set_alien_unsigned_4" ( value c-ptr n -- ) }
423     { "set-alien-unsigned-8" "alien.accessors" "primitive_set_alien_unsigned_8" ( value c-ptr n -- ) }
424     { "set-alien-unsigned-cell" "alien.accessors" "primitive_set_alien_unsigned_cell" ( value c-ptr n -- ) }
425     { "(dlopen)" "alien.libraries" "primitive_dlopen" ( path -- dll ) }
426     { "(dlsym)" "alien.libraries" "primitive_dlsym" ( name dll -- alien ) }
427     { "(dlsym-raw)" "alien.libraries" "primitive_dlsym_raw" ( name dll -- alien ) }
428     { "dlclose" "alien.libraries" "primitive_dlclose" ( dll -- ) }
429     { "dll-valid?" "alien.libraries" "primitive_dll_validp" ( dll -- ? ) }
430     { "current-callback" "alien.private" "primitive_current_callback" ( -- n ) }
431     { "<array>" "arrays" "primitive_array" ( n elt -- array ) }
432     { "resize-array" "arrays" "primitive_resize_array" ( n array -- new-array ) }
433     { "(byte-array)" "byte-arrays" "primitive_uninitialized_byte_array" ( n -- byte-array ) }
434     { "<byte-array>" "byte-arrays" "primitive_byte_array" ( n -- byte-array ) }
435     { "resize-byte-array" "byte-arrays" "primitive_resize_byte_array" ( n byte-array -- new-byte-array ) }
436     { "<tuple-boa>" "classes.tuple.private" "primitive_tuple_boa" ( slots... layout -- tuple ) }
437     { "<tuple>" "classes.tuple.private" "primitive_tuple" ( layout -- tuple ) }
438     { "modify-code-heap" "compiler.units" "primitive_modify_code_heap" ( alist update-existing? reset-pics? -- ) }
439     { "lookup-method" "generic.single.private" "primitive_lookup_method" ( object methods -- method ) }
440     { "mega-cache-miss" "generic.single.private" "primitive_mega_cache_miss" ( methods index cache -- method ) }
441     { "(exists?)" "io.files.private" "primitive_existsp" ( path -- ? ) }
442     { "(fopen)" "io.streams.c" "primitive_fopen" ( path mode -- alien ) }
443     { "fclose" "io.streams.c" "primitive_fclose" ( alien -- ) }
444     { "fflush" "io.streams.c" "primitive_fflush" ( alien -- ) }
445     { "fgetc" "io.streams.c" "primitive_fgetc" ( alien -- byte/f ) }
446     { "fputc" "io.streams.c" "primitive_fputc" ( byte alien -- ) }
447     { "fread-unsafe" "io.streams.c" "primitive_fread" ( n buf alien -- count ) }
448     { "free-callback" "alien" "primitive_free_callback" ( alien -- ) }
449     { "fseek" "io.streams.c" "primitive_fseek" ( alien offset whence -- ) }
450     { "ftell" "io.streams.c" "primitive_ftell" ( alien -- n ) }
451     { "fwrite" "io.streams.c" "primitive_fwrite" ( data length alien -- ) }
452     { "(clone)" "kernel" "primitive_clone" ( obj -- newobj ) }
453     { "<wrapper>" "kernel" "primitive_wrapper" ( obj -- wrapper ) }
454     { "callstack" "kernel" "primitive_callstack" ( -- callstack ) }
455     { "callstack>array" "kernel" "primitive_callstack_to_array" ( callstack -- array ) }
456     { "datastack" "kernel" "primitive_datastack" ( -- array ) }
457     { "die" "kernel" "primitive_die" ( -- ) }
458     { "retainstack" "kernel" "primitive_retainstack" ( -- array ) }
459     { "(identity-hashcode)" "kernel.private" "primitive_identity_hashcode" ( obj -- code ) }
460     { "become" "kernel.private" "primitive_become" ( old new -- ) }
461     { "callstack-bounds" "kernel.private" "primitive_callstack_bounds" ( -- start end ) }
462     { "check-datastack" "kernel.private" "primitive_check_datastack" ( array in# out# -- ? ) }
463     { "compute-identity-hashcode" "kernel.private" "primitive_compute_identity_hashcode" ( obj -- ) }
464     { "context-object" "kernel.private" "primitive_context_object" ( n -- obj ) }
465     { "innermost-frame-executing" "kernel.private" "primitive_innermost_stack_frame_executing" ( callstack -- obj ) }
466     { "innermost-frame-scan" "kernel.private" "primitive_innermost_stack_frame_scan" ( callstack -- n ) }
467     { "set-context-object" "kernel.private" "primitive_set_context_object" ( obj n -- ) }
468     { "set-datastack" "kernel.private" "primitive_set_datastack" ( array -- ) }
469     { "set-innermost-frame-quot" "kernel.private" "primitive_set_innermost_stack_frame_quot" ( n callstack -- ) }
470     { "set-retainstack" "kernel.private" "primitive_set_retainstack" ( array -- ) }
471     { "set-special-object" "kernel.private" "primitive_set_special_object" ( obj n -- ) }
472     { "special-object" "kernel.private" "primitive_special_object" ( n -- obj ) }
473     { "strip-stack-traces" "kernel.private" "primitive_strip_stack_traces" ( -- ) }
474     { "unimplemented" "kernel.private" "primitive_unimplemented" ( -- * ) }
475     { "load-locals" "locals.backend" "primitive_load_locals" ( ... n -- ) }
476     { "bits>double" "math" "primitive_bits_double" ( n -- x ) }
477     { "bits>float" "math" "primitive_bits_float" ( n -- x ) }
478     { "double>bits" "math" "primitive_double_bits" ( x -- n ) }
479     { "float>bits" "math" "primitive_float_bits" ( x -- n ) }
480     { "(format-float)" "math.parser.private" "primitive_format_float" ( n format -- byte-array ) }
481     { "bignum*" "math.private" "primitive_bignum_multiply" ( x y -- z ) }
482     { "bignum+" "math.private" "primitive_bignum_add" ( x y -- z ) }
483     { "bignum-" "math.private" "primitive_bignum_subtract" ( x y -- z ) }
484     { "bignum-bit?" "math.private" "primitive_bignum_bitp" ( x n -- ? ) }
485     { "bignum-bitand" "math.private" "primitive_bignum_and" ( x y -- z ) }
486     { "bignum-bitnot" "math.private" "primitive_bignum_not" ( x -- y ) }
487     { "bignum-bitor" "math.private" "primitive_bignum_or" ( x y -- z ) }
488     { "bignum-bitxor" "math.private" "primitive_bignum_xor" ( x y -- z ) }
489     { "bignum-log2" "math.private" "primitive_bignum_log2" ( x -- n ) }
490     { "bignum-mod" "math.private" "primitive_bignum_mod" ( x y -- z ) }
491     { "bignum-gcd" "math.private" "primitive_bignum_gcd" ( x y -- z ) }
492     { "bignum-shift" "math.private" "primitive_bignum_shift" ( x y -- z ) }
493     { "bignum/i" "math.private" "primitive_bignum_divint" ( x y -- z ) }
494     { "bignum/mod" "math.private" "primitive_bignum_divmod" ( x y -- z w ) }
495     { "bignum<" "math.private" "primitive_bignum_less" ( x y -- ? ) }
496     { "bignum<=" "math.private" "primitive_bignum_lesseq" ( x y -- ? ) }
497     { "bignum=" "math.private" "primitive_bignum_eq" ( x y -- ? ) }
498     { "bignum>" "math.private" "primitive_bignum_greater" ( x y -- ? ) }
499     { "bignum>=" "math.private" "primitive_bignum_greatereq" ( x y -- ? ) }
500     { "bignum>fixnum" "math.private" "primitive_bignum_to_fixnum" ( x -- y ) }
501     { "bignum>fixnum-strict" "math.private" "primitive_bignum_to_fixnum_strict" ( x -- y ) }
502     { "fixnum-shift" "math.private" "primitive_fixnum_shift" ( x y -- z ) }
503     { "fixnum/i" "math.private" "primitive_fixnum_divint" ( x y -- z ) }
504     { "fixnum/mod" "math.private" "primitive_fixnum_divmod" ( x y -- z w ) }
505     { "fixnum>bignum" "math.private" "primitive_fixnum_to_bignum" ( x -- y ) }
506     { "fixnum>float" "math.private" "primitive_fixnum_to_float" ( x -- y ) }
507     { "float*" "math.private" "primitive_float_multiply" ( x y -- z ) }
508     { "float+" "math.private" "primitive_float_add" ( x y -- z ) }
509     { "float-" "math.private" "primitive_float_subtract" ( x y -- z ) }
510     { "float-u<" "math.private" "primitive_float_less" ( x y -- ? ) }
511     { "float-u<=" "math.private" "primitive_float_lesseq" ( x y -- ? ) }
512     { "float-u>" "math.private" "primitive_float_greater" ( x y -- ? ) }
513     { "float-u>=" "math.private" "primitive_float_greatereq" ( x y -- ? ) }
514     { "float/f" "math.private" "primitive_float_divfloat" ( x y -- z ) }
515     { "float<" "math.private" "primitive_float_less" ( x y -- ? ) }
516     { "float<=" "math.private" "primitive_float_lesseq" ( x y -- ? ) }
517     { "float=" "math.private" "primitive_float_eq" ( x y -- ? ) }
518     { "float>" "math.private" "primitive_float_greater" ( x y -- ? ) }
519     { "float>=" "math.private" "primitive_float_greatereq" ( x y -- ? ) }
520     { "float>bignum" "math.private" "primitive_float_to_bignum" ( x -- y ) }
521     { "float>fixnum" "math.private" "primitive_float_to_fixnum" ( x -- y ) }
522     { "all-instances" "memory" "primitive_all_instances" ( -- array ) }
523     { "(code-blocks)" "tools.memory.private" "primitive_code_blocks" ( -- array ) }
524     { "(code-room)" "tools.memory.private" "primitive_code_room" ( -- allocator-room ) }
525     { "compact-gc" "memory" "primitive_compact_gc" ( -- ) }
526     { "(callback-room)" "tools.memory.private" "primitive_callback_room" ( -- allocator-room ) }
527     { "(data-room)" "tools.memory.private" "primitive_data_room" ( -- data-room ) }
528     { "disable-gc-events" "tools.memory.private" "primitive_disable_gc_events" ( -- events ) }
529     { "enable-gc-events" "tools.memory.private" "primitive_enable_gc_events" ( -- ) }
530     { "gc" "memory" "primitive_full_gc" ( -- ) }
531     { "minor-gc" "memory" "primitive_minor_gc" ( -- ) }
532     { "size" "memory" "primitive_size" ( obj -- n ) }
533     { "(save-image)" "memory.private" "primitive_save_image" ( path1 path2 -- ) }
534     { "(save-image-and-exit)" "memory.private" "primitive_save_image_and_exit" ( path1 path2 -- ) }
535     { "jit-compile" "quotations" "primitive_jit_compile" ( quot -- ) }
536     { "quot-compiled?" "quotations" "primitive_quot_compiled_p" ( quot -- ? ) }
537     { "quotation-code" "quotations" "primitive_quotation_code" ( quot -- start end ) }
538     { "array>quotation" "quotations.private" "primitive_array_to_quotation" ( array -- quot ) }
539     { "set-slot" "slots.private" "primitive_set_slot" ( value obj n -- ) }
540     { "<string>" "strings" "primitive_string" ( n ch -- string ) }
541     { "resize-string" "strings" "primitive_resize_string" ( n str -- newstr ) }
542     { "set-string-nth-fast" "strings.private" "primitive_set_string_nth_fast" ( ch n string -- ) }
543     { "(exit)" "system" "primitive_exit" ( n -- * ) }
544     { "nano-count" "system" "primitive_nano_count" ( -- ns ) }
545     { "(sleep)" "threads.private" "primitive_sleep" ( nanos -- ) }
546     { "callstack-for" "threads.private" "primitive_callstack_for" ( context -- array ) }
547     { "context-object-for" "threads.private" "primitive_context_object_for" ( n context -- obj ) }
548     { "datastack-for" "threads.private" "primitive_datastack_for" ( context -- array ) }
549     { "retainstack-for" "threads.private" "primitive_retainstack_for" ( context -- array ) }
550     { "dispatch-stats" "tools.dispatch.private" "primitive_dispatch_stats" ( -- stats ) }
551     { "reset-dispatch-stats" "tools.dispatch.private" "primitive_reset_dispatch_stats" ( -- ) }
552     { "optimized?" "words" "primitive_optimized_p" ( word -- ? ) }
553     { "word-code" "words" "primitive_word_code" ( word -- start end ) }
554     { "(word)" "words.private" "primitive_word" ( name vocab hashcode -- word ) }
555     { "profiling" "tools.profiler.sampling.private" "primitive_sampling_profiler" ( ? -- ) }
556     { "(get-samples)" "tools.profiler.sampling.private" "primitive_get_samples" ( -- samples/f ) }
557     { "(clear-samples)" "tools.profiler.sampling.private" "primitive_clear_samples" ( -- ) }
558 } [ first4 make-primitive ] each
559
560 ! Bump build number
561 "build" "kernel" create build 1 + [ ] curry ( -- n ) define-declared
562
563 ] with-compilation-unit