compiler.cfg: clean up ##phi literals in tests
							parent
							
								
									ffd1844d52
								
							
						
					
					
						commit
						df86d1341f
					
				| 
						 | 
				
			
			@ -11,8 +11,8 @@ FROM: alien.c-types => int ;
 | 
			
		|||
IN: compiler.cfg.builder.tests
 | 
			
		||||
 | 
			
		||||
! Just ensure that various CFGs build correctly.
 | 
			
		||||
: unit-test-cfg ( quot -- )
 | 
			
		||||
    '[ _ test-cfg [ [ optimize-cfg check-cfg ] with-cfg ] each ] [ ] swap unit-test ;
 | 
			
		||||
: unit-test-builder ( quot -- )
 | 
			
		||||
    '[ _ test-builder [ [ optimize-cfg check-cfg ] with-cfg ] each ] [ ] swap unit-test ;
 | 
			
		||||
 | 
			
		||||
: blahblah ( nodes -- ? )
 | 
			
		||||
    { fixnum } declare [
 | 
			
		||||
| 
						 | 
				
			
			@ -105,7 +105,7 @@ IN: compiler.cfg.builder.tests
 | 
			
		|||
        set-string-nth-fast
 | 
			
		||||
    ]
 | 
			
		||||
} [
 | 
			
		||||
    unit-test-cfg
 | 
			
		||||
    unit-test-builder
 | 
			
		||||
] each
 | 
			
		||||
 | 
			
		||||
: test-1 ( -- ) test-1 ;
 | 
			
		||||
| 
						 | 
				
			
			@ -116,7 +116,7 @@ IN: compiler.cfg.builder.tests
 | 
			
		|||
    test-1
 | 
			
		||||
    test-2
 | 
			
		||||
    test-3
 | 
			
		||||
} [ unit-test-cfg ] each
 | 
			
		||||
} [ unit-test-builder ] each
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    byte-array
 | 
			
		||||
| 
						 | 
				
			
			@ -134,8 +134,8 @@ IN: compiler.cfg.builder.tests
 | 
			
		|||
        alien-float
 | 
			
		||||
        alien-double
 | 
			
		||||
    } [| word |
 | 
			
		||||
        { class } word '[ _ declare 10 _ execute ] unit-test-cfg
 | 
			
		||||
        { class fixnum } word '[ _ declare _ execute ] unit-test-cfg
 | 
			
		||||
        { class } word '[ _ declare 10 _ execute ] unit-test-builder
 | 
			
		||||
        { class fixnum } word '[ _ declare _ execute ] unit-test-builder
 | 
			
		||||
    ] each
 | 
			
		||||
    
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -146,22 +146,22 @@ IN: compiler.cfg.builder.tests
 | 
			
		|||
        set-alien-unsigned-2
 | 
			
		||||
        set-alien-unsigned-4
 | 
			
		||||
    } [| word |
 | 
			
		||||
        { fixnum class } word '[ _ declare 10 _ execute ] unit-test-cfg
 | 
			
		||||
        { fixnum class fixnum } word '[ _ declare _ execute ] unit-test-cfg
 | 
			
		||||
        { fixnum class } word '[ _ declare 10 _ execute ] unit-test-builder
 | 
			
		||||
        { fixnum class fixnum } word '[ _ declare _ execute ] unit-test-builder
 | 
			
		||||
    ] each
 | 
			
		||||
    
 | 
			
		||||
    { float class } \ set-alien-float '[ _ declare 10 _ execute ] unit-test-cfg
 | 
			
		||||
    { float class fixnum } \ set-alien-float '[ _ declare _ execute ] unit-test-cfg
 | 
			
		||||
    { float class } \ set-alien-float '[ _ declare 10 _ execute ] unit-test-builder
 | 
			
		||||
    { float class fixnum } \ set-alien-float '[ _ declare _ execute ] unit-test-builder
 | 
			
		||||
    
 | 
			
		||||
    { float class } \ set-alien-double '[ _ declare 10 _ execute ] unit-test-cfg
 | 
			
		||||
    { float class fixnum } \ set-alien-double '[ _ declare _ execute ] unit-test-cfg
 | 
			
		||||
    { float class } \ set-alien-double '[ _ declare 10 _ execute ] unit-test-builder
 | 
			
		||||
    { float class fixnum } \ set-alien-double '[ _ declare _ execute ] unit-test-builder
 | 
			
		||||
    
 | 
			
		||||
    { pinned-c-ptr class } \ set-alien-cell '[ _ declare 10 _ execute ] unit-test-cfg
 | 
			
		||||
    { pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-cfg
 | 
			
		||||
    { pinned-c-ptr class } \ set-alien-cell '[ _ declare 10 _ execute ] unit-test-builder
 | 
			
		||||
    { pinned-c-ptr class fixnum } \ set-alien-cell '[ _ declare _ execute ] unit-test-builder
 | 
			
		||||
] each
 | 
			
		||||
 | 
			
		||||
: count-insns ( quot insn-check -- ? )
 | 
			
		||||
    [ test-mr [ instructions>> ] map ] dip
 | 
			
		||||
    [ test-regs [ instructions>> ] map ] dip
 | 
			
		||||
    '[ _ count ] map-sum ; inline
 | 
			
		||||
 | 
			
		||||
