Commit graph

7969 commits

Author SHA1 Message Date
Andrew Kelley
376242e586
Merge pull request #17161 from tiehuis/vectorize-index-of-scalar
std.mem: add vectorized indexOfScalarPos and indexOfSentinel
2023-10-01 00:07:57 -07:00
Lucas Santos
303181901b Improve (Unmanaged)ArrayList.insert
(Unmanaged)ArrayList.insert has the same inefficiency as the old insertSlice. With the new addManyAt, the solution is trivial.
Also improves the test "growing memory preserves contents". In the previous implementation, if any changes were made to the ArrayList memory growth policy (function growMemory), the list could end up with enough capacity to not trigger a memory growth, defeating the purpose of the test. The new implementation more robustly triggers a memory growth.
2023-09-30 16:17:22 -07:00
Ryan Zezeski
54ad5f31c6 solaris: hard-code ABI and dynamic linker
Solaris/illumos is multi-lib, so you can't rely on an arbitrary
executable to give you the correct dynamic linker. Besides, it's
always the same path.
2023-09-30 11:38:56 -06:00
Ryan Zezeski
68bcd7ddd4 solaris: load CA certs file 2023-09-30 11:38:56 -06:00
Ryan Zezeski
c17ebdca6a solaris: fix path component max 2023-09-30 11:38:56 -06:00
Ryan Zezeski
f0724229d6 solaris: add missing registers 2023-09-30 11:38:56 -06:00
Marc Tiehuis
08635f08a9 fix indexOfSentinel alignment for types larger than 1 byte 2023-09-30 22:15:47 +13:00
Marc Tiehuis
5b5da0ef8c std.mem: check backend vector support for indexOfSentinel/indexOfScalarPos 2023-09-30 21:22:12 +13:00
Marc Tiehuis
cd766513fe std.mem: add vectorized indexOfScalarPos and indexOfSentinel
These are an order of magnitude quicker than the previous
implementations:

A relative comparison of each, measuring scanning a 1G file.

    Reading 1G (1.0000000009313226GiB)

             std.mem.sliceTo: 281.232ms
          vectorized.sliceTo: 24.769ms
                      strlen: 24.291ms

           std.indexOfScalar: 229.016ms
    vectorized.indexOfScalar: 24.685ms
                      memchr: 24.958ms
