zig/test/behavior
mlugg 92c63126e8 compiler: tlv pointers are not comptime-known
Pointers to thread-local variables do not have their addresses known
until runtime, so it is nonsensical for them to be comptime-known. There
was logic in the compiler which was essentially attempting to treat them
as not being comptime-known despite the pointer being an interned value.
This was a bit of a mess, the check was frequent enough to actually show
up in compiler profiles, and it was very awkward for backends to deal
with, because they had to grapple with the fact that a "constant" they
were lowering might actually require runtime operations.

So, instead, do not consider these pointers to be comptime-known in
*any* way. Never intern such a pointer; instead, when the address of a
threadlocal is taken, emit an AIR instruction which computes the pointer
at runtime. This avoids lots of special handling for TLVs across
basically all codegen backends; of all somewhat-functional backends, the
only one which wasn't improved by this change was the LLVM backend,
because LLVM pretends this complexity around threadlocals doesn't exist.

This change simplifies Sema and codegen, avoids a potential source of
bugs, and potentially improves Sema performance very slightly by
avoiding a non-trivial check on a hot path.
2025-05-27 19:23:11 +01:00
..
conflicting_externs categorize behavior/bugs/<issueno>.zig tests 2024-01-06 16:49:41 -08:00
hasdecl move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
import move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
namespace_depends_on_compile_var move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
pub_enum move behavior tests from test/stage1/ to test/ 2021-04-29 15:54:04 -07:00
usingnamespace compiler: split Decl into Nav and Cau 2024-08-11 07:29:41 +01:00
x86_64 x86_64: implement vector_store_elem 2025-05-17 20:31:25 -04:00
zon compiler: allow @import of ZON without a result type 2025-04-02 05:53:22 +01:00
abs.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
addrspace_and_linksection.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
align.zig Sema: Fix some ptr alignment checks to handle a potential ISA tag bit. 2025-04-27 23:54:54 +01:00
alignof.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
array.zig stage2-wasm: fix comparing and storing optionals 2025-03-24 14:58:05 +01:00
asm.zig x86_64: implement switch jump tables 2025-01-16 20:42:08 -05:00
async_fn.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
atomics.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
await_struct.zig Remove uses of deprecated callconv aliases 2025-03-05 03:01:43 +00:00
basic.zig test: Disable arrays and vectors with big integers on MIPS N32. 2025-05-08 21:32:22 +02:00
bit_shifting.zig x86_64: rewrite scalar <<| 2025-05-17 18:00:17 -04:00
bitcast.zig stage2-wasm: packed store/load 128 bits 2025-03-24 15:00:00 +01:00
bitreverse.zig stage2-wasm: bit_reverse 2024-06-16 11:53:33 +02:00
bool.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
builtin_functions_returning_void_or_noreturn.zig x86_64: implement @memmove 2025-05-17 02:08:41 -04:00
byteswap.zig riscv: clean up and unify encoding logic 2024-07-26 04:19:13 -07:00
byval_arg_var.zig riscv: rewrite "binOp" 2024-06-13 02:24:39 -07:00
call.zig stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
cast.zig Merge pull request #23061 from pavelverigo/stage2-wasm-misc 2025-04-11 15:56:35 -04:00
cast_int.zig stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
comptime_memory.zig compiler: fix comptime memory store bugs 2025-05-03 20:10:26 +01:00
const_slice_child.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
decl_literals.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
decltest.zig riscv: math progress 2024-05-11 02:17:24 -07:00
defer.zig stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
destructure.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
duplicated_test_names.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
empty_union.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
enum.zig std.meta.intToEnum -> std.enums.fromInt 2025-05-13 07:28:41 +02:00
error.zig stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
eval.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
export_builtin.zig x86_64: rewrite @splat 2025-05-17 18:00:17 -04:00
export_c_keywords.zig lib,test,tools,doc: update usages of @export 2024-08-27 00:44:35 +01:00
export_keyword.zig spirv: aligned load for physical storage variables 2025-03-18 07:05:50 +03:30
export_self_referential_type_info.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
extern.zig all: update to std.builtin.Type.Pointer.Size field renames 2025-01-16 12:46:29 +00:00
extern_struct_zero_size_fields.zig test: update behavior to silence 'var is never mutated' errors 2023-11-19 09:57:03 +00:00
field_parent_ptr.zig stage2-wasm: pass field_parent_ptr tests 2025-03-24 15:00:00 +01:00
file_to_embed.txt rename behavior test to better describe what it does 2023-10-23 17:28:10 -07:00
floatop.zig Merge pull request #23061 from pavelverigo/stage2-wasm-misc 2025-04-11 15:56:35 -04:00
fn.zig Sema: fix in-memory coercion of functions introducing new generic parameters 2025-03-24 04:32:45 +00:00
fn_delegation.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
fn_in_struct_in_comptime.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
for.zig test: add a behavior test for 0-length loop fix 2025-03-24 06:58:01 -07:00
generics.zig Sema: increment extra index even if return type is generic 2025-04-02 01:34:17 +02:00
globals.zig Value: ensure that extern structs have their layout resolved in ptrField 2025-04-11 15:30:20 -04:00
hasdecl.zig spirv: disable tests that fail on pocl 2024-06-10 20:32:34 +02:00
hasfield.zig Sema: make @hasField support tuples too 2022-03-11 12:59:20 -07:00
if.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
import.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
import_c_keywords.zig all: update to std.builtin.Type.Pointer.Size field renames 2025-01-16 12:46:29 +00:00
incomplete_struct_param_tld.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
inline_switch.zig spirv: skip range switch tests 2024-10-13 01:58:11 +02:00
int128.zig stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
int_comparison_elision.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
ir_block_deps.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
lower_strlit_to_vector.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
math.zig Merge pull request #23061 from pavelverigo/stage2-wasm-misc 2025-04-11 15:56:35 -04:00
maximum_minimum.zig Sema: rewrite analyzeMinMax 2025-05-19 00:27:01 +01:00
member_func.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
memcpy.zig Sema: fix memcpy with C pointers 2025-04-28 05:09:12 +01:00
memmove.zig x86_64: implement @memmove 2025-05-17 02:08:41 -04:00
memset.zig wasm: disable failing tests 2025-02-06 17:02:54 -05:00
merge_error_sets.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
muladd.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
multiple_externs_with_conflicting_types.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
namespace_depends_on_compile_var.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
nan.zig riscv: rewrite "binOp" 2024-06-13 02:24:39 -07:00
null.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
optional.zig stage2-wasm: fix comparing and storing optionals 2025-03-24 14:58:05 +01:00
packed-struct.zig stage2-wasm: packed store/load 128 bits 2025-03-24 15:00:00 +01:00
packed-union.zig spirv: aligned load for physical storage variables 2025-03-18 07:05:50 +03:30
packed_struct_explicit_backing_int.zig stage2-wasm: enable already working tests 2025-03-24 14:59:58 +01:00
pointers.zig Sema: fix a few indexing bugs 2025-04-28 19:43:58 +01:00
popcount.zig riscv: update tests and fix reuse bug 2024-07-26 04:19:58 -07:00
prefetch.zig test: Disable @prefetch behavior test for loongarch. 2025-04-07 16:03:22 +02:00
ptrcast.zig Sema: allow @ptrCast single-item pointer to slice 2025-05-19 19:26:12 +01:00
ptrfromint.zig Sema: error on illegal code when targeting spirv 2025-03-17 21:56:14 +03:30
pub_enum.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
ref_var_in_if_after_if_2nd_switch_prong.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
reflection.zig std: update std.builtin.Type fields to follow naming conventions 2024-08-28 08:39:59 +01:00
return_address.zig riscv: arbitrary sized arrays 2024-06-13 02:19:40 -07:00
saturating_arithmetic.zig x86_64: rewrite scalar <<| 2025-05-17 18:00:17 -04:00
select.zig test: Disable a bunch of vector behavior tests for hexagon. 2025-04-11 02:28:35 +02:00
shuffle.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
sizeof_and_typeof.zig Sema: error on illegal code when targeting spirv 2025-03-17 21:56:14 +03:30
slice.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
slice_sentinel_comptime.zig spirv: update tests 2024-02-04 19:09:33 +01:00
src.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
string_literals.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
struct.zig test: skip "struct fields get automatically reordered" for spirv64 backend 2025-04-28 10:49:19 +03:30
struct_contains_null_ptr_itself.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
struct_contains_slice_of_itself.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
switch.zig x86_64: fix switch on big ints 2025-04-09 20:14:12 -04:00
switch_loop.zig stage2-wasm: implement switch_dispatch + handle > 32 bit integers in switches 2025-02-22 18:34:00 -05:00
switch_on_captured_error.zig stage2-wasm: fix error union handling 2025-03-24 15:00:00 +01:00
switch_prong_err_enum.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
switch_prong_implicit_cast.zig riscv: update tests and fix reuse bug 2024-07-26 04:19:58 -07:00
this.zig Sema: fix handling of @This() on opaques 2025-03-11 13:13:52 +00:00
threadlocal.zig compiler: tlv pointers are not comptime-known 2025-05-27 19:23:11 +01:00
truncate.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
try.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
tuple.zig Sema: fix alignment of runtime field pointer of underaligned tuple 2025-04-28 01:14:24 +01:00
tuple_declarations.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
type.zig Dwarf: handle undefined type values 2025-04-05 21:42:33 -04:00
type_info.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
typename.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
undefined.zig stage2-wasm: enable undef test + ignore undef store/memset with safety off 2025-03-24 15:00:00 +01:00
underscore.zig riscv: std.fmt.format running 2024-06-13 02:20:47 -07:00
union.zig spirv: aligned load for physical storage variables 2025-03-18 07:05:50 +03:30
union_with_members.zig riscv: update tests and fix reuse bug 2024-07-26 04:19:58 -07:00
usingnamespace.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
var_args.zig test: Disable some varargs behavior tests on sparc. 2025-04-28 12:05:19 +02:00
vector.zig x86_64: implement vector_store_elem 2025-05-17 20:31:25 -04:00
void.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
wasm.zig riscv: add stage2_riscv to test matrix and bypass failing tests 2024-05-11 02:17:24 -07:00
while.zig test: skip failing tests with spirv-vulkan 2025-02-24 19:39:42 +01:00
widening.zig riscv: rewrite "binOp" 2024-06-13 02:24:39 -07:00
wrapping_arithmetic.zig x86_64: implement switch jump tables 2025-01-16 20:42:08 -05:00
x86_64.zig behavior: fix issues with x86_64 backend tests 2025-04-09 20:14:12 -04:00
zero.bin Module: fix @embedFile of files containing zero bytes 2024-02-22 12:33:53 -08:00
zon.zig compiler: allow @import of ZON without a result type 2025-04-02 05:53:22 +01:00