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
20 "cpu." cpu name>> append require
26 ! Push all tuple layouts to tenured space to improve method caching
29 : compile-unoptimized ( words -- )
30 [ [ subwords ] map ] keep suffix concat
31 [ word-optimized? ] reject compile ;
33 "debug-compiler" get [
36 "Compiling..." write flush
38 ! Compile a set of words ahead of the full compile.
39 ! This set of words was determined semi-empirically
40 ! using the profiler. It improves bootstrap time
41 ! significantly, because frequently called words
42 ! which are also quick to compile are replaced by
43 ! compiled definitions as soon as possible.
49 array? hashtable? vector?
50 tuple? sbuf? tombstone?
51 curried? composed? callable?
56 array-nth set-array-nth
68 bitand bitor bitxor bitnot
74 + * 2/ < <= > >= shift
80 new-sequence nth push pop last flip
86 hashcode* = equal? assoc-stack (assoc-stack) get set
92 member-eq? split harvest sift cut cut-slice subseq-start index clone
93 set-at reverse push-all class-of number>string string>number
100 read-lines prefix suffix unclip new-assoc assoc-union!
101 word-prop set-word-prop 1array 2array 3array ?nth
102 } compile-unoptimized
107 "GetLastError" "windows.kernel32" lookup-word
108 "FormatMessageW" "windows.kernel32" lookup-word
109 2array compile-unoptimized
113 "(dlerror)" "alien.libraries.unix" lookup-word
114 1array compile-unoptimized
118 malloc calloc free memcpy
119 } compile-unoptimized
123 loaded-vocab-names [ vocab-words compile-unoptimized "." write flush ] each
127 "alien.syntax" require
128 "io.streams.byte-array.fast" require