3539 Commits

Author SHA1 Message Date
Andrew Kelley
10e172b1d7
add other OS and fix regression in build-exe for freestanding 2019-12-04 14:42:40 -05:00
Andrew Kelley
e3ebaab3c7
fix zig builtin 2019-12-03 13:57:13 -05:00
Andrew Kelley
a91f552393
WinMainCRTStartup implies defaulting to console subsystem 2019-12-03 12:52:28 -05:00
Andrew Kelley
6a046c1bcd
activate start code when pub main exists
and rename LinkType->LinkMode, OutType->OutputMode
2019-12-03 12:50:42 -05:00
Vexu
20bcdab462
correct caching and add test for missing fn name 2019-12-03 12:50:41 -05:00
Vexu
a0ca30ce01
move more startup code to std lib 2019-12-03 12:50:18 -05:00
LemonBoy
fd7c7be33c Pick up WinMain with proper CC 2019-12-03 12:49:08 -05:00
LemonBoy
26c8930b95 Accept comptime-known expression for asm 2019-12-02 19:53:06 -05:00
Andrew Kelley
ad214c7aa0
bring your own OS layer in the std lib
closes #3784
2019-12-02 15:02:17 -05:00
Andrew Kelley
dcbd5ad155
remove upstream support for Zen hobby OS
The new plan to support hobby operating systems is #3784.

