| Age | Commit message (Collapse) | Author |
|
|
|
This reverts commit d3ebd428650748e60db70dd2171cc044855814b1.
This caused a build failure on multiple targets.
|
|
This commit makes it possible to obtain pointers to `extern` variables
at comptime.
- `ir_get_var_ptr` employs several checks to determine if the given
variable is eligible for obtaining its pointer at comptime. This
commit alters these checks to consider `extern` variables, which have
runtime values, as eligible.
- After this change, it's now possible for `render_const_val` to be
called for `extern` variables. This commit modifies
`render_const_val` to suppress the value generation for `extern`
variables.
- `do_code_gen` now creates `ZigValue::llvm_global` of `extern`
variables before iterating through module-level variables so that
other module-level variables can refer to them.
This solution is incomplete since there are several cases still
failing:
- `global_var.array[n..m]`
- `&global_var.array[i]`
- `&global_var.inner_struct.value`
- `&global_array[i]`
Closes #5349
|
|
|
|
|
|
bit count
|
|
|
|
* Make unary minus for unsigned types a compile error
* Add unreachable when generating unsigned negate
|
|
|
|
|
|
* Take advantage of coercing anonymous struct literals to struct types.
* Reworks Module to favor Zig source as the primary use case.
Breaks ZIR compilation, which will have to be restored in a future commit.
* Decl uses src_index rather then src, pointing to an AST Decl node
index, or ZIR Module Decl index, rather than a byte offset.
* ZIR instructions have an `analyzed_inst` field instead of Module
having a hash table.
* Module.Fn loses the `fn_type` field since it is redundant with
its `owner_decl` `TypedValue` type.
* Implement Type and Value copying. A ZIR Const instruction's TypedValue
is copied to the Decl arena during analysis, which allows freeing the
ZIR text instructions post-analysis.
* Don't flush the ELF file if there are compilation errors.
* Function return types allow arbitrarily complex expressions.
* AST->ZIR for function calls and return statements.
|
|
|
|
|
|
This will allow the developer to request additional memory pages
from the runtime to be allocated for the Wasm app. Typical usage:
```zig
var wasm_pages = @wasmMemorySize();
@wasmMemoryGrow(1);
@import("std").debug.assert((wasm_pages + 1) == @wasmMemorySize());
```
|
|
This will allow the developer to poll the runtime for currently
allocated memory in the number of Wasm pages. Typical usage:
```zig
var wasm_pages = @wasmMemorySize();
@import("std").debug.assert(wasm_pages > 0);
```
|
|
Currently this does not handle returning these structs yet.
Related: #1481
|
|
ir_assert_gen) (#5393)
|
|
self-hosted-incremental-compilation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Consider a (legal according to the `@bitCast` rules) conversion from u16
to [2]u8: since the former is a scalar and the latter is a pointer
(arrays are represented at pointers in the codegen phase) we have to
allocate a temporary slot on the stack and then bitcast the resulting
pointer to the desired destination type.
Beware that this means the lifetime of the resulting value is the same
of the function it's contained in and for all intents and purposes
should be regarded as a local (eg. it should not escape).
Closes #4395
Closes #5121
|
|
Applying the wrong ABI is slightly better than using the Zig ABI, the
whole thing is so wrong it should be burned to the ground.
|
|
Thanks to @frett27 on irc for reporting the compiler would segfault when
run on ARM.
|
|
The codegen would sometimes change the LLVM type for some constants to
an unnamed structure in order to accomodate extra padding. This is fine
as long as the alignment of each field is still respected and it was not
the case for structure types, leading to ill-formed constants being
generated.
Optional types suffer from this to a lower extent as their layout is
quite lucky, the only missing piece was the tail padding.
Closes #4530
Closes #4594
Closes #4295
Closes my will to live
|
|
* Fix packed struct alignment
* Adjust some tests
|
|
This is a follow-up to d27ef1aaef8ac12801ba4e6c2ed748c7151096a7
and avoids compiler warnings:
warning: argument unused during compilation: '-nostdinc++'
|
|
Thanks to Michael Dusan for figuring out what was happening here.
closes #5012
|
|
Rewrite the bound checks in slice operator
|
|
Extend the logic used for function definitions to variables.
Closes #4947
|
|
* `--major-image-version`
* `--minor-image-version`
* `--stack`
|
|
The extra logic that's needed was lost during a refactoring, now it
should be fine.
|
|
|
|
|
|
Closes #4050
|
|
run detection of libc.
Fixes #4772
|
|
Before, this would cause a link failure when mixing Zig and C code for
RISC-V targets.
Now, the ABIs match and Zig and C code can be mixed successfully.
I will file a follow-up issue for the ability to deal more explicitly
with ABIs.
closes #4863
|
|
Closes #4777
|
|
|
|
Zig disables its caching and forwards these args when any are provided.
see #4784
|
|
|
|
Make fallthrough an error when compiler supports it. This requires a new
macro that is defined with such compilers to be used as a statement, at
all fallthrough sites:
switch (...) {
case 0:
...
ZIG_FALLTHROUGH;
case 1:
...
break;
default:
...
break;
}
If we ever move to C++17 as minimal requirement, then the macro can be
replaced with `[[fallthrough]];` at statement sites.
|
|
fix some nullptr dereferences on arm-linux-musleabhif
|
|
Throughout the stage1 code it is assumed that these have the same layout,
but that was not the case. This caused an issue on 32-bit hardware.
|
|
|
|
zero termination
|
|
This caused link errors in c++ code because it was not correct to pass
these flags to child codegens. And that was the only reason to detect
these flags. Otherwise we can safely rely on non-explicitly-detected
flag forwarding.
|