Skip to content

v3.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 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_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.

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
	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.