Skip to content

Commit c12e169

Browse files
authored
Move StringPool to wasmtime-environ (#12562)
* Move `StringPool` to `wasmtime-environ` * Remove old location's `mod` declaration * always implement TryClone for hashbrown::DefaultHashBuilder
1 parent 755979d commit c12e169

5 files changed

Lines changed: 8 additions & 6 deletions

File tree

crates/core/src/alloc/try_clone.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ impl_try_clone_via_clone! {
104104
std::hash::RandomState
105105
}
106106

107-
#[cfg(not(feature = "std"))]
108107
impl_try_clone_via_clone! {
109108
hashbrown::DefaultHashBuilder
110109
}

crates/environ/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ mod ref_bits;
3636
mod scopevec;
3737
mod stack_map;
3838
mod stack_switching;
39+
mod string_pool;
3940
mod trap_encoding;
4041
mod tunables;
4142
mod types;
@@ -57,6 +58,7 @@ pub use crate::ref_bits::*;
5758
pub use crate::scopevec::ScopeVec;
5859
pub use crate::stack_map::*;
5960
pub use crate::stack_switching::*;
61+
pub use crate::string_pool::{Atom, StringPool};
6062
pub use crate::trap_encoding::*;
6163
pub use crate::tunables::*;
6264
pub use crate::types::*;

crates/wasmtime/src/runtime/string_pool.rs renamed to crates/environ/src/string_pool.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
//! Simple string interning.
22
3-
use crate::{error::OutOfMemory, prelude::*};
3+
use crate::{
4+
collections::{HashMap, String, Vec},
5+
error::OutOfMemory,
6+
prelude::*,
7+
};
48
use core::{fmt, mem, num::NonZeroU32};
59
use wasmtime_core::alloc::TryClone;
6-
use wasmtime_environ::collections::{HashMap, String, Vec};
710

811
/// A pool of interned strings.
912
///

crates/wasmtime/src/runtime.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ pub(crate) mod module;
4949
pub(crate) mod native_debug;
5050
pub(crate) mod resources;
5151
pub(crate) mod store;
52-
pub(crate) mod string_pool;
5352
pub(crate) mod trampoline;
5453
pub(crate) mod trap;
5554
pub(crate) mod type_registry;

crates/wasmtime/src/runtime/linker.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::error::OutOfMemory;
22
use crate::func::HostFunc;
33
use crate::instance::InstancePre;
4-
use crate::runtime::string_pool::{Atom, StringPool};
54
use crate::store::StoreOpaque;
65
use crate::{
76
AsContext, AsContextMut, Caller, Engine, Extern, ExternType, Func, FuncType, ImportType,
@@ -15,7 +14,7 @@ use core::marker;
1514
use core::mem::MaybeUninit;
1615
use log::warn;
1716
use wasmtime_environ::{
18-
PanicOnOom as _,
17+
Atom, PanicOnOom as _, StringPool,
1918
collections::{HashMap, TryClone},
2019
};
2120

0 commit comments

Comments
 (0)