Commit Graph

4754 Commits (af7daae26b874a40319041cce784645b03aa8fb3)

Author SHA1 Message Date
Ryan Liptak af7daae26b readme: Simplify instructions for making changes to the standard library 2019-04-21 21:53:35 -07:00
Ryan Liptak e64c0dee35 readme: Add instructions for making changes to the standard library
Closes #2324
2019-04-21 15:21:19 -07:00
emekoi 0f8fc3b924 fixed stack protector issues 2019-04-21 14:13:48 -04:00
daurnimator 211f0a2226 std: Add mem.nativeIntToBig and mem.nativeIntToLittle
To be used where `htons`, `htonl`, etc. would be used in C.
It's useful to have a function that returns a number directly for use in initialisers.
2019-04-21 14:04:01 -04:00
vegecode bb25f212b3 compiler-rt: add aeabi_fcmp, comparesf2 2019-04-21 00:12:21 -04:00
tgschultz 22f5e5fd3e Fixes DirectAllocator Windows implementation to call HeapFree when new_size == 0 2019-04-20 14:04:09 -04:00
Andrew Kelley b864fe7e23
Merge branch 'LemonBoy-dwarfy' 2019-04-20 13:49:02 -04:00
Andrew Kelley 9b83fe6b4c
fixup and zig fmt 2019-04-20 13:48:38 -04:00
Andrew Kelley 907a7068ce
Merge branch 'dwarfy' of https://github.com/LemonBoy/zig into LemonBoy-dwarfy 2019-04-20 13:32:59 -04:00
LemonBoy c2542bb7b7 Recover symbol infos from DWARF sections 2019-04-20 10:35:39 +02:00
Ryan Liptak 1030cc97ca fix DirectAllocator not unmapping unused pages on large alignments
Fixes #2306
2019-04-20 02:21:42 -04:00
Raul Leal d44d2784e6 zig-fmt: allow comptime blocks in containers (#2308)
* zig-fmt: allow comptime blocks in containers
* add test for comptime block in container
2019-04-19 15:27:42 -04:00
LemonBoy 0286be127e Fix parseFormValueConstant
Signed/unsigned confusion made the code fail an assertion sometimes.
2019-04-19 19:59:14 +02:00
Matt Stancliff 3b6a4fe4cd Fix test in langref to assert against modified var 2019-04-18 16:14:30 -04:00
Andrew Kelley a10a1efc83
ci: fix accidentally shipping zig0.exe 2019-04-17 20:27:13 -04:00
Andrew Kelley ff3cdbc3a0
stage1 assertions always on, and have stack traces 2019-04-17 15:58:20 -04:00
Andrew Kelley 4ad7d09ba5
build: rename zig1 to zig0 to avoid confusion with stage1 2019-04-17 14:09:18 -04:00
Andrew Kelley bc2d60c11f
Merge pull request #2295 from ziglang/stage1-hybrid
stage1 is now a hybrid of C++ and Zig
2019-04-17 00:24:51 -04:00
Andrew Kelley da8403bcdd
build.zig: libuserland expects to against libc 2019-04-16 19:13:46 -04:00
Andrew Kelley 89763c9a0d
stage1 is now a hybrid of C++ and Zig
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
2019-04-16 19:12:20 -04:00
Andrew Kelley 4c03746926
Revert "DirectAllocator: on windows, use HeapFree instead of HeapReAlloc to free memory."
This reverts commit 71bb8cd537.

This broke the CI on Windows.
2019-04-16 19:11:37 -04:00
Andrew Kelley b29241fc08
docs: update intro text 2019-04-16 14:23:58 -04:00
Michael Dusan 611d4bc6a1 stage1: const_values_equal support tagged union 2019-04-16 13:55:23 -04:00
Andrew Kelley 52caf311bb
Merge pull request #2286 from shritesh/wasm_alloc
WasmAllocator: WebAssembly Memory Allocator
2019-04-16 13:27:56 -04:00
Shritesh Bhattarai 0c28a18d96 WasmAllocator: cleanup 2019-04-16 12:23:45 -05:00
Sahnvour 71bb8cd537 DirectAllocator: on windows, use HeapFree instead of HeapReAlloc to free memory. 2019-04-16 13:18:21 -04:00
Andrew Kelley 4e2f6ebf39
freestanding target adds -ffrestanding to cc parameters
closes #2287
2019-04-16 12:06:14 -04:00
Andrew Kelley 3226b5315e
translate-c: move some code to the C API
See #1964
2019-04-16 04:32:48 -04:00
Andrew Kelley f488f3fd03
remove workaround for LLD bug
Zig's embedded LLD now has a patch to resolve the deadlock race
condition, and the patch is getting upstreamed too, so this
closes #2283.
2019-04-16 03:58:15 -04:00
Andrew Kelley c8b60538ed
add patch to LLD to fix deadlock race condition in wasm linker
Patch is getting upstreamed here: https://reviews.llvm.org/D60757
And so this patch can be removed with LLVM 9.0.0.
2019-04-16 03:56:46 -04:00
Shritesh Bhattarai 4235982fe6 fmt wasm_allocator 2019-04-16 01:42:11 -05:00
Shritesh Bhattarai aa3f31ac0a wasm: add WasmAllocator 2019-04-16 01:40:16 -05:00
Shritesh Bhattarai f2119f9961 wasm: WasmAllocator that uses fixed 64kb pages 2019-04-15 21:21:46 -05:00
Andrew Kelley 0a280b6062
update std.os.page_size for WebAssembly 2019-04-15 21:20:41 -04:00
Andrew Kelley 6692cbbe18
disable threads when linking WebAssembly to work around an LLD bug
See #2283
2019-04-15 20:41:50 -04:00
Andrew Kelley 579dd74114
fix Debug mode when error return tracing is off
Previously the code for generating a panic crash expected
one of the parameters to be the error return trace. Now
it does not expect that parameter when g->have_err_ret_tracing
is false.

Closes #2276
2019-04-15 20:17:06 -04:00
Shritesh Bhattarai f5d84250a3 wasi: switch to "standard" wasi_unstable module fn 2019-04-15 18:44:33 -04:00
Andrew Kelley 3b8a85c941
Merge pull request #2281 from shritesh/wasm_module
Support wasm module imports
2019-04-15 18:05:46 -04:00
Shritesh Bhattarai a0d2185199 wasm: add wasm-import-module attr to extern 2019-04-15 17:00:04 -05:00
Shritesh Bhattarai 9465c6d538 link: exemption for wasm instead of wasi 2019-04-15 16:59:34 -05:00
Andrew Kelley 5cb18e9c6f
translate-c: move some code to the C API
See #1964
2019-04-15 00:32:27 -04:00
Shritesh Bhattarai cc8cf94cb2 Update wasm tiers (#2272)
* tier update: wasm32=2, wasm64=4
2019-04-14 11:29:22 -04:00
Andrew Kelley 27253f09b6
organize how the single threaded option is passed around 2019-04-14 11:01:01 -04:00
Andrew Kelley 63a970a548
Merge pull request #2268 from shritesh/wasi
wasm: preliminary WASI OS support
2019-04-14 10:45:30 -04:00
Shritesh Bhattarai 0f1d92e2cf wasm: force single threaded 2019-04-14 10:21:48 -04:00
Shritesh Bhattarai 94e0871603 wasi: don't pass --no-entry to linker 2019-04-14 00:03:32 -05:00
Shritesh Bhattarai ecd0f89254 wasi: better extern wasi logic 2019-04-13 23:49:02 -05:00
Shritesh Bhattarai 93d43d4529 wasi: add std/os/wasi{,/core}.zig to CMakeLists.txt 2019-04-13 22:51:18 -05:00
Shritesh Bhattarai 22960a5fdf wasi: better comments 2019-04-13 22:45:31 -05:00
Shritesh Bhattarai a2d8f03092 support extern "wasi" functions 2019-04-13 22:28:58 -05:00