Commit Graph

5395 Commits

Author SHA1 Message Date
Jakub Konka
d5fcb50988 fmt: fix formatting of lib/std/x/net/bpf.zig 2022-04-28 18:34:37 +02:00
Veikka Tuominen
6d48600ea0
Merge pull request #10717 from gh-fork-dump/seccomp-bits
Add Seccomp bits for linux
2022-04-28 18:54:09 +03:00
Veikka Tuominen
75c9936737
Merge pull request #11214 from iddev5/ay-build-runner
std: explicitly handle error.UnexpectedExitCode in build_runner
2022-04-28 18:38:44 +03:00
matu3ba
7f13f5cd5f
std.testing: add writeZigFile for TmpDir
* remove need for manual string concatenation for building binaries in test blocks
* include small program snippet to show how to get binary path with subslicing
2022-04-28 18:37:30 +03:00
Erik Hugne
8e3add8736
std.build: make no_dll_export_fns accessible in build step 2022-04-28 18:34:15 +03:00
Erik Hugne
f7bc8900bf std.coff: parse out codebase and entrypoint from optionalheader 2022-04-28 18:31:20 +03:00
Isaac Freund
6f4343b61a std: replace usage of std.meta.bitCount() with @bitSizeOf() 2022-04-27 11:10:52 +02:00
Isaac Freund
6c0719fd5f std.meta: deprecate bitCount() for @bitSizeOf() 2022-04-27 11:10:52 +02:00
Jimmi Holst Christensen
cea310c908 Remove usage of inline for from print_targets.cmdTargets
This function was one of the biggest zig functions in a debug build of
the compiler.

  $ bloaty stage3-debug/bin/zig -d symbols --tsv -n 10000000 |
      rg -v '(llvm|clang|std|lld|\(anonymous namespace\))::|\[section ' |
      sort -h -k 3

  ...
  translate_c.ast.renderNode                    86168   86219
  main.buildOutputType                         177959  178004
  InfoTable                                    184832  184870
  AArch64SVEIntrinsicMap                       188544  188596
  print_targets.cmdTargets__anon_4735          319156  319216
  __static_initialization_and_destruction_0()  486666  489582
  MatchTable1                                  621884  621997
  OperandMatchTable                           1139622 1139861
  MatchTable0                                 1899764 1900141
