| 
									
										
										
										
											2010-01-22 06:39:56 -05:00
										 |  |  | ! Copyright (C) 2010 Slava Pestov. | 
					
						
							|  |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2015-04-07 09:05:34 -04:00
										 |  |  | USING: accessors arrays compiler.cfg compiler.units kernel sequences | 
					
						
							| 
									
										
										
										
											2014-12-13 19:10:21 -05:00
										 |  |  | stack-checker tools.test vocabs words ;
 | 
					
						
							| 
									
										
										
										
											2010-01-22 06:39:56 -05:00
										 |  |  | IN: compiler.test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : decompile ( word -- )
 | 
					
						
							| 
									
										
										
										
											2010-02-01 08:49:05 -05:00
										 |  |  |     dup def>> 2array 1array t t modify-code-heap ;
 | 
					
						
							| 
									
										
										
										
											2010-01-22 06:39:56 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : recompile-all ( -- )
 | 
					
						
							|  |  |  |     all-words compile ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : compile-call ( quot -- )
 | 
					
						
							|  |  |  |     [ dup infer define-temp ] with-compilation-unit execute ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-22 06:40:56 -05:00
										 |  |  | << \ compile-call t "no-compile" set-word-prop >> | 
					
						
							| 
									
										
										
										
											2010-01-22 06:39:56 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | : compiler-test ( name -- )
 | 
					
						
							|  |  |  |     "resource:basis/compiler/tests/" ".factor" surround run-test-file ;
 | 
					
						
							| 
									
										
										
										
											2015-03-26 18:46:37 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | USING: compiler.cfg.registers compiler.cfg.stacks compiler.cfg.stacks.local | 
					
						
							|  |  |  | fry namespaces ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : init-cfg-test ( -- )
 | 
					
						
							| 
									
										
										
										
											2015-04-07 09:05:34 -04:00
										 |  |  |     reset-vreg-counter begin-stack-analysis | 
					
						
							|  |  |  |     <basic-block> dup basic-block set begin-local-analysis | 
					
						
							| 
									
										
										
										
											2015-05-07 07:34:48 -04:00
										 |  |  |     H{ } clone representations set
 | 
					
						
							| 
									
										
										
										
											2015-04-07 09:05:34 -04:00
										 |  |  |     H{ } clone replaces set ;
 | 
					
						
							| 
									
										
										
										
											2015-03-26 18:46:37 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : cfg-unit-test ( result quot -- )
 | 
					
						
							|  |  |  |     '[ init-cfg-test @ ] unit-test ; inline
 |