| 
									
										
										
										
											2008-01-01 14:54:14 -05:00
										 |  |  | ! Copyright (C) 2007, 2008 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2008-06-28 03:36:20 -04:00
										 |  |  | 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 | 
					
						
							| 
									
										
										
										
											2008-08-22 04:12:15 -04:00
										 |  |  | io.encodings.string prettyprint libc splitting math.parser | 
					
						
							|  |  |  | compiler.units math.order compiler.tree.builder | 
					
						
							| 
									
										
										
										
											2008-10-23 03:49:55 -04:00
										 |  |  | compiler.tree.optimizer compiler.cfg.optimizer ;
 | 
					
						
							| 
									
										
										
										
											2007-12-24 21:54:45 -05:00
										 |  |  | IN: bootstrap.compiler | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-01-07 16:14:09 -05: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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-28 03:36:20 -04:00
										 |  |  | "cpu." cpu name>> append require | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-24 03:19:38 -05:00
										 |  |  | enable-compiler | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-08 16:32:55 -04:00
										 |  |  | : compile-uncompiled ( words -- )
 | 
					
						
							| 
									
										
										
										
											2008-06-28 03:36:20 -04:00
										 |  |  |     [ compiled>> not ] filter compile ;
 | 
					
						
							| 
									
										
										
										
											2008-04-28 22:26:31 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-28 21:45:16 -05:00
										 |  |  | nl
 | 
					
						
							| 
									
										
										
										
											2008-04-05 08:35:36 -04:00
										 |  |  | "Compiling..." write flush
 | 
					
						
							| 
									
										
										
										
											2007-12-28 21:45:16 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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. | 
					
						
							| 
									
										
										
										
											2007-10-14 20:38:23 -04:00
										 |  |  | { | 
					
						
							|  |  |  |     roll -roll declare not
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-03-26 04:57:48 -04:00
										 |  |  |     array? hashtable? vector?
 | 
					
						
							| 
									
										
										
										
											2008-08-12 04:38:56 -04:00
										 |  |  |     tuple? sbuf? 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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-10-14 20:38:23 -04:00
										 |  |  |     wrap probe | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-09 06:39:55 -04:00
										 |  |  |     namestack* | 
					
						
							| 
									
										
										
										
											2008-06-29 03:12:44 -04:00
										 |  |  | } compile-uncompiled | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "." write flush
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-29 03:12:44 -04:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2007-10-14 20:38:23 -04:00
										 |  |  |     bitand bitor bitxor bitnot
 | 
					
						
							| 
									
										
										
										
											2008-04-28 22:26:31 -04:00
										 |  |  | } compile-uncompiled | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-28 21:45:16 -05: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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-28 21:45:16 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-21 21:18:24 -05:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-04-13 13:54:58 -04:00
										 |  |  |     new-sequence nth push pop peek | 
					
						
							| 
									
										
										
										
											2008-04-28 22:26:31 -04:00
										 |  |  | } compile-uncompiled | 
					
						
							| 
									
										
										
										
											2007-12-28 21:45:16 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | "." 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
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-21 21:18:24 -05:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-08-22 04:12:15 -04:00
										 |  |  |     memq? split harvest sift cut cut-slice start index clone
 | 
					
						
							|  |  |  |     set-at reverse push-all class number>string string>number | 
					
						
							| 
									
										
										
										
											2008-04-28 22:26:31 -04:00
										 |  |  | } compile-uncompiled | 
					
						
							| 
									
										
										
										
											2007-10-05 17:54:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-28 21:45:16 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-12-21 21:18:24 -05:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-08-22 04:12:15 -04:00
										 |  |  |     lines prefix suffix unclip new-assoc update | 
					
						
							|  |  |  |     word-prop set-word-prop 1array 2array 3array ?nth
 | 
					
						
							|  |  |  | } compile-uncompiled | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     . malloc calloc free memcpy | 
					
						
							| 
									
										
										
										
											2008-04-28 22:26:31 -04:00
										 |  |  | } compile-uncompiled | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-06 02:11:28 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-18 16:47:49 -04:00
										 |  |  | { build-tree } compile-uncompiled | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-06 02:11:28 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-18 16:47:49 -04:00
										 |  |  | { optimize-tree } compile-uncompiled | 
					
						
							| 
									
										
										
										
											2008-08-12 04:31:48 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-06 02:11:28 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-23 03:49:55 -04:00
										 |  |  | { optimize-cfg } compile-uncompiled | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-06 02:11:28 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-10-23 03:49:55 -04:00
										 |  |  | { (compile) } compile-uncompiled | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-11-06 02:11:28 -05:00
										 |  |  | "." write flush
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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
 |