Commit Graph

232 Commits

Author SHA1 Message Date
Vexu 3734881577 add error for unused/duplicate block labels 2020-08-13 01:13:17 +03:00
Andrew Kelley 20510d209b GeneralPurposeAllocator: use std.log instead of std.debug.print
`std.builtin.StackTrace` gains a `format` function.

GeneralPurposeAllocator uses `std.log.err` instead of directly printing
to stderr. Some errors are recoverable.

The test runner is modified to fail the test run if any log messages of
"err" or worse severity are encountered.

self-hosted is modified to always print log messages of "err" severity
or worse even if they have not been explicitly enabled.

This makes GeneralPurposeAllocator available on the freestanding target.
2020-08-11 02:01:32 -04:00
Andrew Kelley 0347df82e8 improvements & fixes for general purpose allocator integration
* std.Mutex API is improved to not have init() deinit(). This API is
   designed to support static initialization and does not require any
   resource cleanup. This also happens to work around some kind of
   stage1 behavior that wasn't letting the new allocator mutex code
   get compiled.
 * the general purpose allocator now returns a bool from deinit()
   which tells if there were any leaks. This value is used by the test
   runner to fail the tests if there are any.
 * self-hosted compiler is updated to use the general purpose allocator
   when not linking against libc.
2020-08-07 23:26:58 -07:00
Andrew Kelley cc17f84ccc std: introduce GeneralPurposeAllocator
`std.GeneralPurposeAllocator` is now available. It is a function that
takes a configuration struct (with default field values) and returns an
allocator. There is a detailed description of this allocator in the
doc comments at the top of the new file.

The main feature of this allocator is that it is *safe*. It
prevents double-free, use-after-free, and detects leaks.

Some deprecation compile errors are removed.

The Allocator interface gains `old_align` as a new parameter to
`resizeFn`. This is useful to quickly look up allocations.

`std.heap.page_allocator` is improved to use mmap address hints to avoid
obtaining the same virtual address pages when unmapping and mapping
pages. The new general purpose allocator uses the page allocator as its
backing allocator by default.

`std.testing.allocator` is replaced with usage of this new allocator,
which does leak checking, and so the LeakCheckAllocator is retired.

stage1 is improved so that the `@typeInfo` of a pointer has a lazy value
for the alignment of the child type, to avoid false dependency loops
when dealing with pointers to async function frames.

The `std.mem.Allocator` interface is refactored to be in its own file.

`std.Mutex` now exposes the dummy mutex with `std.Mutex.Dummy`.

This allocator is great for debug mode, however it needs some work to
have better performance in release modes. The next step will be setting
up a series of tests in ziglang/gotta-go-fast and then making
improvements to the implementation.
2020-08-07 22:45:45 -07:00
Andrew Kelley d159ba9295 zig fmt 2020-08-04 23:04:20 -07:00
Vexu 1f8f434b9c compiler_rt: add floatditf 2020-07-29 18:03:44 +03:00
Vexu e85fe13e44 run zig fmt on std lib and self hosted 2020-07-11 20:41:19 +03:00
Andrew Kelley bf56cdd9ed start to make test runner aware of logging
by default the test runner will only print logs with "warning" or
higher. this can be configured via the std.testing API.

See #5738 for future plans
2020-07-08 21:01:13 -07:00
xackus b8553b4813 compiler-rt: fix bugs uncovered by previous commit 2020-07-05 20:44:08 +02:00
Alexandros Naskos 50b70bd77f @asyncCall now requires an argument tuple 2020-06-24 14:07:39 +03:00
Veikka Tuominen eb687810cf Merge pull request #4976 from xackus/std-lib-docs
std lib docs: fix null and int values
2020-06-01 14:50:05 +03:00
Vexu d061e5854a Merge pull request #5020 from jinroh/docs/search-perf
docs: search perf
2020-05-16 16:43:41 +03:00
Vexu 08e2e690d7 Merge pull request #5275 from strangebug/docs-markdown-links
Add support for external links and URL to markdown parser.
2020-05-12 15:35:50 +03:00
StrangeBug 54088fe6e1 Add support for external links and URL to markdown parser. 2020-05-05 18:09:32 +02:00
Tadeo Kondrak 6745a6f6f6 zig fmt 2020-05-05 09:38:02 -06:00
Tadeo Kondrak 350b2adacd std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06:00
Tadeo Kondrak f977155fdb @Vector -> std.meta.Vector 2020-04-28 00:47:13 -06:00
Timon Kruiper c829f2f7b7 Add mips support to standard library 2020-04-24 15:28:55 -04:00
Pierre Guilleminot f31e0d9834 docs: use String.repeat for dom templates 2020-04-13 14:03:44 +02:00
Pierre Guilleminot 297452cf67 improve search perf: trim search results 2020-04-12 23:17:20 +02:00
Pierre Guilleminot f76d59ef76 improve search perf: batching dom list mutations 2020-04-12 23:13:57 +02:00
xackus 721c76b53c refactor common pattern into a function 2020-04-07 23:37:33 +02:00
xackus bf46117f13 std lib docs: fix null and int values 2020-04-07 23:37:01 +02:00
LemonBoy a0b73c9f02 compiler-rt: Separate max size allowed for load/store and CAS
The v6m ISA has no way to express a CAS loop natively without turning
off the interrupts or using the kernel cmpxchg harness.

