1 ! Copyright (C) 2007, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors compiler 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
9 compiler.units math.order compiler.tree.builder
10 compiler.tree.optimizer compiler.cfg.optimizer ;
11 IN: bootstrap.compiler
13 ! Don't bring this in when deploying, since it will store a
14 ! reference to 'eval' in a global variable
15 "deploy-vocab" get "staging" get or [
16 "alien.remote-control" require
20 "stack-checker.errors.prettyprint" require
21 "alien.prettyprint" require
24 "cpu." cpu name>> append require
28 : compile-unoptimized ( words -- )
29 [ optimized>> not ] filter compile ;
32 "Compiling..." write flush
34 ! Compile a set of words ahead of the full compile.
35 ! This set of words was determined semi-empirically
36 ! using the profiler. It improves bootstrap time
37 ! significantly, because frequenly called words
38 ! which are also quick to compile are replaced by
39 ! compiled definitions as soon as possible.
41 roll -roll declare not
43 array? hashtable? vector?
44 tuple? sbuf? tombstone?
46 array-nth set-array-nth
56 bitand bitor bitxor bitnot
62 + 1+ 1- 2/ < <= > >= shift
68 new-sequence nth push pop peek flip
80 memq? split harvest sift cut cut-slice start index clone
81 set-at reverse push-all class number>string string>number
87 lines prefix suffix unclip new-assoc update
88 word-prop set-word-prop 1array 2array 3array ?nth
94 malloc calloc free memcpy
99 { build-tree } compile-unoptimized
103 { optimize-tree } compile-unoptimized
107 { optimize-cfg } compile-unoptimized
111 { (compile) } compile-unoptimized
115 vocabs [ words compile-unoptimized "." write flush ] each