Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Replace all memory allocations with fallible allocations and swap the… #29

Merged
merged 23 commits into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a31413e
Replace all memory allocations with fallible allocations and swap the…
ahomescu Feb 4, 2020
881affe
Add comment on alignment requirements
ahomescu Feb 4, 2020
0f4179d
Remove casts for FREE macro calls
ahomescu Feb 5, 2020
0f45eea
Add MALLOC![T; N] form of MALLOC macro that allocates arrays of a giv…
ahomescu Feb 5, 2020
fbfd002
Add MALLOC!(@T) form that allocates a single object of the given type
ahomescu Feb 5, 2020
5b429c0
Replace some more raw MALLOCs with the array form
ahomescu Feb 5, 2020
faf0905
Add type-safe version of REALLOC macro that uses Layout
ahomescu Feb 5, 2020
48c2fbb
Replace direct calls to allocation functions with calls to MALLOC/FRE…
ahomescu Feb 5, 2020
101112a
Remove allocator_api feature from runtests.rs
ahomescu Feb 5, 2020
e8a3100
Add a TODO on removing the boxes inside the hash maps
ahomescu Feb 6, 2020
61777a9
Merge branch 'master' into swap_runtests_alloc
ahomescu Feb 6, 2020
7f85078
Use the INIT_DATA_BUF_SIZE const instead of the numeric value when al…
ahomescu Feb 6, 2020
cd6b377
Use a few more consts instead of literals in calls to MALLOC
ahomescu Feb 6, 2020
51f3925
Replace one literal with const in REALLOC macro use
ahomescu Feb 6, 2020
4bce612
Directly initialize m_tempPool and m_temp2Pool as members of parser
ahomescu Feb 6, 2020
98552df
Merge branch 'master' into swap_runtests_alloc
ahomescu Feb 6, 2020
7f0610f
Merge branch 'master' into swap_runtests_alloc
ahomescu Feb 6, 2020
32a2248
Remove OldEncoding structure
ahomescu Feb 6, 2020
f12979b
Use unimplemented! to abort if the user passes in a custom memory all…
ahomescu Feb 6, 2020
26ffcec
Reduce the number of lookups in hash_insert! by folding the contains_…
ahomescu Feb 6, 2020
19bceea
Revert "Remove OldEncoding structure"
ahomescu Feb 7, 2020
6336948
Revert "Revert "Remove OldEncoding structure""
ahomescu Feb 7, 2020
c86e9ee
Merge branch 'master' into swap_runtests_alloc
ahomescu Feb 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ harness = false

[dependencies]
libc = "0.2"
alloc-wg = "0.7"
fallible_collections = "0.1.0"
wchar = { path = "deps/wchar", optional = true }
bencher = "0.1"

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#![feature(main)]
#![feature(const_in_array_repeat_expressions)]
#![feature(ptr_wrapping_offset_from)]
#![feature(try_reserve)]
#![feature(alloc_layout_extra)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we want to not add nightly features?

If we do add them, be sure to update #18

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading rust-lang/rust#55724 (comment) makes me think they'll stabilize more of Layout soon. There's also been some recent discussion on stabilizing try_reserve.

Copy link
Contributor Author

@ahomescu ahomescu Feb 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One alternative Stephen and I were discussing earlier is to have a nightly or fallible feature that conditionally enables fallible allocation, and fall back to panics if building for stable Rust. We really, really need the nightly features for runtests, but could allow panics outside of that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized something else: alloc_layout_extra is temporary, since once we replace all pointers with slices/boxes/etc we won't need to manually allocate any memory, so that feature will go away. We'll still need try_reserve, but we can enable that conditionally.


#[cfg(all(feature = "unicode_wchar_t", not(target_os = "windows")))]
compile_error!("Feature \"unicode_wchar_t\" is only supported on windows");
Expand Down
Loading