On such a platform the user has to provide a few __sync_* builtins to
satisfy the linker.
2020-04-06 12:52:53 -04:00
daurnimator e9e43ed0d3 compiler_rt/atomics: be consistent with const value 2020-04-05 14:08:25 +10:00
daurnimator f947444362 Tidy up compiler_rt/atomics 2020-04-05 14:06:12 +10:00
Andrew Kelley e89c42655c Merge pull request #4868 from xackus/new-arraylist-api
new ArrayList API
2020-04-03 22:31:15 -04:00
Andrew Kelley e03cbb117e compiler-rt: don't forget to export these functions 2020-04-03 16:07:32 -04:00
LemonBoy ed69821f5b compiler-rt: Add the __atomic family of builtins
The implementation was checked against a few files using std::atomic and
compiled using zig c++.

Closes #4887
2020-04-03 16:04:44 -04:00
xackus 7a28c644aa new ArrayList API: fix everything else 2020-04-02 16:12:08 +02:00
Andrew Kelley d9d8c42426 remove unnecessary inline
works around a bug triggered by previous commit
2020-03-31 11:18:11 -04:00
Andrew Kelley 0e372ccff5 clean up the duplicate export logic for __clear_cache 2020-03-31 10:48:48 -04:00
LemonBoy e9c49f423d compiler-rt: More clear_cache implementations 2020-03-31 10:36:12 -04:00
daurnimator 63409cf422 std: linux syscall numbers are now an extensible enum 2020-03-31 10:16:20 -04:00
Andrew Kelley 83ff94b1cc compiler-rt: don't export __clear_cache when no impl available 2020-03-30 23:15:07 -04:00
Timon Kruiper f6f03cd90f compiler-rt: implement clear_cache for arm32-linux 2020-03-31 00:29:41 +02:00
Andrew Kelley 9e7ae06249 std lib API deprecations for the upcoming 0.6.0 release
See #3811
2020-03-30 14:23:22 -04:00
LemonBoy 1ef6f068f5 compiler-rt: Implement all the shift builtins
* Unify all the code paths with a generic function
* Add some EABI aliases

Closes #4853
2020-03-30 10:58:47 -04:00
LemonBoy 0512be227c compiler-rt: Fix __floatunditf
This builtin converts a u64 into a f128, not a u128 into a f128.

Fixes some weird-ass crashes that happened only on AArch64 systems.
2020-03-27 20:10:59 +01:00
LemonBoy cc774c603b compiler-rt: Add __divtf3 2020-03-24 18:08:53 +01:00
Andrew Kelley 39589cffe0 compiler-rt: fix __clear_cache on aarch64 darwin 2020-03-24 11:51:13 -04:00
Andrew Kelley 03013e5176 compiler-rt: aarch64 implementation of __clear_cache 2020-03-24 10:33:23 -04:00
Andrew Kelley 93c7fa105f Merge remote-tracking branch 'origin/llvm10'
LLVM 10 was released today
2020-03-24 09:57:09 -04:00
momumi 7aac21c6f5 allow _ separators in number literals (stage 1)
* Underscores `_` may be placed between two digits in a int/float literal
* Consecutive underscores are not allowed
* Fixed parsing bug in exponents of hexadecimal float literals.
  Exponents should always be base 10, but hex characters would be parsed
  inside the exponent and everything after them would be ignored. eg:
  `0x1.0p1ab1` would be parsed as `0x1.0p1`.
2020-03-15 12:38:35 +10:00
Andrew Kelley 656ba530d8 Merge remote-tracking branch 'origin/master' into llvm10 2020-03-13 15:17:53 -04:00
Andrew Kelley 2bff0dda79 fix regressions found by test suite 2020-03-10 20:22:30 -04:00
Andrew Kelley 3178807657 Merge remote-tracking branch 'origin/master' into llvm10 2020-03-04 15:35:46 -05:00
pfg e3b37fc9c1 Generated documentation mobile support 2020-03-04 10:47:21 -05:00
Andrew Kelley d1cb16aace Merge remote-tracking branch 'origin/master' into llvm10 2020-03-03 09:44:13 -05:00
xackus 00be934569 short std.builtin enum literals in std lib 2020-03-01 13:57:41 -05:00