Commit Graph

44 Commits (9781342042798f7a75f3f7233872bae0fbde3ecc)

Author SHA1 Message Date
Jakub Konka 8ffa8ed9a8 Expose full llvm intrinsic 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
Andrew Kelley a32d3a85d2 rework self-hosted compiler for incremental builds
* introduce std.ArrayListUnmanaged for when you have the allocator
   stored elsewhere
 * move std.heap.ArenaAllocator implementation to its own file. extract
   the main state into std.heap.ArenaAllocator.State, which can be
   stored as an alternative to storing the entire ArenaAllocator, saving
   24 bytes per ArenaAllocator on 64 bit targets.
 * std.LinkedList.Node pointer field now defaults to being null
   initialized.
 * Rework self-hosted compiler Package API
 * Delete almost all the bitrotted self-hosted compiler code. The only bit
   rotted code left is in main.zig and compilation.zig
 * Add call instruction to ZIR
 * self-hosted compiler ir API and link API are reworked to support
   a long-running compiler that incrementally updates declarations
 * Introduce the concept of scopes to ZIR semantic analysis
 * ZIR text format supports referencing named decls that are declared
   later in the file
 * Figure out how memory management works for the long-running compiler
   and incremental compilation. The main roots are top level
   declarations. There is a table of decls. The key is a cryptographic
   hash of the fully qualified decl name. Each decl has an arena
   allocator where all of the memory related to that decl is stored.
   Each code block has its own arena allocator for the lifetime of
   the block. Values that want to survive when going out of scope in
   a block must get copied into the outer block. Finally, values must
   get copied into the Decl arena to be long-lived.
 * Delete the unused MemoryCell struct. Instead, comptime pointers are
   based on references to Decl structs.
 * Figure out how caching works. Each Decl will store a set of other
   Decls which must be recompiled when it changes.

This branch is still work-in-progress; this commit breaks the build.
2020-05-10 02:05:54 -04:00
Tadeo Kondrak 350b2adacd
std.meta.IntType -> std.meta.Int 2020-04-28 19:11:31 -06: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
Andrew Kelley 18f1fef142
update standard library to new I/O streams API 2020-03-10 18:44:30 -04:00
Andrew Kelley 4616af0ca4
introduce operating system version ranges as part of the target
* re-introduce `std.build.Target` which is distinct from `std.Target`.
   `std.build.Target` wraps `std.Target` so that it can be annotated as
   "the native target" or an explicitly specified target.
 * `std.Target.Os` is moved to `std.Target.Os.Tag`. The former is now a
   struct which has the tag as well as version range information.
 * `std.elf` gains some more ELF header constants.
 * `std.Target.parse` gains the ability to parse operating system
   version ranges as well as glibc version.
 * Added `std.Target.isGnuLibC()`.
 * self-hosted dynamic linker detection and glibc version detection.
   This also adds the improved logic using `/usr/bin/env` rather than
   invoking the system C compiler to find the dynamic linker when zig
   is statically linked. Related: #2084
   Note: this `/usr/bin/env` code is work-in-progress.
 * `-target-glibc` CLI option is removed in favor of the new `-target`
   syntax. Example: `-target x86_64-linux-gnu.2.27`

