Commit Graph

534 Commits (26e08d57016352c469ae34b3fbd61e7f2a85a76c)

Author SHA1 Message Date
Andrew Kelley f205d23e65
implement async function call with `@call`
this removes the last usage of var args in zig std lib
2019-12-09 15:27:26 -05:00
Andrew Kelley 5d82744f1c
ability to give comptime and non-comptime types to same parameter 2019-12-09 13:30:53 -05:00
Andrew Kelley d571fad20e
update tests to new format API 2019-12-09 00:05:21 -05:00
Andrew Kelley 03396b3caa
update docs to new fmt API 2019-12-08 23:46:50 -05:00
Andrew Kelley 5f9467d78f
update formatted printing when linking libc 2019-12-08 23:39:30 -05:00
Andrew Kelley 7a4f704258
windows-specific fixes 2019-12-08 23:26:19 -05:00
Andrew Kelley 8b2622cdd5
std.fmt.format: tuple parameter instead of var args 2019-12-08 22:53:51 -05:00
Benjamin Feng 608d36ad8c Rewrite WasmPageAllocator tests to be less flaky on environment 2019-12-08 21:22:07 -06:00
Andrew Kelley 64d700bfa6
zig fmt: support comptime fields 2019-12-08 12:26:20 -05:00
Josh Wolfe 05fc4d34a9 documentation for mutable HashMap KV pointers 2019-12-07 13:22:23 -05:00
Benjamin Feng e91522b875 Add back comptime check for wasm 2019-12-06 17:27:11 -06:00
data-man 80a72c225c Crypto benchmark fixes 2019-12-06 17:14:10 -05:00
data-man 008e42f483 getStdOut fixes 2019-12-06 16:41:02 -05:00
Benjamin Feng 5a004ed834 Actually use `const conventional` as the comment indicates 2019-12-06 15:16:07 -06:00
Andrew Kelley 525b1e8fb4
Merge pull request #3856 from ziglang/builtin-call
introduce `@call` and remove other builtin calls
2019-12-06 15:49:47 -05:00
Andrew Kelley 656cc33f8d
allow calling with a new stack to regress a bit
Calling with a new stack, with a runtime-known stack pointer (e.g.
not a global variable) is regressed with this branch. It is now a
compile-error, due to the Runtime Hint system not being smart enough
to mix a compile-time modifier field with a runtime stack field.
I'm OK with this regression because this feature is flawed (see #3268)
and may be deleted from the language.
2019-12-06 15:25:00 -05:00
Andrew Kelley 71b7f4b47f
remove `@newStackCall` from zig 2019-12-06 14:52:09 -05:00
Andrew Kelley 343987cd05
remove `@inlineCall` from zig 2019-12-06 14:12:01 -05:00
Benjamin Feng eb495d934b Add WasmPageAllocator tests 2019-12-05 21:54:57 -06:00
Andrew Kelley 105ef560b3
Merge pull request #3853 from xackus/doc-fixes
Docs: assembly example printing garbage and minor html fixes
2019-12-05 20:43:10 -05:00
Benjamin Feng f2b0dbea74 Resolve tests to work with or skip WasmPageAllocator 2019-12-05 19:31:49 -06:00
Benjamin Feng 694616adb5 Standardize around bigger slices 2019-12-05 18:43:51 -06:00
Benjamin Feng 7d1c4fe4dc Switch bitmask to enums 2019-12-05 18:01:49 -06:00
Andrew Kelley ef83358eb6
remove `@noInlineCall` from zig 2019-12-05 17:37:29 -05:00
Andrew Kelley 1f602fe8c5
implement `@call`
closes #3732
2019-12-05 17:07:15 -05:00
xackus 71354498c9 docs: add html lang and minor fixes 2019-12-05 22:40:58 +01:00
Vexu bfb15f1c9f fix casts 2019-12-05 15:47:06 -05:00
frmdstryr 1baaf9a503 Increase io.BufferedInStream readByte speed by ~75% 2019-12-05 10:16:50 -05:00
Vexu d40ad92668
use enum literals in render.zig 2019-12-05 14:50:51 +02:00
Vexu 10cc8cad86
fix zig fmt of c pointers 2019-12-05 14:50:46 +02:00
Benjamin Feng 30da6d49f4 Fix freeing memory across bounds 2019-12-04 22:43:02 -06:00
Benjamin Feng 86ae75363e Strip out an unnecessary memset 2019-12-04 21:41:01 -06:00
Benjamin Feng 5784985bb8 Use raw PackedIo to shave ~150b 2019-12-04 21:22:36 -06:00
Benjamin Feng a910a6c871 Rejuggle how offsets are calculated 2019-12-04 18:12:25 -06:00
Andrew Kelley bef3769bb7
std.fmt.ParseUnsignedError is now public 2019-12-04 18:44:22 -05:00
Andrew Kelley 10e172b1d7
add `other` OS and fix regression in build-exe for freestanding 2019-12-04 14:42:40 -05:00
Andrew Kelley 44e896f613
Merge pull request #3844 from Snektron/sort-improvements
Small sort improvements
2019-12-04 14:25:00 -05:00
Vexu 137cb32f5e add docs for function parameters 2019-12-04 14:14:47 -05:00
Robin Voetter 841a37ab59 Add std.sort.argMax and std.sort.argMin 2019-12-04 18:20:55 +01:00
Robin Voetter 0159fa284a Make std.sort.min and std.sort.max return ?T 2019-12-04 18:10:20 +01:00
Robin Voetter 65f57e4499 Make std.sort.max accept const slices and add tests 2019-12-04 16:42:18 +01:00
Robin Voetter 6bb0ee0bc4 Add std.sort.isSorted 2019-12-04 16:41:32 +01:00
Benjamin Feng a6f838aab2 Remove redundant alloc 2019-12-04 00:10:37 -06:00
Benjamin Feng 01e73bba8d Tighten recycled search 2019-12-04 00:08:09 -06:00
Benjamin Feng baffaf7986 Extract setBits 2019-12-04 00:07:52 -06:00
Benjamin Feng b33211ed51 Implement block-based skipping 2019-12-03 17:24:50 -06:00
Andrew Kelley 521744bb91
correct the calling convention of WinMainCRTStartup 2019-12-03 16:55:27 -05:00
Andrew Kelley 8db4d2332e
correct startup logic for exporting libc main 2019-12-03 13:10:26 -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 621c08e692
exported main must be pub 2019-12-03 12:50:42 -05:00
Vexu a0ca30ce01
move more startup code to std lib 2019-12-03 12:50:18 -05:00
Benjamin Feng 45e0441278 Fix bugs 2019-12-02 22:04:09 -06:00
LemonBoy 26c8930b95 Accept comptime-known expression for asm 2019-12-02 19:53:06 -05:00
Andrew Kelley b7be57766b
Merge pull request #3715 from daurnimator/towards-afd
Misc windows additions+fixes
2019-12-02 16:12:55 -05:00
Andrew Kelley 6a36c549a8
add extra LICENSE file for clarification 2019-12-02 15:11:11 -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
Benjamin Feng f32555aa08 Work around __heap_base for now 2019-12-02 09:59:20 -06:00
Benjamin Feng ba38a6d122 Get stuff vaguely working 2019-12-02 09:59:20 -06:00
Benjamin Feng eb1628b033 Initialize memory segments 2019-12-02 09:59:20 -06:00
Benjamin Feng eff926b454 Brain dump new wasm allocator 2019-12-02 09:59:20 -06:00
Andrew Kelley b6127b0fe9
add some null-termination annotations
closes #3797
2019-12-02 01:13:46 -05:00
Andrew Kelley 3644e85091 fix regressions on windows 2019-12-01 21:31:00 -05:00
Andrew Kelley 4af5c38674
fixes for self-hosted compiler 2019-12-01 19:22:03 -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 951dc451d6
Merge pull request #3808 from LemonBoy/i386-for-ya
linux-i386 support
2019-11-30 22:00:00 -05:00
Andrew Kelley 2e7350140d
further clarify std.fs function docs 2019-11-30 18:36:47 -05:00
Andrew Kelley 034ccb4e4e add missing error code handling on Windows 2019-11-30 16:58:32 -05:00
Andrew Kelley 413f9a5cfc
move `std.fs.Dir.cwd` to `std.fs.cwd`
update to non-deprecated std.fs APIs throughout the codebase

