This is identical to `mem.set(u8, slice, 0)` except that it will never
be optimized out by the compiler. Intended usage is for clearing
secret data.
The resulting assembly has been manually verified in --release-* modes.
It would be valuable to test the 'never be optimized out' claim in tests
but this is harder than initially expected due to how much Zig appears
to know locally. May be doable with @intToPtr, @ptrToInt to get around
known data dependencies but I could not work it out right now.
* add std.atomic.QueueMpsc.isEmpty
* make std.debug.global_allocator thread-safe
* std.event.Loop: now you have to choose between
- initSingleThreaded
- initMultiThreaded
* std.event.Loop multiplexes coroutines onto kernel threads
* Remove std.event.Loop.stop. Instead the event loop run() function
returns once there are no pending coroutines.
* fix crash in ir.cpp for calling methods under some conditions
* small progress self-hosted compiler, analyzing top level declarations
* Introduce std.event.Lock for synchronizing coroutines
* introduce std.event.Locked(T) for data that only 1 coroutine should
modify at once.
* make the self hosted compiler use multi threaded event loop
* make std.heap.DirectAllocator thread-safe
See #174
TODO:
* call sched_getaffinity instead of hard coding thread pool size 4
* support for Windows and MacOS
* #1194
* #1197
* 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'
start using zig-fmt-pointer-reform branch build of zig fmt
to fix code to use the new syntax
all of test/cases/* are processed, but there are more left
to be done - all the std lib used by the behavior tests
* remove std.os.spawnThreadAllocator - windows does not support
an explicit stack, so using an allocator for a thread stack
space does not work.
* std.os.spawnThread - instead of accepting a stack argument, the
implementation will directly allocate using OS-specific APIs.
Use std.heap.FixedBufferAllocator combined with
std.heap.DirectAllocator instead.
std.mem.FixedBufferAllocator is moved to std.heap.FixedBufferAllocator
* DirectAllocator does the underlying syscall for every allocation.
* ArenaAllocator takes another allocator as an argument and
allocates bytes up front, falling back to DirectAllocator with
increasingly large allocation sizes, to avoid calling it too often.
Then the entire arena can be freed at once.
The self hosted parser is updated to take advantage of ArenaAllocator
for the AST that it returns. This significantly reduces the complexity
of cleanup code.
docgen and build runner are updated to use the combination of
ArenaAllocator and DirectAllocator instead of IncrementingAllocator,
which is now deprecated in favor of FixedBufferAllocator combined
with DirectAllocator.
The C allocator calls aligned_alloc instead of malloc, in order to
respect the alignment parameter.
Added asserts in Allocator to ensure that implementors of the
interface return slices of the correct size.
Fixed a bug in Allocator when you call realloc to grow the allocation.
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.