: contains-insn? ( quot insn-check -- ? )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -184,14 +184,11 @@ V{
 | 
			
		|||
} 2 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 3 }
 | 
			
		||||
    T{ ##phi f 3 H{ { 1 1 } { 2 2 } } }
 | 
			
		||||
    T{ ##allot f 1 64 byte-array }
 | 
			
		||||
    T{ ##branch }
 | 
			
		||||
} 3 test-bb
 | 
			
		||||
 | 
			
		||||
1 get 1 2array
 | 
			
		||||
2 get 2 2array 2array 3 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
0 { 1 2 } edges
 | 
			
		||||
1 3 edge
 | 
			
		||||
2 3 edge
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -24,14 +24,10 @@ V{
 | 
			
		|||
} 3 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 2 }
 | 
			
		||||
    T{ ##phi f 2 H{ { 2 0 } { 3 1 } } }
 | 
			
		||||
    T{ ##branch }
 | 
			
		||||
} 4 test-bb
 | 
			
		||||
 | 
			
		||||
2 get 0 2array
 | 
			
		||||
3 get 1 2array 2array
 | 
			
		||||
4 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##branch }
 | 
			
		||||
} 5 test-bb
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,16 +26,13 @@ V{
 | 
			
		|||
} 2 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 3 }
 | 
			
		||||
    T{ ##phi f 3 H{ { 1 0 } { 2 1 } } }
 | 
			
		||||
} 3 test-bb
 | 
			
		||||
 | 
			
		||||
0 { 1 2 } edges
 | 
			
		||||
1 3 edge
 | 
			
		||||
2 3 edge
 | 
			
		||||
 | 
			
		||||
1 get 0 2array
 | 
			
		||||
2 get 1 2array 2array 3 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
[ ] [ test-scc ] unit-test
 | 
			
		||||
 | 
			
		||||
[ t ] [ 0 vreg>scc 1 vreg>scc = ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -251,7 +251,7 @@ V{
 | 
			
		|||
} 2 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 3 }
 | 
			
		||||
    T{ ##phi f 3 H{ { 1 1 } { 2 2 } } }
 | 
			
		||||
    T{ ##replace f 3 D 0 }
 | 
			
		||||
    T{ ##branch }
 | 
			
		||||
} 3 test-bb
 | 
			
		||||
| 
						 | 
				
			
			@ -261,9 +261,6 @@ V{
 | 
			
		|||
    T{ ##return }
 | 
			
		||||
} 4 test-bb
 | 
			
		||||
 | 
			
		||||
1 get 1 2array
 | 
			
		||||
2 get 2 2array 2array 3 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
0 { 1 2 } edges
 | 
			
		||||
1 3 edge
 | 
			
		||||
2 3 edge
 | 
			
		||||
| 
						 | 
				
			
			@ -298,7 +295,7 @@ V{
 | 
			
		|||
} 2 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 4 }
 | 
			
		||||
    T{ ##phi f 4 H{ { 1 2 } { 2 3 } } }
 | 
			
		||||
    T{ ##replace f 4 D 0 }
 | 
			
		||||
    T{ ##branch }
 | 
			
		||||
} 3 test-bb
 | 
			
		||||
| 
						 | 
				
			
			@ -308,9 +305,6 @@ V{
 | 
			
		|||
    T{ ##return }
 | 
			
		||||
} 4 test-bb
 | 
			
		||||
 | 
			
		||||
1 get 2 2array
 | 
			
		||||
2 get 3 2array 2array 3 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
0 { 1 2 } edges
 | 
			
		||||
1 3 edge
 | 
			
		||||
2 3 edge
 | 
			
		||||
| 
						 | 
				
			
			@ -371,7 +365,7 @@ cpu x86.32? [
 | 
			
		|||
    } 3 test-bb
 | 
			
		||||
 | 
			
		||||
    V{
 | 
			
		||||
        T{ ##phi f 4 }
 | 
			
		||||
        T{ ##phi f 4 H{ { 2 2 } { 3 3 } } }
 | 
			
		||||
        T{ ##peek f 5 D 0 }
 | 
			
		||||
        T{ ##add-float f 6 4 5 }
 | 
			
		||||
        T{ ##replace f 6 D 0 }
 | 
			
		||||
| 
						 | 
				
			
			@ -385,9 +379,6 @@ cpu x86.32? [
 | 
			
		|||
    test-diamond
 | 
			
		||||
    4 5 edge
 | 
			
		||||
 | 
			
		||||
    2 get 2 2array
 | 
			
		||||
    3 get 3 2array 2array 4 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
    [ ] [ test-representations ] unit-test
 | 
			
		||||
 | 
			
		||||
    [ t ] [ 2 get instructions>> first ##load-double? ] unit-test
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2302,14 +2302,11 @@ V{
 | 
			
		|||
} 3 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 3 }
 | 
			
		||||
    T{ ##phi f 3 H{ { 2 1 } { 3 2 } } }
 | 
			
		||||
    T{ ##replace f 3 D 0 }
 | 
			
		||||
    T{ ##return }
 | 
			
		||||
} 4 test-bb
 | 
			
		||||
 | 
			
		||||
2 get 1 2array
 | 
			
		||||
3 get 2 2array 2array 4 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
test-diamond
 | 
			
		||||
 | 
			
		||||
[ ] [
 | 
			
		||||
| 
						 | 
				
			
			@ -2341,7 +2338,7 @@ V{
 | 
			
		|||
} 2 test-bb
 | 
			
		||||
 | 
			
		||||
V{
 | 
			
		||||
    T{ ##phi f 3 V{ } }
 | 
			
		||||
    T{ ##phi f 3 H{ { 1 1 } { 2 0 } } }
 | 
			
		||||
    T{ ##branch }
 | 
			
		||||
} 3 test-bb
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2350,9 +2347,6 @@ V{
 | 
			
		|||
    T{ ##return }
 | 
			
		||||
} 4 test-bb
 | 
			
		||||
 | 
			
		||||
1 get 1 2array
 | 
			
		||||
2 get 0 2array 2array 3 get instructions>> first (>>inputs)
 | 
			
		||||
 | 
			
		||||
test-diamond
 | 
			
		||||
 | 
			
		||||
[ ] [
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue