Commit Graph

5072 Commits

Author SHA1 Message Date
Jimmi Holst Christensen
fb3b943b07 added tests for global variable declaration syntax 2019-05-11 20:11:56 +02:00
Andrew Kelley
32efa68f90
Merge pull request #2449 from Sahnvour/directallocator
Rework of windows' DirectAllocator
2019-05-11 13:04:20 -04:00
Jimmi Holst Christensen
b2a196e01d Merge branch 'master' of github.com:ziglang/zig 2019-05-11 18:49:23 +02:00
Jimmi Holst Christensen
c051904903 Fixed parser for extern threadlocal variables 2019-05-11 18:48:52 +02:00
Andrew Kelley
10e9d47b49
stage2 translate-c: implement functions with no prototype
stage1 translate-c actually has this wrong. When exporting a function,
it's ok to use empty parameters. But for prototypes, "no prototype"
means that it has to be emitted as a function that accepts anything,
e.g. extern fn foo(...) void;

See #1964
2019-05-11 12:09:11 -04:00
Andrew Kelley
2ef2f9d71f
Merge pull request #2475 from LemonBoy/linux-wo-vdso
Fix clock_gettime on systems without VDSO
2019-05-11 12:01:52 -04:00
Sahnvour
cd537f822b Use unprotected heap when in single_threaded mode. 2019-05-11 16:41:13 +02:00
Sahnvour
a2d5b0fabe Implement Windows' DirectAllocator on top of VirtualAlloc and VirtualFree. 2019-05-11 16:41:13 +02:00
daurnimator
3d93c89fc5 std: the failing allocator didn't actually count allocations
Add a field '.allocations' to actually track the number of allocations.

Additionally, only increment '.deallocations' when memory is freed
2019-05-11 09:55:41 -04:00
LemonBoy
6756e545f4 Fix more corner cases in LEB128 parsing 2019-05-11 09:54:48 -04:00
LemonBoy
1b23348f30 linux: Minor zig fmt induced reformatting 2019-05-11 10:34:22 +02:00
LemonBoy
715d808f14 linux: Fix clock_gettime on systems w/o VDSO 2019-05-11 10:33:41 +02:00
Andrew Kelley
5f4c3e6557
stage2 translate-c: simple function definitions
See #1964
2019-05-10 23:35:46 -04:00
Andrew Kelley
dbb5da14f4
stage2 translate-c: builtin types and pub
See #1964
2019-05-10 17:56:00 -04:00
Andrew Kelley
82219b1fd5
translate-c: better handling of restore points 2019-05-10 17:44:47 -04:00
Andrew Kelley
2933d6b848
add test case for previous commit
closes #2467
2019-05-10 16:57:37 -04:00
Andrew Kelley
fee0e6c8b9
fix hang for some compile errors
see #2467
2019-05-10 16:39:50 -04:00
Andrew Kelley
a6f7a9ce2b
translate-c: we have our first test of self-hosted
See #1964
2019-05-10 16:03:54 -04:00
Michael Dusan
d065f297ab stage1: compile error for loop expr val ignored
closes #2460
2019-05-10 10:05:40 -04:00
Jimmi HC
6b10f03b4a Fixes and simplifications for stage 1 parser 2019-05-10 16:09:58 +02:00
Andrew Kelley
bcf4d20289
Merge pull request #2465 from LemonBoy/builtins-for-wasm
A few builtins for wasm
2019-05-10 08:44:27 -04:00
LemonBoy
1606dae728 Fix erroneous test case
The *Mem variants cannot return EndOfStream and are generally unsafe to
use.
Proper order of checks, try both the variants and make sure they return
the same error/result.
Run the leb128.zig tests.
2019-05-10 08:40:36 -04:00
LemonBoy
7fb55ce2bb compiler-rt: Add __ashrti3 2019-05-10 13:26:33 +02:00
LemonBoy
fbffece1b5 compiler-rt: Add __lshrti3 2019-05-10 13:26:33 +02:00
LemonBoy
7db2aa1c25 compiler-rt: Add __ashlti3 2019-05-10 13:26:33 +02:00
Andrew Kelley
1c0223899c
translate-c: progress on self-hosted function prototypes
See #1964
2019-05-10 01:24:00 -04:00
Andrew Kelley
f8b7ea119f
Merge pull request #2461 from LemonBoy/dwarf-leb128
Fix minor bug in LEB128 parsing
2019-05-09 20:14:20 -04:00
Andrew Kelley
09cff0d2bd
fix translate-c regression
introduced in eb65410b62
2019-05-09 20:11:56 -04:00
LemonBoy
8cc4eaea9f Use matching types when parsing fields 2019-05-10 00:44:24 +02:00
LemonBoy
4d8f96dd88 Fix minor bug in LEB128 parsing 2019-05-10 00:41:05 +02:00
Andrew Kelley
eea2de108d
translate-c: progress on self-hosted function prototypes
See #1964
2019-05-09 16:52:30 -04:00
Andrew Kelley
214625587c
translate-c: use C API for builtin types
See #1964
2019-05-09 15:46:48 -04:00
Andrew Kelley
010963ce43
stage1: make some asserts print source location 2019-05-09 14:52:06 -04:00
Andrew Kelley
c459edac18
compile error for attempt to cast enum literal to error
closes #2203
2019-05-09 13:18:13 -04:00
Andrew Kelley
72899da44b
fix std.os.copyFile
closes #2454
2019-05-09 13:05:06 -04:00
Andrew Kelley
eb65410b62
translate-c: enough C tokenization/parsing to handle shifting in macros
See #2451
2019-05-09 12:48:38 -04:00
Andrew Kelley
62065a9aea
translate-c: handle int to ptr and ptr to int casting
See #2451
2019-05-09 12:17:23 -04:00
Andrew Kelley
a7346ea49f fix build on macOS
Sadly due to a workaround for LLD linker limitations on macOS
we cannot put libuserland into an .a file; instead we have to use object
files. Again due to linker limitations, bundling compiler_rt.o into
another relocatable object also doesn't work. So we're left with
disabling stack probing on macOS for the stage1 self-hosted code.

