1 ! Copyright (C) 2007, 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors arrays assocs assocs.private classes
4 classes.tuple.private compiler.units cpu.architecture hashtables
5 hashtables.private io kernel libc math math.parser memory
6 namespaces namespaces.private quotations quotations.private
7 sbufs sequences sequences.private splitting system vectors
8 vocabs vocabs.loader words ;
9 FROM: compiler => enable-optimizer ;
10 IN: bootstrap.compiler
12 ! Don't bring this in when deploying, since it will store a
13 ! reference to 'eval' in a global variable
15 "alien.remote-control" require
18 { "boostrap.compiler" "prettyprint" } "alien.prettyprint" require-when
19 ! USE-WHEN-LOADED: alien.prettyprint { "boostrap.compiler" "prettyprint" }
21 "cpu." cpu name>> append require
27 ! Push all tuple layouts to tenured space to improve method caching
30 : compile-unoptimized ( words -- )
31 [ [ subwords ] map ] keep suffix concat
32 [ word-optimized? ] reject compile ;
34 "debug-compiler" get [
37 "Compiling..." write flush
39 ! Compile a set of words ahead of the full compile.
40 ! This set of words was determined semi-empirically
41 ! using the profiler. It improves bootstrap time
42 ! significantly, because frequently called words
43 ! which are also quick to compile are replaced by
44 ! compiled definitions as soon as possible.
50 array? hashtable? vector?
51 tuple? sbuf? tombstone?
52 curried? composed? callable?
57 array-nth set-array-nth
69 bitand bitor bitxor bitnot
75 + * 2/ < <= > >= shift
81 new-sequence nth push pop last flip
87 hashcode* = equal? assoc-stack (assoc-stack) get set
93 member-eq? split harvest sift cut cut-slice subseq-start index clone
94 set-at reverse push-all class-of number>string string>number
101 read-lines prefix suffix unclip new-assoc assoc-union!
102 word-prop set-word-prop 1array 2array 3array ?nth
103 } compile-unoptimized
108 "GetLastError" "windows.kernel32" lookup-word
109 "FormatMessageW" "windows.kernel32" lookup-word
110 2array compile-unoptimized
114 "(dlerror)" "alien.libraries.unix" lookup-word
115 1array compile-unoptimized
119 malloc calloc free memcpy
120 } compile-unoptimized
124 loaded-vocab-names [ vocab-words compile-unoptimized "." write flush ] each
128 "alien.syntax" require
129 "io.streams.byte-array.fast" require