]> gitweb.factorcode.org Git - factor.git/blob - core/bootstrap/primitives.factor
vm: strip out call-counting profiler
[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.singleton classes.tuple
8 classes.tuple.private kernel.private vocabs vocabs.loader
9 source-files definitions slots classes.union
10 classes.intersection classes.predicate compiler.units
11 bootstrap.image.private io.files accessors 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     { "windows-x86.32" "x86/32/windows" }
22     { "windows-x86.64" "x86/64/windows" }
23     { "unix-x86.32"  "x86/32/unix"  }
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" lookup-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.counting.private"
108     "tools.profiler.sampling.private"
109     "words"
110     "words.private"
111     "vectors"
112     "vectors.private"
113     "vm"
114 } [ create-vocab drop ] each
115
116 ! Builtin classes
117 : lookup-type-number ( word -- n )
118     [ target-word ] with-global type-number ;
119
120 : register-builtin ( class -- )
121     [ dup lookup-type-number "type" set-word-prop ]
122     [ dup "type" word-prop builtins get set-nth ]
123     [ f f f builtin-class define-class ]
124     tri ;
125
126 : prepare-slots ( slots -- slots' )
127     [ [ dup pair? [ first2 create ] when ] map ] map ;
128
129 : define-builtin-slots ( class slots -- )
130     prepare-slots make-slots 1 finalize-slots
131     [ "slots" set-word-prop ] [ define-accessors ] 2bi ;
132
133 : define-builtin-predicate ( class -- )
134     dup class>type [ eq? ] curry [ tag ] prepend define-predicate ;
135
136 : define-builtin ( symbol slotspec -- )
137     [ [ define-builtin-predicate ] keep ] dip define-builtin-slots ;
138
139 "fixnum" "math" create register-builtin
140 "bignum" "math" create register-builtin
141 "tuple" "kernel" create register-builtin
142 "float" "math" create register-builtin
143 "f" "syntax" lookup-word register-builtin
144 "array" "arrays" create register-builtin
145 "wrapper" "kernel" create register-builtin
146 "callstack" "kernel" create register-builtin
147 "string" "strings" create register-builtin
148 "quotation" "quotations" create register-builtin
149 "dll" "alien" create register-builtin
150 "alien" "alien" create register-builtin
151 "word" "words" create register-builtin
152 "byte-array" "byte-arrays" create register-builtin
153
154 ! We need this before defining c-ptr below
155 "f" "syntax" lookup-word { } define-builtin
156
157 "f" "syntax" create [ not ] "predicate" set-word-prop
158 "f?" "syntax" vocab-words delete-at
159
160 "t" "syntax" lookup-word define-singleton-class
161
162 ! Some unions
163 "c-ptr" "alien" create [
164     "alien" "alien" lookup-word ,
165     "f" "syntax" lookup-word ,
166     "byte-array" "byte-arrays" lookup-word ,
167 ] { } make define-union-class
168
169 ! A predicate class used for declarations
170 "array-capacity" "sequences.private" create
171 "fixnum" "math" lookup-word
172 [
173     [ dup 0 fixnum>= ] %
174     bootstrap-max-array-capacity <fake-bignum> [ fixnum<= ] curry ,
175     [ [ drop f ] if ] %
176 ] [ ] make
177 define-predicate-class
178
179 "array-capacity" "sequences.private" lookup-word
180 [ >fixnum ] bootstrap-max-array-capacity <fake-bignum> [ fixnum-bitand ] curry append
181 "coercer" set-word-prop
182
183 ! Catch-all class for providing a default method.
184 "object" "kernel" create
185 [ f f { } intersection-class define-class ]
186 [ [ drop t ] "predicate" set-word-prop ]
187 bi
188
189 "object?" "kernel" vocab-words delete-at
190
191 ! Empty class with no instances
192 "null" "kernel" create
193 [ f { } f union-class define-class ]
194 [ [ drop f ] "predicate" set-word-prop ]
195 bi
196
197 "null?" "kernel" vocab-words delete-at
198
199 "fixnum" "math" create { } define-builtin
200 "fixnum" "math" create ">fixnum" "math" create 1quotation "coercer" set-word-prop
201
202 "bignum" "math" create { } define-builtin
203 "bignum" "math" create ">bignum" "math" create 1quotation "coercer" set-word-prop
204
205 "float" "math" create { } define-builtin
206 "float" "math" create ">float" "math" create 1quotation "coercer" set-word-prop
207
208 "array" "arrays" create {
209     { "length" { "array-capacity" "sequences.private" } read-only }
210 } define-builtin
211
212 "wrapper" "kernel" create {
213     { "wrapped" read-only }
214 } define-builtin
215
216 "string" "strings" create {
217     { "length" { "array-capacity" "sequences.private" } read-only }
218     "aux"
219 } define-builtin
220
221 "quotation" "quotations" create {
222     { "array" { "array" "arrays" } read-only }
223     "cached-effect"
224     "cache-counter"
225 } define-builtin
226
227 "dll" "alien" create {
228     { "path" { "byte-array" "byte-arrays" } read-only }
229 } define-builtin
230
231 "alien" "alien" create {
232     { "underlying" { "c-ptr" "alien" } read-only }
233     "expired"
234 } define-builtin
235
236 "word" "words" create {
237     { "hashcode" { "fixnum" "math" } }
238     "name"
239     "vocabulary"
240     { "def" { "quotation" "quotations" } initial: [ ] }
241     "props"
242     "pic-def"
243     "pic-tail-def"
244     { "sub-primitive" read-only }
245 } define-builtin
246
247 "byte-array" "byte-arrays" create {
248     { "length" { "array-capacity" "sequences.private" } read-only }
249 } define-builtin
250
251 "callstack" "kernel" create { } define-builtin
252
253 "tuple" "kernel" create
254 [ { } define-builtin ]
255 [ define-tuple-layout ]
256 bi
257
258 ! Create special tombstone values
259 "tombstone" "hashtables.private" create
260 tuple
261 { "state" } define-tuple-class
262
263 "((empty))" "hashtables.private" create
264 "tombstone" "hashtables.private" lookup-word f
265 2array >tuple 1quotation ( -- value ) define-inline
266
267 "((tombstone))" "hashtables.private" create
268 "tombstone" "hashtables.private" lookup-word t
269 2array >tuple 1quotation ( -- value ) define-inline
270
271 ! Some tuple classes
272 "curry" "kernel" create
273 tuple
274 {
275     { "obj" read-only }
276     { "quot" read-only }
277 } prepare-slots define-tuple-class
278
279 "curry" "kernel" lookup-word
280 {
281     [ f "inline" set-word-prop ]
282     [ make-flushable ]
283     [ ]
284     [
285         [
286             callable instance-check-quot %
287             tuple-layout ,
288             \ <tuple-boa> ,
289         ] [ ] make
290     ]
291 } cleave
292 ( obj quot -- curry ) define-declared
293
294 "compose" "kernel" create
295 tuple
296 {
297     { "first" read-only }
298     { "second" read-only }
299 } prepare-slots define-tuple-class
300
301 "compose" "kernel" lookup-word
302 {
303     [ f "inline" set-word-prop ]
304     [ make-flushable ]
305     [ ]
306     [
307         [
308             callable instance-check-quot [ dip ] curry %
309             callable instance-check-quot %
310             tuple-layout ,
311             \ <tuple-boa> ,
312         ] [ ] make
313     ]
314 } cleave
315 ( quot1 quot2 -- compose ) define-declared
316
317 ! Sub-primitive words
318 : make-sub-primitive ( word vocab effect -- )
319     [
320         create
321         dup t "primitive" set-word-prop
322         dup 1quotation
323     ] dip define-declared ;
324
325 {
326     { "mega-cache-lookup" "generic.single.private" ( methods index cache -- ) }
327     { "inline-cache-miss" "generic.single.private" ( generic methods index cache -- ) }
328     { "inline-cache-miss-tail" "generic.single.private" ( generic methods index cache -- ) }
329     { "drop" "kernel" ( x -- ) }
330     { "2drop" "kernel" ( x y -- ) }
331     { "3drop" "kernel" ( x y z -- ) }
332     { "dup" "kernel" ( x -- x x ) }
333     { "2dup" "kernel" ( x y -- x y x y ) }
334     { "3dup" "kernel" ( x y z -- x y z x y z ) }
335     { "rot" "kernel" ( x y z -- y z x ) }
336     { "-rot" "kernel" ( x y z -- z x y ) }
337     { "dupd" "kernel" ( x y -- x x y ) }
338     { "swapd" "kernel" ( x y z -- y x z ) }
339     { "nip" "kernel" ( x y -- y ) }
340     { "2nip" "kernel" ( x y z -- z ) }
341     { "over" "kernel" ( x y -- x y x ) }
342     { "pick" "kernel" ( x y z -- x y z x ) }
343     { "swap" "kernel" ( x y -- y x ) }
344     { "eq?" "kernel" ( obj1 obj2 -- ? ) }
345     { "tag" "kernel.private" ( object -- n ) }
346     { "(execute)" "kernel.private" ( word -- ) }
347     { "(call)" "kernel.private" ( quot -- ) }
348     { "fpu-state" "kernel.private" ( -- ) }
349     { "set-fpu-state" "kernel.private" ( -- ) }
350     { "signal-handler" "kernel.private" ( -- ) }
351     { "leaf-signal-handler" "kernel.private" ( -- ) }
352     { "ffi-signal-handler" "kernel.private" ( -- ) }
353     { "ffi-leaf-signal-handler" "kernel.private" ( -- ) }
354     { "unwind-native-frames" "kernel.private" ( -- ) }
355     { "set-callstack" "kernel.private" ( callstack -- * ) }
356     { "lazy-jit-compile" "kernel.private" ( -- ) }
357     { "c-to-factor" "kernel.private" ( -- ) }
358     { "slot" "slots.private" ( obj m -- value ) }
359     { "get-local" "locals.backend" ( n -- obj ) }
360     { "load-local" "locals.backend" ( obj -- ) }
361     { "drop-locals" "locals.backend" ( n -- ) }
362     { "both-fixnums?" "math.private" ( x y -- ? ) }
363     { "fixnum+fast" "math.private" ( x y -- z ) }
364     { "fixnum-fast" "math.private" ( x y -- z ) }
365     { "fixnum*fast" "math.private" ( x y -- z ) }
366     { "fixnum-bitand" "math.private" ( x y -- z ) }
367     { "fixnum-bitor" "math.private" ( x y -- z ) }
368     { "fixnum-bitxor" "math.private" ( x y -- z ) }
369     { "fixnum-bitnot" "math.private" ( x -- y ) }
370     { "fixnum-mod" "math.private" ( x y -- z ) }
371     { "fixnum-shift-fast" "math.private" ( x y -- z ) }
372     { "fixnum/i-fast" "math.private" ( x y -- z ) }
373     { "fixnum/mod-fast" "math.private" ( x y -- z w ) }
374     { "fixnum+" "math.private" ( x y -- z ) }
375     { "fixnum-" "math.private" ( x y -- z ) }
376     { "fixnum*" "math.private" ( x y -- z ) }
377     { "fixnum<" "math.private" ( x y -- ? ) }
378     { "fixnum<=" "math.private" ( x y -- z ) }
379     { "fixnum>" "math.private" ( x y -- ? ) }
380     { "fixnum>=" "math.private" ( x y -- ? ) }
381     { "string-nth-fast" "strings.private" ( n string -- ch ) }
382     { "(set-context)" "threads.private" ( obj context -- obj' ) }
383     { "(set-context-and-delete)" "threads.private" ( obj context -- * ) }
384     { "(start-context)" "threads.private" ( obj quot -- obj' ) }
385     { "(start-context-and-delete)" "threads.private" ( obj quot -- * ) }
386 } [ first3 make-sub-primitive ] each
387
388 ! Primitive words
389 : make-primitive ( word vocab function effect -- )
390     [
391         [
392             create
393             dup reset-word
394             dup t "primitive" set-word-prop
395         ] dip
396         ascii string>alien [ do-primitive ] curry
397     ] dip define-declared ;
398
399 {
400     { "<callback>" "alien" "primitive_callback" ( return-rewind word -- alien ) }
401     { "<displaced-alien>" "alien" "primitive_displaced_alien" ( displacement c-ptr -- alien ) }
402     { "alien-address" "alien" "primitive_alien_address" ( c-ptr -- addr ) }
403     { "alien-cell" "alien.accessors" "primitive_alien_cell" ( c-ptr n -- value ) }
404     { "alien-double" "alien.accessors" "primitive_alien_double" ( c-ptr n -- value ) }
405     { "alien-float" "alien.accessors" "primitive_alien_float" ( c-ptr n -- value ) }
406     { "alien-signed-1" "alien.accessors" "primitive_alien_signed_1" ( c-ptr n -- value ) }
407     { "alien-signed-2" "alien.accessors" "primitive_alien_signed_2" ( c-ptr n -- value ) }
408     { "alien-signed-4" "alien.accessors" "primitive_alien_signed_4" ( c-ptr n -- value ) }
409     { "alien-signed-8" "alien.accessors" "primitive_alien_signed_8" ( c-ptr n -- value ) }
410     { "alien-signed-cell" "alien.accessors" "primitive_alien_signed_cell" ( c-ptr n -- value ) }
411     { "alien-unsigned-1" "alien.accessors" "primitive_alien_unsigned_1" ( c-ptr n -- value ) }
412     { "alien-unsigned-2" "alien.accessors" "primitive_alien_unsigned_2" ( c-ptr n -- value ) }
413     { "alien-unsigned-4" "alien.accessors" "primitive_alien_unsigned_4" ( c-ptr n -- value ) }
414     { "alien-unsigned-8" "alien.accessors" "primitive_alien_unsigned_8" ( c-ptr n -- value ) }
415     { "alien-unsigned-cell" "alien.accessors" "primitive_alien_unsigned_cell" ( c-ptr n -- value ) }
416     { "set-alien-cell" "alien.accessors" "primitive_set_alien_cell" ( value c-ptr n -- ) }
417     { "set-alien-double" "alien.accessors" "primitive_set_alien_double" ( value c-ptr n -- ) }
418     { "set-alien-float" "alien.accessors" "primitive_set_alien_float" ( value c-ptr n -- ) }
419     { "set-alien-signed-1" "alien.accessors" "primitive_set_alien_signed_1" ( value c-ptr n -- ) }
420     { "set-alien-signed-2" "alien.accessors" "primitive_set_alien_signed_2" ( value c-ptr n -- ) }
421     { "set-alien-signed-4" "alien.accessors" "primitive_set_alien_signed_4" ( value c-ptr n -- ) }
422     { "set-alien-signed-8" "alien.accessors" "primitive_set_alien_signed_8" ( value c-ptr n -- ) }
423     { "set-alien-signed-cell" "alien.accessors" "primitive_set_alien_signed_cell" ( value c-ptr n -- ) }
424     { "set-alien-unsigned-1" "alien.accessors" "primitive_set_alien_unsigned_1" ( value c-ptr n -- ) }
425     { "set-alien-unsigned-2" "alien.accessors" "primitive_set_alien_unsigned_2" ( value c-ptr n -- ) }
426     { "set-alien-unsigned-4" "alien.accessors" "primitive_set_alien_unsigned_4" ( value c-ptr n -- ) }
427     { "set-alien-unsigned-8" "alien.accessors" "primitive_set_alien_unsigned_8" ( value c-ptr n -- ) }
428     { "set-alien-unsigned-cell" "alien.accessors" "primitive_set_alien_unsigned_cell" ( value c-ptr n -- ) }
429     { "(dlopen)" "alien.libraries" "primitive_dlopen" ( path -- dll ) }
430     { "(dlsym)" "alien.libraries" "primitive_dlsym" ( name dll -- alien ) }
431     { "(dlsym-raw)" "alien.libraries" "primitive_dlsym_raw" ( name dll -- alien ) }
432     { "dlclose" "alien.libraries" "primitive_dlclose" ( dll -- ) }
433     { "dll-valid?" "alien.libraries" "primitive_dll_validp" ( dll -- ? ) }
434     { "current-callback" "alien.private" "primitive_current_callback" ( -- n ) }
435     { "<array>" "arrays" "primitive_array" ( n elt -- array ) }
436     { "resize-array" "arrays" "primitive_resize_array" ( n array -- new-array ) }
437     { "(byte-array)" "byte-arrays" "primitive_uninitialized_byte_array" ( n -- byte-array ) }
438     { "<byte-array>" "byte-arrays" "primitive_byte_array" ( n -- byte-array ) }
439     { "resize-byte-array" "byte-arrays" "primitive_resize_byte_array" ( n byte-array -- new-byte-array ) }
440     { "<tuple-boa>" "classes.tuple.private" "primitive_tuple_boa" ( slots... layout -- tuple ) }
441     { "<tuple>" "classes.tuple.private" "primitive_tuple" ( layout -- tuple ) }
442     { "modify-code-heap" "compiler.units" "primitive_modify_code_heap" ( alist update-existing? reset-pics? -- ) }
443     { "lookup-method" "generic.single.private" "primitive_lookup_method" ( object methods -- method ) }
444     { "mega-cache-miss" "generic.single.private" "primitive_mega_cache_miss" ( methods index cache -- method ) }
445     { "(exists?)" "io.files.private" "primitive_existsp" ( path -- ? ) }
446     { "(fopen)" "io.streams.c" "primitive_fopen" ( path mode -- alien ) }
447     { "fclose" "io.streams.c" "primitive_fclose" ( alien -- ) }
448     { "fflush" "io.streams.c" "primitive_fflush" ( alien -- ) }
449     { "fgetc" "io.streams.c" "primitive_fgetc" ( alien -- byte/f ) }
450     { "fputc" "io.streams.c" "primitive_fputc" ( byte alien -- ) }
451     { "fread-unsafe" "io.streams.c" "primitive_fread" ( n buf alien -- count ) }
452     { "fseek" "io.streams.c" "primitive_fseek" ( alien offset whence -- ) }
453     { "ftell" "io.streams.c" "primitive_ftell" ( alien -- n ) }
454     { "fwrite" "io.streams.c" "primitive_fwrite" ( data length alien -- ) }
455     { "(clone)" "kernel" "primitive_clone" ( obj -- newobj ) }
456     { "<wrapper>" "kernel" "primitive_wrapper" ( obj -- wrapper ) }
457     { "callstack" "kernel" "primitive_callstack" ( -- callstack ) }
458     { "callstack>array" "kernel" "primitive_callstack_to_array" ( callstack -- array ) }
459     { "datastack" "kernel" "primitive_datastack" ( -- array ) }
460     { "die" "kernel" "primitive_die" ( -- ) }
461     { "retainstack" "kernel" "primitive_retainstack" ( -- array ) }
462     { "(identity-hashcode)" "kernel.private" "primitive_identity_hashcode" ( obj -- code ) }
463     { "become" "kernel.private" "primitive_become" ( old new -- ) }
464     { "callstack-bounds" "kernel.private" "primitive_callstack_bounds" ( -- start end ) }
465     { "check-datastack" "kernel.private" "primitive_check_datastack" ( array in# out# -- ? ) }
466     { "compute-identity-hashcode" "kernel.private" "primitive_compute_identity_hashcode" ( obj -- ) }
467     { "context-object" "kernel.private" "primitive_context_object" ( n -- obj ) }
468     { "innermost-frame-executing" "kernel.private" "primitive_innermost_stack_frame_executing" ( callstack -- obj ) }
469     { "innermost-frame-scan" "kernel.private" "primitive_innermost_stack_frame_scan" ( callstack -- n ) }
470     { "set-context-object" "kernel.private" "primitive_set_context_object" ( obj n -- ) }
471     { "set-datastack" "kernel.private" "primitive_set_datastack" ( array -- ) }
472     { "set-innermost-frame-quot" "kernel.private" "primitive_set_innermost_stack_frame_quot" ( n callstack -- ) }
473     { "set-retainstack" "kernel.private" "primitive_set_retainstack" ( array -- ) }
474     { "set-special-object" "kernel.private" "primitive_set_special_object" ( obj n -- ) }
475     { "special-object" "kernel.private" "primitive_special_object" ( n -- obj ) }
476     { "strip-stack-traces" "kernel.private" "primitive_strip_stack_traces" ( -- ) }
477     { "unimplemented" "kernel.private" "primitive_unimplemented" ( -- * ) }
478     { "load-locals" "locals.backend" "primitive_load_locals" ( ... n -- ) }
479     { "bits>double" "math" "primitive_bits_double" ( n -- x ) }
480     { "bits>float" "math" "primitive_bits_float" ( n -- x ) }
481     { "double>bits" "math" "primitive_double_bits" ( x -- n ) }
482     { "float>bits" "math" "primitive_float_bits" ( x -- n ) }
483     { "(format-float)" "math.parser.private" "primitive_format_float" ( n format -- byte-array ) }
484     { "bignum*" "math.private" "primitive_bignum_multiply" ( x y -- z ) }
485     { "bignum+" "math.private" "primitive_bignum_add" ( x y -- z ) }
486     { "bignum-" "math.private" "primitive_bignum_subtract" ( x y -- z ) }
487     { "bignum-bit?" "math.private" "primitive_bignum_bitp" ( n x -- ? ) }
488     { "bignum-bitand" "math.private" "primitive_bignum_and" ( x y -- z ) }
489     { "bignum-bitnot" "math.private" "primitive_bignum_not" ( x -- y ) }
490     { "bignum-bitor" "math.private" "primitive_bignum_or" ( x y -- z ) }
491     { "bignum-bitxor" "math.private" "primitive_bignum_xor" ( x y -- z ) }
492     { "bignum-log2" "math.private" "primitive_bignum_log2" ( x -- n ) }
493     { "bignum-mod" "math.private" "primitive_bignum_mod" ( x y -- z ) }
494     { "bignum-shift" "math.private" "primitive_bignum_shift" ( x y -- z ) }
495     { "bignum/i" "math.private" "primitive_bignum_divint" ( x y -- z ) }
496     { "bignum/mod" "math.private" "primitive_bignum_divmod" ( x y -- z w ) }
497     { "bignum<" "math.private" "primitive_bignum_less" ( x y -- ? ) }
498     { "bignum<=" "math.private" "primitive_bignum_lesseq" ( x y -- ? ) }
499     { "bignum=" "math.private" "primitive_bignum_eq" ( x y -- ? ) }
500     { "bignum>" "math.private" "primitive_bignum_greater" ( x y -- ? ) }
501     { "bignum>=" "math.private" "primitive_bignum_greatereq" ( x y -- ? ) }
502     { "bignum>fixnum" "math.private" "primitive_bignum_to_fixnum" ( x -- y ) }
503     { "fixnum-shift" "math.private" "primitive_fixnum_shift" ( x y -- z ) }
504     { "fixnum/i" "math.private" "primitive_fixnum_divint" ( x y -- z ) }
505     { "fixnum/mod" "math.private" "primitive_fixnum_divmod" ( x y -- z w ) }
506     { "fixnum>bignum" "math.private" "primitive_fixnum_to_bignum" ( x -- y ) }
507     { "fixnum>float" "math.private" "primitive_fixnum_to_float" ( x -- y ) }
508     { "float*" "math.private" "primitive_float_multiply" ( x y -- z ) }
509     { "float+" "math.private" "primitive_float_add" ( x y -- z ) }
510     { "float-" "math.private" "primitive_float_subtract" ( x y -- z ) }
511     { "float-u<" "math.private" "primitive_float_less" ( x y -- ? ) }
512     { "float-u<=" "math.private" "primitive_float_lesseq" ( x y -- ? ) }
513     { "float-u>" "math.private" "primitive_float_greater" ( x y -- ? ) }
514     { "float-u>=" "math.private" "primitive_float_greatereq" ( x y -- ? ) }
515     { "float/f" "math.private" "primitive_float_divfloat" ( x y -- z ) }
516     { "float<" "math.private" "primitive_float_less" ( x y -- ? ) }
517     { "float<=" "math.private" "primitive_float_lesseq" ( x y -- ? ) }
518     { "float=" "math.private" "primitive_float_eq" ( x y -- ? ) }
519     { "float>" "math.private" "primitive_float_greater" ( x y -- ? ) }
520     { "float>=" "math.private" "primitive_float_greatereq" ( x y -- ? ) }
521     { "float>bignum" "math.private" "primitive_float_to_bignum" ( x -- y ) }
522     { "float>fixnum" "math.private" "primitive_float_to_fixnum" ( x -- y ) }
523     { "all-instances" "memory" "primitive_all_instances" ( -- array ) }
524     { "(code-blocks)" "tools.memory.private" "primitive_code_blocks" ( -- array ) }
525     { "(code-room)" "tools.memory.private" "primitive_code_room" ( -- code-room ) }
526     { "compact-gc" "memory" "primitive_compact_gc" ( -- ) }
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     { "profiling" "tools.profiler.counting.private" "primitive_counting_profiler" ( ? -- ) }
553     { "optimized?" "words" "primitive_optimized_p" ( word -- ? ) }
554     { "word-code" "words" "primitive_word_code" ( word -- start end ) }
555     { "(word)" "words.private" "primitive_word" ( name vocab hashcode -- word ) }
556     { "profiling" "tools.profiler.sampling.private" "primitive_sampling_profiler" ( ? -- ) }
557     { "(get-samples)" "tools.profiler.sampling.private" "primitive_get_samples" ( -- samples/f ) }
558     { "(clear-samples)" "tools.profiler.sampling.private" "primitive_clear_samples" ( -- ) }
559 } [ first4 make-primitive ] each
560
561 ! Bump build number
562 "build" "kernel" create build 1 + [ ] curry ( -- n ) define-declared
563
564 ] with-compilation-unit