These workarounds could all be removed if the macos support in the LLD
linker improved, or if Zig project had its own linker that did not have
these issues.
2019-05-08 22:45:49 -04:00
Andrew Kelley
4b9e12be50
Merge pull request #2452 from LemonBoy/more-more-builtins
More more builtins
2019-05-08 22:24:12 -04:00
Andrew Kelley
46e1c34fcf
self-hosted translate-c progress on function decls
See #1964
2019-05-08 22:05:59 -04:00
Andrew Kelley
9bbd71c9ab
add --bundle-compiler-rt function to link options
and use it when building libuserland.a

The self-hosted part of stage1 relies on zig's compiler-rt, and so we
include it in libuserland.a.

This should potentially be the default, but for now it's behind a linker
option.

self-hosted translate-c: small progress on translating functions.
2019-05-08 20:51:49 -04:00
Andrew Kelley
3bd5c16f39
stage1: remove unneeded extern function 2019-05-08 19:33:57 -04:00
Andrew Kelley
e3542196c0
translate-c: NULL pointers translate to null
See #1967
2019-05-08 19:21:54 -04:00
Andrew Kelley
9c12237d2d
std.debug: fix stack trace iteration code
Previously, the stack trace iteration code was using the number of
frames collected as the number of frames to print, not recognizing the
fixed size of the buffer. So it would redundantly print items, matching
the total number of frames ever collected.

Now the iteration code is limited to the actual stack trace frame count,
and will not print duplicate frames.

Closes #2447
Closes #2151
2019-05-08 19:11:01 -04:00
Andrew Kelley
a4aee8b24d
C pointers support if and orelse
See #1967
2019-05-08 18:47:14 -04:00
LemonBoy
4208fa9ad9 compiler-rt: add __floatsitf 2019-05-09 00:25:50 +02:00
LemonBoy
383b8a032e compiler-rt: Add __aeabi_unwind_cpp_pr{0,1,2} 2019-05-09 00:07:46 +02:00
LemonBoy
2dce137d92 compiler-rt: Add __extendsfdf2
Add AEABI builtin __aeabi_f2d
2019-05-09 00:07:46 +02:00
LemonBoy
2be066d057 compiler-rt: Add __floatdidf
Add AEABI builtin __aeabi_l2d
2019-05-08 23:57:09 +02:00
LemonBoy
d4434dfb67 compiler-rt: Add __floatundidf & __floatunsidf
Add AEABI builtins __aeabi_ul2d, __aeabi_ui2d
2019-05-08 23:57:09 +02:00