Andrew Kelley
50eb7983cd
remove most conditional compilation based on stage1
...
There are still a few occurrences of "stage1" in the standard library
and self-hosted compiler source, however, these instances need a bit
more careful inspection to ensure no breakage.
2022-12-06 20:38:54 -07:00
Andrew Kelley
b7b905d227
add behavior test for while(true) not needing else unreachable
...
closes #707
2022-12-06 17:57:27 -07:00
Andrew Kelley
e7d28344fa
Merge pull request #13560 from ziglang/wasi-bootstrap
...
Nuke the C++ implementation of Zig from orbit using WASI
2022-12-06 18:52:39 -05:00
Frank Denis
d4adf44200
std.crypto.aes: use software implementation in comptime context ( #13792 )
...
Hardware-accelerated AES requires inline assembly code, which
cannot work at comptime.
2022-12-06 22:48:19 +00:00
Andrew Kelley
823d1e7087
add std.heap.wasm_allocator
2022-12-06 12:27:28 -07:00
Andrew Kelley
e73170f972
std: fix WASI regressions
...
This branch largely reverts 58f961f4cb9875bbce3070969438ecf08f392c9f. I
would like to revisit the proposal to modify the standard library in
this way and think more carefully about it before adding isAbsolute()
checks everywhere.
2022-12-06 12:15:05 -07:00
Jacob Young
906120bc2c
std.fmt: more descriptive names for impl functions
...
This is a workaround for a limitation of the C backend.
2022-12-06 12:15:04 -07:00
Andrew Kelley
9cb06f3b8b
fix merge conflicts from master branch
2022-12-06 12:15:04 -07:00
Andrew Kelley
55ca43a04c
std.wasm: add Opcode.prefixed and make PrefixedOpcode nonexhaustive
2022-12-06 12:15:04 -07:00
Andrew Kelley
6b0d773266
std: clean up imports in a couple files
2022-12-06 12:15:04 -07:00
Andrew Kelley
d5312d53a0
WASI: remove absolute path emulation from std lib
...
Instead of checking for absolute paths and current working directories
in various file system operations, there is one simple solution: allow
overriding `std.fs.cwd` on WASI.
os.realpath is back to causing a compile error when used on WASI. This
caused a compile error in the Sema handling of `@src()`. The compiler
should never call realpath, so the commit that made this change is
reverted (95ab942184427e7c9b840d71f4d093931e3e48fb). If this breaks
debug info, a different strategy is needed to solve it other than using
realpath.
I also removed the preopens code and replaced it with something much
simpler. There is no longer any global state in the standard library.
Additionally-
* os.openat no longer does an unnecessary fstat on WASI when O.WRONLY
is not provided.
* os.chdir is back to causing a compile error on WASI.
2022-12-06 12:15:04 -07:00
Andrew Kelley
4e2a960b52
std.fs: fix openDirAbsolute
...
These functions had a compile error since the introduction of
IterableDir.
2022-12-06 12:15:04 -07:00
Andrew Kelley
28514476ef
remove -fstage1 option
...
After this commit, the self-hosted compiler does not offer the option to
use stage1 as a backend anymore.
2022-12-06 12:15:04 -07:00
Pyrolistical
bf316e5506
std: added eql to DynamicBitSet and DynamicBitSetUnmanaged
2022-12-06 21:09:33 +02:00
Frank Denis
397881fefb
treshold -> threshold
2022-12-05 19:25:10 -05:00
Jason Phan
97827d6d38
std.fmt.formatInt: Use an optimized path for decimals
...
It enables faster decimal-to-string conversions for values in the range
[0, 100).
2022-12-05 22:58:45 +02:00
Pyrolistical
9e74e4c1f8
std: added pure functions to StaticBitSet
...
The following functions were added to both IntegerBitSet and ArrayBitSet:
fn eql(self: Self, other: Self) bool
fn subsetOf(self: Self, other: Self) bool
fn supersetOf(self: Self, other: Self) bool
fn complement(self: Self) Self
fn unionWith(self: Self, other: Self) Self
fn intersectWith(self: Self, other: Self) Self
fn xorWith(self: Self, other: Self) Self
fn differenceWith(self: Self, other: Self) Self
2022-12-05 21:06:10 +02:00
nc
a7cb5027ae
std.atomic.Queue: fix unget implementation and add doc
2022-12-05 17:01:56 +02:00
Martin Wickham
b1c4227763
Allow const ArrayLists to be cloned
2022-12-05 04:36:10 -05:00
Frank Denis
4be1bb4aac
std.crypto benchmark: don't use a relative path to import std ( #13772 )
2022-12-05 04:44:14 +00:00
Andrew Kelley
954019983d
std: add move() functions to hash maps
2022-12-04 15:57:40 -07:00
Veikka Tuominen
e361740669
Merge pull request #13142 from mllken/gzip-safety
...
gzip: add missing header fields and bounds for header parsing
2022-12-04 14:32:25 +02:00
Gregory Oakes
8d17e90fcd
std: add a special case for empty structs in meta.FieldEnum.
...
Empty structs would previously result in a compilation error.
2022-12-04 14:22:16 +02:00
Andrew Kelley
fdbb0fb7b9
Merge pull request #13744 from Vexu/stage2-fixes
...
Improve error messages, fix dependency loops
2022-12-03 00:42:11 -05:00
Veikka Tuominen
0e38cc16d5
Sema: fix comparisons between lazy and runtime values
...
Closes #12498
2022-12-03 00:09:23 +02:00
Jakub Konka
5eaacf1ce9
windows: use array of tmp bufs as backing store for input memory to ntdll
2022-12-02 12:24:15 -05:00
Jakub Konka
2823fcabd1
Merge pull request #13725 from mathetake/fixreaddir
...
wasi: fixes IterableDir.nextWasi for large directory
2022-12-01 17:30:00 +01:00
Veikka Tuominen
b7066b6024
add workaround for compiler bug
2022-12-01 14:48:09 +02:00
Ryan Liptak
c37afa2811
std.testing: Improve expectEqualBytes for large inputs and make expectEqualSlices use it
...
`expectEqualBytes` will now truncate the hexdump of each input to a maximum window of 256 bytes, which makes it safe to use for arbitrarily large inputs. Therefore, it can be used in `expectEqualSlices` when the type is u8.
2022-12-01 02:18:51 -05:00
Takeshi Yoneda
829bf5a03e
wasi: fixes IterableDir.nextWasi for large directory
...
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2022-12-01 13:56:53 +09:00
Andrew Kelley
a943422672
Merge pull request #13717 from GethDW/option-fix
...
std.build.Builder: fix for Allocator changes
2022-11-30 19:43:51 -05:00
Ryan Liptak
34fa6a1e04
std.testing: Add expectEqualBytes that outputs hexdumps with diffs highlighted in red
...
The coloring is controlled by `std.debug.detectTTYConfig` so it will be disabled when appropriate.
2022-11-30 18:57:37 -05:00
Andrew Kelley
16caea38d1
std.ArrayList: fix shrinkAndFree
...
Fixes a regression introduced in
e35f297aeb993ec956ae80379ddf7f86069e109b.
Now there is test coverage for ArrayList.shrinkAndFree in the case when
resizing fails.
2022-11-30 15:42:59 -07:00
Andrew Kelley
c84bc3a06b
std.os.test: disable flaky timerfd test
...
See tracking issue #13721
2022-11-30 15:18:35 -07:00
Veikka Tuominen
34f96c5fd0
Merge pull request #13719 from Vexu/debug
...
Improve debuggability of programs built by the self hosted compiler
2022-11-30 22:51:39 +02:00
Andrew Kelley
abd9089aa6
std.build: simpler fix to options implementation
...
Instead of messing with ArrayList and more logic, just unwrap the error
of toOwnedSlice().
2022-11-30 13:22:04 -07:00
GethDW
747f64b3fb
std.build.Builder: fix for Allocator changes
2022-11-30 13:04:32 -07:00
Andrew Kelley
44ee1c885f
std.os.windows.ReadLink: add missing alignment of local data buffer
2022-11-30 12:55:23 -07:00
Veikka Tuominen
e4fd9acc2a
CLI: allow using --debug-compile-errors with zig build
2022-11-30 19:14:04 +02:00
Andrew Kelley
7f063b2c52
WasmAllocator: simplify thanks to new Allocator interface
...
Now it can refuse to resize when it would disturb the metadata tracking
strategy, resulting in smaller code size, a simpler implementation, and
less fragmentation.
2022-11-29 23:46:02 -07:00
Andrew Kelley
931261752d
rename a couple variables
2022-11-29 23:46:02 -07:00
Andrew Kelley
e2e60f5ff9
std.heap.WasmAllocator: redo
...
The previous version had a fatal flaw: it did ensureCapacity(1) on the
freelist when allocating, but I neglected to consider that you could
free() twice in a row. Silly!
This strategy allocates an intrusive freelist node with every
allocation, big or small. It also does not have the problems with resize
because in this case we can push the upper areas of freed stuff into the
corresponding freelist.
2022-11-29 23:46:02 -07:00
Andrew Kelley
3dcea95ffe
std.heap.WasmAllocator: implement resizing
2022-11-29 23:46:02 -07:00
Andrew Kelley
d4a1ae474a
std.heap.WasmAllocator: resize in place without force shrinking
2022-11-29 23:46:02 -07:00
Andrew Kelley
0c0c70ee82
std.heap.WasmAllocator: large allocations
2022-11-29 23:46:02 -07:00
Andrew Kelley
3ea04ed64c
introduce std.heap.WasmAllocator
...
fast allocator for WebAssembly
eventually this is intended to be merged into
`std.heap.GeneralPurposeAllocator`
2022-11-29 23:46:02 -07:00
Andrew Kelley
9f8c19210b
std.heap: extract PageAllocator, WasmPageAllocator
2022-11-29 23:46:02 -07:00
Andrew Kelley
f466667888
stage2: fix crash on comptime lazy @ctz and @clz
2022-11-29 23:30:38 -07:00
Andrew Kelley
ceb0a632cf
std.mem.Allocator: allow shrink to fail
...
closes #13535
2022-11-29 23:30:38 -07:00
Andrew Kelley
b8473ae7d3
Merge pull request #13693 from Vexu/safety
...
Safety panic improvements & some bug fixes
2022-11-29 19:59:55 -05:00