Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 3 additions & 5 deletions components/salsa-macro-rules/src/setup_input_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ macro_rules! setup_input_struct {
type Fields = ($($field_ty,)*);

/// A array of [`StampedValue<()>`](`StampedValue`) tuples, one per each of the value fields.
type Stamps = $zalsa::Array<$zalsa::Stamp, $N>;
type Stamps = [$zalsa::Stamp; $N];
}

impl $Configuration {
Expand Down Expand Up @@ -284,10 +284,8 @@ macro_rules! setup_input_struct {
}
}

pub(super) fn builder_into_inner(builder: $Builder, revision: $zalsa::Revision) -> (($($field_ty,)*), $zalsa::Array<$zalsa::Stamp, $N>) {
let stamps = $zalsa::Array::new([
$($zalsa::stamp(revision, builder.durabilities[$field_index])),*
]);
pub(super) fn builder_into_inner(builder: $Builder, revision: $zalsa::Revision) -> (($($field_ty,)*), [$zalsa::Stamp; $N]) {
let stamps = [$($zalsa::stamp(revision, builder.durabilities[$field_index])),*];

(builder.fields, stamps)
}
Expand Down
4 changes: 2 additions & 2 deletions components/salsa-macro-rules/src/setup_tracked_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ macro_rules! setup_tracked_struct {

type Fields<$db_lt> = ($($field_ty,)*);

type Revisions = $zalsa::Array<$Revision, $N>;
type Revisions = [$Revision; $N];

type Struct<$db_lt> = $Struct<$db_lt>;

Expand All @@ -138,7 +138,7 @@ macro_rules! setup_tracked_struct {
}

fn new_revisions(current_revision: $Revision) -> Self::Revisions {
$zalsa::Array::new([current_revision; $N])
[current_revision; $N]
}

unsafe fn update_fields<$db_lt>(
Expand Down
27 changes: 0 additions & 27 deletions src/array.rs

This file was deleted.

4 changes: 2 additions & 2 deletions src/input.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::any::{Any, TypeId};
use std::fmt;
use std::ops::DerefMut;
use std::ops::IndexMut;
use std::sync::Arc;

pub mod input_field;
Expand Down Expand Up @@ -34,7 +34,7 @@ pub trait Configuration: Any {
type Fields: Send + Sync;

/// A array of [`StampedValue<()>`](`StampedValue`) tuples, one per each of the value fields.
type Stamps: Send + Sync + fmt::Debug + DerefMut<Target = [Stamp]>;
type Stamps: Send + Sync + fmt::Debug + IndexMut<usize, Output = Stamp>;
}

pub struct JarImpl<C: Configuration> {
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

mod accumulator;
mod active_query;
mod array;
mod attach;
mod cancelled;
mod cycle;
Expand Down Expand Up @@ -50,7 +49,7 @@ pub use self::input::setter::Setter;
pub use self::key::DatabaseKeyIndex;
pub use self::revision::Revision;
pub use self::runtime::Runtime;
pub use self::storage::Storage;
pub use self::storage::{Storage, StorageHandle};
pub use self::update::Update;
pub use self::zalsa::IngredientIndex;
pub use crate::attach::with_attached_database;
Expand All @@ -77,7 +76,6 @@ pub mod plumbing {
};

pub use crate::accumulator::Accumulator;
pub use crate::array::Array;
pub use crate::attach::{attach, with_attached_database};
pub use crate::cycle::{CycleRecoveryAction, CycleRecoveryStrategy};
pub use crate::database::{current_revision, Database};
Expand Down
11 changes: 3 additions & 8 deletions src/tracked_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::any::TypeId;
use std::fmt;
use std::hash::Hash;
use std::marker::PhantomData;
use std::ops::DerefMut;
use std::ops::Index;
use std::sync::Arc;

use crossbeam_queue::SegQueue;
Expand Down Expand Up @@ -45,7 +45,7 @@ pub trait Configuration: Sized + 'static {
/// When a struct is re-recreated in a new revision, the corresponding
/// entries for each field are updated to the new revision if their
/// values have changed (or if the field is marked as `#[no_eq]`).
type Revisions: Send + Sync + DerefMut<Target = [Revision]>;
type Revisions: Send + Sync + Index<usize, Output = Revision>;

type Struct<'db>: Copy;

Expand Down Expand Up @@ -151,7 +151,7 @@ pub trait TrackedStructInDb: SalsaStructInDb {
///
/// This ingredient only stores the "id" fields. It is a kind of "dressed up" interner;
/// the active query + values of id fields are hashed to create the tracked
/// struct id. The value fields are stored in [`crate::function::FunctionIngredient`]
/// struct id. The value fields are stored in [`crate::function::IngredientImpl`]
/// instances keyed by the tracked struct id. Unlike normal interners, tracked
/// struct indices can be deleted and reused aggressively: when a tracked
/// function re-executes, any tracked structs that it created before but did
Expand Down Expand Up @@ -676,11 +676,6 @@ where
///
/// Note that this function returns the entire tuple of value fields.
/// The caller is responsible for selecting the appropriate element.
///
/// This function takes two indices:
/// - `field_index` is the absolute index of the field on the tracked struct.
/// - `relative_tracked_index` is the index of the field relative only to other
/// tracked fields.
pub fn tracked_field<'db>(
&'db self,
db: &'db dyn crate::Database,
Expand Down
4 changes: 2 additions & 2 deletions src/tracked_struct/tracked_field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{Database, Id};
/// This ingredient only stores the "id" fields.
/// It is a kind of "dressed up" interner;
/// the active query + values of id fields are hashed to create the tracked struct id.
/// The value fields are stored in [`crate::function::FunctionIngredient`] instances keyed by the tracked struct id.
/// The value fields are stored in [`crate::function::IngredientImpl`] instances keyed by the tracked struct id.
/// Unlike normal interners, tracked struct indices can be deleted and reused aggressively:
/// when a tracked function re-executes,
/// any tracked structs that it created before but did not create this time can be deleted.
Expand All @@ -23,7 +23,7 @@ where
/// Index of this ingredient in the database (used to construct database-ids, etc).
ingredient_index: IngredientIndex,

/// The absolute index of this field on the tracked struct.
/// The index of this field on the tracked struct relative to all other tracked fields.
field_index: usize,
phantom: PhantomData<fn() -> Value<C>>,
}
Expand Down