5844 Commits

Author SHA1 Message Date
Jonathan Marler
f598234ee8 std.json: expose encodeJsonString and encodeJsonStringChars
Expose 2 functions from std.json.  These functions take a slice of bytes
and forward them to a given writer as a JSON encoded string.

The use case I have for this is in a custom JsonStringWriter.  This writer
takes data and automatically encodes it as JSON string characters and
forwards it to an underlying writer.  I use this JsonStringWriter in
combination with std.fmt.format to go directly from a format string/arg
pair to JSON.  This way I don't have to format my string into a separate
buffer first and encode it afterwards, which avoids the need to create
a temporary buffer to hold the unencoded but formatted string.
2022-07-24 11:51:59 +03:00
Andrew Kelley
a2ab9e36fa
Merge pull request #12143 from Vexu/stage2-safety
Stage2 runtime safety progress
2022-07-23 20:09:24 -07:00
Vincent Rischmann
d99c32c2e1
io_uring: add new flags and opcodes 2022-07-23 17:21:17 +03:00
Veikka Tuominen
d75fa86d70 stage2: implement @setFloatMode 2022-07-23 15:40:12 +03:00
Veikka Tuominen
72c60acd5d Revert "std.mem.Allocator: add alignedCreate"
This reverts commit 5647a73fea7ecc9e1ee190362ef47f402eb95dff.
2022-07-23 15:30:12 +03:00
devins2518
5647a73fea
std.mem.Allocator: add alignedCreate 2022-07-23 14:22:35 +03:00
Veikka Touminen
819c868bbf std.net.getAddressList: fix segfault on bad hostname
Fixes #12065
2022-07-23 13:54:24 +03:00
ominitay
889efddd1a std.json: Fix parsing of large numbers
Numbers greater than about 2^53 are encoded as strings in JSON.
std.json.parseInternal previously errored out in this condition.
2022-07-23 13:52:16 +03:00
Jakub Konka
a8bfddfaea
Merge pull request #12140 from ziglang/macho-gc-sections
macho: add support for `-dead_strip` (GC sections) and simplify symbol resolution
2022-07-23 00:01:09 -07:00
Andrew Kelley
7502e490cb
Merge pull request #12173 from ziglang/autodocs-rebased
New Autodocs!
2022-07-22 20:56:59 -07:00
Jakub Konka
eb1b2f5c58 macos: add /usr/local/* paths conditional on macOS major version
`/usr/local/include`, `/usr/local/lib` and `/Library/Frameworks`
have been deprecated since approximately macOS 11, and so to avoid
redundant and misinformed warning messages generated by the linker,
add those dirs only when natively targeting macOS 10.x.x or below.
2022-07-22 14:11:23 -07:00
Andrew Kelley
5dd59a5423
Merge pull request #12191 from ziglang/underaligned-fields
LLVM: fix lowering of structs with underaligned fields
2022-07-22 11:58:50 -07:00
VÖRÖSKŐI András
d925d19cfc PriorityQueue: use compareFn in update()
update() calls mem.indexOfScalar() which uses `==` for comparing items,
which fails when the operator is not supported.
As PirorityQueue needs a comparing function anyway we can use `.eq` results
to identify matching objects.

closes #9918
2022-07-22 19:25:38 +03:00
Dan Ellis Echavarria
d1d892c83c SIMD size suggestions: suggestions code now compiles, added more
architectures
The idea behind this is using the register capabilities in safe amounts,
 there is still some consideration to be done.
+ Fixed compile error using std.Target.<arch>.featureSetHas
+ X86 MMX and "3DNOW" 64 bits register usage considered for vector size
+ Added ARM Neon recommened usage of 128 bits (The size of the register)
+ Added AARCH64 Neon and SVE for 128 bits. SVE could use in theory up to
  2048 bits, but found only evidence of functional 512 bits on a super
       computer, decided on using 128 bits as a safety
+ Added Altivec recommendation of using the 128 bits long register
+ Using MIPS msa 2x64bits capabilities, usage of 64 bits registers for MDMX
  systems, need testing on how using bigger values affect performance
+ Using V extension on RISC-V, which is extendable via instructions, decided on 128 bits
  as a value to not use all registers
+ in SPARC the 64 bits registers are used, a max of 32 registers
  are to be used for configurable simd instructions, decided on using
the size of the register, need testing on performance hit on using a
bigger sized register vector size
2022-07-22 18:58:43 +03:00
Jakub Konka
2c184f9a5f link-tests: add checkNotPresent and add -dead_strip smoke test
`checkNotPresent` is the inverse of `checkNext` - if the phrase is
found in the output, then it fails the test.
2022-07-22 16:58:21 +02:00
Jakub Konka
7ec9a4f382 cli: support --gc-sections and --no-gc-sections for Zig sources 2022-07-22 16:58:20 +02:00
Andrew Kelley
f550c29c4e LLVM: fix lowering of structs with underaligned fields
When lowering a struct type to an LLVM struct type, keep track of
whether there are any underaligned fields. If so, then make it a packed
llvm struct. This works because we already insert manual padding bytes
regardless.

We could unconditionally use an LLVM packed struct; the reason we bother
checking for underaligned fields is that it is a conservative choice, in
case LLVM handles packed structs less optimally. A future improvement
could simplify this code by unconditionally using packed LLVM structs
and then make sure measure perf is unaffected.

closes #12190
2022-07-21 22:51:17 -07:00
Yujiri
b8bf5de75a Fix #9184: fmtIntSizeDec/fmtIntSizeBin support FormatOptions 2022-07-21 18:41:21 +03:00
Andrew Kelley
ca3adb83b7
Merge pull request #12111 from ziglang/ci-stage3
CI: increase stage3 test coverage
2022-07-20 17:07:19 -07:00
Motiejus Jakštys
fd9b55a640 build.zig: teach --compress-debug-sections
Now that #11863 is landed, let's expose it to the zig programs that
build stuff via `build.zig`. "Benchmarks" with [turbonss](https://git.sr.ht/~motiejus/turbonss):

Built with:

    $ zig build -Dtarget=x86_64-linux-gnu.2.19 -Dcpu=x86_64_v3 -Drelease-small=true

*Debug, uncompressed*

    174K turbonss-analyze
    161K turbonss-getent
    1.2M turbonss-unix2db
    448K libnss_turbo.so.2.0.0

*Debug, compressed*

     78K turbonss-analyze
     86K turbonss-getent
    572K turbonss-unix2db
    190K libnss_turbo.so.2.0.0

*Stripped, for completeness*

     17K turbonss-analyze
     20K turbonss-getent
    197K turbonss-unix2db
     26K libnss_turbo.so.2.0.0
2022-07-20 18:26:17 -04:00
Andrew Kelley
21064d9144 disable std lib test failing with self-hosted ReleaseSafe
I opened a corresponding issue #12178 which has the 0.10.0 milestone, so
this must be fixed before we release.
2022-07-20 12:50:58 -07:00
Cody Tapscott
de62bd0647 macho: Pass sections by pointer when slicing names
We were accidentally returning a pointer to stack memory, because these
arguments were passed by value. It's just an accident that stage 1 was
passing these by reference, so things were alright until stage 3.
2022-07-20 03:45:29 -04:00
Andrew Kelley
aa1a06bf9b Autodoc: small polish on the html 2022-07-19 19:10:12 -07:00
Loris Cro
572f9a5602 Autodoc: add warning banner to html 2022-07-19 19:10:12 -07:00
Loris Cro
ad7bc57919 autodoc: fix rendering of function arguments 2022-07-19 19:10:12 -07:00
Loris Cro
8ec34eb046 autodoc: handle result location instructions 2022-07-19 19:10:12 -07:00
Loris Cro
947eff6e39 autodoc: handle special case of autodoc for std 2022-07-19 19:10:12 -07:00
Vallahor
fed9dcff24 autodoc: @as behavior in js 2022-07-19 19:10:12 -07:00
Vallahor
341431b15c autodoc: handling more values sections 2022-07-19 19:10:12 -07:00
Loris Cro
24a79426ec autodoc: update array analysis to new Zir 2022-07-19 19:10:12 -07:00
Vallahor
866bbb2e7a autodoc: fiedRef type rendering 2022-07-19 19:10:12 -07:00
Vallahor
e7476fd81c autodoc: handling refPath and fieldRef 2022-07-19 19:10:12 -07:00
Vallahor
81147dd101 autodoc: initial work in opaque_decl 2022-07-19 19:10:12 -07:00
Loris Cro
45e3b1a23d autodoc: remove type annotations from main.js 2022-07-19 19:10:12 -07:00
Vallahor
02bd5fe93a autodoc: experiment get line info 2022-07-19 19:10:12 -07:00
Loris Cro
d2baf404a5 autodoc: enabled packages 2022-07-19 19:10:12 -07:00
Loris Cro
a5e7b0e4db autodoc: restore support for zig version + cleanup & init work to fix packages 2022-07-19 19:10:12 -07:00
Vallahor
f189e46b8e autodoc: add some tags 2022-07-19 19:10:12 -07:00
Vallahor
f13db1ce18 autodoc: add cmpxchg_strong/weak 2022-07-19 19:10:12 -07:00
Vallahor
5e52666c83 autodoc: add some builtin functions and float128 2022-07-19 19:10:12 -07:00
Vallahor
9613aca417 autodoc: refactoring binOp 2022-07-19 19:10:12 -07:00
Loris Cro
918475e2e2 autodoc: new design for function list 2022-07-19 19:10:12 -07:00
Vallahor
dd9a018185 fix: slice_start, slice_end and slice_sentinel typeRef are now showing the slice type 2022-07-19 19:10:12 -07:00
Vallahor
1f5df0e034 add: slice_start, slice_end and slice_sentinel 2022-07-19 19:10:12 -07:00
Vallahor
b9fa91002e add: builtins functions 2022-07-19 19:10:12 -07:00
Vallahor
a0ec87be71 add: merge_error_sets and @alignOf() need a checkin to confirm it's fully work 2022-07-19 19:10:12 -07:00
Loris Cro
d858f26139 autodoc: fixes to generic fn support plus linking support 2022-07-19 19:10:12 -07:00
Loris Cro
413cfd4066 autodoc: init generic function support 2022-07-19 19:10:12 -07:00
Vallahor
f07534069d WIP: switch_block tag 2022-07-19 19:10:12 -07:00
Vallahor
9be9e4d02c add: @enumToInt() WIP 2022-07-19 19:10:12 -07:00