]> gitweb.factorcode.org Git - factor.git/blob - basis/bootstrap/compiler/compiler.factor
Fix permission bits
[factor.git] / basis / 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 hashtables.private sequences.private math classes.tuple.private
7 growable namespaces.private assocs words command-line vocabs io
8 io.encodings.string prettyprint libc splitting math.parser
9 compiler.units math.order compiler.tree.builder
10 compiler.tree.optimizer ;
11 IN: bootstrap.compiler
12
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 [
16     "alien.remote-control" require
17 ] unless
18
19 "cpu." cpu name>> append require
20
21 enable-compiler
22
23 : compile-uncompiled ( words -- )
24     [ compiled>> not ] filter compile ;
25
26 nl
27 "Compiling..." write flush
28
29 ! Compile a set of words ahead of the full compile.
30 ! This set of words was determined semi-empirically
31 ! using the profiler. It improves bootstrap time
32 ! significantly, because frequenly called words
33 ! which are also quick to compile are replaced by
34 ! compiled definitions as soon as possible.
35 {
36     roll -roll declare not
37
38     array? hashtable? vector?
39     tuple? sbuf? tombstone?
40
41     array-nth set-array-nth
42
43     wrap probe
44
45     namestack*
46 } compile-uncompiled
47
48 "." write flush
49
50 {
51     bitand bitor bitxor bitnot
52 } compile-uncompiled
53
54 "." write flush
55
56 {
57     + 1+ 1- 2/ < <= > >= shift
58 } compile-uncompiled
59
60 "." write flush
61
62 {
63     new-sequence nth push pop peek
64 } compile-uncompiled
65
66 "." write flush
67
68 {
69     hashcode* = get set
70 } compile-uncompiled
71
72 "." write flush
73
74 {
75     memq? split harvest sift cut cut-slice start index clone
76     set-at reverse push-all class number>string string>number
77 } compile-uncompiled
78
79 "." write flush
80
81 {
82     lines prefix suffix unclip new-assoc update
83     word-prop set-word-prop 1array 2array 3array ?nth
84 } compile-uncompiled
85
86 "." write flush
87
88 {
89     . malloc calloc free memcpy
90 } compile-uncompiled
91
92 { build-tree } compile-uncompiled
93
94 { optimize-tree } compile-uncompiled
95
96 vocabs [ words compile-uncompiled "." write flush ] each
97
98 " done" print flush