aboutsummaryrefslogtreecommitdiff
path: root/lib/std/array_list.zig
AgeCommit message (Collapse)Author
2020-06-02pass allocator to self.resize() in appendNTimes()Jesse Rudolph
2020-05-26Remove unimplemented `init` call from ArrayListUnmanaged.Walter Mays
2020-05-13self-hosted: fix compile errors, except for codegen.zigAndrew Kelley
2020-05-12self-hosted: rework the memory layout of ir.Module and related typesAndrew Kelley
* add TypedValue.Managed which represents a Type, a Value, and some kind of memory management strategy. * introduce an analysis queue * flesh out how incremental compilation works with respect to exports * ir.text.Module is only capable of one error message during parsing * link.zig no longer has a decl table map and instead has structs that exist directly on ir.Module.Decl and ir.Module.Export * implement primitive .text block allocation * implement linker code for updating Decls and Exports * implement null Type Some supporting std lib changes: * add std.ArrayList.appendSliceAssumeCapacity * add std.fs.File.copyRange and copyRangeAll * fix std.HashMap having modification safety on in ReleaseSmall builds * add std.HashMap.putAssumeCapacityNoClobber
2020-05-10rework self-hosted compiler for incremental buildsAndrew Kelley
* 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-04-15translate-c cleanup and zig fmtVexu
2020-04-11ArrayList: remove old (before span) APIxackus
2020-04-02new ArrayList API: fix ArrayList.shrinkxackus
2020-04-02new ArrayList API, fix enough std lib to testxackus
2020-04-01fixups and revert a few thingsAndrew Kelley
2020-04-01std: add std.ArrayList(u8).outStream()daurnimator
2020-03-06fixups & make some API decisionsAndrew Kelley
Removed: std.io.InStream.readUntilDelimiterBuffer Deprecated: std.ArrayList.toSlice std.ArrayList.toSliceConst std.ArrayList.at std.ArrayList.ptrAt std.ArrayList.setOrError std.ArrayList.set std.ArrayList.swapRemoveOrError std.Buffer.toSlice std.Buffer.toSliceConst std.io.InStream.readFull => std.io.InStream.readAll std.io.InStream.readAllBuffer New: std.ArrayList.span std.ArrayList.expandToCapacity std.Buffer.span std.io.InStream.readUntilDelimiterArrayList
2020-03-06std: add ArrayList.eql for parity with std.Bufferdaurnimator
2020-03-06std: add .startsWith and .endsWith to std.ArrayListdaurnimator
2020-02-19Add an appendValues method to ArrayList to append a value n times. (#4460)Bas
2020-02-12Switch a bunch of FBA to use testing.allocatorBenjamin Feng
2020-01-29Promoted "leak_count_allocator" to the main testing.allocatorBenjamin Feng
2020-01-29Create leak_count_allocatorBenjamin Feng
2020-01-29Move debug.global_allocator to testing.allocatorBenjamin Feng
2019-12-29ArrayList: ptrAt function returns pointer to item at given indexBenoit Giannangeli
2019-12-10remove iterator API from std.ArrayListAndrew Kelley
This is not a meaningful abstraction. Use a for loop on the result of `toSlice` or `toSliceConst`. An iterator can be implemented on top of ArrayList by applications which want additional functionality, such as removing elements while iterating. Closes #3037.
2019-12-10Replace @typeOf with @TypeOf in all zig sourceRobin Voetter
This change was mostly made with `zig fmt` and this also modified some whitespace. Note that in some files, `zig fmt` produced incorrect code, so the change was made manually.
2019-12-01Merge remote-tracking branch 'origin/master' into remove-array-type-coercionAndrew Kelley
2019-11-27Merge pull request #3769 from MCRusher/initcapacity-for-buffer-arraylistAndrew Kelley
Add initCapacity for buffer & arraylist
2019-11-27remove type coercion from array values to referencesAndrew Kelley
* Implements #3768. This is a sweeping breaking change that requires many (trivial) edits to Zig source code. Array values no longer coerced to slices; however one may use `&` to obtain a reference to an array value, which may then be coerced to a slice. * Adds `IrInstruction::dump`, for debugging purposes. It's useful to call to inspect the instruction when debugging Zig IR. * Fixes bugs with result location semantics. See the new behavior test cases, and compile error test cases. * Fixes bugs with `@typeInfo` not properly resolving const values. * Behavior tests are passing but std lib tests are not yet. There is more work to do before merging this branch.
2019-11-25zig fmtAndrew Kelley
2019-11-23Added initCapacity and relevant testMCRusher
Added ArrayList.initCapcity() as a way to preallocate a block of memory to reduce future allocations. Added a test "std.ArrayList.initCapacity" that ensures initCapacity adds no elements and increases capacity by at least the requested amount
2019-11-08update the codebase to use `@as`Andrew Kelley
2019-10-28Add some documentation for standard library things. (#3540)Nathan Michaels
* Add some documentation for standard library things. Added a bunch of descriptions for array_list. Added some usage notes for failing_allocator. Documented some of mem.Allocator.
2019-09-25mv std/ lib/Andrew Kelley
that's all this commit does. further commits will fix cli flags and such. see #2221