Commit Graph

4784 Commits

Author SHA1 Message Date
Andrew Kelley
976080462c
translate-c: a little closer to self-hosted implementation 2019-04-25 00:06:54 -04:00
Andrew Kelley
56e07622c6
Merge pull request #2312 from squeek502/heap-shrink-large-align
fix heap allocators when shrinking an object but growing its alignment
2019-04-24 23:44:28 -04:00
Shawn Landden
8ef7f6febb remove Shebang (#!) support
Closes:  #2165
2019-04-24 23:34:19 -04:00
Andrew Kelley
fb2acaff06
@sizeOf returns 0 for comptime types
This defines `@sizeOf` to be the runtime size of a type, which means
that it is zero for types such as comptime_int, type, and (enum
literal).

See #2209
2019-04-24 22:31:53 -04:00
vegecode
733c547a65 compiler-rt: Add missing import of test for comparesf2 2019-04-24 21:16:03 -04:00
vegecode
01168e1577 compiler-rt: add aeabi_dcmp, comparedf2 2019-04-24 21:15:39 -04:00
Andrew Kelley
ad994c9642
Merge pull request #2296 from LemonBoy/translate-c-stuff
Handle implicit casts in translate-c
2019-04-24 14:43:46 -04:00
Wink Saville
7bafe2e490 Fix alignment of macro FIND_AND_ADD_CLANG_LIB 2019-04-24 14:42:08 -04:00
hryx
06bf918436 Sync grammar with spec
- Remove rule LabeledExpr
- Add rule CurlySuffixExpr
2019-04-24 14:38:56 -04:00
Michael Dusan
5de934810f add -fvisibility-inlines-hidden
On macOS building with Xcode/clang the linker complains loudly when
symbol visibility is inconsistent. This option syncs visibilty setting
of both LLVM and Zig.
2019-04-24 14:37:14 -04:00
Andrew Kelley
ed41955522
build libuserland in cross compilation mode
Previously libuserland was being built for the native target,
which could depend on native CPU features such as AVX. The
CI infrastructure is intending to create binaries that are
widely compatible and do not make use of specific CPU features.

There could be something to gain from enabling native CPU features
sometimes, by introducing a new cmake configuration option, but
since it's planned to eventually ship self-hosted rather than stage1,
I don't think it really matters.

closes #2348
2019-04-24 14:13:55 -04:00
Jimmi Holst Christensen
e4a86d4653
Merge pull request #2351 from ziglang/fixed-2346
fixes #2346
2019-04-24 18:42:55 +02:00
Jimmi HC
1a2e02e267 fixed #2356
const_ptr_pointee_unchecked did not take into account that if the
pointer is zero sized, then const_val->data.x_ptr.special would be
ConstPtrSpecialInvalid. This commit fixes this by also checking
that the child type of the pointer only have one possible value
and just returns that value.
2019-04-24 15:04:58 +02:00
Jimmi Holst Christensen
e553ade090
Merge pull request #2335 from hryx/no-tag-expr-for-struct
Allow tag expr for enum but not struct
2019-04-24 14:53:54 +02:00
Andrew Kelley
3bc361178c
Merge pull request #2344 from LemonBoy/dbg-things
Minor debug things
2019-04-23 10:15:53 -04:00
LemonBoy
374d16793f Go one instruction before the return address
The return address may not point to an area covered by the debug infos
so we hope for the best and decrement the address so that it points to
the caller instruction.
2019-04-23 10:05:46 +02:00
LemonBoy
b095e33667 Fix silly typo 2019-04-23 09:57:57 +02:00
LemonBoy
57ec183c09 Fix reading of signed leb128 values 2019-04-23 09:57:22 +02:00
LemonBoy
70c2e86da3 Add translation from pointer to boolean 2019-04-22 22:23:41 +02:00
LemonBoy
a44ad08954 Add some zig_panic for 80-bit float codepaths 2019-04-22 22:23:41 +02:00
LemonBoy
9ea600b634 Correct rendering of AST Char literals 2019-04-22 22:23:41 +02:00
LemonBoy
8d05330cf7 More precise translation of char literals 2019-04-22 22:23:41 +02:00
LemonBoy
ab424bbb35 translate-c: Add test for implicit casts 2019-04-22 22:23:41 +02:00
LemonBoy
69bc5fd04d translate-c: Pointer to/from integral conversion 2019-04-22 22:16:30 +02:00
LemonBoy
d3dd49c403 translate-c: Support for integer to boolean conversions 2019-04-22 22:16:29 +02:00
Ryan Liptak
8ce130de3c Bump up FixedBufferAllocator test memory to account for new tests 2019-04-22 02:25:57 -07:00
Ryan Liptak
b3598163df std.heap.DirectAllocator: Fix aligned reallocs on Windows 2019-04-22 02:20:01 -07:00
hryx
5765cbd2de
Allow tag expr for enum but not struct 2019-04-22 00:14:51 -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
Ryan Liptak
66020856b2 fix heap allocators when shrinking an object but growing its alignment 2019-04-20 23:56:39 -07: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
LemonBoy
19b8278f91 translate-c: Convert char literals 2019-04-19 11:50:30 +02:00
LemonBoy
6d95c5d15c translate-c: Parse float/double literals 2019-04-19 11:50:30 +02:00
LemonBoy
1fda44cbc8 translate-c: support conversion to/from fp types 2019-04-19 11:50:30 +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