13432 Commits

Author SHA1 Message Date
Andrew Kelley
2d290d6f82 stage2: write out builtin.zig before spawning AstGen tasks
Otherwise it's possible for AstGen to get FileNotFound when trying to
eager-load `import("builtin")`.
2021-04-22 22:35:18 -07:00
Andrew Kelley
a830ebe718 ZIR: fix text printing of field_ptr_type
Thanks @g-w1
2021-04-22 22:18:53 -07:00
Andrew Kelley
8df4bb7c96 stage2: fix builtin.zig for zig test 2021-04-22 19:48:12 -07:00
jacob gw
ce41ddcd23 std: fix potential bug in parseInt 2021-04-22 22:42:46 -04:00
Andrew Kelley
93d1c2d6d4 std: fix compile errors caught by stage2 AstGen
Follow-up from 507a8096d2f9624bafaf963c3e189a477ef6b7bf
2021-04-22 19:32:57 -07:00
Andrew Kelley
8dd7378013 delete packed enums from the language
No need for any such thing. Instead, provide an integer tag type for the
enum.
2021-04-22 19:21:50 -07:00
Andrew Kelley
329a359974 AstGen: implement align and linksection on globals 2021-04-22 19:21:33 -07:00
Andrew Kelley
507a8096d2 std: fix compile errors caught by stage2 AstGen
* `comptime const` is redundant
 * don't use `extern enum`; specify a tag type.
   `extern enum` is only when you need tags to alias. But aliasing tags
   is a smell. I will be making a proposal shortly to remove `extern enum`
   from the language.
 * there is no such thing as `packed enum`.
 * instead of `catch |_|`, omit the capture entirely.
 * unused function definition with missing parameter name
 * using `try` outside of a function or test
2021-04-22 18:07:46 -07:00
Andrew Kelley
7c453b91b8 AstGen: implement @extern builtin 2021-04-22 16:31:51 -07:00
Andrew Kelley
3d637e6dd2 AstGen: fix @export
Make it properly use `std.builtin.ExportOptions`.
2021-04-22 16:07:58 -07:00
Andrew Kelley
130ad08001 AstGen: implement function prototypes 2021-04-22 14:24:22 -07:00
Andrew Kelley
389020009a AstGen: implement alignment on locals 2021-04-21 22:43:57 -07:00
Andrew Kelley
ea00ddfe37 AstGen: implement comptime locals 2021-04-21 20:42:49 -07:00
Andrew Kelley
8ee0cbe50a AstGen: fix switch result location elision
It was eliding wrong instructions for nested break from labeled block
2021-04-21 19:49:58 -07:00
Andrew Kelley
570ed7b3bf AstGen: implement @bitCast for other result location types 2021-04-21 19:11:36 -07:00
Andrew Kelley
4cfea2fbd5 AstGen: fix @floatCast having wrong arity
It's not time for #5909 yet.
2021-04-21 19:10:54 -07:00
Andrew Kelley
d10ec6e70d AstGen: slightly better eager-allocating heuristic
Some early ensureCapacity calls to avoid needless reallocations.
2021-04-20 22:16:45 -07:00
Andrew Kelley
a1ac2b95bb AstGen: implement union decls 2021-04-20 21:48:18 -07:00
Andrew Kelley
971f3d95f9 AstGen: implement size zero inferred length arrays 2021-04-20 18:32:43 -07:00
Andrew Kelley
c69a95f64b AstGen: fix store_to_block_ptr elision for switch statements
to make sure it matches the expected block
2021-04-20 17:58:04 -07:00
Andrew Kelley
a008fb0a71 std.fs: delete unused label
stage2 starting to catch problems with the standard library :)
2021-04-20 17:57:35 -07:00
Andrew Kelley
e9477048e5 AstGen: implement for loop payload 2021-04-20 17:52:35 -07:00
Andrew Kelley
30c9808391 AstGen: implement anytype parameters 2021-04-20 17:38:06 -07:00
Andrew Kelley
a62db38d90 AstGen: implement defer for break 2021-04-20 17:04:11 -07:00
Andrew Kelley
458c4b6fc6 AstGen: implement defer for continue 2021-04-20 17:04:11 -07:00
Andrew Kelley
a59bcae59f AstGen: basic defer implementation 2021-04-20 17:04:11 -07:00
jacob gw
b4aec0e31d stage2: make std.fmt.parseInt ignore _ 2021-04-20 17:08:05 -04:00
jacob gw
6b944492b5 stage2: fix compile error in codegen 2021-04-20 17:08:05 -04:00
Andrew Kelley
b4baa9eda2 AstGen: try fixups
Primarily this required fixing `setCondBrPayloadElideBlockStorePtr` to
not assume there would always be two `store_to_block_ptr` instructions
in each of the condbr prongs.
2021-04-20 11:16:50 -07:00
jacob gw
ee3c1c763c stage2: astgen try 2021-04-20 13:16:08 -04:00
Andrew Kelley
e315120b79 AstGen: implement array initialization expressions 2021-04-19 23:23:24 -07:00
Andrew Kelley
693dbeeef2 stage2: make @alignCast accept 2 parameters
It is not yet time to implement #5909.
2021-04-19 18:46:45 -07:00
Andrew Kelley
4630e3891c AstGen: implement inline asm output 2021-04-19 18:44:59 -07:00
Andrew Kelley
a136c093bf zig astgen: print instruction counts and byte sizes 2021-04-19 16:23:05 -07:00
Andrew Kelley
7f931a7522 AstGen: implement error set decls 2021-04-19 16:03:46 -07:00
Andrew Kelley
2083208f19 AstGen: implement functions with inferred error sets
This commit also reclaims +2 ZIR instruction tags by moving the
following to `extended`:
 * func_var_args
 * func_extra
 * func_extra_var_args