Related: #3811
2019-11-30 15:35:27 -05:00
Andrew Kelley d039fed831
introduce std.fs.Dir.openFile and std.fs.Dir.createFile
These functions have flags parameters which cover all the use cases. The
other functions are now deprecated.
2019-11-30 13:32:11 -05:00
LemonBoy e1e06e6766 linux-i386 support 2019-11-30 16:13:33 +01:00
Andrew Kelley b220be7a33
more test regression fixes 2019-11-29 23:04:19 -05:00
Andrew Kelley d87b13f2f7
fix windows std lib regressions 2019-11-29 21:55:27 -05:00
Andrew Kelley 2ab7f31e99
std.math: remove constants that should be expressions
All four of these can be represented in fewer characters with
expressions, which will be guaranteed to happen at compile-time, and
have the same or better precision.

The other math constants here which depend on function calls could be
similarly removed if and when #425 is solved. However I left them for
now since Zig does not eagerly evaluate functions with comptime parameters.
2019-11-29 10:48:46 -05:00
Quetzal Bradley a6c9c5f767 implement correct buffer wrapping logic in std.event.Channel 2019-11-27 23:09:24 -05:00
Michael Dusan ca61a5f0b7 Windows: fix test/standalone/shared_library
- on Windows use first found env var { "Path", "PATH" }

