compiler.cfg.*: new unit test vocabs
							parent
							
								
									5782855343
								
							
						
					
					
						commit
						d0dde922bd
					
				| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
USING: accessors assocs combinators compiler.cfg compiler.cfg.registers
 | 
			
		||||
compiler.cfg.stacks compiler.cfg.stacks.height kernel tools.test ;
 | 
			
		||||
IN: compiler.cfg.stacks.height.tests
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    T{ ds-loc f 4 }
 | 
			
		||||
    T{ rs-loc f 5 }
 | 
			
		||||
} [
 | 
			
		||||
    begin-stack-analysis
 | 
			
		||||
    3 4 T{ basic-block }
 | 
			
		||||
    [ record-stack-heights ]
 | 
			
		||||
    [ D 1 swap untranslate-loc ]
 | 
			
		||||
    [ R 1 swap untranslate-loc ] tri
 | 
			
		||||
] unit-test
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,36 @@
 | 
			
		|||
USING: accessors assocs biassocs combinators compiler.cfg.instructions
 | 
			
		||||
compiler.cfg.registers compiler.cfg.stacks.local cpu.architecture kernel
 | 
			
		||||
namespaces sequences tools.test ;
 | 
			
		||||
IN: compiler.cfg.stacks.local.tests
 | 
			
		||||
 | 
			
		||||
{ T{ current-height f 3 0 3 0 } } [
 | 
			
		||||
    current-height new current-height [
 | 
			
		||||
        3 inc-d current-height get
 | 
			
		||||
    ] with-variable
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    { T{ ##inc-d { n 4 } } T{ ##inc-r { n -2 } } }
 | 
			
		||||
} [
 | 
			
		||||
    T{ current-height { emit-d 4 } { emit-r -2 } } height-changes
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
{ 30 } [
 | 
			
		||||
    29 vreg-counter set-global <bihash> locs>vregs set D 0 loc>vreg
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    {
 | 
			
		||||
        T{ ##copy { dst 1 } { src 25 } { rep any-rep } }
 | 
			
		||||
        T{ ##copy { dst 2 } { src 26 } { rep any-rep } }
 | 
			
		||||
    }
 | 
			
		||||
} [
 | 
			
		||||
    0 vreg-counter set-global <bihash> locs>vregs set
 | 
			
		||||
    { { D 0 25 } { R 0 26 } } stack-changes
 | 
			
		||||
] unit-test
 | 
			
		||||
 | 
			
		||||
{ 80 } [
 | 
			
		||||
    current-height new current-height set
 | 
			
		||||
    H{ } clone replace-mapping set 80
 | 
			
		||||
    D 77 replace-loc D 77 peek-loc
 | 
			
		||||
] unit-test
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
USING: accessors arrays assocs combinators compiler.cfg.registers
 | 
			
		||||
compiler.cfg.stacks.local kernel literals namespaces tools.test ;
 | 
			
		||||
IN: compiler.cfg.stacks
 | 
			
		||||
 | 
			
		||||
{ H{ { D -2 4 } { D -1 3 } { D -3 5 } } } [
 | 
			
		||||
    {
 | 
			
		||||
        ${ current-height current-height new }
 | 
			
		||||
        ${ replace-mapping H{ } clone }
 | 
			
		||||
    } [
 | 
			
		||||
        { 3 4 5 } ds-store replace-mapping get
 | 
			
		||||
    ] with-variables
 | 
			
		||||
] unit-test
 | 
			
		||||
		Loading…
	
		Reference in New Issue