factor/basis/bootstrap/compiler/compiler.factor

90 lines
1.8 KiB
Factor
Raw Normal View History

2008-01-01 14:54:14 -05:00
! Copyright (C) 2007, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors compiler cpu.architecture vocabs.loader system
sequences namespaces parser kernel kernel.private classes
classes.private arrays hashtables vectors classes.tuple sbufs
2008-08-12 04:31:48 -04:00
hashtables.private sequences.private math classes.tuple.private
growable namespaces.private assocs words command-line vocabs io
io.encodings.string prettyprint libc compiler.units math.order
compiler.tree.builder compiler.tree.optimizer ;
2007-12-24 21:54:45 -05:00
IN: bootstrap.compiler
2007-09-20 18:09:08 -04:00
! Don't bring this in when deploying, since it will store a
! reference to 'eval' in a global variable
"deploy-vocab" get [
"alien.remote-control" require
] unless
2007-09-20 18:09:08 -04:00
"cpu." cpu name>> append require
2007-09-20 18:09:08 -04:00
enable-compiler
2008-06-08 16:32:55 -04:00
: compile-uncompiled ( words -- )
[ compiled>> not ] filter compile ;
2008-04-28 22:26:31 -04:00
nl
2008-04-05 08:35:36 -04:00
"Compiling..." write flush
2007-12-26 20:21:46 -05:00
! Compile a set of words ahead of the full compile.
! This set of words was determined semi-empirically
! using the profiler. It improves bootstrap time
! significantly, because frequenly called words
! which are also quick to compile are replaced by
! compiled definitions as soon as possible.
{
roll -roll declare not
2007-09-20 18:09:08 -04:00
2008-03-26 04:57:48 -04:00
array? hashtable? vector?
tuple? sbuf? node? tombstone?
2007-09-20 18:09:08 -04:00
2008-07-16 17:48:09 -04:00
array-nth set-array-nth
2007-09-20 18:09:08 -04:00
wrap probe
2007-09-20 18:09:08 -04:00
2008-06-09 06:39:55 -04:00
namestack*
} compile-uncompiled
"." write flush
2007-09-20 18:09:08 -04:00
{
bitand bitor bitxor bitnot
2008-04-28 22:26:31 -04:00
} compile-uncompiled
2007-09-20 18:09:08 -04:00
"." write flush
2007-12-16 15:17:28 -05:00
{
2008-04-28 22:26:31 -04:00
+ 1+ 1- 2/ < <= > >= shift
} compile-uncompiled
2007-09-20 18:09:08 -04:00
"." write flush
{
2008-04-13 13:54:58 -04:00
new-sequence nth push pop peek
2008-04-28 22:26:31 -04:00
} compile-uncompiled
"." write flush
{
hashcode* = get set
2008-04-28 22:26:31 -04:00
} compile-uncompiled
2007-09-20 18:09:08 -04:00
2008-01-01 14:54:14 -05:00
"." write flush
{
. lines
2008-04-28 22:26:31 -04:00
} compile-uncompiled
"." write flush
{
2008-03-20 18:20:03 -04:00
malloc calloc free memcpy
2008-04-28 22:26:31 -04:00
} compile-uncompiled
2007-09-20 18:09:08 -04:00
2008-08-12 04:31:48 -04:00
{
build-tree optimize-tree
} compile-uncompiled
2008-04-28 22:26:31 -04:00
vocabs [ words compile-uncompiled "." write flush ] each
2008-04-05 08:35:36 -04:00
2008-01-01 14:54:14 -05:00
" done" print flush