]> gitweb.factorcode.org Git - factor.git/blob - core/bootstrap/compiler/compiler.factor
Builtinn types now use new slot accessors; tuple slot type declaration work in progress
[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 prettyprint libc compiler.units
9 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-capacity array-nth set-array-nth
41
42     wrap probe
43
44     namestack*
45
46     bitand bitor bitxor bitnot
47 } compile-uncompiled
48
49 "." write flush
50
51 {
52     + 1+ 1- 2/ < <= > >= shift
53 } compile-uncompiled
54
55 "." write flush
56
57 {
58     new-sequence nth push pop peek
59 } compile-uncompiled
60
61 "." write flush
62
63 {
64     hashcode* = get set
65 } compile-uncompiled
66
67 "." write flush
68
69 {
70     . lines
71 } compile-uncompiled
72
73 "." write flush
74
75 {
76     malloc calloc free memcpy
77 } compile-uncompiled
78
79 vocabs [ words compile-uncompiled "." write flush ] each
80
81 " done" print flush