0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test/link/wasm
mlugg 4976b58ab1
Prevent analysis of functions only referenced at comptime
The idea here is that there are two ways we can reference a function at runtime:

* Through a direct call, i.e. where the function is comptime-known
* Through a function pointer

This means we can easily perform a form of rudimentary escape analysis
on functions. If we ever see a `decl_ref` or `ref` of a function, we
have a function pointer, which could "leak" into runtime code, so we
emit the function; but for a plain `decl_val`, there's no need to.

This change means that `comptime { _ = f; }` no longer forces a function
to be emitted, which was used for some things (mainly tests). These use
sites have been replaced with `_ = &f;`, which still triggers analysis
of the function body, since you're taking a pointer to the function.

Resolves: #6256
Resolves: #15353
History 2023-05-29 23:06:08 +01:00
..
archive wasm: implement float operations with compiler-rt 2023-03-26 22:48:56 +02:00
basic-features re-enable test-cases and get them all passing 2023-03-15 10:48:14 -07:00
bss wasm-link: update bss linker test 2023-03-18 16:47:12 +01:00
export re-enable test-cases and get them all passing 2023-03-15 10:48:14 -07:00
export-data re-enable test-cases and get them all passing 2023-03-15 10:48:14 -07:00
extern re-enable wasm linker tests 2023-03-15 10:48:14 -07:00
extern-mangle re-enable test-cases and get them all passing 2023-03-15 10:48:14 -07:00
function-table re-enable test-cases and get them all passing 2023-03-15 10:48:14 -07:00
infer-features re-enable test-cases and get them all passing 2023-03-15 10:48:14 -07:00
producers std.Build.CompileStep: remove run() and install() 2023-04-10 18:35:14 -07:00
segments std.Build.CompileStep: remove run() and install() 2023-04-10 18:35:14 -07:00
stack_pointer std.Build.CompileStep: remove run() and install() 2023-04-10 18:35:14 -07:00
type Prevent analysis of functions only referenced at comptime 2023-05-29 23:06:08 +01:00