


# garbage-collector.api
#
# This is an alternative module for generating GC code.
# There are a few improvements.
#
# All code to invoke GC is generated once at the end of the
# compilation unit---with one exception. For each cluster, a
# call to GC is a jump to the end of the cluster where there
# is another jump.
#
# Code to invoke GC for known functions is generated at the end of
# the cluster. This is important as there may be spilling across
# gc invocation calls.
# Compiled by:
# src/lib/compiler/core.make6api Garbage_Collector {
package codetree_stream
:
Codetree_Stream; # Codetree_Stream is from src/lib/compiler/lower/codetree/codetree-stream.api package control_flow_graph
:
Control_Flow_Graph # Control_Flow_Graph is from src/lib/compiler/lower/flowgraph/control-flow-graph.api where pseudo_op
==
codetree_stream::instruction_stream::pseudo_op;
Type = { max_alloc: Int,
regfmls: List( codetree_stream::codetree::Expression ),
regtys: List( continuation_passing_style::Cps_Type ),
return: codetree_stream::codetree::Statement
};
Stream
=
codetree_stream::Stream(
codetree_stream::codetree::Statement,
List( codetree_stream::codetree::Expression ),
control_flow_graph::Control_Flow_Graph
);
# List of registers which are
# used as the root of the GC:
#
root_registers
:
List( codetree_stream::codetree::Int_Expression );
# Initialize the state before compiling a module
#
init: Void -> Void;
# Generate a check limit for standard function
#
standard_function_check_limit: Stream -> Type -> Void;
# Generate a check limit for known function
#
known_function_check_limit: Stream -> Type -> Void;
# Generate a check limit for optimized, known function
#
optimized_known_function_check_limit
:
Stream -> Type -> Void;
# Generate a long jump to call gc
#
emit_longjump_garbage_collector_calls
:
Stream -> Void;
# Generate all GC invocation code in a module:
#
emit_garbage_collector_calls_for_package
:
Stream -> Void;
# Generate the actual GC invocation code
#
call_gc
:
Stream
->
{ regfmls: List( codetree_stream::codetree::Expression ),
regtys: List( continuation_passing_style::Cps_Type ),
ret: codetree_stream::codetree::Statement
}
->
Void;
};
## Changes by Jeff Prothero Copyright (c) 2010,
## released under Gnu Public Licence version 3.


