Commit graph

521 commits

Author SHA1 Message Date
Micha Reiser
3f93415313
Fix const query with custom database trait 2024-08-20 21:49:30 +02:00
Niko Matsakis
d7af1a85fb simplify Id traits, make new crate-private
`Id` values are used in a very tailored way now, no reason
to let people construct arbitrary ones.
2024-08-20 10:09:49 -04:00
Niko Matsakis
6401563755 store memoized fn results attached to the salsa struct 2024-08-20 10:09:49 -04:00
Niko Matsakis
8833a7168b remove "constant" functions
The goal here is that ALL `Id` values come from a `Table`
2024-08-20 10:09:49 -04:00
Niko Matsakis
703f312eae port input to use Table 2024-08-20 10:09:49 -04:00
Niko Matsakis
403755548b give each function ingredient a memo ingredient index 2024-08-20 10:09:49 -04:00
Niko Matsakis
188f759555 use table for tracked structs and their fields
This also retools a tiny bit how deletion works.
We will reuse ids faster than before, actually.
2024-08-20 10:09:49 -04:00
Niko Matsakis
01d4ef86b2 introduce Table and use for interned values 2024-08-20 10:09:49 -04:00
Niko Matsakis
4657ac3a0d Revert "introduce Table and use for interned values"
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (false, beta) (push) Has been cancelled
Test / Test (false, stable) (push) Has been cancelled
Test / Test (true, nightly) (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled
This reverts commit 9a3111ce27.
2024-08-11 08:04:47 +03:00
Niko Matsakis
9a3111ce27 introduce Table and use for interned values
Some checks failed
Book / Book (push) Has been cancelled
Test / Test (false, beta) (push) Has been cancelled
Test / Test (false, stable) (push) Has been cancelled
Test / Test (true, nightly) (push) Has been cancelled
Test / Miri (push) Has been cancelled
Test / Benchmarks (push) Has been cancelled
Book / Deploy (push) Has been cancelled
2024-08-08 18:25:06 +03:00
Micha Reiser
fbc7b8c544
Move Builder::new impl out of Configuration::builder method 2024-08-06 08:53:03 +02:00
Micha Reiser
0848b78d90
Add #[must_use] attribute 2024-08-06 08:47:59 +02:00
Micha Reiser
17a2f6b2ca
Add support for [#default] and setting field-level durability 2024-08-06 08:47:57 +02:00
Micha Reiser
632faff5a6
Implement inputs builder 2024-08-06 08:44:12 +02:00
Micha Reiser
d6df21fba1
Merge pull request #557 from MichaReiser/high-durability-write
Some checks are pending
Book / Book (push) Waiting to run
Book / Deploy (push) Blocked by required conditions
Test / Test (false, beta) (push) Waiting to run
Test / Test (false, stable) (push) Waiting to run
Test / Test (true, nightly) (push) Waiting to run
Test / Miri (push) Waiting to run
Test / Benchmarks (push) Waiting to run
Fix query invalidation when high durability input changes
2024-08-05 16:36:21 +00:00
Niko Matsakis
c830be20f2
Merge pull request #549 from obsgolem/fix_warning
Fixed non_local_definitions warning
2024-08-05 16:36:16 +00:00
Micha Reiser
a263dd04ba
Fix query invalidation when high durability input changes 2024-08-05 16:24:39 +02:00
Niko Matsakis
6ff1975e17 Update components/salsa-macro-rules/src/setup_input_struct.rs
Co-authored-by: Micha Reiser <micha@reiser.io>
2024-08-04 03:05:32 -04:00
Niko Matsakis
4d2ccffddc return to the database-wrapping-storage setup 2024-08-04 02:18:54 -04:00
Josiah Bills
49657a4989 Fixed non_local_definitions warning. 2024-08-01 20:09:13 -04:00
Niko Matsakis
a675810edf move local-state into DatabaseImpl
Each clone gets an independent local state.
2024-07-28 12:47:50 +00:00
Niko Matsakis
138ca4b1f3 merge handle into the database
Separate handles are no longer needed.
2024-07-28 12:47:50 +00:00
Niko Matsakis
daaa78056a switch to new database design
Under this design, *all* databases are a
`DatabaseImpl<U>`, where the `U` implements
`UserData` (you can use `()` if there is none).

Code would default to `&dyn salsa::Database` but
if you want to give access to the userdata, you
can define a custom database trait
`MyDatabase: salsa::Databse` so long as you

* annotate `MyDatabase` trait definition of
  impls of `MyDatabase` with `#[salsa::db]`
* implement `MyDatabase` for `DatabaseImpl<U>`
  where `U` is your userdata (this could be a
  blanket impl, if you don't know the precise
  userdata type).

The `tests/common/mod.rs` shows the pattern.
2024-07-28 12:47:50 +00:00
Niko Matsakis
1842b1dfbb (almost) encansulate Runtime into Zalsa
The distinction is dumb and should go away.
But we still need it for a bit.
2024-07-28 12:35:33 +00:00
Niko Matsakis
596461c213 hide internal methods behind a Zalsa trait
The traits are now quite simple:

* Database is the external trait
* ZalsaDatabase is the internal one, implemented
  by `#[salsa::db]`. It adds two methods,
  `zalsa` and `zalsa_mut`. Those give access
  to our internal methods.

For now I've hidden the methods behind
`&dyn Zalsa`. This is nice and clean but it may
be worth later refactoring to a `struct Zalsa`.
2024-07-28 12:35:33 +00:00
Niko Matsakis
bc72bdf524 as_salsa_database => as_dyn_database
Also, move to a blanket impl'd trait.
Overall cleaner approach.
2024-07-28 12:35:33 +00:00
Niko Matsakis
9e8635c7db remove upcast_mut
We only ever need to upcast to shared references.

This change isn't necessary, just dead code
cleanup.
2024-07-28 12:35:33 +00:00
Niko Matsakis
21af3a2009 move local state into thread local 2024-07-23 21:45:31 -04:00
Niko Matsakis
74ef66dbb4 make tracked structs take db, not runtime 2024-07-23 11:54:55 -04:00
Niko Matsakis
782896772f make interner take database, not runtime 2024-07-23 11:54:55 -04:00
Niko Matsakis
53ccfa3fc3 make input::fields take Database not Runtime 2024-07-23 11:54:55 -04:00
Niko Matsakis
f466228da5 make accumulate take database instead of Runtime
We are going to want to take databases at
public entry points.
2024-07-23 11:54:55 -04:00
Micha Reiser
6975a47690
Replace derived Debug implementation of salsa::Id 2024-07-22 17:56:16 +02:00
Niko Matsakis
431fd14b69
Merge pull request #523 from MichaReiser/tracked-fn-interned
Some checks are pending
Book / Book (push) Waiting to run
Book / Deploy (push) Blocked by required conditions
Test / Test (false, beta) (push) Waiting to run
Test / Test (false, stable) (push) Waiting to run
Test / Test (true, nightly) (push) Waiting to run
Test / Miri (push) Waiting to run
Allow interned values as tracked function arguments
2024-07-22 10:54:46 +00:00
Micha Reiser
9ba36ebf7e
Allow interned values as tracked function arguments 2024-07-20 09:03:57 +02:00
Micha Reiser
ba169ef039
Respct no_eq attribute for tracked functions 2024-07-20 08:47:51 +02:00
Niko Matsakis
e8b467733f squelch most clippy warnings in generated code 2024-07-19 10:00:03 -04:00
Niko Matsakis
e847929536 pacify the merciless clippy 2024-07-19 09:20:41 -04:00
Niko Matsakis
ad61687e83 wip 2024-07-19 08:09:55 -04:00
Niko Matsakis
68a3a7fceb wip 2024-07-19 08:05:39 -04:00
Niko Matsakis
27f847545a cleanup getters/setters 2024-07-19 07:22:09 -04:00
Niko Matsakis
73a6aed554 wip privacy on interned 2024-07-19 07:14:57 -04:00
Niko Matsakis
fe90e68c8f wip privacy for tracked structs 2024-07-19 07:12:07 -04:00
Niko Matsakis
3304acc5dd wip: accum, privacy for inputs 2024-07-19 07:08:24 -04:00
Niko Matsakis
b677019407 fix accumulation 2024-07-19 06:22:40 -04:00
Niko Matsakis
5209735d0b ensure the fn value is up-to-date 2024-07-19 06:00:16 -04:00
Niko Matsakis
92eee06596 delete a bunch of dead code 2024-07-19 05:55:40 -04:00
Niko Matsakis
c545f8a8c3 wip 2024-07-18 07:50:22 -04:00
Niko Matsakis
812923ab0c wip 2024-07-18 07:49:06 -04:00
Niko Matsakis
efbf3249ef wip 2024-07-18 06:32:18 -04:00