Commit Graph

1461 Commits

Author SHA1 Message Date
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
a7763c06f9 delete IrInstructionMarkErrRetTracePtr
this IR instruction is no longer needed
2019-08-05 00:44:39 -04:00
Andrew Kelley
0d8c9fcb18 support async functions with inferred error sets 2019-08-05 00:41:49 -04:00
Andrew Kelley
f27e5d439c refactor logic for determining if there is a frame pointer 2019-08-04 20:44:52 -04:00
Andrew Kelley
fbf21efd24 simpler, less memory intensive suspend/resume implementation 2019-08-04 18:58:14 -04:00
Andrew Kelley
042914de75 move state from ZigFn to CodeGen to save memory 2019-08-04 18:26:37 -04:00
Andrew Kelley
fa30ebfbe5 suspension points inside branching control flow 2019-08-04 18:24:10 -04:00
Nick Erdmann
b979fc1bcd initial work torwards std lib support for uefi 2019-08-04 21:53:49 +02:00
Andrew Kelley
87710a1cc2 implement @asyncCall which supports async function pointers 2019-08-03 16:17:42 -04:00
Andrew Kelley
63ebd9d12e Merge remote-tracking branch 'origin/master' into llvm9 2019-08-03 12:39:15 -04:00
Andrew Kelley
e444e737b7 add runtime safety for resuming an awaiting function 2019-08-03 02:11:52 -04:00
Andrew Kelley
0920bb0872 implement async functions returning structs 2019-08-02 19:27:27 -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
90e64bc620 fix cmpxchg with discarded result 2019-08-02 14:47:26 -04:00
Andrew Kelley
056c4e2c98 implement async await and return 2019-08-02 01:06:00 -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
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
018a89c7a1 async functions return void, no more GetSize resume block 2019-07-26 17:07:19 -04:00
Andrew Kelley
7b3686861f @frameSize works via PrefixData 2019-07-25 22:24:01 -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
Andrew Kelley
ead2d32be8 calling an inferred async function 2019-07-25 00:03:06 -04:00
Michael Dusan
8e4f3a6f15 align src for IrInstructionArrayToVector
closes #2942
2019-07-24 15:04:32 -04:00
Andrew Kelley
e220812f2f implement local variables in async functions 2019-07-24 02:59:51 -04:00
Andrew Kelley
7e9760de10 inferring async from async calls 2019-07-23 18:54:45 -04:00
Andrew Kelley
fcadeb50c0 fix multiple coroutines existing clobbering each other 2019-07-22 14:36:14 -04:00
Andrew Kelley
bc31c1280e disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:41:59 -04:00
Andrew Kelley
5b69a9cd83 disable segfault handler when panicking
this prevents a segfault in stack trace printing to activate the
segfault handler.
2019-07-22 12:15:16 -04:00
Andrew Kelley
32d0ac1355 fix wrong calling convention on async resume 2019-07-22 00:07:48 -04:00
Andrew Kelley
59bf9ca58c implement async function parameters 2019-07-21 23:27:47 -04:00
Andrew Kelley
11bd50f2b2 implement coroutine resume 2019-07-21 20:54:08 -04:00
Andrew Kelley
78e03c466c simple async function passing test 2019-07-21 19:56:37 -04:00
Andrew Kelley
56c08eb302 returning from async fn adds bad resume safety 2019-07-21 17:17:44 -04:00
Andrew Kelley
6053ca4f69 fix not jumping to entry 2019-07-21 17:10:16 -04:00
Andrew Kelley
72e983670e simple async function call working 2019-07-21 16:21:16 -04:00
Andrew Kelley
2c1e955de7 always give the type to byval attribute 2019-07-20 13:32:50 -04:00
Andrew Kelley
54e716afdc remove coroutines implementation and promise type 2019-07-19 18:18:44 -04:00
Andrew Kelley
03a3b1ca39 riscv workarounds for llvm not having good asm integration 2019-07-18 15:20:58 -04:00
Andrew Kelley
afbf99c846 riscv musl: only add the +a feature 2019-07-18 12:28:24 -04:00
Andrew Kelley
d4ca337e6b improvements to riscv support 2019-07-18 12:21:57 -04:00
Andrew Kelley
c0b4121ff2 libc headers before C language headers, and disable libunwind on arm32 2019-07-16 21:38:18 -04:00
Andrew Kelley
d994379173 update bundled musl source to 1.1.23 2019-07-16 19:54:14 -04:00
Andrew Kelley
f70ce707e2 update musl headers to musl v1.1.23 2019-07-16 19:02:51 -04:00
Andrew Kelley
776423bbf7 fix result location alignment in ir_render_call 2019-07-15 23:44:44 -04:00
Andrew Kelley
7b8ba871a9 mingw libc: solve the segfault having to do with destructors
* fixed --verbose-cc printing an extra "zig" before the rest of
   the command line
 * windows-gnu targets use libfoo.a, foo.o extensions to match mingw
   conventions.
2019-07-12 14:44:34 -04:00
Andrew Kelley
d9c4c96bf2 add -Wno-pragma-pack when targeting windows-gnu
windows.h has files such as pshpack1.h which do #pragma packing,
triggering a clang warning. So for this target, this warning is
disabled.

this commit also improves the error message printed when no libc can be
used, printing the "zig triple" rather than the "llvm triple".
2019-07-11 23:48:13 -04:00
Andrew Kelley
ea90a3a9a1 mingw: building and linking mingw32.lib 2019-07-10 14:13:00 -04:00