factor/core/bootstrap/compiler/compiler.factor

86 lines
1.7 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.
2007-10-29 01:12:27 -04:00
USING: compiler cpu.architecture vocabs.loader system sequences
namespaces parser kernel kernel.private classes classes.private
arrays hashtables vectors classes.tuple sbufs inference.dataflow
hashtables.private sequences.private math classes.tuple.private
growable namespaces.private assocs words generator command-line
vocabs io prettyprint libc compiler.units ;
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 append require
2007-09-20 18:09:08 -04:00
: enable-compiler ( -- )
[ optimized-recompile-hook ] recompile-hook set-global ;
: disable-compiler ( -- )
[ default-recompile-hook ] recompile-hook set-global ;
enable-compiler
nl
2008-01-12 22:24:27 -05:00
"Compiling some words to speed up bootstrap..." 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
array-capacity array-nth set-array-nth
2007-09-20 18:09:08 -04:00
wrap probe
2007-09-20 18:09:08 -04:00
delegate
2007-09-20 18:09:08 -04:00
underlying
2007-09-20 18:09:08 -04:00
find-pair-next namestack*
2007-09-20 18:09:08 -04:00
bitand bitor bitxor bitnot
2007-12-26 20:21:46 -05:00
} compile
2007-09-20 18:09:08 -04:00
"." write flush
2007-12-16 15:17:28 -05:00
{
+ 1+ 1- 2/ < <= > >= shift min
2007-12-26 20:21:46 -05:00
} compile
2007-09-20 18:09:08 -04:00
"." write flush
{
new nth push pop peek
} compile
"." write flush
{
hashcode* = get set
2007-12-26 20:21:46 -05:00
} compile
2007-09-20 18:09:08 -04:00
2008-01-01 14:54:14 -05:00
"." write flush
{
. lines
2007-12-26 20:21:46 -05:00
} compile
"." write flush
{
2008-03-20 18:20:03 -04:00
malloc calloc free memcpy
2007-12-26 20:21:46 -05:00
} compile
2007-09-20 18:09:08 -04:00
2008-01-01 14:54:14 -05:00
" done" print flush