closes #1907
2020-02-28 14:51:53 -05:00
Vexu 538d9a5dd8
remove uses of `@ArgType` and `@IntType` 2020-02-24 23:39:03 +02:00
xackus 783e8ad031 remove @bytesToSlice, @sliceToBytes from std lib 2020-02-21 19:46:53 +01:00
Felix (xq) Queißner cf67d30cdc Makes ArenaAllocator.deinit() not require a mutable reference. 2020-02-13 16:19:34 -05:00
Benjamin Feng 4d134a01f5 Move debug.global_allocator to testing.allocator 2020-01-29 12:21:29 -06:00
daurnimator d7333d8798 std: fix LoggingAllocator, add simple test 2020-01-09 13:34:46 -05:00
Andrew Kelley cd4d638d10
Merge pull request #3830 from fengb/wasm-page-allocator
WasmPageAllocator
2019-12-10 10:58:50 -05:00
Benjamin Feng 608d36ad8c Rewrite WasmPageAllocator tests to be less flaky on environment 2019-12-08 21:22:07 -06:00
Benjamin Feng e91522b875 Add back comptime check for wasm 2019-12-06 17:27:11 -06:00
Benjamin Feng 5a004ed834 Actually use `const conventional` as the comment indicates 2019-12-06 15:16:07 -06:00
Benjamin Feng eb495d934b Add WasmPageAllocator tests 2019-12-05 21:54:57 -06:00
Benjamin Feng f2b0dbea74 Resolve tests to work with or skip WasmPageAllocator 2019-12-05 19:31:49 -06:00
Benjamin Feng 694616adb5 Standardize around bigger slices 2019-12-05 18:43:51 -06:00
Benjamin Feng 7d1c4fe4dc Switch bitmask to enums 2019-12-05 18:01:49 -06:00
Benjamin Feng 30da6d49f4 Fix freeing memory across bounds 2019-12-04 22:43:02 -06:00
Benjamin Feng 86ae75363e Strip out an unnecessary memset 2019-12-04 21:41:01 -06:00
Benjamin Feng 5784985bb8 Use raw PackedIo to shave ~150b 2019-12-04 21:22:36 -06:00
Benjamin Feng a910a6c871 Rejuggle how offsets are calculated 2019-12-04 18:12:25 -06:00
Benjamin Feng a6f838aab2 Remove redundant alloc 2019-12-04 00:10:37 -06:00
Benjamin Feng 01e73bba8d Tighten recycled search 2019-12-04 00:08:09 -06:00
Benjamin Feng baffaf7986 Extract setBits 2019-12-04 00:07:52 -06:00
Benjamin Feng b33211ed51 Implement block-based skipping 2019-12-03 17:24:50 -06:00
Benjamin Feng 45e0441278 Fix bugs 2019-12-02 22:04:09 -06:00
Andrew Kelley ad214c7aa0
bring your own OS layer in the std lib
closes #3784
2019-12-02 15:02:17 -05:00
Benjamin Feng f32555aa08 Work around __heap_base for now 2019-12-02 09:59:20 -06:00
Benjamin Feng ba38a6d122 Get stuff vaguely working 2019-12-02 09:59:20 -06:00
Benjamin Feng eb1628b033 Initialize memory segments 2019-12-02 09:59:20 -06:00
Benjamin Feng eff926b454 Brain dump new wasm allocator 2019-12-02 09:59:20 -06:00
Andrew Kelley 4261fa3c49
move logic to the appropriate layers; add new compile error 2019-11-25 18:46:17 -05:00
Andrew Kelley 659c1bdeee
Merge branch 'wasi-run-tests' of https://github.com/fengb/zig into fengb-wasi-run-tests 2019-11-25 17:53:26 -05:00
Andrew Kelley cb38bd0a14
rename std.heap.direct_allocator to std.heap.page_allocator
std.heap.direct_allocator is still available for now but it is marked
deprecated.
2019-11-25 17:25:06 -05:00
Benjamin Feng 747529e96b Use wasm_allocator 2019-11-19 00:31:40 -06:00
Andrew Kelley aa0daea541
update more of the std lib to use `@as` 2019-11-08 15:57:25 -05:00
Andrew Kelley e0db54e89d
update the codebase to use `@as` 2019-11-08 15:57:24 -05:00
Andrew Kelley 6ee3cabe5c
allow type coercion from *[0]T to E![]const T
This is an unambiguous, safe cast.
2019-11-06 20:44:15 -05:00
Andrew Kelley 60cd11bd4b
get rid of std.os.foo.is_the_target
It had the downside of running all the comptime blocks and resolving
all the usingnamespaces of each system, when just trying to discover if
the current system is a particular one.

For Darwin, where it's nice to use `std.Target.current.isDarwin()`, this
demonstrates the utility that #425 would provide.
2019-10-24 01:14:52 -04:00
Vexu 2550cb4638 remove pub syntax for container fields 2019-10-21 23:04:19 -04:00
Andrew Kelley ed36dbbd9c
mv std/ lib/
that's all this commit does. further commits will fix cli flags and
such.

see #2221
2019-09-25 23:35:41 -04:00