]> gitweb.factorcode.org Git - factor.git/blob - core/bootstrap/compiler/compiler.factor
5480bac4f581f6fb478c3fd10b98599a6e3a7a11
[factor.git] / core / bootstrap / compiler / compiler.factor
1 ! Copyright (C) 2007, 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: compiler cpu.architecture vocabs.loader system sequences
4 namespaces parser kernel kernel.private classes classes.private
5 arrays hashtables vectors classes.tuple sbufs inference.dataflow
6 hashtables.private sequences.private math classes.tuple.private
7 growable namespaces.private assocs words generator command-line
8 vocabs io prettyprint libc compiler.units math.order ;
9 IN: bootstrap.compiler
10
11 ! Don't bring this in when deploying, since it will store a
12 ! reference to 'eval' in a global variable
13 "deploy-vocab" get [
14     "alien.remote-control" require
15 ] unless
16
17 "cpu." cpu word-name append require
18
19 enable-compiler
20
21 : compile-uncompiled ( words -- )
22     [ compiled? not ] filter compile ;
23
24 nl
25 "Compiling..." write flush
26
27 ! Compile a set of words ahead of the full compile.
28 ! This set of words was determined semi-empirically
29 ! using the profiler. It improves bootstrap time
30 ! significantly, because frequenly called words
31 ! which are also quick to compile are replaced by
32 ! compiled definitions as soon as possible.
33 {
34     roll -roll declare not
35
36     array? hashtable? vector?
37     tuple? sbuf? node? tombstone?
38
39     array-capacity array-nth set-array-nth
40
41     wrap probe
42
43     underlying
44
45     namestack*
46
47     bitand bitor bitxor bitnot
48 } compile-uncompiled
49
50 "." write flush
51
52 {
53     + 1+ 1- 2/ < <= > >= shift
54 } compile-uncompiled
55
56 "." write flush
57
58 {
59     new-sequence nth push pop peek
60 } compile-uncompiled
61
62 "." write flush
63
64 {
65     hashcode* = get set
66 } compile-uncompiled
67
68 "." write flush
69
70 {
71     . lines
72 } compile-uncompiled
73
74 "." write flush
75
76 {
77     malloc calloc free memcpy
78 } compile-uncompiled
79
80 vocabs [ words compile-uncompiled "." write flush ] each
81
82 " done" print flush