2022-04-26 17:52:21 -04:00
protty
18f3034629
std.Thread: ResetEvent improvements (#11523)
* std: start removing redundant ResetEvents

* src: fix other uses of std.Thread.ResetEvent

* src: add builtin.sanitize_thread for tsan detection

* atomic: add Atomic.fence for proper fencing with tsan

* Thread: remove the other ResetEvent's and rewrite the current one

* Thread: ResetEvent docs

* zig fmt + WaitGroup.reset() fix

* src: fix build issues for ResetEvent + tsan

* Thread: ResetEvent tests

* Thread: ResetEvent module doc

* Atomic: replace llvm *p memory constraint with *m

* panicking: handle spurious wakeups in futex.wait() when waiting for abort()

* zig fmt
2022-04-26 16:48:56 -05:00
Cody Tapscott
28c05b0a53 compiler_rt: Bypass fmodx impl. on stage2
This function is codegen'd incorrectly in stage2, since it fails to
generate the correct soft-float operations. This will be fixed once
issue #11161 is implemented
2022-04-25 19:38:59 -07:00
Cody Tapscott
96d86e3465 compiler_rt: Fix rounding edge case for __mulxf3 2022-04-25 17:21:09 -07:00
Cody Tapscott
f5540778b5 stdlib: Fix hex-float printing for f80 2022-04-25 17:21:09 -07:00
Cody Tapscott
d930e015c7 compiler_rt: Implement __divxf3 for f80 2022-04-25 17:21:09 -07:00
Cody Tapscott
6c0114e044 compiler_rt: Implement fmodx for f80 2022-04-25 17:21:05 -07:00
jagt
76311aebff std: fix crypto and hash benchmark 2022-04-24 23:01:06 -04:00
protty
963ac60918
std.Thread: Mutex and Condition improvements (#11497)
* Thread: minor cleanups

* Thread: rewrite Mutex

* Thread: introduce Futex.Deadline

* Thread: Condition rewrite + cleanup

* Mutex: optimize lock fast path

* Condition: more docs

* Thread: more mutex + condition docs

* Thread: remove broken Condition test

* Thread: zig fmt

* address review comments + fix Thread.DummyMutex in GPA

* Atomic: disable bitRmw x86 inline asm for stage2

* GPA: typo mutex_init

* Thread: remove noalias on stuff

* Thread: comment typos + clarifications
2022-04-23 19:35:56 -05:00
Morritz
daef82d06f
add GetProcessTimes binding to the kernel32.zig (#11488) 2022-04-23 16:58:27 -05:00
Jakub Konka
5da0e03553
Merge pull request #11480 from rabingaire/fix-child-process-hang-on-macos
Fix child process spawn on macos hangs with stdin, stdout behavior set to pipe
2022-04-22 07:26:51 +02:00
Jakub Konka
5c501e8dad
Merge pull request #11485 from ziglang/fix-4353 2022-04-22 06:34:06 +02:00
Jakub Konka
74bfb8ba07 pdb: fix resource mgmt 2022-04-21 21:53:29 +02:00
Yusuf Bham
41654a318d std.mem: add concatWithSentinel 2022-04-21 14:39:41 -04:00
Jakub Konka
bedd7efa2b debug: add smoke test 2022-04-21 11:51:38 +02:00
Jakub Konka
28ca203b71 debug: fix resource (de)allocation for Elf and Coff targets
With this change, it is now possible to safely call
`var di = std.debug.openSelfDebugInfo(gpa)`. Calling then
`di.deinit()` on the object will correctly free all allocated
resources.

Ensure we store the result of `mmap` with correct alignment.
2022-04-21 11:48:15 +02:00
Rabin Gaire
50ec55faaf ran zig fmt on changes 2022-04-21 14:12:08 +05:45
Rabin Gaire
4ece507b5a update test message and using unreachable keyword for unintended test code path 2022-04-21 13:28:41 +05:45
Andrew Kelley
f7596ae942 stage2: use indexes for Decl objects
Rather than allocating Decl objects with an Allocator, we instead allocate
them with a SegmentedList. This provides four advantages:
 * Stable memory so that one thread can access a Decl object while another
   thread allocates additional Decl objects from this list.
 * It allows us to use u32 indexes to reference Decl objects rather than
   pointers, saving memory in Type, Value, and dependency sets.
 * Using integers to reference Decl objects rather than pointers makes
   serialization trivial.
 * It provides a unique integer to be used for anonymous symbol names,
   avoiding multi-threaded contention on an atomic counter.
2022-04-20 17:37:35 -07:00
Andrew Kelley
4f527e5d36 std: fix missing hash map safety
There was a missing compile error for calling ensureUnusedCapacity
without a Context in the case that the Context is non-void.
2022-04-20 17:18:06 -07:00
Jakub Konka
96c1314443 debug: fix resource (de)allocation for MachO targets
With this change, it is now possible to safely call
`var di = std.debug.openSelfDebugInfo(gpa)`. Calling then
`di.deinit()` on the object will correctly free all allocated
resources.
2022-04-21 00:45:01 +02:00
Jakub Konka
26153ce73a dwarf: clean up allocations in std.dwarf module
While this code probably could do with some love and a redesign,
this commit fixes the allocations by making sure we explicitly
pass an allocator where required, and we use arenas for temporary
or narrowly-scoped objects such as a `Die` (for `Die` in particular,
not every `FormValue` will be allocated - we could duplicate, or
we can use an arena which is the proposal of this commit).
2022-04-21 00:06:52 +02:00
Rabin Gaire
d976456ef6 add test case for child_process spawn logic
tests creating a child process with stdin/stdout behavior set to
StdIo.Pipe.
2022-04-20 18:37:10 +05:45
Andrew Kelley
99112b63bd std.SegmentedList: breaking API changes
* Remove the Allocator field; instead it must be passed in as a
   parameter to any function that needs it.
 * Rename `push` to `append` and `pushMany` to `appendSlice` to match
   the conventions set by ArrayList.
2022-04-20 05:31:24 -07:00
Andrew Kelley
711bf55eaa std: bring back SegmentedList
I want to use it for the self-hosted compiler.
2022-04-20 05:31:24 -07:00
Rabin Gaire
9e4cd1f4e6 fix child process spawn on macos hangs issue
When a child process with stdin, stdout behavior set to pipe is
ran on macos it used to hang which has been fixed. Issue existed because
we forgot to call `posix_spawn_file_actions_addclose` syscall on user
exposed file descriptor which resulted on file descriptor not closing
properly.
2022-04-20 18:02:41 +05:45
protty
e3cbea934e
std.Thread.Futex improvements (#11464)
* atomic: cache_line

* Thread: Futex rewrite + more native platform support

* Futex: tests compile

* Futex: compiles and runs test

* Futex: broadcast test

* Futex: fix PosixImpl for tests

* Futex: fix compile errors for bsd platforms

* Futex: review changes + fix timeout=0 + more comments
2022-04-19 19:42:15 -05:00
Yusuf Bham
2fa7f6e502 std.os.uefi: Add BlockIoProtocol 2022-04-19 19:51:19 -04:00
Robin Voetter
859ae152bc array hash map: fix getOrPutAdapted on Managed array hash map 2022-04-19 19:41:12 -04:00
Andrew Kelley
0c5ad335d2 build system: add -fstage1/-fno-stage1 to zig build
So that people can start experimenting with compiling their projects
with the self-hosted compiler.

I expect this commit to be reverted after #89 is closed.
2022-04-19 14:40:27 -07:00
Andrew Kelley
9c2cbe39c2
Merge pull request #11461 from Luukdegram/wasm-debug-info
Wasm: add support for debug information
2022-04-19 14:12:13 -04:00
Luuk de Gram
be08d2bdbd
wasm: Fix unreachable paths
When the last instruction is a debug instruction, the type of it is void.
Similarly for 'noreturn' emit an 'unreachable' instruction to tell the wasm-validator
the path cannot be reached.

Also respect the '--strip' flag in the self-hosted wasm linker and not emit a 'name' section
when the flag is set to `true`.
2022-04-19 19:58:49 +02:00
Andrew Kelley
78f26b970e
Merge pull request #11469 from topolarity/wasm-fixup
stage2: Move `selfExePathWasi` to `introspect.zig`
2022-04-19 13:30:15 -04:00
Andrew Kelley
f3b3d7f20a
Merge pull request #11468 from topolarity/f80-mul
compiler_rt: Implement softfloat multiply for `f80`
2022-04-19 13:04:31 -04:00
Cody Tapscott
bb9cd6db1c stage2: Move WASI/Zig-specific selfExePath to introspect.zig 2022-04-18 23:06:49 -07:00
Cody Tapscott
b2950866b1 compiler_rt: Fix rounding/NaN handling for f80 add/sub
There were a few minor bugs in the rounding behavior and Inf/NaN
handling for the f80 __addxf3 and __subtf3 functions.

This change updates the original generic implementation to correctly
handle f80 floats, including the explicit integer bit.
2022-04-18 21:45:46 -07:00
Cody Tapscott
d760cae2b1 compiler_rt: implement __mulxf3 for f80 2022-04-18 20:46:03 -07:00
Cody Tapscott
3a63fa6b7f stage2: Add 'zig.wasm' fallback for binary name 2022-04-18 10:20:20 -07:00
Cody Tapscott
922d8378e7 stage2: Add limited WASI support for selfExePath and globalCacheDir
This change adds support for locating the Zig executable and the library
and global cache directories, based on looking in the fixed "/zig" and
"/cache" directories.

Since our argv[0] on WASI is just the basename (any absolute/relative
path information is deleted by the runtime), there's very limited
introspection we can do on WASI, so we rely on these fixed directories.
These can be provided on the command-line using `--mapdir`, as follows:

```
wasmtime --mapdir=/cwd::. --mapdir=/cache::"$HOME/.cache/zig" --mapdir=/zig::./zig-out/ ./zig-out/bin/zig.wasm
```
2022-04-18 10:19:34 -07:00
Luuk de Gram
2193f7c4a2
wasm: Add support for debug info
This implements basic DWARF output when building for the wasm target.
Stacktraces, however, are currently not supported.
2022-04-18 13:11:37 +02:00
Ryan Liptak
f8d2b87fa1 Update doc comment of ArrayHashMap to include 4th arg in eql fns
4th argument was added in cf88cf2657
2022-04-18 03:47:03 -04:00
Yusuf Bham
2aeaa1cfc4
std.os.uefi: fix GUID formatting (#11452) 2022-04-17 06:15:15 -04:00