forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[pull] master from ziglang:master #3
Open
pull
wants to merge
2,831
commits into
ryoppippi:master
Choose a base branch
from
ziglang:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Currently we don't report any errors to the user due to a bug in self-hosted x86_64-macos backend.
macho: add basic handling of DWARFv5
… check. The former is supported by most compilers while the latter is Clang-only.
tcc doesn't have __has_attribute and __has_builtin, so we need to manually check for tcc in these preprocessor paths.
The old spellings from C11 are deprecated in C23.
There's only one spot in the header where we want to handle GCC but not Clang, so just add an extra check there.
It seems like only Clang supports this in MinGW mode, and Clang will already take the __builtin_debugtrap() path anyway.
Just use inline assembly instead, which is what that header does. Also make sure we have a dummy implementation when inline assembly is unavailable.
We already do this for C99 only later in the file.
If present, these headers are usable even when compiling for older C language versions. Most notably, this enables zig.h atomics to work with slimcc and TinyCC in C99 mode (and earlier).
This fix doesn't matter at all in the grand scheme of things, but I think the story behind it is perhaps curious, as it might point at a design flaw in the Sema's error reporting API. So, a story: On lobsters, there's a rather heated discussion on the merits on RAII vs defer. I don't really like participating in heating discussions, but also sort of can't stop thinking about this. My own personal experience with Zig's defer and errdefer is that they are fiddly to get right consistency --- if a program has a lot of resource management to do, I _always_ mess up at least one defer/errdefer. I've found my internal peace by just avoiding spread-out, "pox" resource management, and instead centralizing resource ownership under one of the following patterns: * Either the thing is acquired and released in main * Or main allocates N instances of thing, and then the rest of the code explicitly juggles this finite pool of N. Notably, this juggling typically doesn't involve defer/errdefer at all, as, at this level of precision, there are no `try`s left, so you only code the happy path * Or there's some sort of arena thing, where a bunch of resources have a single owner, the user's don' bother cleaning up their resources, and instead the owner does it once at the end. So I wanted to make a lobster.rs comment in the vein of "yeah, if your program is mostly about resource management, then Zig could be kinda a pain, but that's friction tells you something: perhaps your program shouldn't be about resource management, and instead it should be doing what it is supposed to do?". And, as an evidence for my claim, I wanted to point out some large body of Zig code which doesn't have a lot of errdefers. So, I cracked opened Sema.zig, `ctrl+f` for `defer`, saw whopping 400 something occupancies, and my heart skipped a bit. Looking at the occurrences, _some_ of them were non-resource-related usages of defer. But a lot of them were the following pattern: ```zig const msg = try sema.errMsg(src, "comptime control flow inside runtime block", .{}); errdefer msg.destroy(sema.gpa); ``` This is exactly the thing that I know _I_ can't get right consistently! So, at this point, I made a prediction that at least one of `errdefer`s is missing. So, I looked at the first few `const msg = try` and of course found one without `errdefer`. I am at 0.8 that, even with this PR applied, the claim will still stand --- there will be `errdefer` missing. So it feels like some API re-design is in order, to make sure individual error messages are not resources. Could Sema just own all partially-constructed error messages, and, at a few known safe-points: * if the control flow is normal, assert that there are no in-progress error messages * if we are throwing an error, go and release messages immediately? I am unlikely to do the actual refactor here, but I think it's worth highlighting the overall pattern here. PS: I am only 0.9 sure that what I've found is indeed a bug! I don't understand the code, I did a dumb text search, so I _could_ have made a fool of myself here :P
It doesn't appear that targeting bridgeOS is meaningfully supported by Apple. Even LLVM/Clang appear to have incomplete support for it, suggesting that Apple never bothered to upstream that support. So there's really no sense in us pretending to support this.
These were leftovers from when we used the LLVM API to create modules.
The construction is likely to change before standardization
`std.Target`: Remove `Os.Tag.bridgeos`
…e changes `Zcu.PerThead.ensureTypeUpToDate` is set up in such a way that it only returns the updated type the first time it is called. In general, that's okay; however, the exception is that we want the function to continue returning `error.AnalysisFail` when the type has been lost, or its number of captures changed. Therefore, the check for this case now happens before the up-to-date success return. For simplicity, the number of captures is now handled by intentionally losing the instruction in `Zcu.mapOldZirToNew`, since there is nothing to gain from tracking a type when old instances of it can never be reused.
This commit reworks how values like the panic handler function are memoized during a compiler invocation. Previously, the value was resolved by whichever analysis requested it first, and cached on `Zcu`. This is problematic for incremental compilation, as after the initial resolution, no dependencies are marked by users of this memoized state. This is arguably acceptable for `std.builtin`, but it's definitely not acceptable for the panic handler/messages, because those can be set by the user (`std.builtin.Panic` checks `@import("root").Panic`). So, here we introduce a new kind of `AnalUnit`, called `memoized_state`. There are 3 such units: * `.{ .memoized_state = .va_list }` resolves the type `std.builtin.VaList` * `.{ .memoized_state = .panic }` resolves `std.Panic` * `.{ .memoized_state = .main }` resolves everything else we want These units essentially "bundle" the resolution of their corresponding declarations, storing the results into fields on `Zcu`. This way, when, for instance, a function wants to call the panic handler, it simply runs `ensureMemoizedStateResolved`, registering one dependency, and pulls the values from the `Zcu`. This "bundling" minimizes dependency edges. The 3 units are separated to allow them to act independently: for instance, the panic handler can use `std.builtin.Type` without triggering a dependency loop.
These cover the fixes from the last few commits.
* remove from doc., add explicit info when panic * match convention for assert documentation, avoiding to use panic here
incremental: fixes
Rather than `Zcu.BuiltinDecl.Memoized` being a struct with fields, it can instead just be an array, indexed by the enum. This allows runtime indexing, avoiding a few now-unnecessary `inline` switch cases.
incremental: debug line number updates
This is an RLS footgun. Resolves: #21834
The final offset was clobbering the first error name, which is revealed by an out of bounds when the global error set is empty. Closes #22362
* MSDN documentation page covering what resource IDs manifests should have: https://learn.microsoft.com/en-us/windows/win32/sbscs/using-side-by-side-assemblies-as-a-resource * This change ensures shared libraries that embed win32 manifests use the proper ID of 2 instead of 1, which is only allowed for .exes. If the manifest uses the wrong ID, it will not be found and is essentially ignored.
Some QEMU fixes + disable some tests for `thumbeb` in addition to `armeb`
The relocation range issues will happen eventually as we add more code to the standard library and test suites, so we may as well just deal with this now. @MasonRemaley ran into this in #20271, for example.
I'm not entirely sure how this happens.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by pull[bot] (v2.0.0-alpha.1)
Can you help keep this open source service alive? 💖 Please sponsor : )