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