compiler.cfg.save-contexts: context-save-needed not needed because it's
the same as gc-map-insndb4
							parent
							
								
									3f9fa7e39e
								
							
						
					
					
						commit
						bdc4880b17
					
				| 
						 | 
					@ -5,21 +5,21 @@ IN: compiler.cfg.save-contexts
 | 
				
			||||||
HELP: insert-save-contexts
 | 
					HELP: insert-save-contexts
 | 
				
			||||||
{ $values { "cfg" cfg } }
 | 
					{ $values { "cfg" cfg } }
 | 
				
			||||||
{ $description "Inserts " { $link ##save-context } " instructions in each " { $link basic-block } " in the cfg that needs them. Save contexts are needed after instructions that modify the context, or instructions that read parameter registers." }
 | 
					{ $description "Inserts " { $link ##save-context } " instructions in each " { $link basic-block } " in the cfg that needs them. Save contexts are needed after instructions that modify the context, or instructions that read parameter registers." }
 | 
				
			||||||
{ $see-also context-save-needed } ;
 | 
					{ $see-also insns-needs-save-context? } ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
HELP: insns-needs-save-context?
 | 
					HELP: insns-needs-save-context?
 | 
				
			||||||
{ $values { "insns" sequence } { "?" boolean } }
 | 
					{ $values { "insns" sequence } { "?" boolean } }
 | 
				
			||||||
{ $description "Whether to insert a " { $link ##save-context } " instruction in the given instruction sequence or not." }
 | 
					{ $description "Whether to insert a " { $link ##save-context } " instruction in the given instruction sequence or not. Only instructions that can allocate memory mandates save contexts." }
 | 
				
			||||||
{ $see-also context-save-needed } ;
 | 
					{ $see-also gc-map-insn } ;
 | 
				
			||||||
 | 
					 | 
				
			||||||
HELP: context-save-needed
 | 
					 | 
				
			||||||
{ $class-description "Union class of all instructions that needs to be preceeded by a " { $link ##save-context } " instruction. Only instructions that can allocate memory mandates save contexts." } ;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
HELP: save-context-offset
 | 
					HELP: save-context-offset
 | 
				
			||||||
{ $values { "insns" sequence } { "n" integer } }
 | 
					{ $values { "insns" sequence } { "n" integer } }
 | 
				
			||||||
{ $description { $link ##save-context } " must be placed after instructions that modify the context, or instructions that read parameter registers." } ;
 | 
					{ $description { $link ##save-context } " must be placed after instructions that modify the context, or instructions that read parameter registers." } ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ARTICLE: "compiler.cfg.save-contexts" "Insert context saves"
 | 
					ARTICLE: "compiler.cfg.save-contexts" "Insert context saves"
 | 
				
			||||||
"Inserts " { $link ##save-context } " in blocks that need them." ;
 | 
					"Inserts " { $link ##save-context } " in blocks that need them."
 | 
				
			||||||
 | 
					$nl
 | 
				
			||||||
 | 
					"Main word:"
 | 
				
			||||||
 | 
					{ $subsections insert-save-contexts } ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ABOUT: "compiler.cfg.save-contexts"
 | 
					ABOUT: "compiler.cfg.save-contexts"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,17 @@ compiler.cfg.save-contexts kernel namespaces tools.test
 | 
				
			||||||
cpu.x86.assembler.operands cpu.architecture ;
 | 
					cpu.x86.assembler.operands cpu.architecture ;
 | 
				
			||||||
IN: compiler.cfg.save-contexts.tests
 | 
					IN: compiler.cfg.save-contexts.tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					! insns-needs-save-context?
 | 
				
			||||||
 | 
					{ t f } [
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        T{ ##call-gc }
 | 
				
			||||||
 | 
					    } insns-needs-save-context?
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        T{ ##add f 1 2 3 }
 | 
				
			||||||
 | 
					        T{ ##branch }
 | 
				
			||||||
 | 
					    } insns-needs-save-context?
 | 
				
			||||||
 | 
					] unit-test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
H{ } clone representations set
 | 
					H{ } clone representations set
 | 
				
			||||||
 | 
					
 | 
				
			||||||
V{
 | 
					V{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,13 +5,12 @@ cpu.architecture kernel sequences ;
 | 
				
			||||||
IN: compiler.cfg.save-contexts
 | 
					IN: compiler.cfg.save-contexts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UNION: context-modifier ##phi ##inc ##callback-inputs ;
 | 
					UNION: context-modifier ##phi ##inc ##callback-inputs ;
 | 
				
			||||||
UNION: context-save-needed gc-map-insn ;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
: save-context-offset ( insns -- n )
 | 
					: save-context-offset ( insns -- n )
 | 
				
			||||||
    [ context-modifier? not ] find drop ;
 | 
					    [ context-modifier? not ] find drop ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: insns-needs-save-context? ( insns -- ? )
 | 
					: insns-needs-save-context? ( insns -- ? )
 | 
				
			||||||
    [ context-save-needed? ] any? ;
 | 
					    [ gc-map-insn? ] any? ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
: insert-save-context ( insns -- insns' )
 | 
					: insert-save-context ( insns -- insns' )
 | 
				
			||||||
    dup insns-needs-save-context? [
 | 
					    dup insns-needs-save-context? [
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue