Skip to main content

Module function_adapters

Module function_adapters 

Source
Expand description

Collects top-level functions used in value position and emits closure-shaped adapter bodies for them.

Structs§

AdapterMeta

Functions§

allocate_closure_globals
Allocates the globals that cache a function’s closure, so every read of a top-level function yields the same value and f === f holds. The closure has no environment, so one instance serves every read. Each starts null and is filled on first read. Each function this module exports gets one shared anyref cache; any other function read here gets a typed cache of its own, unless it imported a shared one. Returns how many globals were added.
emit_bodies
exported_closure_caches
The closure caches this module exports, from the name a consumer knows the function by to the function it defines: its non-generic exported functions, under each name they are exported as, and its classes’ public static methods. A consumer that reads one as a value imports the cache instead of keeping its own, so the function is one closure across packages, as in JavaScript.
import_shared_closure_caches
Imports the closure cache of each dependency function this module reads as a value, where the function’s package exports one.