1 ! Copyright (C) 2007, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors cpu.architecture vocabs.loader system
4 sequences namespaces parser kernel kernel.private classes
5 classes.private arrays hashtables vectors classes.tuple sbufs
6 hashtables.private sequences.private math classes.tuple.private
7 growable namespaces.private assocs words command-line vocabs io
8 io.encodings.string libc splitting math.parser memory compiler.units
9 math.order compiler.tree.builder compiler.tree.optimizer
10 compiler.cfg.optimizer ;
11 FROM: compiler => enable-optimizer compile-word ;
12 IN: bootstrap.compiler
14 ! Don't bring this in when deploying, since it will store a
15 ! reference to 'eval' in a global variable
16 "deploy-vocab" get "staging" get or [
17 "alien.remote-control" require
21 "stack-checker.errors.prettyprint" require
22 "alien.prettyprint" require
25 "cpu." cpu name>> append require
29 ! Push all tuple layouts to tenured space to improve method caching
32 : compile-unoptimized ( words -- )
33 [ optimized? not ] filter compile ;
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 frequenly called words
42 ! which are also quick to compile are replaced by
43 ! compiled definitions as soon as possible.
47 array? hashtable? vector?
48 tuple? sbuf? tombstone?
50 array-nth set-array-nth
60 bitand bitor bitxor bitnot
66 + 1+ 1- 2/ < <= > >= shift
72 new-sequence nth push pop last flip
84 memq? split harvest sift cut cut-slice start index clone
85 set-at reverse push-all class number>string string>number
91 lines prefix suffix unclip new-assoc update
92 word-prop set-word-prop 1array 2array 3array ?nth
98 malloc calloc free memcpy
103 { build-tree } compile-unoptimized
107 { optimize-tree } compile-unoptimized
111 { optimize-cfg } compile-unoptimized
115 { compile-word } compile-unoptimized
119 vocabs [ words compile-unoptimized "." write flush ] each