Commit Graph

9505 Commits (2c7fc1c5c504af9dd22d5ac21ecc6773e263e395)

Author SHA1 Message Date
Jakub Konka 200f9ea6fb Add unit test for std.fs.wasi.PreopenList 2020-06-11 23:00:02 +02:00
Jakub Konka c7721bb368 Add custom format method for Preopen struct 2020-06-11 22:31:08 +02:00
Jakub Konka e4a8598ddd Add doc example for extracting WASI preopens 2020-06-11 22:30:02 +02:00
Jonathan Marler a282ac7a91 Support Reader for InStream 2020-06-09 13:36:17 -04:00
Andrew Kelley 4302f276ed Merge branch 'kubkon-wasm-instrinsics'
closes #5507
2020-06-09 00:22:43 -04:00
Jakub Konka 42c95a64d6 Update langref.html.in 2020-06-09 00:22:34 -04:00
Jakub Konka 660eef9a43 Document the builtins 2020-06-09 00:22:34 -04:00
Jakub Konka 52b97eeef1 Return u32 in @wasmMemorySize instead of i32 2020-06-09 00:22:34 -04:00
Jakub Konka 057d97c093 Return should be i32 due to error signaling in memory.grow
Also, fix tests.
2020-06-09 00:22:34 -04:00
Jakub Konka 3f0a3cea6e Fix builtins to return and accept u32 instead of i32 2020-06-09 00:22:34 -04:00
Jakub Konka 8ffa8ed9a8 Expose full llvm intrinsic 2020-06-09 00:22:34 -04:00
Jakub Konka 73a3bfd1dd Add basic tests for the new builtins 2020-06-09 00:22:34 -04:00
Jakub Konka 146be2a8cb Use builtins in std.heap.WasmAllocator 2020-06-09 00:22:17 -04:00
Jakub Konka 601e831f1d Add builtin for llvm.wasm.memory.grow.i32 intrinsic
This will allow the developer to request additional memory pages
from the runtime to be allocated for the Wasm app. Typical usage:

```zig
var wasm_pages = @wasmMemorySize();
@wasmMemoryGrow(1);
@import("std").debug.assert((wasm_pages + 1) == @wasmMemorySize());
```
2020-06-09 00:22:17 -04:00
Jakub Konka ce3f0077cf Add builtin for llvm.wasm.memory.size.i32 instrinsic
This will allow the developer to poll the runtime for currently
allocated memory in the number of Wasm pages. Typical usage:

```zig
var wasm_pages = @wasmMemorySize();
@import("std").debug.assert(wasm_pages > 0);
```
2020-06-09 00:22:17 -04:00
Jonathan Marler 12051b02f1 fix memory errors 2020-06-09 00:17:22 -04:00
Andrew Kelley 9ee98f103b
Merge pull request #5539 from mikdusan/issue5474
stage1: fix constness in some corner cases
2020-06-09 00:12:57 -04:00
Jonathan Marler 7481582774 support Writer instead of OutStream
Start implementing https://github.com/ziglang/zig/issues/4917 which is to rename instream/outstream to reader/writer.  This first change allows code to use Writer/writer instead of OutStream/outStream, but still maintains the old outstream names with "Deprecated" comments.
2020-06-08 22:59:28 -04:00
Michael Dusan f5b584cc13
Merge pull request #5567 from mikdusan/qemu
ci linux: bump qemu-5.0.0-49ee115552
2020-06-08 22:12:14 -04:00
Andrew Kelley d2278f2156
Merge pull request #5566 from ziglang/stage2-garbage-collect-decls
Stage2 garbage collect decls
2020-06-08 18:29:12 -04:00
Jakub Konka 0ff5d7b24e Add option for overriding the stack size
This commit adds a `--stack [size]` link-time option to zig compiler
allowing the user to override the default stack size set for the
specified executable/library format. This is currently limited to
ELF, COFF and Wasm however (i.e., Mach-O is excluded).
2020-06-08 17:44:06 -04:00
Jakub Konka cde7c75676 Increase default Wasm stack to 1MB
This commit increases the default Wasm stack to 1MB from the default
of 1 Wasm page which equal 64KB. This seems like a reasonable default
size while at the same time not overly large. Also, Rust lang seems
to be favouring this default as well: [rust-lang#50083].

[rust-lang#50083]: https://github.com/rust-lang/rust/pull/50083
2020-06-08 17:29:14 -04:00
xackus 0d40cb6255 stage1: fix crash on slice byte reinterpretation 2020-06-08 17:19:06 -04:00
Andrew Kelley 05d284c842 update sort callsite to new API 2020-06-08 16:33:35 -04:00
Michael Dusan c2f547f91f
ci linux: bump qemu-5.0.0-49ee115552
update qemu to upstream with mremap patch
2020-06-08 16:20:39 -04:00
Andrew Kelley 47090d234e stage2: add passing test for compile error in unreferenced cycle 2020-06-08 15:16:40 -04:00
Andrew Kelley 9ea4965ceb self-hosted: remove deleted Decls from failed_decls 2020-06-08 15:16:40 -04:00
Andrew Kelley 91930a4ff0 stage2: fix not re-loading source file for updates after errors 2020-06-08 15:16:40 -04:00
Andrew Kelley cf654b52d6 stage2: -femit-zir respects decl names and supports cycles 2020-06-08 15:16:40 -04:00
Andrew Kelley d4d954abd2 std.sort: give comparator functions a context parameter 2020-06-08 15:16:40 -04:00
Noam Preil c405844b0a [Stage2/x86] Fix 8-bit register order 2020-06-08 02:28:39 -04:00
Andrew Kelley 37695ed81e
Merge pull request #5556 from iansimonson/try_other_addresses
tcpConnectToHost try all addresses in AddressList
2020-06-07 13:53:12 -04:00
Ian Simonson a6d1ef64d7 tcpConnectToHost try all addresses in AddressList
The AddressList returned can contain more than one item
e.g. the ipv4 and ipv6 addresses for a given hostname.
Previously if a server had multiple addresses but
was not listening on one of them Zig would give up
immediately.

Now on std.os.ConnectError.ConnectionRefused Zig will
try the next address in the list. Zig still gives up on
all other errors as they are related to the system and
system resources rather than whether the remote server
is listening on a particular address.
2020-06-07 22:39:35 +10:00
Ian Simonson 983f93c840 Test case for tcpConnectToHost fix 2020-06-07 22:39:35 +10:00
Veikka Tuominen 499df9680c
Merge pull request #5531 from Vexu/translate-c
Translate-c don't crash on complex switches
2020-06-05 10:41:56 +03:00
Michael Dusan c0c9d11d8c
stage1: fix constness in some corner cases
- for one-possible-value types, ir_analyze_struct_field_ptr()
  no longer hardcodes const/volatile

- when slicing arrays, ir_analyze_instruction_slice()
  no longer consults ConstValSpecialStatic

closes #5474
2020-06-05 00:49:57 -04:00
Ryan Liptak f839d34baa std.os.windows.OpenFile: Handle FILE_IS_A_DIRECTORY status
Fixes #5533
2020-06-04 22:53:23 -04:00
Ryan Liptak 95a5f6bf2d Windows: Handle ERROR_DIRECTORY in std.fs.deleteDirAbsolute when called on a file path
ERROR_DIRECTORY (267) is returned from kernel32.RemoveDirectoryW if the path is not a directory. Note also that os.DirectDirError already includes NotDir

Before: error.Unexpected: GetLastError(267): The directory name is invalid.
After: error: NotDir
2020-06-04 22:52:53 -04:00
Ryan Liptak f7b6957fb4 Windows: Fix std.fs.Dir.deleteDir() deleting files
Would previously delete files, now correctly returns error.NotDir. Fixes #5536
2020-06-04 22:51:58 -04:00
Vexu c27a8bd6be
translate-c: don't crash on complex switches 2020-06-04 14:22:27 +03:00
Vexu fd067fbe8b
add workaround for #5525 2020-06-04 13:11:23 +03:00
Andrew Kelley 6524a64bda stage2: fix referencing decls which appear later in the file 2020-06-02 17:43:51 -04:00
Andrew Kelley 14d235dd6e Merge branch 'lun-4-resolve-ip6'
closes #4864
2020-06-02 15:31:14 -04:00
Andrew Kelley 7fd937fef4 cleanups
* improve docs
 * add TODO comments for things that don't have open issues
 * remove redundant namespacing of struct fields
 * guard against ioctl returning EINTR
 * remove the general std.os.ioctl function in favor of the specific
   ioctl_SIOCGIFINDEX function. This allows us to have a more precise
   error set, and more type-safe API.
2020-06-02 15:28:46 -04:00
Luna 0d091dc923 Replace os.linux to os.system 2020-06-02 14:56:19 -04:00
Luna 6623efd7d4 Change ioctl's request type to i32 2020-06-02 14:56:19 -04:00
Luna 6d3d1152ea Add declaration for libc ioctl 2020-06-02 14:56:19 -04:00
Luna 7c71054286 Replace syscall3 to os.ioctl 2020-06-02 14:56:19 -04:00
Luna 09c01ea7b9 Use resolveIp when looking up addresses on linux 2020-06-02 14:56:19 -04:00
Luna c8468bed42 Add std.os.ioctl 2020-06-02 14:56:19 -04:00