| 
									
										
										
										
											2015-07-21 05:22:38 -04:00
										 |  |  | USING: accessors compiler.cfg compiler.cfg.instructions | 
					
						
							|  |  |  | compiler.cfg.stack-frame compiler.cfg.utilities cpu.architecture | 
					
						
							|  |  |  | cpu.x86 kernel layouts math namespaces system tools.test ;
 | 
					
						
							| 
									
										
										
										
											2014-11-23 22:04:26 -05:00
										 |  |  | IN: cpu.architecture.tests | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-21 05:22:38 -04:00
										 |  |  | : cfg-w-spill-area-base ( base -- cfg )
 | 
					
						
							|  |  |  |     stack-frame new swap >>spill-area-base | 
					
						
							|  |  |  |     { } insns>cfg swap >>stack-frame ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-23 22:04:26 -05:00
										 |  |  | : expected-gc-root-offset ( slot-number spill-area-base -- offset )
 | 
					
						
							| 
									
										
										
										
											2015-07-21 05:22:38 -04:00
										 |  |  |     [ spill-slot boa ] [ cfg-w-spill-area-base ] bi*
 | 
					
						
							|  |  |  |     cfg [ | 
					
						
							| 
									
										
										
										
											2014-11-23 22:04:26 -05:00
										 |  |  |         gc-root-offset reserved-stack-space cell / -
 | 
					
						
							|  |  |  |     ] with-variable ;
 | 
					
						
							| 
									
										
										
										
											2014-11-16 06:35:52 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | cpu x86.64? [ | 
					
						
							|  |  |  |     ! The offset is 1, not 0 because the return address occupies the | 
					
						
							|  |  |  |     ! first position in the stack frame. | 
					
						
							| 
									
										
										
										
											2014-11-23 22:04:26 -05:00
										 |  |  |     { 1 } [ 0 0 expected-gc-root-offset ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     { 10 } [ 8 64 expected-gc-root-offset ] unit-test | 
					
						
							| 
									
										
										
										
											2014-11-16 06:35:52 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-11-23 22:04:26 -05:00
										 |  |  |     { 20 } [ 24 128 expected-gc-root-offset ] unit-test | 
					
						
							| 
									
										
										
										
											2014-11-16 06:35:52 -05:00
										 |  |  | ] when
 |