And what kind of name is "Zen" anyway? There's already a
[Zen programming language](http://zenlang.sourceforge.net/)
and that's just confusing.
2019-12-02 12:01:49 -05:00
Andrew Kelley
6d8550a7df
fix crash assigning optional struct with anon literal
closes #3827
2019-12-02 01:09:06 -05:00
Andrew Kelley
e7ee6647a1
fix invalid check for fn_inline property 2019-12-01 23:56:28 -05:00
Andrew Kelley
37caa56fbc
fix docs regressions 2019-12-01 21:27:55 -05:00
Andrew Kelley
c32e50f505
fix regressions in compile error tests 2019-12-01 20:53:24 -05:00
Andrew Kelley
080316cd4f
fix assigning to an unwrapped optional field in an inline loop 2019-12-01 18:55:35 -05:00
Andrew Kelley
c2cee40aec
add advanced IR debugging support
and use it to improve copy_const_val with regards to parent backrefs
2019-12-01 17:09:11 -05:00
Andrew Kelley
78811ff4ac
Merge remote-tracking branch 'origin/kill-ConstGlobalRefs' into remove-array-type-coercion 2019-12-01 09:58:32 -05:00
Andrew Kelley
b36c07a95a
Merge remote-tracking branch 'origin/master' into remove-array-type-coercion 2019-12-01 09:56:01 -05:00
Andrew Kelley
4b6740e19d
sometimes free stuff from Zig IR pass 1
Total bytes used in stage1 std lib tests:
3.418 -> 3.198 GiB (saving 225 MiB)

There's still this from pass 1 not getting freed:
Const: 6909049 items, 72 bytes each, total 474.407 MiB

This is due to 2 things hanging on to references to IrAnalyze pointers:
 * ZigVar->owner_exec->analysis
 * LazyValue->ira

The LazyValue one could be solved by memoizing the results after the
lazy value is resolved, and then it could unref the IrAnalyze.

ZigVars that are determined to be comptime const, could have their
const_value set to that value, instead of using the mem_slot_index
mechanism. This would prevent an IrAnalyze ref in some cases.
2019-12-01 01:13:21 -05:00
Andrew Kelley
b5df18c8fd
inline ConstGlobalRefs into ZigValue
Having ConstGlobalRefs be a pointer in ZigValue was a hack that caused
plenty of bugs. It was used to work around difficulties in type coercing
array values into slices.

However, after #3787 is merged, array values no longer type coerce into
slices, and so this provided an opportunity to clean up the code.

This has the nice effect of reducing stage1 peak RAM usage during the
std lib tests from 3.443 GiB to 3.405 GiB (saving 39 MiB).

There is one behavior test failing in this branch, which I plan to debug
after merging #3787.
2019-12-01 00:29:16 -05:00
Andrew Kelley
5026b1aad5
free IrAnalyze sometimes
Total bytes used in stage1 std lib tests:
3.443 GiB -> 3.418 GiB
2019-11-30 23:57:48 -05:00
Andrew Kelley
85e1e3b95f
Merge pull request #3284 from Sahnvour/export_variables
Improved support for exporting variables
2019-11-30 00:25:52 -05:00
Andrew Kelley
f980c29306
fix typo in error note for integer casting 2019-11-29 22:33:55 -05:00
Andrew Kelley
7278c51ddd
fix empty result location for parameters not working 2019-11-29 21:36:12 -05:00
Andrew Kelley
559bd27b08
fix @bitCast result coercing to error union by returning 2019-11-29 19:58:00 -05:00
Andrew Kelley
815b4cfd9d
fix return result loc as peer result loc in inferred error set function 2019-11-29 18:21:21 -05:00
Andrew Kelley
bcdb3a9006
more progress 2019-11-28 00:02:53 -05:00
Andrew Kelley
bf3ac66150
remove type coercion from array values to references
* Implements #3768. This is a sweeping breaking change that requires
   many (trivial) edits to Zig source code. Array values no longer
   coerced to slices; however one may use `&` to obtain a reference to
   an array value, which may then be coerced to a slice.

 * Adds `IrInstruction::dump`, for debugging purposes. It's useful to
   call to inspect the instruction when debugging Zig IR.

 * Fixes bugs with result location semantics. See the new behavior test
   cases, and compile error test cases.

 * Fixes bugs with `@typeInfo` not properly resolving const values.

 * Behavior tests are passing but std lib tests are not yet. There
   is more work to do before merging this branch.
2019-11-27 03:37:50 -05:00
Andrew Kelley
8ecd6c4d8c
add compiler note for bad int coercion
closes #3724
2019-11-26 19:50:52 -05:00
Vexu
379d547603
add missing cast to generic function call result 2019-11-26 14:32:37 -05:00
Vexu
0e405c5fc5
add missing cast to call result type 2019-11-26 14:32:34 -05:00
Michael Dusan
d20df7df09
stage1: fix bad intern counting 2019-11-25 20:41:17 -05:00
Michael Dusan
6b7e1085e3
Merge pull request #3774 from mikdusan/stage1-intern-housekeeping
stage1: consolodate interning
2019-11-25 19:19:32 -05:00
Andrew Kelley
4261fa3c49
move logic to the appropriate layers; add new compile error 2019-11-25 18:46:17 -05:00
Michael Dusan
6c89f96df1
stage1: consolodate interning
- merge const_void_val → intern.x_void
- move const_zero_byte → intern.zero_byte
- wrap intern access
2019-11-25 17:18:56 -05:00
Michael Dusan
a647a88dfc
const interning for 1-possible-value types 2019-11-25 15:04:49 -05:00
Michael Dusan
8f3e972da6
unembed ZigValue from IrInstruction 2019-11-25 15:04:39 -05:00
Michael Dusan
acd95546b7
rename ConstExprValue → ZigValue 2019-11-25 15:04:29 -05:00
Andrew Kelley
29e438fd1f
more sentinel-terminated pointers std lib integration
See #3767
2019-11-25 00:43:36 -05:00
Andrew Kelley
15d415e10b
make std.mem.toSlice use null terminated pointers
and fix the fallout
2019-11-24 21:21:05 -05:00
Andrew Kelley
34b1ebefaa
Merge remote-tracking branch 'origin/master' into null-terminated-pointers 2019-11-24 20:28:46 -05:00
Andrew Kelley
b9f88c3552
fix compile errors for array sentinels mismatching 2019-11-24 20:25:14 -05:00
Andrew Kelley
7eb5acdc80
fix casting [N:x]T to [N]T memcpying too many bytes 2019-11-24 18:57:07 -05:00
Andrew Kelley
217a5090ff
fix compile error regressions 2019-11-24 18:10:31 -05:00
Andrew Kelley
c96d565166
add compile error for incompatible pointer sentinels 2019-11-24 17:02:56 -05:00
Andrew Kelley
09ec720dab
fix comptime @ptrCast of pointers to arrays 2019-11-24 16:25:26 -05:00
Sahnvour
6ebd26f3db removed unnecessary backslashes in windows' libc paths 2019-11-24 21:33:58 +01:00
Sahnvour
696567d9d7 export: check variable type
also fixed existing occurrences
2019-11-24 21:33:58 +01:00
Sahnvour
1bde3b6821 gen-h: register the need for stdbool.h and stdint.h when exploring types recursively
otherwise they wouldn't be included when only a struct contains them
2019-11-24 21:33:58 +01:00
Sahnvour
49156e3980 gen-h: add a pass for exported variables 2019-11-24 21:33:58 +01:00