Commit Graph

6120 Commits

Author SHA1 Message Date
Andrew Kelley
7e75e1075e zig fmt 2019-08-15 18:19:04 -04:00
Andrew Kelley
55f5cee86b fix error return traces for async calls of blocking functions 2019-08-15 15:06:05 -04:00
Andrew Kelley
13b5a4bf8c remove cancel 2019-08-15 14:05:12 -04:00
Andrew Kelley
f3f838cc01 add compile error for await in exported function 2019-08-14 11:22:12 -04:00
Andrew Kelley
7799423f24 rename behavior test files 2019-08-14 00:38:27 -04:00
Andrew Kelley
5749dc49d8 respect local variable alignment in async functions 2019-08-14 00:35:51 -04:00
Andrew Kelley
12ff91c1c9 alignment of structs no longer depends on LLVM
fixes async function tests in optimized builds
2019-08-13 12:44:30 -04:00
Andrew Kelley
8a9289996a Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-13 11:39:32 -04:00
Andrew Kelley
4d8d513e16 all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley
b87686dfa0 fix enum with one member and custom tag type 2019-08-11 13:43:44 -04:00
Andrew Kelley
1b83ee78a4 allow comptime_int to implicit cast to comptime_float 2019-08-11 12:01:02 -04:00
Andrew Kelley
3f5c6d7a89 add test case for typical async/await usage 2019-08-10 18:03:36 -04:00
Andrew Kelley
77d098e92d fix returning a const error from async function 2019-08-10 17:23:45 -04:00
Andrew Kelley
22428a7546 fix try in an async function with error union and non-zero-bit payload 2019-08-10 15:20:08 -04:00
Andrew Kelley
b9d1d45dfd fix combining try with errdefer cancel 2019-08-09 21:49:40 -04:00
Andrew Kelley
2e7f53f1f0 fix cancel inside an errdefer 2019-08-09 17:34:06 -04:00
Andrew Kelley
614cab5d68 fix passing string literals to async functions 2019-08-08 19:08:41 -04:00
Andrew Kelley
bfa1d12fba better compile errors when frame depends on itself 2019-08-08 13:44:57 -04:00
Andrew Kelley
d813805f77 more debuggable safety for awaiting twice 2019-08-08 12:02:56 -04:00
Andrew Kelley
34bfdf193a cancel, defer, errdefer all working as intended now 2019-08-08 11:37:49 -04:00
Andrew Kelley
e11cafbd4f cancel works on non-pointers 2019-08-07 10:56:37 -04:00
Andrew Kelley
7e1fcb55b3 implement cancel
all behavior tests passing in this branch
2019-08-07 00:53:04 -04:00
Andrew Kelley
1afbb53661 fix awaiting when result type is a struct 2019-08-06 19:07:25 -04:00
Andrew Kelley
966c9ea63c error return trace across suspend points 2019-08-06 18:47:09 -04:00
Andrew Kelley
17199b0879 passing the error return trace async function test 2019-08-06 18:29:56 -04:00
Andrew Kelley
20f63e588e async functions have error return traces where appropriate
however the traces are not merged on `await` or async function calls
yet.

When an async function has an error set or error union as its return
type, it has a `StackTrace` before the args in the frame, so that it is
accessible from `anyframe->T` awaiters. However when it does not have an
errorable return type, but it does call or await an errorable, it has a
stack trace just before the locals. This way when doing an `@asyncCall`
on an async function pointer, it can populate the args (which are after
the `StackTrace`) because it knows the offset of the args based only on
the return type.

This sort of matches normal functions, where a stack trace pointer could
be supplied by a parameter, or it could be supplied by the stack of the
function, depending on whether the function itself is errorable.
2019-08-05 03:10:14 -04:00
Andrew Kelley
0d8c9fcb18 support async functions with inferred error sets 2019-08-05 00:41:49 -04:00
Andrew Kelley
fa30ebfbe5 suspension points inside branching control flow 2019-08-04 18:24:10 -04:00
Andrew Kelley
87710a1cc2 implement @asyncCall which supports async function pointers 2019-08-03 16:17:42 -04:00
Andrew Kelley
c879209661 add compile error for calling async function pointer 2019-08-03 02:40:38 -04:00
Andrew Kelley
e444e737b7 add runtime safety for resuming an awaiting function 2019-08-03 02:11:52 -04:00
Andrew Kelley
24d78177ee add compile error for async call of function pointer 2019-08-03 01:06:14 -04:00
Andrew Kelley
0920bb0872 implement async functions returning structs 2019-08-02 19:27:27 -04:00
Andrew Kelley
5bd330e76c add heap allocated async function frame test 2019-08-02 16:32:24 -04:00
Andrew Kelley
b3b6a98451 Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-02 16:31:43 -04:00
Andrew Kelley
f07f09a373 Merge branch 'master' into rewrite-coroutines 2019-08-02 16:13:36 -04:00
Andrew Kelley
d105769926 fix regressions regarding writing through const pointers 2019-08-02 16:09:40 -04:00
Andrew Kelley
9069ee957c fix discarding function call results 2019-08-02 15:17:02 -04:00
Andrew Kelley
90e64bc620 fix cmpxchg with discarded result 2019-08-02 14:47:26 -04:00
Andrew Kelley
a5cb0f77d1 assignment participates in result location
fix one regression with optionals but there are more
2019-08-02 13:54:58 -04:00
Andrew Kelley
056c4e2c98 implement async await and return 2019-08-02 01:06:00 -04:00
Andrew Kelley
0f879d02a4 more passing coroutine tests 2019-08-01 19:14:48 -04:00
Andrew Kelley
1dd0c3d49f fix calling an inferred async function 2019-08-01 16:41:30 -04:00
Andrew Kelley
e7ae4e4645 reimplement async with function splitting instead of switch 2019-08-01 16:08:52 -04:00
Andrew Kelley
6cb4cac5cd disable behavior test for 128-bit cmpxchg
once #2883 is done this can be revisited
2019-08-01 03:36:03 -04:00
Andrew Kelley
38b5812c48 allow 128 bit cmpxchg on x86_64 2019-08-01 02:46:37 -04:00
Andrew Kelley
dbdc4d62d0 improve support for anyframe and anyframe->T
* add implicit cast from `*@Frame(func)` to `anyframe->T` or `anyframe`.
 * add implicit cast from `anyframe->T` to `anyframe`.
 * `resume` works on `anyframe->T` and `anyframe` types.
2019-07-29 19:32:49 -04:00
Andrew Kelley
ee64a22045 add the anyframe and anyframe->T types 2019-07-26 19:52:35 -04:00
Andrew Kelley
538c0cd225 implement @frameSize 2019-07-25 15:05:55 -04:00
Andrew Kelley
70bced5dcf implement @frame and @Frame 2019-07-25 01:47:56 -04:00