Commit Graph

5762 Commits (bf7b6fbbdb7d28c0d7dba3e17c46ce156712cfc8)

Author SHA1 Message Date
Andrew Kelley 93840f8610
fix var args call on non-generic function 2019-08-08 15:34:41 -04:00
Andrew Kelley cfe84423c9
fix segfault with var args 2019-08-08 15:13:05 -04:00
Andrew Kelley bfa1d12fba
better compile errors when frame depends on itself 2019-08-08 13:44:57 -04:00
Andrew Kelley 8be95af480
add compile error for unable to determine async fn frame 2019-08-08 13:07:05 -04:00
Andrew Kelley 8d4cb85285
async functions in single threaded mode do not use atomic ops 2019-08-08 12:30:22 -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 e6ef00233e
Merge pull request #3025 from euantorano/fix/3015-std-os-window-rtlgenrandom
Fix #3015 - fix RtlGenRandom function signature
2019-08-07 14:21:54 -07:00
Euan Torano f2bef0447a
Remove unneeded casts. 2019-08-07 22:19:25 +01:00
Sam Tebbs 8621e3b5bd Don't emit clang error if source or filename pointer is null 2019-08-07 14:11:18 -07:00
Andrew Kelley 2cd5e55581
std.math.min: return a more restrictive type sometimes 2019-08-07 16:28:23 -04:00
Ryan Saunderson 8fcf21fefc modify header precedence for zig cc, resolves intrinsics issues (#3027) 2019-08-07 10:51:30 -07:00
Andrew Kelley e11cafbd4f
cancel works on non-pointers 2019-08-07 10:56:37 -04:00
Andrew Kelley f587fa1cd7
clean up the bitcasting of awaiter fn ptr 2019-08-07 10:56:19 -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 400500a3af
improve async function semantics
* add safety panic for resuming a function which is returning, pending
   an await
 * remove IrInstructionResultPtr
 * add IrInstructionReturnBegin. This does the early return in async
   functions; does nothing in normal functions.
 * `await` gets a result location
 * `analyze_fn_async` will call `analyze_fn_body` if necessary.
 * async function frames have a result pointer field for themselves
   to access and one for the awaiter to supply before the atomic rmw.
   when returning, async functions copy the result to the awaiter result
   pointer, if it is non-null.
 * async function frames have a stack trace pointer which is supplied by
   the awaiter before the atomicrmw. Later in the frame is a stack trace
   struct and addresses, which is used for its own calls and awaits.
 * when awaiting an async function, if an early return occurred, the
   awaiter tail resumes the frame.
 * when an async function returns, early return does a suspend
   (in IrInstructionReturnBegin) before copying
   the error return trace data, result, and running the defers.
   After the last defer runs, the frame will no longer be accessed.
 * proper acquire/release atomic ordering attributes in async functions.
2019-08-06 16:53:22 -04:00
Euan Torano 2d25348f63
Fix function signature and use a loop to ensure buffer is filled. 2019-08-06 19:32:22 +01:00
Andrew Kelley 7f23dac6dc
update readme 2019-08-05 13:49:17 -04:00
Euan Torano 7b8c96612f Fix #2993 - use getrandom on freebsd 2019-08-05 09:31:38 -07:00
Euan T 8aa87ec441 Add misisng newline 2019-08-05 09:23:15 -07:00
Euan Torano 0157365872 Add missing S_IS* for NetBSD 2019-08-05 09:23:15 -07: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 dfe8c5a2e9
add a src() method to AstNode to aid debugging 2019-08-05 03:09:17 -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 b7c94be688
Merge remote-tracking branch 'origin/master' into rewrite-coroutines 2019-08-04 19:10:36 -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
Andrew Kelley 30466bccef
update CONTRIBUTING.md 2019-08-04 15:15:25 -04:00
Sahnvour 8c99a51993
Merge pull request #2797 from Sahnvour/hashing
hash algorithm improvements
2019-08-04 21:02:00 +02:00
Sahnvour 54255ee32e autohash: force inlining of integer hashing so that the optimizer can see the fast path based on key's size which is known at comptime
otherwise it will always outline the call to hasher.update, resulting in much worse performance
2019-08-04 12:34:37 +02:00
Sahnvour 3faf5d3857 wyhash: stateless is faster for both iterative hashing and small keys. 2019-08-04 12:34:37 +02:00
Sahnvour 4b5172d287 move autoHash into its own module since it can be used with any hash function implementing a streaming interface 2019-08-04 12:34:37 +02:00
Sahnvour 5bf63bfbf1 make use of hashing streaming interface in autoHash 2019-08-04 12:34:05 +02:00
Sahnvour 8805a7b509 adapt http/headers.zig to wyhash's new interface 2019-08-04 12:34:05 +02:00
Marc Tiehuis 4c93ccab5a Add throughput test program for hash functions 2019-08-04 12:34:05 +02:00
Marc Tiehuis 83dffc70af Add iterative wyhash api 2019-08-04 12:34:05 +02:00
Sahnvour c9ce43f59f fix hashmap using strings as keys 2019-08-04 12:34:05 +02:00
Sahnvour 5bd407b278 use wyhash in std's hashmap, and improve autoHash to handle more types and behave more correctly 2019-08-04 12:34:05 +02:00
Sahnvour 6150da3df9 direct port of wyhash v2
also inspired by https://github.com/ManDeJan/zig-wyhash
2019-08-04 12:34:02 +02:00
Andrew Kelley f01cb8cc16
Merge pull request #2998 from daurnimator/return-elf
std: return Elf object from constructors instead of filling in pointer
2019-08-04 00:21:38 -07:00
daurnimator 887eac0219
std: remove elf.auto_close_stream and elf.prealloc_file 2019-08-04 16:27:36 +10:00
Andrew Kelley 12924477a5
fix regression in calling extern functions 2019-08-03 20:33:16 -04:00
Andrew Kelley 87710a1cc2
implement `@asyncCall` which supports async function pointers 2019-08-03 16:17:42 -04:00
Andrew Kelley 5687323cd2
Merge pull request #2994 from euantorano/fix/1626-os-getRandomBytesDevURandom
Check if /dev/urandom is a character device
2019-08-02 23:55:43 -07:00