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
Andrew Kelley
83f8906449
codegen for coro_resume instruction
...
See #727
2018-02-25 17:34:05 -05:00
Andrew Kelley
4eac75914b
codegen for coro_free instruction
...
See #727
2018-02-25 16:46:01 -05:00
Andrew Kelley
d2d2ba10e9
codegen for coro_end instruction
...
See #727
2018-02-25 16:40:00 -05:00
Andrew Kelley
0cf327eb17
codegen for coro_suspend instruction
...
See #727
2018-02-25 16:29:07 -05:00
Andrew Kelley
d0f2eca106
codegen for coro_begin instruction
...
See #727
2018-02-25 16:22:19 -05:00
Andrew Kelley
79f1ff574b
codegen for coro_alloc_fail instruction
...
See #727
2018-02-25 16:15:14 -05:00
Andrew Kelley
bced3fb64c
codegen for get_implicit_allocator instruction
...
See #727
2018-02-25 16:05:10 -05:00
Andrew Kelley
93cbd4eeb9
codegen for coro_alloc and coro_size instructions
...
See #727
2018-02-25 15:20:31 -05:00
Andrew Kelley
9f6c5a20de
codegen for coro_id instruction
...
See #727
2018-02-25 15:10:29 -05:00
Andrew Kelley
7567448b91
codegen for cancel
...
See #727
2018-02-25 14:47:58 -05:00
Andrew Kelley
05bf666eb6
codegen for calling an async function
...
See #727
2018-02-25 02:47:31 -05:00
Marc Tiehuis
08d595b472
Add utf8 string view
2018-02-24 11:32:01 -07:00
Andrew Kelley
8db7a1420f
update errors section of docs
...
closes #768
2018-02-23 20:43:47 -05:00
Andrew Kelley
4955c4b8f9
update C headers to clang 6.0.0rc3
2018-02-23 13:15:16 -05:00
Andrew Kelley
1ba6e1641a
LLD patch: workaround for buggy MACH-O code
...
This reapplies 1a1414fc42
to the embedded LLD.
2018-02-23 13:05:17 -05:00
Andrew Kelley
a33b689f2c
update embedded LLD to 6.0.0rc3
2018-02-23 13:04:47 -05:00
Andrew Kelley
9cfd7dea19
Merge remote-tracking branch 'origin/master' into llvm6
2018-02-23 12:56:41 -05:00
Andrew Kelley
78bc62fd34
Revert "workaround on windows for llvm6 missing advapi32.lib in llvm-config"
...
This reverts commit eaac218d59
.
This is fixed now in llvm6 rc3
2018-02-23 12:55:58 -05:00
Andrew Kelley
40dbcd09da
fix type_is_codegen_pointer being used incorrectly
...
The names of these functions should probably change, but at least
the semantics are correct now:
* type_is_codegen_pointer - the type is either a fn, ptr, or promise
* get_codegen_ptr_type -
- ?&T and &T returns &T
- ?promise and promise returns promise
- ?fn()void and fn()void returns fn()void
- otherwise returns nullptr
2018-02-23 12:49:21 -05:00
Ben Noordhuis
f11b948019
allow implicit cast from `S` to `?&const S`
...
Allow implicit casts from container types to nullable const pointers to
said container type. That is:
fn f() void {
const s = S {};
g(s); // Works.
g(&s); // So does this.
}
fn g(_: ?&const S) void { // Nullable const pointer.
}
Fixes #731 .
2018-02-23 15:55:57 +01:00
Andrew Kelley
99985ad6fc
implement Zig IR for async functions
...
See #727
2018-02-23 03:03:06 -05:00
Andrew Kelley
b66547e98c
Merge pull request #783 from bnoordhuis/fix675
...
name types inside functions after variable
2018-02-22 14:26:45 -05:00
Ben Noordhuis
0845cbe277
name types inside functions after variable
...
Before this commit:
fn f() []const u8 {
const S = struct {};
return @typeName(S); // "f()", unexpected.
}
And now:
fn f() []const u8 {
const S = struct {};
return @typeName(S); // "S", expected.
}
Fixes #675 .
2018-02-22 19:54:02 +01:00
Andrew Kelley
ca1b77b2d5
IR analysis for coro.begin
...
See #727
2018-02-22 11:54:27 -05:00
Andrew Kelley
88e7b9bf80
ir analysis for coro_id and coro_alloc
...
See #727
2018-02-22 09:36:58 -05:00
Andrew Kelley
37c07d4f3f
coroutines: analyze get_implicit_allocator instruction
...
see #727
2018-02-22 09:30:55 -05:00
Andrew Kelley
b261da0672
add coroutine startup IR to async functions
...
See #727
2018-02-21 23:28:35 -05:00