noinline is an expression-level compiler hint that prevents a specific function call from being inlined.

Syntax

(noinline (⟨fn-expr⟩ ⟨arg⟩*))

Semantics

  • noinline is a function of type (:a -> :a) that returns the value of its argument unchanged.
  • Unlike inline, noinline is only an expression-level operator and cannot be used as a top-level attribute.
  • When the argument to noinline is syntactically a function application (f a1 ...), Coalton marks that application node :noinline in the codegen AST, preventing Coalton’s AST inliner and scalar-replacement passes from inlining f at that call site.
  • If the argument is not a syntactic function application, (noinline expr) simply evaluates to expr.

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