Andrew Kelley
63f636e7b7
limit integer types to maximum bit width of 65535
...
closes #1541
2018-11-06 11:09:14 -05:00
Andrew Kelley
dcfd15a7f0
the last number in a packed ptr is host int bytes
...
See #1121
2018-09-26 14:54:52 -04:00
Andrew Kelley
f8fe517d12
better string literal caching implementation
...
We were caching the ConstExprValue of string literals,
which works if you can never modify ConstExprValues.
This premise is broken with `comptime var ...`.
So I implemented an optimization in ConstExprValue
arrays, where it stores a `Buf *` directly rather
than an array of ConstExprValues for the elements,
and then similar to array of undefined, it is
expanded into the canonical form when necessary.
However many operations can happen directly on the
`Buf *`, which is faster.
Furthermore, before a ConstExprValue array is expanded
into canonical form, it removes itself from the string
literal cache. This fixes the issue, because before an
array element is modified it would have to be expanded.
closes #1076
2018-09-20 11:04:31 -04:00
Andrew Kelley
345f8db1c4
fix optional pointer to empty struct incorrectly being non-null
...
closes #1178
2018-09-18 17:51:50 -04:00
Andrew Kelley
3f776af3fa
fix alignment of structs
...
closes #1248
closes #1052
closes #1154
2018-09-14 19:08:59 -04:00
Andrew Kelley
639c381128
fix coroutine alignment
...
zig returned the wrong alignment for coroutine promises
in some cases
2018-09-14 13:55:45 -04:00
Andrew Kelley
c06a61e9bf
remove this
. add @This()
.
...
closes #1283
2018-09-13 16:34:33 -04:00
Andrew Kelley
4af844732a
Merge remote-tracking branch 'origin/master' into stage1-caching
2018-09-11 15:56:04 -04:00
Andrew Kelley
67735c6f15
ability to disable cache. off by default except for...
...
...zig run, zig build, compiler_rt.a, and builtin.a
2018-09-11 00:32:40 -04:00
Andrew Kelley
9c169f3cf7
C ABI: support returning large structs on x86_64
...
also panic instead of emitting bad code for returning small structs
See #1481
2018-09-07 20:09:33 -04:00
Andrew Kelley
04d7b565f7
stage1: refactor fn type analysis to use C ABI walk fn
2018-09-07 12:23:50 -04:00
Andrew Kelley
a9a925e500
add C ABI tests
2018-09-06 16:29:35 -04:00
Andrew Kelley
6632d85e5f
stage1: improve handling of generic fn proto type expr
...
closes #902
2018-09-05 21:21:59 -04:00
Andrew Kelley
1d8b8ad687
add compile error for using outer scoped runtime variables
...
from a fn defined inside it. closes #876
2018-09-05 20:32:06 -04:00
Andrew Kelley
1f5c7ff4d7
stage1: rename VariableTableEntry to ZigVar
2018-09-05 18:35:57 -04:00
Andrew Kelley
3500d32db5
stage1: rename FnTableEntry to ZigFn
2018-09-05 18:34:33 -04:00
Andrew Kelley
db882e5d63
stage1: rename TypeTableEntry to ZigType
2018-09-05 18:33:07 -04:00
Andrew Kelley
68db9d5074
add compile error for comptime control flow inside runtime block
...
closes #834
2018-09-04 15:28:35 -04:00
Andrew Kelley
ac36f98e72
fix stack traces on linux
2018-08-25 03:07:37 -04:00
Andrew Kelley
e9a03cccf3
all integer sizes are available as primitives
...
* fix wrong implicit cast for `@IntType` bit_count parameter.
* fix incorrect docs for `@IntType` bit_count parameter.
closes #1242
closes #745
closes #1240
2018-07-16 10:53:15 -04:00
Andrew Kelley
1cf7511dc9
add compile error notes for where struct definitions are
...
closes #1202
2018-07-06 16:20:46 -04:00
Andrew Kelley
af95e15572
rename get_maybe_type to get_optional_type
2018-06-26 15:11:05 -04:00
Jimmi HC
bf3d1c1aab
Allow access of array.len through a pointer
2018-06-08 09:21:31 +02:00
Andrew Kelley
e53b683bd3
Pointer Reform: proper slicing and indexing ( #1053 )
...
* enable slicing for single-item ptr to arrays
* disable slicing for other single-item pointers
* enable indexing for single-item ptr to arrays
* disable indexing for other single-item pointers
see #770
closes #386
2018-06-04 22:11:14 -04:00
Andrew Kelley
96164ce613
disallow single-item pointer indexing
...
add pointer arithmetic for unknown length pointer
2018-06-04 01:39:57 -04:00
Jimmi HC
1b3aaacba2
Removed copy-pasted resolve_inferred_error_set
...
both ir.cpp and analyze.cpp have a function resolve_inferred_error_set,
which is a nearly exact copy-paste. This commit removes the one in ir.cpp
and exposes then one in analyze.cpp. This also allows us to make
analyze_fn_body local to analyze.cpp, as it is not used anywhere in
ir.cpp after this change
2018-05-30 10:34:20 +02:00
Jimmi HC
9b29c872ce
Added Slice as it's own type info in userland
2018-05-09 09:34:04 +02:00
Andrew Kelley
06909ceaab
support break in suspend blocks
...
* you can label suspend blocks
* labeled break supports suspend blocks
See #803
2018-04-18 22:21:54 -04:00
Andrew Kelley
aa2995ee39
fix invalid codegen for error return traces across suspend points
...
See #821
Now the code works correctly, but error return traces are missing
the frames from coroutines.
2018-03-24 22:07:12 -04:00
Andrew Kelley
bcce77700f
some return types disqualify comptime fn call caching
...
closes #828
2018-03-12 12:56:25 -04: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
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
07e47c058c
ptrCast builtin now gives an error for removing const qualifier
...
closes #384
2018-03-06 16:37:03 -05:00
Andrew Kelley
253d988e7c
implementation of await
...
but it has bugs
2018-03-01 03:28: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
9f6c5a20de
codegen for coro_id instruction
...
See #727
2018-02-25 15:10:29 -05:00
Andrew Kelley
99985ad6fc
implement Zig IR for async functions
...
See #727
2018-02-23 03:03:06 -05:00
Andrew Kelley
236bbe1183
implement IR analysis for async function calls
...
See #727
2018-02-21 00:52:20 -05:00
Andrew Kelley
65a51b401c
add promise type
...
See #727
2018-02-20 16:42:14 -05:00
Andrew Kelley
21ce559c9c
add --forbid-library
...
to help track down accidentally linking against a library
2018-02-04 22:06:03 -05:00
Andrew Kelley
ef5e7bb469
*WIP* error sets - an inferred error set can end up being the global one
2018-02-03 14:06:37 -05:00
Andrew Kelley
39d5f44863
*WI* error sets - basic support working
2018-02-02 14:26:14 -05:00
Andrew Kelley
cfb2c67692
*WIP* error sets - rewrite "const cast only" function
2018-02-02 11:50:19 -05:00
Andrew Kelley
13b36d458f
*WIP* error sets - fix implicit cast
2018-02-01 10:23:25 -05:00
Andrew Kelley
5161d70620
*WIP* error sets
2018-01-31 01:51:31 -05:00
Andrew Kelley
3ef6a00bb8
add compile error for duplicate struct, enum, union fields
...
closes #730
2018-01-30 11:52:03 -05:00
Andrew Kelley
32ea6f54e5
*WIP* proof of concept error return traces
2018-01-12 02:12:11 -05:00
Andrew Kelley
7ec783876a
functions which can return errors have secret stack trace param
...
See #651
2018-01-11 23:04:08 -05:00
Andrew Kelley
27ba4f0baf
export keyword works again
2017-12-19 01:49:42 -05:00
Andrew Kelley
1fdebc1dc4
wip export rewrite
2017-12-18 09:59:57 -05:00