1472 Commits

Author SHA1 Message Date
Andrew Kelley
7f7d1fbe5a
Implement noasync awaits
Note that there is not yet runtime safety for this.

See #3157
2020-02-16 01:44:52 -05:00
LemonBoy
3038290a46 ir: Make all the payload captures do a copy
The payload doesn't alias anymore the same memory it comes from and is
instead a fresh copy of the original object.
2020-02-14 15:30:20 +01:00
LemonBoy
a090a5e3bc ir: Don't crash when converting undefined ptrs 2020-02-13 16:18:24 -05:00
LemonBoy
c5260f7f86 ir: Allow implicit conversion between vector types
Only valid when the number of elements match and the types are
compatible.

Fixes #4334
2020-02-13 12:13:56 +01:00
LemonBoy
6c05f0949a ir: Fix erroneous error message for ptr casts
Don't blindly throw an error if two integer types are checked for
compatibility.

Bug reported in #4430
2020-02-11 17:03:11 +01:00
Michael Dusan
e624c86289
Merge pull request #4389 from mikdusan/stage1-mem
stage1: memory/report overhaul
2020-02-10 23:08:33 -05:00
Michael Dusan
edb210905d
stage1: memory/report overhaul
- split util_base.hpp from util.hpp
- new namespaces: `mem` and `heap`
- new `mem::Allocator` interface
- new `heap::CAllocator` impl with global `heap::c_allocator`
- new `heap::ArenaAllocator` impl
- new `mem::TypeInfo` extracts names without RTTI
- name extraction is enabled w/ ZIG_ENABLE_MEM_PROFILE=1
- new `mem::List` takes explicit `Allocator&` parameter
- new `mem::HashMap` takes explicit `Allocator&` parameter
- add Codegen.pass1_arena and use for all `ZigValue` allocs
- deinit Codegen.pass1_arena early in `zig_llvm_emit_output()`
2020-02-10 21:08:08 -05:00
Timon Kruiper
2618366055 Add cast between [*c]T and ?[*:0]T on fn parameter
Fixes #4176
2020-02-10 19:43:58 -05:00
Andrew Kelley
3170ead9eb
compile error instead of abort for unimplemented @typeInfo
of `@Frame(func)`. Closes #3995
2020-02-10 19:14:54 -05:00
Andrew Kelley
70a4794c57
fix compiler assertion when duplicating fields...
...in nested anonymous struct literals

closes #4391
2020-02-10 10:57:40 -05:00
Andrew Kelley
014f66e6de Merge pull request #4404 from ziglang/async-std
a big step towards std lib integration with async I/O
2020-02-10 00:22:59 -05:00
Andrew Kelley
5ea79bfc4a
fix not checking type of return pointer
Thanks to Vexu for the test cases.

Closes #3422
Closes #3646
Closes #3224
Closes #3327
Closes #3269
2020-02-09 22:34:34 -05:00
Andrew Kelley
04ee3b01a1
fix defer interfering with return value spill 2020-02-09 17:19:28 -05:00
Andrew Kelley
24d197b037
solve previous commit a better way 2020-02-08 15:28:12 -05:00
Andrew Kelley
d80db3546c
Revert "properly spill optional payload capture value"
This reverts commit 80ba21b83cd13849c1d1d9cdebfa070b03f334d3.
2020-02-08 15:07:12 -05:00
Andrew Kelley
80ba21b83c
properly spill optional payload capture value 2020-02-08 14:59:33 -05:00
LemonBoy
21932a0ef2 Fix edge case in cast between fn with varargs
* Prevent the next_param_index to become greater than the param_count
  one as it's expected by every other function.
* Fix a typo in a error message.

Closes #4381
2020-02-05 20:31:18 +01:00
Andrew Kelley
f97b398b65
simplify int/float comparison 2020-01-29 17:20:41 -05:00
LemonBoy
fe4ef7b461
Fix comptime float-int comparisons
Closes #4259
2020-01-29 16:37:55 -05:00
LemonBoy
59bc1d2721 Fix edge case in switch with single else
ir_gen_switch_expr doesn't set the switch_br field at all if there are
zero cases, detect this situation and handle it gracefully.