The following ZIR instruction tag is added:
 * func_inferred
2021-04-19 15:03:41 -07:00
Andrew Kelley
22015c1b3b std.MultiArrayList: ensureUnusedCapacity/ensureTotalCapacity
Same as c8ae581fef6506a8234cdba1355ba7f0f449031a, but for
MultiArrayList.
2021-04-19 15:02:37 -07:00
Andrew Kelley
27d4bea9a4 AstGen: implement if optional, if error union 2021-04-19 12:25:16 -07:00
Andrew Kelley
3dadccec45 AstGen: implement while optional and while error union 2021-04-19 12:02:11 -07:00
Andrew Kelley
3f60481be4 AstGen: implement the remaining struct init ResultLoc forms 2021-04-19 11:09:00 -07:00
Andrew Kelley
ae495de54d AstGen: implement all the builtin functions 2021-04-18 22:38:41 -07:00
Andrew Kelley
5a3045b5de AstGen: implement overflow arithmetic builtins 2021-04-17 13:00:10 -07:00
Andrew Kelley
8cf0ef2779 AstGen: implement simple enums and decls for enums 2021-04-16 22:21:26 -07:00
Andrew Kelley
0409d433ba AstGen: fix compile error using wrong node/token function 2021-04-16 19:49:19 -07:00
Andrew Kelley
e13fc6b119 stage2: make @import relative to the current file
previously, it was incorrectly relative to the package directory
2021-04-16 19:45:58 -07:00
Andrew Kelley
415ef1be51 AstGen: fix function decl astgen
it was using the wrong scope and other mistakes too
2021-04-16 19:45:24 -07:00
Andrew Kelley
dd5a1b1106 build.zig: add a way to skip installing lib/ files 2021-04-16 18:58:27 -07:00
Andrew Kelley
9375ad0d3b AstGen: implement global var decls
And fix bug with using `ensureCapacity` when I wanted
`ensureUnusedCapacity`.
2021-04-16 17:57:51 -07:00
Andrew Kelley
c8ae581fef std: deprecate ensureCapacity, add two other capacity functions
I've run into this footgun enough times, nearly every time I want
`ensureUnusedCapacity`, not `ensureCapacity`. This commit deprecates
`ensureCapacity` in favor of `ensureTotalCapacity` and introduces
`ensureUnusedCapacity`.
2021-04-16 17:56:30 -07:00
Andrew Kelley
5ff45b3f44 stage2: use import list from ZIR to queue up more AstGen tasks 2021-04-16 17:28:28 -07:00