2023-09-30 21:19:43 +13:00
Andrew Kelley
101df768a0
Merge pull request #17312 from LucasSantos91/master
Fix inefficiency with ArrayList.insertSlice
2023-09-29 18:15:24 -07:00
Krzysztof Wolicki
19a82ffdba
Add include_extensions to InstallDir Options (#17300)
closes #16687
2023-09-29 18:50:37 -04:00
Andrew Kelley
9013970861 std.ArrayList: fixups for the previous commit
* Move `computeBetterCapacity` to the bottom so that `pub` stuff shows
   up first.
 * Rename `computeBetterCapacity` to `growCapacity`. Every function
   implicitly computes something; that word is always redundant in a
   function name. "better" is vague. Better in what way? Instead we
   describe what is actually happening. "grow".
 * Improve doc comments to be very explicit about when element pointers
   are invalidated or not.
 * Rename `addManyAtIndex` to `addManyAt`. The parameter is named
   `index`; that is enough.
 * Extract some duplicated code into `addManyAtAssumeCapacity` and make
   it `pub`.
 * Since I audited every line of code for correctness, I changed the
   style to my personal preference.
 * Avoid a redundant `@memset` to `undefined` - memory allocation does
   that already.
 * Fixed comment giving the wrong reason for not calling
   `ensureTotalCapacity`.
2023-09-29 13:42:38 -07:00
Lucas Santos
9d765b5ab5 std.ArrayList: insertSlice avoids extra memcpy
Includes a more robust implementation of replaceRange, which updates the
ArrayListUnmanaged if state changes in the managed part of the code
before returning an error.

Co-authored-by: Andrew Kelley <andrew@ziglang.org>
2023-09-29 12:52:40 -07:00
Krzysztof Wolicki
e919fbea9f
Step.Run: fix assert of the wrong value (#17303)
closes #16866
2023-09-29 14:14:42 -04:00
Adam Goertz
2f0e5b00b0 Allow only relative paths.
This commit makes the following changes:
* Disallow file:/// URIs
* Allow only relative paths in the .path field of build.zig.zon
* Remote now-unneeded shlwapi dependency
2023-09-29 00:32:43 -07:00
Adam Goertz
b3cad98534 Support file:/// URIs and relative paths 2023-09-29 00:32:43 -07:00
Philipp Lühmann
ed19ebc360
std.math.big.int.Const.order 0 == -0 (#17299) 2023-09-29 18:09:47 +13:00
Luis Cáceres
acac685621
std.Build.ConfigHeader: override include guard option for blank style (#17310)
This commit adds an option to allow for overriding the default header guard that is generated from the output
file path.
2023-09-28 19:30:42 -04:00
Andrew Kelley
077994abb6
Merge pull request #17318 from gh-fork-dump/linux-5.6-cachestat
Update Linux syscalls for 5.5 and add a wrapper for `cachestat`
2023-09-28 16:27:28 -07:00
Christofer Nolander
c4ad6be002
Allow empty enum to be used in EnumSet/EnumMap
Moves the check for empty fields before any access to those fields.
2023-09-28 21:48:39 +00:00
Karl Seguin
599641357c
std.mem: use for loop instead of while in indexOf* to reduce bound checking 2023-09-28 15:40:08 +00:00
Jonathan Marler
e0ef61d46d simplify ContainerDeclarations grammar rule
Noticed this grammar rule could be simplified using a repeating sequence
rather than recursion.
2023-09-28 14:18:54 +03:00
Emil Lerch
fcca3cd1a3
std.http: introduce options to http client to allow for raw uris
Addresses #17015 by introducing a new startWithOptions. The only option is currently is a flag
to use the provided URI as is, without modification when passed to the server. Normally, this
is not needed nor desired. However, some REST APIs may have requirements that cannot be satisfied
with the default handling.
2023-09-28 14:16:39 +03:00
Jonathan Marler
18f1db134c docs: remove unnecessary nesting in grammar
noticed this extra level of nesting in the Decl grammar that looks
unnecssary.
2023-09-28 13:58:14 +03:00
Stephen Gregoratto
bc0bf4e97a Linux: Add cachestat wrapper.
Can be tested using this program I whipped up:
https://gist.github.com/The-King-of-Toasters/aee448f5975c50f735fd1946794574f7
2023-09-28 18:58:05 +10:00
Stephen Gregoratto
5f456b2b97 Update Linux syscalls for kernel 5.5
The latest addition is `cachestat`, which provides more detailed
information for paged files.
2023-09-28 18:58:05 +10:00
antlilja
8191199951 fmt: add rewrite from @fabs to @abs 2023-09-27 11:24:45 -07:00
antlilja
bcf4a13913 Remove @fabs, fabs and absCast/Int from std lib
Replaces occurences of @fabs absCast and absInt with new @abs builtin.
Also removes the std.math.fabs alias from math.zig.
2023-09-27 11:24:28 -07:00
Kai Jellinghaus
d1e39b6914 Add new fields to io_sqring_offsets & io_cqring_offsets
`user_addr`s were introduced in `03d89a2` ([github link](03d89a2de2) which was shipped in v6.5
`flags` was introduced even earlier
2023-09-26 18:16:36 -07:00
Jay Petacat
37398ed2a5 std: Reactivate skipped tests w.r.t. llvm/llvm-project#55522 2023-09-27 01:37:25 +03:00
LinuxUserGD
ceaae42e90 Add '--compress-debug-sections=zstd' 2023-09-26 14:18:01 -07:00
Chris Burgess
1c726bcb32
std.http: add identity to content encodings (#16493)
Some servers will respond with the identity encoding, meaning no
encoding, especially when responding to range-get requests. Adding the
identity encoding stops the header parser from failing when it
encounters this.
2023-09-26 17:16:40 -04:00
Andrew Kelley
28ac9f8b70
Merge pull request #17253 from ziglang/MultiArrayList-0bit-struct
std.MultiArrayList: add test coverage for 0-bit structs
2023-09-25 02:33:32 -07:00
Jan Weidner
c8ba5839f7
std.http.Client: add note about resource management 2023-09-25 12:17:11 +03:00
Andrew Kelley
cc69315f03 std.MultiArrayList: add test coverage for 0-bit structs
closes #10618
solved by #17172
2023-09-24 15:49:56 -07:00
Andrew Kelley
df5f0517b3
Merge pull request #17205 from mlugg/rls-ref
compiler: preserve result type information through address-of operator
2023-09-24 15:19:48 -07:00
antlilja
8eff0a0a66 Support non zig dependencies
Dependencies no longer require a build.zig file.

Adds path function to Dependency struct which
returns a LazyPath into a dependency.
2023-09-24 02:47:21 +01:00
Garrett Beck
8b78df403f Allow Step.TranslateC to not link libc 2023-09-23 17:41:11 -07:00
mlugg
09a57583a4
compiler: preserve result type information through address-of operator
This commit introduces the new `ref_coerced_ty` result type into AstGen.
This represents a expression which we want to treat as an lvalue, and
the pointer will be coerced to a given type.

This change gives known result types to many expressions, in particular
struct and array initializations. This allows certain casts to work
which previously required explicitly specifying types via `@as`. It also
eliminates our dependence on anonymous struct types for expressions of
the form `&.{ ... }` - this paves the way for #16865, and also results
in less Sema magic happening for such initializations, also leading to
potentially better runtime code.

As part of these changes, this commit also implements #17194 by
disallowing RLS on explicitly-typed struct and array initializations.
Apologies for linking these changes - it seemed rather pointless to try
and separate them, since they both make big changes to struct and array
initializations in AstGen. The rationale for this change can be found in
the proposal - in essence, performing RLS whilst maintaining the
semantics of the intermediary type is a very difficult problem to solve.

This allowed the problematic `coerce_result_ptr` ZIR instruction to be
completely eliminated, which in turn also simplified the logic for
inferred allocations in Sema - thanks to this, we almost break even on
line count!

In doing this, the ZIR instructions surrounding these initializations
have been restructured - some have been added and removed, and others
renamed for clarity (and their semantics changed slightly). In order to
optimize ZIR tag count, the `struct_init_anon_ref` and
`array_init_anon_ref` instructions have been removed in favour of using
`ref` on a standard anonymous value initialization, since these
instructions are now virtually never used.

Lastly, it's worth noting that this commit introduces a slightly strange
source of generic poison types: in the expression `@as(*anyopaque, &x)`,
the sub-expression `x` has a generic poison result type, despite no
generic code being involved. This turns out to be a logical choice,
because we don't know the result type for `x`, and the generic poison
type represents precisely this case, providing the semantics we need.

Resolves: #16512
Resolves: #17194
2023-09-23 22:01:08 +01:00
travisstaloch
759b0fe00a
std.testing: expectEqualDeep() - support self-referential structs 2023-09-23 20:25:57 +00:00
kcbanner
53d1282f0c build: add --skip-oom-steps
Specifying this argument causes steps that specify a max_rss that exceeds the
total max_rss value of the runner to be skipped, instead of failing.
2023-09-22 15:08:51 -07:00
Aven Bross
6c54ed73f7 Added basic support for wasm32-emscripten target 2023-09-22 12:49:03 -07:00
Andrew Kelley
3fc7413574
Merge pull request #17069 from squeek502/resinator
Add a `.rc` -> `.res` compiler to the Zig compiler
2023-09-22 12:18:50 -07:00
Andrew Kelley
e36ec537f2 nvptx: omit sm_90a from the CPU target features for now
There seems to be an LLVM bug with this feature. Since it's new, let's
collect more information before adding it.
2023-09-19 09:37:53 -07:00
Andrew Kelley
5b8af7a2a9 skip regressed LLVM 17 std lib test on powerpc
Tracked by #16951
2023-09-19 09:37:53 -07:00
Jacob Young
401de6dd2f compiler_rt: fix arm hard-float f16 abi
Closes #16848
2023-09-19 09:37:53 -07:00
Jacob Young
d7daf7c203 start: workaround for LLVM 17 regression
Tracking issue #16799
2023-09-19 09:37:32 -07:00
Andrew Kelley
62a12e0631 LLVM 17 std lib updates and fixes
* some manual fixes to generated CPU features code. in the future it
   would be nice to make the script do those automatically. I suspect
   the sm_90a thing is a bug in LLVM.
 * add liteos to various target OS switches. I know nothing about this
   OS; someone will need to work specifically on support for this OS
   when the time comes to support it properly in zig.
 * while waiting for the compiler, I went ahead and made more
   conservative choices about when to use `inline` in std/Target.zig
2023-09-19 09:37:31 -07:00
Andrew Kelley
3ed40b1140 update CPU features to LLVM 17
release/17.x branch, commit 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8
2023-09-19 09:37:31 -07:00
Andrew Kelley
cd8234c3ba update for LLVM 17 new target data
New OSs:
* UEFI
* LiteOS

New ABI:
* OpenHOS

Also update the LLD driver API wrappers.
2023-09-19 09:37:30 -07:00