Skip to content

v.markused #

Parallel body-call precollection. Each worker analyzes a disjoint, contiguous range of fn_decl bodies with its own forked TypeChecker (private type_cache, so checker memoization never races) and writes into disjoint slots of a preallocated results array. The result content per body is a pure function of the (read-only) AST and checker tables, so the outcome is identical to the serial fallback.

fn can_check_library_body_frontiers #

fn can_check_library_body_frontiers(a &flat.FlatAst, tc &types.TypeChecker) bool

can_check_library_body_frontiers keeps the on-demand checker on the lazy body path.

fn is_trivial_literal_output_program #

fn is_trivial_literal_output_program(a &flat.FlatAst, diagnostic_files map[string]bool) bool

is_trivial_literal_output_program reports whether the selected source consists only of literal print calls. It does not depend on semantic collection, so the driver can select its non-generic check path before checking function bodies.

fn mark_all_used_with_generic_usage #

fn mark_all_used_with_generic_usage(a &flat.FlatAst, tc &types.TypeChecker, test_files []string) (map[string]bool, bool)

mark_all_used_with_generic_usage roots every concrete function while preserving ordinary generic reachability and test harness roots.

fn mark_used #

fn mark_used(a &flat.FlatAst, tc &types.TypeChecker) map[string]bool

mark_used updates mark used state for markused.

fn mark_used_checking_library_bodies #

fn mark_used_checking_library_bodies(a &flat.FlatAst, mut tc types.TypeChecker, parallel bool) (map[string]bool, bool)

mark_used_checking_library_bodies checks each reached concrete library body before collecting its calls, retaining the current reachability queue between frontiers. The checker and reachability results belong to the caller's compilation arena.

fn mark_used_for_cache #

fn mark_used_for_cache(a &flat.FlatAst, tc &types.TypeChecker, test_files []string, source_modules map[string]bool) map[string]bool

mark_used_for_cache roots every concrete function in modules being built for the object cache.

fn mark_used_for_cache_with_generic_usage #

fn mark_used_for_cache_with_generic_usage(a &flat.FlatAst, tc &types.TypeChecker, test_files []string, source_modules map[string]bool) (map[string]bool, bool)

mark_used_for_cache_with_generic_usage roots cached module functions and reports whether their reachable code requires monomorphization.

fn mark_used_for_cache_without_generic_detection #

fn mark_used_for_cache_without_generic_detection(a &flat.FlatAst, tc &types.TypeChecker, test_files []string, source_modules map[string]bool) map[string]bool

mark_used_for_cache_without_generic_detection is the self-host cache variant for inputs whose caller already guarantees that monomorphization is unnecessary.

fn mark_used_for_tests #

fn mark_used_for_tests(a &flat.FlatAst, tc &types.TypeChecker, test_files []string) map[string]bool

fn mark_used_for_tests_with_generic_usage #

fn mark_used_for_tests_with_generic_usage(a &flat.FlatAst, tc &types.TypeChecker, test_files []string) (map[string]bool, bool)

mark_used_for_tests_with_generic_usage is the test-file-rooted variant of mark_used_with_generic_usage.

fn mark_used_with_generic_usage #

fn mark_used_with_generic_usage(a &flat.FlatAst, tc &types.TypeChecker) (map[string]bool, bool)

mark_used_with_generic_usage also reports whether reachable code uses a generic function, struct, or sum type and therefore requires monomorphization.

fn mark_used_with_generic_usage_full_runtime #

fn mark_used_with_generic_usage_full_runtime(a &flat.FlatAst, tc &types.TypeChecker) (map[string]bool, bool)

mark_used_with_generic_usage_full_runtime disables the literal-output shortcut so compatibility fixtures retain helpers referenced by the complete builtin runtime.

fn mark_used_without_generic_detection #

fn mark_used_without_generic_detection(a &flat.FlatAst, tc &types.TypeChecker) map[string]bool

mark_used_without_generic_detection is the self-host variant for inputs whose caller already guarantees that monomorphization is unnecessary.

fn mark_used_without_generic_detection_prepared #

fn mark_used_without_generic_detection_prepared(a &flat.FlatAst, tc &types.TypeChecker, mut prepared PreparedMarkusedDecls) map[string]bool

mark_used_without_generic_detection_prepared consumes declaration indexes built concurrently with checking for the no-generic self-host path.

fn prepare_markused_declarations #

fn prepare_markused_declarations(a &flat.FlatAst, tc &types.TypeChecker, enabled bool) &PreparedMarkusedDecls

prepare_markused_declarations builds self-host declaration indexes on a helper-local arena. It intentionally performs no semantic/body queries.

fn reachable_const_exprs #

fn reachable_const_exprs(a &flat.FlatAst, tc &types.TypeChecker, root_ids []flat.NodeId, root_modules []string, root_files []string) []flat.NodeId

reachable_const_exprs returns const initializer expressions referenced by the supplied post-transform AST roots, including transitive const-to-const references.

fn seeded_fn_names #

fn seeded_fn_names() []string

seeded_fn_names returns the functions that mark_used keeps without a call that leads to them, by the names it looks them up with: those that every program keeps, and those that a program keeps for a construct found anywhere in it. The channel and shared helpers of sync are not among them.

struct PreparedMarkusedDecls #

@[heap]
struct PreparedMarkusedDecls {
mut:
	fn_decls                     map[string]FnDeclInfo
	fn_decl_lists                map[string][]FnDeclInfo
	struct_decls                 map[string]StructDeclInfo
	const_decls                  map[string]ConstDeclInfo
	fn_name_suffixes             map[string]bool
	const_name_suffixes          map[string]bool
	suffix_map                   map[string][]string
	import_contexts              []map[string]string
	marked_roots                 []string
	cached_header_enum_str_roots []u32
	c_interface_roots            []string
	auto_roots                   []string
	body_ids                     []int
	body_modules                 []string
	body_import_contexts         []int
	needs_closure_runtime        bool
	scope                        voidptr
	ready                        bool
}

PreparedMarkusedDecls owns the declaration indexes that can be built from the immutable post-collect AST while semantic body checking uses the other cores.

fn (PreparedMarkusedDecls) release #

fn (mut prepared PreparedMarkusedDecls) release()

release frees the helper-local preparation arena after the caller has published the used-name map into its compilation arena.