noinline is an expression-level compiler hint that prevents a specific function call from being inlined.
Syntax
(noinline (⟨fn-expr⟩ ⟨arg⟩*))
Semantics
noinlineis a function of type(:a -> :a)that returns the value of its argument unchanged.- Unlike
inline,noinlineis only an expression-level operator and cannot be used as a top-level attribute. - When the argument to
noinlineis syntactically a function application(f a1 ...), Coalton marks that application node:noinlinein the codegen AST, preventing Coalton’s AST inliner and scalar-replacement passes from inliningfat that call site. - If the argument is not a syntactic function application,
(noinline expr)simply evaluates toexpr.
Examples
(coalton-toplevel
(declare fallback-hash (U64 -> U64))
(define (fallback-hash x)
(* x 11400714819323198485))
;; Prevent Coalton's AST inliner from inlining `fallback-hash` at this call site
(declare probe (Boolean * U64 -> U64))
(define (probe hit? key)
(if (likely hit?)
key
(noinline (fallback-hash key)))))
Other notes
noinlineis useful for keeping cold error/fallback paths out of hot inner loops, inspecting call boundaries inpprint-coalton-codegenorcl:disassemble, and profiling individual calls.- See
inlineand Performance and Optimization.