Closes #4322
2020-01-29 16:05:14 -05:00
Benjamin Feng
a4ac7980b4 Add a spill to while error union 2020-01-29 10:01:51 -06:00
Benjamin Feng
2f239e3dbd Add a spill to while optional 2020-01-28 23:36:43 -06:00
Andrew Kelley
504ce86ac9
fix more compile error test regressions 2020-01-28 14:17:25 -05:00
Andrew Kelley
793d81c4e8
fix result locations not handling undefined correctly 2020-01-28 13:33:51 -05:00
Andrew Kelley
86da9346e4
fix error message column/line number regressions 2020-01-28 13:25:49 -05:00
Andrew Kelley
e0000c47bd
fix regression of storing optional with 0-bit payload 2020-01-28 12:32:39 -05:00
Andrew Kelley
287d3c37e1
fix 0-bit child type coerced to optional return ptr result location
by un-special-casing 0 bit types in result locations
2020-01-28 11:39:36 -05:00
Andrew Kelley
8710fdbf39
fix line, column numbers of compile errors 2020-01-27 22:05:27 -05:00
Andrew Kelley
ae20574d5e
add missing spill for for loops with pointer elems 2020-01-27 21:30:11 -05:00
Andrew Kelley
9d59cdb8c1
fix auto created variables not having correct alignment 2020-01-27 19:42:32 -05:00
Andrew Kelley
37ab960492
fix not handling undefined u0 correctly 2020-01-27 18:59:46 -05:00
Andrew Kelley
b38b967844
fix triple level result location with bitcast sandwich
...passed as tuple element
2020-01-27 18:26:39 -05:00
Andrew Kelley
b96872ef2f
@bitCast result location: fix passing invalid alignment
when the value has 0 bits
2020-01-27 17:45:29 -05:00
Andrew Kelley
c0fee9dfc7
fix nested bitcast passed as tuple element 2020-01-27 17:30:39 -05:00
Andrew Kelley
e2778c03e0
Merge branch 'master' into ir-clean-up-vars 2020-01-27 13:32:39 -05:00
Andrew Kelley
f41e50dc08
Merge branch 'fx-4274' of https://github.com/LemonBoy/zig into LemonBoy-fix-4274 2020-01-27 09:52:31 -05:00
Andrew Kelley
d9fb6c2054
fix compilation error 2020-01-26 00:55:04 -05:00
Andrew Kelley
9dffc369f1
Merge remote-tracking branch 'origin/master' into layneson-cpus_and_features 2020-01-25 23:25:29 -05:00
Andrew Kelley
32f0039b43
fix memory profiling 2020-01-25 22:02:10 -05:00
Andrew Kelley
6aac423964
split IrInstruction into IrInst, IrInstSrc, IrInstGen
This makes it so that less memory is used for IR instructions, as well
as catching bugs when one expected one kind of instruction and received
the other.
2020-01-25 21:49:32 -05:00
LemonBoy
8d9b8ab930 More error checking for unresolved TLDs
Closes #4274
2020-01-23 22:40:12 +01:00
Andrew Kelley
f3dd9bbdac
improve zig targets 2020-01-20 13:40:25 -05:00
Andrew Kelley
7bb4c855ad
Merge pull request #4222 from LemonBoy/eutwouwth
Prevent crash with empty non-exhaustive enum
2020-01-18 19:25:23 -05:00
LemonBoy
b0f753e21d Fix edge case in tagName handling of unions
Closes #4226
2020-01-18 20:16:15 +01:00
LemonBoy
f456b88bae Get rid of some dead logic 2020-01-18 19:24:04 +01:00
LemonBoy
c53d94e512 Prevent crash with empty non-exhaustive enum 2020-01-18 15:13:21 +01:00
LemonBoy
5f2bac010d Allow @tagName on enum literals
Closes #4214
2020-01-18 09:55:18 +01:00
Andrew Kelley
b5ac079f88
Merge pull request #4191 from Vexu/non-exhaustive-enums
Implement non-exhaustive enums
2020-01-17 14:26:12 -05:00
Andrew Kelley
8f336b3970
revert one part of ir get_elem_ptr analysis
this reverts one part of 4c3bfeca. it solves some behavior regressions
but introduces new ones. This change was incorrect to make however,
and this commit takes the code in a better direction.
2020-01-16 21:58:52 -05:00
Andrew Kelley
6a8c9f7306
fix regression with optionals and globals 2020-01-16 21:58:52 -05:00