1418 Commits

Author SHA1 Message Date
Andrew Kelley
ac7703f65f
fixups and add documentation for @Type 2019-09-04 11:12:14 -04:00
Jonathan Marler
b728cb6d4e Add @Type builtin 2019-09-03 22:50:29 -06:00
Andrew Kelley
77a5f888be
emit a compile error if a test becomes async
See #3117
2019-09-03 22:09:47 -04:00
Andrew Kelley
be17a4b6c1
fix compiler crash in struct field pointers
when the llvm type has not been fully analyzed. This is a regression
from lazy values.
2019-09-03 14:51:34 -04:00
Andrew Kelley
e673d865fb
fix stack traces on macos when passing absolute path to root source file
The comment added by this commit is copied here:

For macOS stack traces, we want to avoid having to parse the compilation unit debug
info. As long as each debug info file has a path independent of the compilation unit
directory (DW_AT_comp_dir), then we never have to look at the compilation unit debug
info. If we provide an absolute path to LLVM here for the compilation unit debug info,
LLVM will emit DWARF info that depends on DW_AT_comp_dir. To avoid this, we pass "."
for the compilation unit directory. This forces each debug file to have a directory
rather than be relative to DW_AT_comp_dir. According to DWARF 5, debug files will
no longer reference DW_AT_comp_dir, for the purpose of being able to support the
common practice of stripping all but the line number sections from an executable.

closes #2700
2019-09-03 13:46:08 -04:00
Andrew Kelley
d74b8567cf
omit prefix data for async functions sometimes
When `@frameSize` is never called, and `@asyncCall` on a runtime-known
pointer is never used, no prefix data for async functions is needed.

Related: #3160
2019-09-02 21:31:26 -04:00
Andrew Kelley
058050f22c
Merge remote-tracking branch 'origin/master' into llvm9 2019-09-02 20:56:31 -04:00
Andrew Kelley
4a5b0cde13
fix const result loc, runtime if cond, else unreachable
Closes #2791. See that issue for more details; I documented the
debugging process quite thoroughly on this one.
2019-09-02 20:28:25 -04:00
Andrew Kelley
0fe28855c5
add ability to specify darwin framework search dirs 2019-09-02 11:48:06 -04:00
Andrew Kelley
5c3a9a1a3e
improvements to @asyncCall
* `await @asyncCall` generates better code. See #3065
 * `@asyncCall` works with a real `@Frame(func)` in addition to
   a byte slice. Closes #3072
 * `@asyncCall` allows passing `{}` (a void value) as the result
   pointer, which uses the result location inside the frame.
   Closes #3068
 * support `await @asyncCall` on a non-async function. This is in
   preparation for safe recursion (#1006).
2019-08-31 18:50:16 -04:00
Andrew Kelley
a223063923
@typeOf now guarantees no runtime side effects
related: #1627
2019-08-31 11:00:31 -04:00
Andrew Kelley
6ab8b2aab4
support recursive async and non-async functions
which heap allocate their own frames

related: #1006
2019-08-30 20:06:02 -04:00
Andrew Kelley
03910925f0
await does not force async if callee is blocking
closes #3067
2019-08-29 21:51:37 -04:00
Andrew Kelley
d9f0446b1f
make @sizeOf lazy 2019-08-29 12:43:56 -04:00
Andrew Kelley
94bbb46ca6
fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:29:48 -04:00
Andrew Kelley
f7f8692730
fix not fully resolving debug info for structs causing llvm error 2019-08-29 10:24:24 -04:00
Andrew Kelley
928ce5e326
Merge remote-tracking branch 'origin/master' into llvm9 2019-08-28 16:59:35 -04:00
Andrew Kelley
af90da1531
fix implicit cast from zero sized array ptr to slice
closes #1850
2019-08-28 12:16:52 -04:00
Andrew Kelley
ae65c236c5
fix regression with global variable assignment...
...with optional unwrapping with var initialized to undefined
2019-08-26 15:24:24 -04:00
Andrew Kelley
fa6c20a02d
hook up unions with lazy values
this case works now:

```zig
const Expr = union(enum) {
    Literal: u8,
    Question: *Expr,
};
```
2019-08-25 11:34:07 -04:00
Andrew Kelley
ac4dd9d665
better handling of lazy structs
this case works now:

```zig
const A = struct {
    b_list_pointer: *const []B,
};
const B = struct {
    a_pointer: *const A,
};

const b_list: []B = [_]B{};
const a = A{ .b_list_pointer = &b_list };
const obj = B{ .a_pointer = &a };
```
2019-08-23 15:54:51 -04:00
Andrew Kelley
1dd658d1d0
allow top level declarations to be lazy
this case now works:

```zig
const A = struct {
    b: B,
};
const B = fn (A) void;
```
2019-08-23 14:07:34 -04:00
Andrew Kelley
3865b6ad8f
Merge remote-tracking branch 'origin/master' into fix-field-alignment-kludge 2019-08-23 11:43:37 -04:00
Jonathan Marler
9322eee80a Encapsulate bigint representation, assert on cast data loss 2019-08-23 11:14:08 -04:00
Andrew Kelley
8460d5617c
introduce lazy values
see #2174
2019-08-22 12:08:04 -04:00
Andrew Kelley
6529658ad8
Merge remote-tracking branch 'origin/master' into llvm9 2019-08-16 16:43:56 -04:00
Andrew Kelley
5a2cbe239f
fix and test case for returning from suspend block
See #3063
2019-08-16 13:07:07 -04:00
Andrew Kelley
cba3b8291a
codegen: LLVMConstSub instead of LLVMBuildSub in one place 2019-08-16 11:19:01 -04:00
Andrew Kelley
ff7e826b82
fix crash with sometimes type not being resolved 2019-08-15 18:54:23 -04:00
Andrew Kelley
0b08ae581e
add assertion about control flow to fix gcc warning 2019-08-15 18:38:20 -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
64c293f8a4
codegen for async call of blocking function 2019-08-14 12:52:20 -04:00
Andrew Kelley
5092634103
avoid the word "coroutine", they're "async functions" 2019-08-13 14:14:19 -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
98183e4743
flip the order of fields in error unions
to prepare for fixing u128 alignment issues
2019-08-13 11:33:01 -04:00
Andrew Kelley
911b1a0428
fix no-longer-correct nonnull attribute on merge err ret traces fn 2019-08-11 22:05:09 -04:00
Andrew Kelley
62c5bc6058
fix cancel invoking branch on undefined memory 2019-08-11 21:14:19 -04:00
Andrew Kelley
4d8d513e16
all tests passing 2019-08-11 19:53:10 -04:00
Andrew Kelley
af8c6ccb4b
fix canceling async functions which have error return tracing 2019-08-11 14:26:34 -04:00
Nick Erdmann
a9b3700c6e
src/codegen: configure stack probes explicitly 2019-08-11 00:29:24 +02: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
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