aboutsummaryrefslogtreecommitdiff
path: root/src/userland.h
AgeCommit message (Collapse)Author
2020-02-16rename libuserland to libstage2Andrew Kelley
2020-02-16self-hosted libc detectionAndrew Kelley
* libc_installation.cpp is deleted. src-self-hosted/libc_installation.zig is now used for both stage1 and stage2 compilers. * (breaking) move `std.fs.File.access` to `std.fs.Dir.access`. The API now encourages use with an open directory handle. * Add `std.os.faccessat` and related functions. * Deprecate the "C" suffix naming convention for null-terminated parameters. "C" should be used when it is related to libc. However null-terminated parameters often have to do with the native system ABI rather than libc. "Z" suffix is the new convention. For example, `std.os.openC` is deprecated in favor of `std.os.openZ`. * Add `std.mem.dupeZ` for using an allocator to copy memory and add a null terminator. * Remove dead struct field `std.ChildProcess.llnode`. * Introduce `std.event.Batch`. This API allows expressing concurrency without forcing code to be async. It requires no Allocator and does not introduce any failure conditions. However it is not thread-safe. * There is now an ongoing experiment to transition away from `std.event.Group` in favor of `std.event.Batch`. * `std.os.execvpeC` calls `getenvZ` rather than `getenv`. This is slightly more efficient on most systems, and works around a limitation of `getenv` lack of integration with libc. * (breaking) `std.os.AccessError` gains `FileBusy`, `SymLinkLoop`, and `ReadOnlyFileSystem`. Previously these error codes were all reported as `PermissionDenied`. * Add `std.Target.isDragonFlyBSD`. * stage2: access to the windows_sdk functions is done with a manually maintained .zig binding file instead of `@cImport`. * Update src-self-hosted/libc_installation.zig with all the improvements that stage1 has seen to src/libc_installation.cpp until now. In addition, it now takes advantage of Batch so that evented I/O mode takes advantage of concurrency, but it still works in blocking I/O mode, which is how it is used in stage1.
2020-02-15translate-c: change OutOfMemory → ASTUnitFailureMichael Dusan
- return a better error when no diagnostics are available
2020-01-22std.Target.CpuFeatures is now a struct with both CPU and feature setAndrew Kelley
Previously it was a tagged union which was one of: * baseline * a specific CPU * a set of features Now, it's possible to have a CPU but also modify the CPU's feature set on top of that. This is closer to what LLVM does. This is more correct because Zig's notion of CPUs (and LLVM's) is not exact CPU models. For example "skylake" is not one very specific model; there are several different pieces of hardware that match "skylake" that have different feature sets enabled.
2020-01-21properly forward baseline target cpu features to llvmAndrew Kelley
2020-01-21make zig targets show native cpu name and featuresAndrew Kelley
2020-01-21fixups to arch data, support any number of cpu featuresAndrew Kelley
2020-01-20stage1 is building. `zig targets` now self-hostedAndrew Kelley
2020-01-19figure out zig0/stage1 and scanning for native CPUAndrew Kelley
2020-01-19progress towards mergingAndrew Kelley
see BRANCH_TODO file
2020-01-19Add defaut feature supportLayne Gustafson
2020-01-19Add builtin.zig supportLayne Gustafson
2020-01-19Add TargetDetails abstractionLayne Gustafson
2020-01-19Add cpu/feature specification to cmndlineLayne Gustafson
2020-01-19Make targets cmd able to list CPUs and featuresLayne Gustafson
2019-12-12remove concept of translate modeVexu
2019-10-23move types from builtin to stdAndrew Kelley
* All the data types from `@import("builtin")` are moved to `@import("std").builtin`. The target-related types are moved to `std.Target`. This allows the data types to have methods, such as `std.Target.current.isDarwin()`. * `std.os.windows.subsystem` is moved to `std.Target.current.subsystem`. * Remove the concept of the panic package from the compiler implementation. Instead, `std.builtin.panic` is always the panic function. It checks for `@hasDecl(@import("root"), "panic")`, or else provides a default implementation. This is an important step for multibuilds (#3028). Without this change, the types inside the builtin namespace look like different types, when trying to merge builds with different target settings. With this change, Zig can figure out that, e.g., `std.builtin.Os` (the enum type) from one compilation and `std.builtin.Os` from another compilation are the same type, even if the target OS value differs.
2019-10-22integrate stage1 progress display with semantic analysisAndrew Kelley
2019-10-17improve progress reportingAndrew Kelley
* use erase rest of line escape code. * use `stderr.supportsAnsiEscapeCodes` rather than `isTty`. * respect `--color off` * avoid unnecessary recursion * add `Progress.log` * disable the progress std lib test since it's noisy and uses `time.sleep()`. * enable/integrate progress printing with the default test runner
2019-10-17rework the progress module and integrate with stage1Andrew Kelley
2019-08-29await does not force async if callee is blockingAndrew Kelley
closes #3067
2019-08-29comparing against zero participates in lazy valuesAndrew Kelley
2019-07-02enable segfault stack traces in stage1 compilerAndrew Kelley
2019-05-29add review changesMichael Dusan
- use std.heap.c_allocator - use @panic instead of unreachable - use extern enum for tokenizer result type
2019-05-27new .d file parser for C compilationMichael Dusan
- wip for #2046 - clang .d output must be created with `clang -MV` switch - implemented in Zig - hybridized for zig stage0 and stage1 - zig test src-self-hosted/dep_tokenizer.zig
2019-05-15fix static builds of zig from requiring c compilerAndrew Kelley
to be installed when linking libc. When zig links against libc, it requires a dynamic linker path. Usually this can be determined based on the architecture and operating system components of the target. However on some systems this is not correct; because of this zig checks its own dynamic linker. When zig is statically linked, this information is not available, and so it resorts to using cc -print-filename=foo to find the dynamic linker path. Before this commit, Zig incorrectly exited with an error if there was no c compiler installed. Now, Zig falls back to the dynamic linker determined based on the arch and os when no C compiler can be found.
2019-04-26zig fmt is built directly into stage1 rather than child processAndrew Kelley
Previously, `zig fmt` on the stage1 compiler (which is what we currently ship) would perform what equates to `zig run std/special/fmt_runner.zig` Now, `zig fmt` is implemented with the hybrid zig/C++ strategy outlined by #1964. This means Zig no longer has to ship some of the stage2 .zig files, and there is no longer a delay when running `zig fmt` for the first time.
2019-04-25translate-c: unify API for self-hosted and C++ translate-cAndrew Kelley
See #1964
2019-04-25translate-c: a little closer to self-hosted implementationAndrew Kelley
2019-04-17stage1 assertions always on, and have stack tracesAndrew Kelley
2019-04-16stage1 is now a hybrid of C++ and ZigAndrew Kelley
This modifies the build process of Zig to put all of the source files into libcompiler.a, except main.cpp and userland.cpp. Next, the build process links main.cpp, userland.cpp, and libcompiler.a into zig1. userland.cpp is a shim for functions that will later be replaced with self-hosted implementations. Next, the build process uses zig1 to build src-self-hosted/stage1.zig into libuserland.a, which does not depend on any of the things that are shimmed in userland.cpp, such as translate-c. Finally, the build process re-links main.cpp and libcompiler.a, except with libuserland.a instead of userland.cpp. Now the shims are replaced with .zig code. This provides all of the Zig standard library to the stage1 C++ compiler, and enables us to move certain things to userland, such as translate-c. As a proof of concept I have made the `zig zen` command use text defined in userland. I added `zig translate-c-2` which is a work-in-progress reimplementation of translate-c in userland, which currently calls `std.debug.panic("unimplemented")` and you can see the stack trace makes it all the way back into the C++ main() function (Thanks LemonBoy for improving that!). This could potentially let us move other things into userland, such as hashing algorithms, the entire cache system, .d file parsing, pretty much anything that libuserland.a itself doesn't need to depend on. This can also let us have `zig fmt` in stage1 without the overhead of child process execution, and without the initial compilation delay before it gets cached. See #1964