diff options
| author | Luuk de Gram <luuk@degram.dev> | 2023-04-16 15:10:45 +0200 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2023-04-22 21:16:23 +0200 |
| commit | d4ceb12ae9d409dbd52c1f5c96312a1e6ad7d6bc (patch) | |
| tree | 2431e92ce3e64e0b404a4d7e5a6cb833c298e342 /src/Module.zig | |
| parent | 27a41413f71b9b2d2fb15ea14a96983b4ba9bd2e (diff) | |
| download | zig-d4ceb12ae9d409dbd52c1f5c96312a1e6ad7d6bc.tar.gz zig-d4ceb12ae9d409dbd52c1f5c96312a1e6ad7d6bc.zip | |
wasm: implement `error_set_has_value`
This implements the safety check for error casts. The instruction
generates a jump table with 2 possibilities. The operand is used
as an index into the jump table. For cases where the value does
not exist within the error set, it will generate a jump to the
'false' block. For cases where it does exist, it will generate
a jump to the 'true' block. By calculating the highest and lowest
value we can keep the jump table smaller, as it doesn't need to
contain an index into the entire error set.
Diffstat (limited to 'src/Module.zig')
| -rw-r--r-- | src/Module.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Module.zig b/src/Module.zig index fa91e8c1ed..27f7b24e7a 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -6626,7 +6626,7 @@ pub fn backendSupportsFeature(mod: Module, feature: Feature) bool { .safety_check_formatted => mod.comp.bin_file.options.use_llvm, .error_return_trace => mod.comp.bin_file.options.use_llvm, .is_named_enum_value => mod.comp.bin_file.options.use_llvm, - .error_set_has_value => mod.comp.bin_file.options.use_llvm, + .error_set_has_value => mod.comp.bin_file.options.use_llvm or mod.comp.bin_file.options.target.isWasm(), .field_reordering => mod.comp.bin_file.options.use_llvm, }; } |
