Commit Graph

2334 Commits (07e47c058c480914d45ec0b1f9c61b76f59e6299)

Author SHA1 Message Date
Andrew Kelley 07e47c058c ptrCast builtin now gives an error for removing const qualifier
closes #384
2018-03-06 16:37:03 -05:00
Andrew Kelley 46e258c9f7
Merge pull request #815 from Hejsil/more-translate-c
Translate C now handles bools better
2018-03-06 10:43:52 -05:00
Andrew Kelley c3807dfb34 remove value judgement from std lib API docs
documentation should be purely technical, and not contain opinions about
how easy or hard something is.
2018-03-06 10:41:07 -05:00
Jimmi Holst Christensen 1d378d8f26 Removed fixed todo 2018-03-06 12:33:09 +01:00
Jimmi Holst Christensen 5ab25798e3 We now also use trans_to_bool_expr on bool not 2018-03-06 12:04:14 +01:00
Jimmi Holst Christensen bf47cf418a expr to bool is now it's own function.
* Now while and for loops work on ints and floats, like if statements
* This fixes the loop problem in #813
2018-03-06 11:57:51 +01:00
Jimmi Holst Christensen 61ecc48671 Added appropriate TODO comment to UO_LNot 2018-03-06 11:15:13 +01:00
Jimmi Holst Christensen ed1386eeff Simple translation of UO_LNot 2018-03-06 11:13:10 +01:00
Andrew Kelley d34d36619e
Merge pull request #814 from jacobdufault/utf8-view
Make Utf8View public, add comments, and make iterator lowercase.
2018-03-06 01:42:04 -05:00
Jacob Dufault 8fd7e9115c Make Utf8View public, add comments, and make iterator lowercase. 2018-03-05 21:42:01 -08:00
Joshua Olson c787837ce5 Clarify what is meant by 'libraries' (#808) 2018-03-04 19:26:16 -05:00
Joshua Olson db18d38a43 Fix Linux gcc requirement (#807)
g++ may be a separate package. I had this problem on Fedora.
2018-03-04 17:46:17 -05:00
Andrew Kelley 101b7745c4 add optnone noinline to async functions
this works around LLVM optimization assertion failures.
https://bugs.llvm.org/show_bug.cgi?id=36578

closes #800
2018-03-02 13:40:03 -05:00
Andrew Kelley 7d494b3e7b Merge branch 'async'
closes #727
2018-03-01 21:55:15 -05:00
Andrew Kelley de5c0c9f40 Merge remote-tracking branch 'origin/master' into async 2018-03-01 20:47:35 -05:00
Andrew Kelley 6bade0b825 coroutines: add await early test case 2018-03-01 16:17:38 -05:00
Andrew Kelley 8a0e1d4c02 await keyword works 2018-03-01 15:46:35 -05:00
Andrew Kelley a7c87ae1e4 fix not casting result of llvm.coro.promise 2018-03-01 10:23:47 -05:00
Andrew Kelley 253d988e7c implementation of await
but it has bugs
2018-03-01 03:28:13 -05:00
Andrew Kelley 834e992a7c add test for coroutine suspend with block 2018-02-28 22:26:26 -05:00
Andrew Kelley 8429d4ceac implement coroutine resume 2018-02-28 22:18:48 -05:00
Andrew Kelley c622766156 async function fulfills promise atomically 2018-02-28 21:48:20 -05:00
Andrew Kelley 807a5e94e9 add atomicrmw builtin function 2018-02-28 21:19:51 -05:00
Andrew Kelley 36eadb569a run coroutine tests only in Debug mode
LLVM 5.0.1, 6.0.0, and trunk crash when attempting to optimize coroutine code.
So, Zig does not support ReleaseFast or ReleaseSafe for coroutines yet.
Luckily, Clang users are running into the same crashes, so folks from the LLVM
community are working on fixes. If we're really lucky they'll be fixed in 6.0.1.
Otherwise we can hope for 7.0.0.
2018-02-28 18:56:26 -05:00
Andrew Kelley 58dc2b719c better coroutine codegen, now passing first coro test
we have to use the Suspend block with llvm.coro.end to
return from the coro
2018-02-28 18:22:43 -05:00
Andrew Kelley ad2a29ccf2 break the data dependencies that llvm coro transforms cant handle
my simple coro test program builds now

see #727
2018-02-28 16:47:13 -05:00
Andrew Kelley 026aebf2ea another workaround for llvm coroutines
this one doesn't work either
2018-02-28 04:01:22 -05:00
Andrew Kelley 6568be575c Merge branch 'bnoordhuis-fix795' 2018-02-28 00:29:20 -05:00
Andrew Kelley 556f22a751 different way of fixing previous commit
get_fn_type doesn't need the complete parameter type, it
can just ensure zero bits known.
2018-02-28 00:28:26 -05:00
Andrew Kelley 1b8a241f6f Merge branch 'fix795' of https://github.com/bnoordhuis/zig into bnoordhuis-fix795 2018-02-28 00:22:53 -05:00
Andrew Kelley 0f449a3ec1
Merge pull request #796 from bnoordhuis/fix731-more
allow implicit cast from &const to ?&const &const
2018-02-27 23:55:03 -05:00
Ben Noordhuis 90598b4631 fix assert on self-referencing function ptr field
The construct `struct S { f: fn(S) void }` is not legal because structs
are not copyable but it should not result in an ICE.

Fixes #795.
2018-02-28 00:56:00 +01:00
Andrew Kelley d243453862 Revert "llvm coroutine workaround: sret functions return sret pointer"
This reverts commit 132e604aa3.

this workaround didn't work either
2018-02-27 17:47:18 -05:00
Andrew Kelley 138d6f9093 revert workaround for alloc and free as coro params
reverts 4ac6c4d6bf

the workaround didn't work
2018-02-27 17:46:13 -05:00
Andrew Kelley 132e604aa3 llvm coroutine workaround: sret functions return sret pointer 2018-02-27 17:12:53 -05:00
Andrew Kelley 6e2a67724c Revert "another llvm workaround for getelementptr"
This reverts commit c2f5634fb3.

It doesn't work. With this, LLVM moves the allocate fn call
to after llvm.coro.begin
2018-02-27 14:58:02 -05:00
Andrew Kelley c2f5634fb3 another llvm workaround for getelementptr 2018-02-27 14:57:49 -05:00
Andrew Kelley 439621e44a remove signal hanlding stuff from std.os.ChildProcess 2018-02-27 11:14:14 -05:00
Andrew Kelley 4e43bde924 workaround for llvm: delete coroutine allocation elision
maybe this can be reverted, but it seems to be related
to llvm's coro transformations crashing.

See #727
2018-02-26 21:31:00 -05:00
Andrew Kelley 4ac6c4d6bf workaround llvm coro transformations
by making alloc and free functions be parameters to async
functions instead of using getelementptr in the DynAlloc block

See #727
2018-02-26 21:14:15 -05:00
Ben Noordhuis 9aa65c0e8e allow implicit cast from &const to ?&const &const
Allow implicit casts from n-th degree const pointers to nullable const
pointers of degree n+1.  That is:

    fn f() void {
        const s = S {};
        const p = &s;
        g(p);   // Works.
        g(&p);  // So does this.
    }

    fn g(_: ?&const &const S) void {  // Nullable 2nd degree const ptr.
    }

Fixes #731 some more.
2018-02-26 19:56:26 +01:00
Andrew Kelley 1eecfdaa9b
Merge pull request #785 from bnoordhuis/fix731
allow implicit cast from `S` to `?&const S`
2018-02-26 03:20:46 -05:00
Andrew Kelley 3e86fb500d implement coroutine suspend
see #727
2018-02-26 02:46:21 -05:00
Andrew Kelley c60496a297 parse await and suspend syntax
See #727
2018-02-26 00:04:11 -05:00
Andrew Kelley 6fef7406c8 move coroutine init code to after coro.begin 2018-02-25 20:29:14 -05:00
Andrew Kelley 6b436146a8 fix invalid memory write in coroutines implementation 2018-02-25 20:28:44 -05:00
Andrew Kelley 6cbea99ed6 async functions are allowed to accept zig types 2018-02-25 20:27:53 -05:00
Andrew Kelley b018c64ca2 add coroutine LLVM passes 2018-02-25 18:09:39 -05:00
Andrew Kelley fe354ebb5c coroutines: fix llvm error of instruction not dominating uses
See #727
2018-02-25 17:57:05 -05:00
Andrew Kelley 704a8acb59 fix handle_is_ptr for promise type 2018-02-25 17:34:18 -05:00