Commit Graph

1622 Commits

Author SHA1 Message Date
Andrew Kelley
5834ff0cc5 don't memoize comptime fn calls that access comptime mutable state
closes #827
2018-03-12 08:35:41 -04:00
Andrew Kelley
1bf2810f33 fix comptime slicing not preserving comptime mutability
* fix comptime slice of slice not preserving mutatibility
   of the comptime data
 * fix comptime slice of pointer not preserving mutability
   of the comptime data

closes #826
2018-03-12 01:21:10 -04:00
Andrew Kelley
49c3922037 fix incorrect setEvalBranchQuota compile error
closes #688
2018-03-12 00:08:52 -04:00
Andrea Orru
d0621391bc zen-specific: main -> _start 2018-03-10 16:59:28 -08:00
Andrew Kelley
84e952c230 fix await multithreaded data race
coro return was reading from a value that coro await was
writing to. that wasn't how it was designed to work, it
was an implementation mistake.

this commit also has some work-in-progress code for fixing
error return traces across suspend points.
2018-03-10 01:38:40 -05:00
Andrew Kelley
60b2031831 improvements to stack traces
* @panic generates an error return trace
 * printing an error return trace no longer interferes with
   normal stack traces.
 * instead of ignore_frame_count, we look at the return address
   when you call panic, and that's the first stack trace function
   makes stack traces much cleaner - the error return trace
   flows gracefully into the stack trace
2018-03-10 01:38:40 -05:00
Andrew Kelley
6db9be8900 don't memoize comptime functions if they can mutate state via parameters
closes #639
2018-03-09 14:20:44 -05:00
Andrew Kelley
aaf2230ae8 fix partial inlining of binary math operator using old value
the code was abusing the internal IR API. fixed now.

closes #699
2018-03-08 17:15:55 -05:00
Andrew Kelley
028ec0f2c3 enums with 1 field and explicit tag type still get the tag type
closes #820
2018-03-08 15:22:42 -05:00
Andrew Kelley
aa9902b586 translate-c: add missing case labels 2018-03-08 11:47:07 -05:00
Andrew Kelley
b57cb04afc Merge remote-tracking branch 'origin/master' into llvm6 2018-03-08 10:59:24 -05:00
Jimmi Holst Christensen
2e010c60ae Translate C now correctly converts ints, floats, ptrs and enums to bools
* Boolean "and" and "or" should also work with these types.
* This new method also simplifies to output code.
2018-03-08 15:34:00 +01:00
Jimmi Holst Christensen
b2887620f3 Translate C will now handle ignored return values 2018-03-08 13:15:30 +01:00
Jimmi Holst Christensen
689e241ff8 Merge branch 'master' of github.com:zig-lang/zig 2018-03-08 10:29:43 +01:00
Jimmi Holst Christensen
51b2f1b80b Translate C can now translate switch statements again 2018-03-08 10:29:29 +01:00
Andrew Kelley
790aaeacae add compile error for using @tagName on extern union
closes #742
2018-03-07 14:35:48 -05:00
Jimmi Holst Christensen
bb80daf509 Ast Render no longer outputs erroneous semicolon
closes #813
2018-03-07 10:39:32 +01:00
Andrew Kelley
d96dd5bc32 fix missing compile error for returning error from void async function
closes #799
2018-03-06 21:44:27 -05:00
Andrew Kelley
6b5cfd9d99 turn assertion into compile error for using var as return type
closes #758
2018-03-06 20:41:49 -05:00
Andrew Kelley
eff3530dfa var is no longer a pseudo-type, it is syntax
closes #779
2018-03-06 18:31:31 -05:00
Andrew Kelley
44ae891bd7 fix assertion when taking slice of zero-length array
closes #788
2018-03-06 17:19:45 -05:00
Andrew Kelley
cc0f660ad2 unless hf is specified in target environ, assume soft floating point
closes #804
2018-03-06 16:57:41 -05:00
Andrew Kelley
07e47c058c ptrCast builtin now gives an error for removing const qualifier
closes #384
2018-03-06 16:37:03 -05:00
Jimmi Holst Christensen
1d378d8f26 Removed fixed todo 2018-03-06 12:33:09 +01:00
Jimmi Holst Christensen
5ab25798e3 We now also use trans_to_bool_expr on bool not 2018-03-06 12:04:14 +01:00
Jimmi Holst Christensen
bf47cf418a expr to bool is now it's own function.
* Now while and for loops work on ints and floats, like if statements
* This fixes the loop problem in #813
2018-03-06 11:57:51 +01:00
Jimmi Holst Christensen
61ecc48671 Added appropriate TODO comment to UO_LNot 2018-03-06 11:15:13 +01:00
Jimmi Holst Christensen
ed1386eeff Simple translation of UO_LNot 2018-03-06 11:13:10 +01:00
Andrew Kelley
1c244d34b3 Merge branch 'master' into llvm6 2018-03-03 16:30:59 -05:00
Andrew Kelley
101b7745c4 add optnone noinline to async functions
this works around LLVM optimization assertion failures.
https://bugs.llvm.org/show_bug.cgi?id=36578

closes #800
2018-03-02 13:40:03 -05:00
Andrew Kelley
a217c764db Merge remote-tracking branch 'origin/master' into llvm6 2018-03-01 22:25:15 -05:00
Andrew Kelley
de5c0c9f40 Merge remote-tracking branch 'origin/master' into async 2018-03-01 20:47:35 -05:00
Andrew Kelley
8a0e1d4c02 await keyword works 2018-03-01 15:46:35 -05:00
Andrew Kelley
a7c87ae1e4 fix not casting result of llvm.coro.promise 2018-03-01 10:23:47 -05:00
Andrew Kelley
253d988e7c implementation of await
but it has bugs
2018-03-01 03:28:13 -05:00
Andrew Kelley
8429d4ceac implement coroutine resume 2018-02-28 22:18:48 -05:00
Andrew Kelley
c622766156 async function fulfills promise atomically 2018-02-28 21:48:20 -05:00
Andrew Kelley
807a5e94e9 add atomicrmw builtin function 2018-02-28 21:19:51 -05:00
Andrew Kelley
58dc2b719c better coroutine codegen, now passing first coro test
we have to use the Suspend block with llvm.coro.end to
return from the coro
2018-02-28 18:22:43 -05:00
Andrew Kelley
ad2a29ccf2 break the data dependencies that llvm coro transforms cant handle
my simple coro test program builds now

see #727
2018-02-28 16:47:13 -05:00
Andrew Kelley
026aebf2ea another workaround for llvm coroutines
this one doesn't work either
2018-02-28 04:01:22 -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
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
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