Bug Description: `build test` results in the following error on in
a msys64 shell with "PATH" env var instead of "Path":

    error while loading shared libraries: mathtest.dll:
    cannot open shared object file: No such file or directory
2019-11-27 19:24:06 -05:00
Felix Queißner f0d6447569 Implements std.testing.expectEqual for tagged unions. (#3773) 2019-11-27 16:35:32 -05:00
Andrew Kelley 0f2a9af4aa
Merge pull request #3769 from MCRusher/initcapacity-for-buffer-arraylist
Add initCapacity for buffer & arraylist
2019-11-27 13:40:39 -05:00
Andrew Kelley 83c664eaa0
Merge pull request #3780 from Vexu/stage2-async-review
Update use of async functions in self hosted compiler
2019-11-27 13:38:49 -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
Vexu 4d8a8e65df
add more workarounds 2019-11-27 10:17:37 +02:00
daurnimator 8a71f77c4a
std: lie about windows socklen_t signed-ness 2019-11-27 13:01:34 +11:00
daurnimator edc84e7ef7
std: add more winsock functions 2019-11-27 13:01:33 +11:00
daurnimator 19f26578c0
std: windows sockaddr constants come from ws2_32 2019-11-27 13:01:32 +11:00
daurnimator 8aa3d6019c
std: add windows.USHORT definition 2019-11-27 13:01:30 +11:00
daurnimator 254c79125b
std: fix WSAIoctl definition
zig automatically passes functions as pointers
2019-11-27 13:01:28 +11:00
daurnimator d99f0a2b8f
std: IO_STATUS_BLOCK's status member is an NTSTATUS; add union 2019-11-27 13:01:10 +11:00
daurnimator 1537d4701e
std: fix definition of NtDeviceIoControlFile 2019-11-27 13:01:09 +11:00
daurnimator a453c99ba9
std: add comments for some nt status codes 2019-11-27 13:01:08 +11:00
daurnimator 2c6788d7de
std: add windows.closesocket 2019-11-27 13:01:07 +11:00
daurnimator 6b5b0e6cd6
std: fix windows.GetOverlappedResult 2019-11-27 13:01:05 +11:00
daurnimator ce9966a39b
std: improved windows.DeviceIoControl 2019-11-27 13:01:04 +11:00
daurnimator b05a5a3e52
std: add CreateEvent for windows 2019-11-27 13:01:03 +11:00
daurnimator 78c0d33eb7
std: add WaitForMultipleObjects for windows 2019-11-27 13:01:02 +11:00
daurnimator 21ca54f560
std: add alertable argument for windows.WaitForSingleObject 2019-11-27 13:00:59 +11:00
kprotty ff445814cb
remove wait timeout test cases 2019-11-26 20:40:28 -05:00
kprotty 056b5a26c9
ResetEvent: get abstime based on std.time 2019-11-26 20:40:28 -05:00
kprotty ca2d566ec8
replace ThreadParker with ResetEvent + WordLock mutex 2019-11-26 20:40:27 -05:00
kprotty a0955990dc
fix ResetEvent windows bugs 2019-11-26 20:40:04 -05:00