From 99ac6e89ef2d4c1aec0f695d59b5737d1daaab60 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 11 Jul 2024 05:47:18 -0400 Subject: [PATCH] WIP adopt concurrent-vec 1.10 --- Cargo.toml | 3 +-- src/storage.rs | 8 ++++---- src/upcast.rs | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 969753be..deb4f449 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" } diff --git a/src/storage.rs b/src/storage.rs index d05ba863..611ec780 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -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 { /// Vector of ingredients. /// /// Immutable unless the mutex on `ingredients_map` is held. - ingredients_vec: Arc>>, + ingredients_vec: Arc>>, /// 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 Default for Storage { 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 Storage { } 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 diff --git a/src/upcast.rs b/src/upcast.rs index 510017a6..b63e52c5 100644 --- a/src/upcast.rs +++ b/src/upcast.rs @@ -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 { #[derive(Clone)] pub(crate) struct DynUpcasts { source_type_id: TypeId, - vec: Arc>, + vec: Arc>, } struct DynUpcast { @@ -63,7 +63,7 @@ impl DynUpcasts { let source_type_id = TypeId::of::(); Self { source_type_id, - vec: Arc::new(AppendOnlyVec::new()), + vec: Default::default(), } }