This is akin to channels in Go, except:
* implemented in userland
* they are lock-free and thread-safe
* they integrate with the userland event loop
The self hosted compiler is changed to use a channel for events,
and made to stay alive, watching files and performing builds when
things change, however the main.zig file exits after 1 build.
Note that nothing is actually built yet, it just parses the input
and then declares that the build succeeded.
Next items to do:
* add windows and macos support for std.event.Loop
* improve the event loop stop() operation
* make the event loop multiplex coroutines onto kernel threads
* watch source file for updates, and provide AST diffs
(at least list the top level declaration changes)
* top level declaration analysis
* add assertion for trying to do @typeInfo on global error set
* remove TypeInfo.Slice
* add TypeInfo.Pointer.Size with possible values
- One
- Many
- Slice
See #770
* 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 #770closes#386
See #770
To help automatically translate code, see the
zig-fmt-pointer-reform-2 branch.
This will convert all & into *. Due to the syntax
ambiguity (which is why we are making this change),
even address-of & will turn into *, so you'll have
to manually fix thes instances. You will be guaranteed
to get compile errors for them - expected 'type', found 'foo'
- Fix errors printing very small numbers
- Add explicit scientific output mode
- Add rounding based on a specific precision for both decimal/exp
modes.
- Test and confirm exp/decimal against libc for all f32 values. Various
changes to better match libc.
The purpose of this is:
* Only one way to do things
* Changing a function with void return type to return a possible
error becomes a 1 character change, subtly encouraging
people to use errors.
See #632
Here are some imperfect sed commands for performing this update:
remove arrow:
```
sed -i 's/\(\bfn\b.*\)-> /\1/g' $(find . -name "*.zig")
```
add void:
```
sed -i 's/\(\bfn\b.*\))\s*{/\1) void {/g' $(find ../ -name "*.zig")
```
Some cleanup may be necessary, but this should do the bulk of the work.
Before:
* IR basic blocks are in arbitrary order
* when doing an IR pass, when a block is encountered, code
must look at all the instructions in the old basic block,
determine what blocks are referenced, and queue up those
old basic blocks first.
* This had a bug (See #667)
Now:
* IR basic blocks are required to be in an order that guarantees
they will be referenced by a branch, before any instructions
within are referenced.
ir pass1 is updated to meet this constraint.
* When doing an IR pass, we iterate over old basic blocks
in the order they appear. Blocks which have not been
referenced are discarded.
* After the pass is complete, we must iterate again to look
for old basic blocks which now point to incomplete new
basic blocks, due to comptime code generation.
* This last part can probably be optimized - most of the time
we don't need to iterate over the basic block again.
closes#667