mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-13 00:40:22 +00:00
WIP adopt concurrent-vec 1.10
This commit is contained in:
parent
c84bd1b5c2
commit
99ac6e89ef
3 changed files with 8 additions and 9 deletions
|
@ -8,7 +8,6 @@ repository = "https://github.com/salsa-rs/salsa"
|
|||
description = "A generic framework for on-demand, incrementalized computation (experimental)"
|
||||
|
||||
[dependencies]
|
||||
append-only-vec = { git = "https://github.com/nikomatsakis/append-only-vec.git", version = "0.1.4" }
|
||||
arc-swap = "1.6.0"
|
||||
boomphf = "0.6.0"
|
||||
crossbeam = "0.8.1"
|
||||
|
@ -16,7 +15,7 @@ dashmap = "5.3.4"
|
|||
hashlink = "0.8.0"
|
||||
indexmap = "2"
|
||||
log = "0.4.5"
|
||||
orx-concurrent-vec = "1.9.0"
|
||||
orx-concurrent-vec = "1.10.0"
|
||||
parking_lot = "0.12.1"
|
||||
rustc-hash = "1.1.0"
|
||||
salsa-macros = { path = "components/salsa-macros" }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::any::{Any, TypeId};
|
||||
use std::sync::Arc;
|
||||
|
||||
use append_only_vec::AppendOnlyVec;
|
||||
use orx_concurrent_vec::ConcurrentVec;
|
||||
use parking_lot::{Condvar, Mutex};
|
||||
use rustc_hash::FxHashMap;
|
||||
|
||||
|
@ -153,7 +153,7 @@ struct Shared<Db: Database> {
|
|||
/// Vector of ingredients.
|
||||
///
|
||||
/// Immutable unless the mutex on `ingredients_map` is held.
|
||||
ingredients_vec: Arc<AppendOnlyVec<Box<dyn Ingredient>>>,
|
||||
ingredients_vec: Arc<ConcurrentVec<Box<dyn Ingredient>>>,
|
||||
|
||||
/// Conditional variable that is used to coordinate cancellation.
|
||||
/// When the main thread writes to the database, it blocks until each of the snapshots can be cancelled.
|
||||
|
@ -177,7 +177,7 @@ impl<Db: Database> Default for Storage<Db> {
|
|||
cvar: Arc::new(Default::default()),
|
||||
noti_lock: Arc::new(parking_lot::Mutex::new(())),
|
||||
jar_map: Default::default(),
|
||||
ingredients_vec: Arc::new(AppendOnlyVec::new()),
|
||||
ingredients_vec: Default::default(),
|
||||
sync: Some(Arc::new(())),
|
||||
},
|
||||
runtime: Runtime::default(),
|
||||
|
@ -230,7 +230,7 @@ impl<Db: Database> Storage<Db> {
|
|||
}
|
||||
|
||||
pub fn lookup_ingredient(&self, index: IngredientIndex) -> &dyn Ingredient {
|
||||
&*self.shared.ingredients_vec[index.as_usize()]
|
||||
&**self.shared.ingredients_vec.get(index.as_usize()).unwrap()
|
||||
}
|
||||
|
||||
pub fn snapshot(&self) -> Storage<Db>
|
||||
|
|
|
@ -5,7 +5,7 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
use append_only_vec::AppendOnlyVec;
|
||||
use orx_concurrent_vec::ConcurrentVec;
|
||||
|
||||
use crate::Database;
|
||||
|
||||
|
@ -17,7 +17,7 @@ pub(crate) struct DynUpcastsFor<Db: Database> {
|
|||
#[derive(Clone)]
|
||||
pub(crate) struct DynUpcasts {
|
||||
source_type_id: TypeId,
|
||||
vec: Arc<AppendOnlyVec<DynUpcast>>,
|
||||
vec: Arc<ConcurrentVec<DynUpcast>>,
|
||||
}
|
||||
|
||||
struct DynUpcast {
|
||||
|
@ -63,7 +63,7 @@ impl DynUpcasts {
|
|||
let source_type_id = TypeId::of::<Db>();
|
||||
Self {
|
||||
source_type_id,
|
||||
vec: Arc::new(AppendOnlyVec::new()),
|
||||
vec: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue