1 ! Copyright (C) 2007, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors 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 memory compiler.units
9 math.order quotations quotations.private assocs.private ;
10 FROM: compiler => enable-optimizer ;
11 IN: bootstrap.compiler
13 "profile-compiler" get [
14 "bootstrap.compiler.timing" require
17 ! Don't bring this in when deploying, since it will store a
18 ! reference to 'eval' in a global variable
19 "deploy-vocab" get "staging" get or [
20 "alien.remote-control" require
24 "stack-checker.errors.prettyprint" require
25 "alien.prettyprint" require
28 "cpu." cpu name>> append require
32 ! Push all tuple layouts to tenured space to improve method caching
35 : compile-unoptimized ( words -- )
36 [ optimized? not ] filter compile ;
38 "debug-compiler" get [
41 "Compiling..." write flush
43 ! Compile a set of words ahead of the full compile.
44 ! This set of words was determined semi-empirically
45 ! using the profiler. It improves bootstrap time
46 ! significantly, because frequenly called words
47 ! which are also quick to compile are replaced by
48 ! compiled definitions as soon as possible.
54 array? hashtable? vector?
55 tuple? sbuf? tombstone?
56 curry? compose? callable?
61 array-nth set-array-nth length>>
73 bitand bitor bitxor bitnot
85 new-sequence nth push pop last flip
91 hashcode* = equal? assoc-stack (assoc-stack) get set
97 member-eq? split harvest sift cut cut-slice start index clone
98 set-at reverse push-all class number>string string>number
100 } compile-unoptimized
105 lines prefix suffix unclip new-assoc update
106 word-prop set-word-prop 1array 2array 3array ?nth
107 } compile-unoptimized
112 malloc calloc free memcpy
113 } compile-unoptimized
117 vocabs [ words compile-unoptimized "." write flush ] each