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