starting point - Fix bootstrap; I broke it in merging. Disable environment variables because the compiler isn't loaded yet and can't call C ffi functions, and tools.test loads this vocab.
Disable intrinsics in cpu.x86.64 for now, since they invoke the compiler
Fix ##branch renaming to ##branch,
To work on this branch:
./factor -include=math -i=boot.image
./factor -run=listener
USE: compiler USE: tools.test save
enable-optimizer
Error message is now:
T{ vregs-shouldn't-interfere f 409 424 }
			
			
				db4
			
			
		
							parent
							
								
									07227f22f9
								
							
						
					
					
						commit
						a0dd953e33
					
				| 
						 | 
				
			
			@ -76,12 +76,6 @@ SYMBOL: temp-locations
 | 
			
		|||
: register->memory ( from to -- )
 | 
			
		||||
    [ [ reg>> ] [ rep>> ] bi ] [ reg>> ] bi* ##spill, ;
 | 
			
		||||
 | 
			
		||||
: temp->register ( from to -- )
 | 
			
		||||
    nip [ reg>> ] [ rep>> ] [ rep>> spill-temp ] tri ##reload, ;
 | 
			
		||||
 | 
			
		||||
: register->temp ( from to -- )
 | 
			
		||||
    drop [ [ reg>> ] [ rep>> ] bi ] [ rep>> spill-temp ] bi ##spill, ;
 | 
			
		||||
 | 
			
		||||
: register->register ( from to -- )
 | 
			
		||||
    swap [ reg>> ] [ [ reg>> ] [ rep>> ] bi ] bi* ##copy, ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -95,7 +89,7 @@ SYMBOL: temp-locations
 | 
			
		|||
: mapping-instructions ( alist -- insns )
 | 
			
		||||
    [ swap ] H{ } assoc-map-as [
 | 
			
		||||
        [ temp-location ] [ swap >insn ] parallel-mapping
 | 
			
		||||
        ##branch
 | 
			
		||||
        ##branch,
 | 
			
		||||
    ] { } make ;
 | 
			
		||||
 | 
			
		||||
: perform-mappings ( bb to mappings -- )
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -60,7 +60,7 @@ PRIVATE>
 | 
			
		|||
 | 
			
		||||
: parallel-copy ( mapping -- )
 | 
			
		||||
    ! mapping is a list of { dst src } pairs
 | 
			
		||||
    next-vreg '[ drop _ ] [ any-rep ##copy ] parallel-mapping ;
 | 
			
		||||
    next-vreg '[ drop _ ] [ any-rep ##copy, ] parallel-mapping ;
 | 
			
		||||
 | 
			
		||||
<PRIVATE
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -74,4 +74,4 @@ PRIVATE>
 | 
			
		|||
: parallel-copy-rep ( mapping -- )
 | 
			
		||||
    ! mapping is a list of { dst src } pairs
 | 
			
		||||
    H{ } clone temp-vregs set
 | 
			
		||||
    [ rep-of temp-vreg ] [ dup rep-of ##copy ] parallel-mapping ;
 | 
			
		||||
    [ rep-of temp-vreg ] [ dup rep-of ##copy, ] parallel-mapping ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ SYMBOL: copies
 | 
			
		|||
    ] each ;
 | 
			
		||||
 | 
			
		||||
: insert-edge-copies ( from to copies -- )
 | 
			
		||||
    [ ##parallel-copy ##branch ] { } make insert-basic-block ;
 | 
			
		||||
    [ ##parallel-copy, ##branch, ] { } make insert-basic-block ;
 | 
			
		||||
 | 
			
		||||
: insert-copies ( bb -- )
 | 
			
		||||
    [ copies get ] dip '[
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -145,11 +145,11 @@ M: x86.64 (cpuid) ( rax rcx regs -- )
 | 
			
		|||
 | 
			
		||||
! The result of reading 4 bytes from memory is a fixnum on
 | 
			
		||||
! x86-64.
 | 
			
		||||
enable-alien-4-intrinsics
 | 
			
		||||
! enable-alien-4-intrinsics
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
    { [ os unix? ] [ "cpu.x86.64.unix" require ] }
 | 
			
		||||
    { [ os windows? ] [ "cpu.x86.64.windows" require ] }
 | 
			
		||||
} cond
 | 
			
		||||
 | 
			
		||||
check-cpu-features
 | 
			
		||||
! check-cpu-features
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -31,9 +31,9 @@ HOOK: set-os-envs-pointer os ( malloc -- )
 | 
			
		|||
} cond
 | 
			
		||||
 | 
			
		||||
[
 | 
			
		||||
    "FACTOR_ROOTS" os-env
 | 
			
		||||
    [
 | 
			
		||||
        os windows? ";" ":" ? split
 | 
			
		||||
        [ add-vocab-root ] each
 | 
			
		||||
    ] when*    
 | 
			
		||||
    ! "FACTOR_ROOTS" os-env
 | 
			
		||||
    ! [
 | 
			
		||||
        ! os windows? ";" ":" ? split
 | 
			
		||||
        ! [ add-vocab-root ] each
 | 
			
		||||
    ! ] when*    
 | 
			
		||||
] "environment" add-startup-hook
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue