diff options
| author | Jedidiah Barber <contact@jedbarber.id.au> | 2026-01-19 13:43:42 +1300 |
|---|---|---|
| committer | Jedidiah Barber <contact@jedbarber.id.au> | 2026-01-19 13:43:42 +1300 |
| commit | 0c3e440a6eaf45e83654e9d8f5471e88a2eacf77 (patch) | |
| tree | f1f3383b85f64a538be5edb1f622765e6cad0a9c /src/kompsos-collector.ads | |
| parent | db8422a9f4e331fcbb0a17e20e919bc12824b111 (diff) | |
Cached results now freed after being used by all possible branches
Diffstat (limited to 'src/kompsos-collector.ads')
| -rw-r--r-- | src/kompsos-collector.ads | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/kompsos-collector.ads b/src/kompsos-collector.ads index b58721a..d352fa3 100644 --- a/src/kompsos-collector.ads +++ b/src/kompsos-collector.ads @@ -46,6 +46,8 @@ private type State_Access is access State; + + type Eval_Kind is (Unify_Data, Disjunct_Data, @@ -79,23 +81,36 @@ private (Key_Type => Graph_Component_Access, Element_Type => Eval_Data); - type Managed_Map is new Ada.Finalization.Controlled with record - Actual : Eval_Maps.Map; - end record; - overriding procedure Finalize - (This : in out Managed_Map); + subtype Short_Positive is Short_Integer range 1 .. Short_Integer'Last; + type Cached_State is record + Used : Short_Positive; + Data : State_Access; + end record; package State_Vectors is new Ada.Containers.Vectors (Index_Type => Long_Positive, - Element_Type => State); + Element_Type => Cached_State); + + type Cache_Entry is record + Keep : Boolean; + Data : State_Vectors.Vector; + end record; package Cache_Maps is new Ada.Containers.Ordered_Maps (Key_Type => Graph_Component_Access, - Element_Type => State_Vectors.Vector, - "=" => State_Vectors."="); + Element_Type => Cache_Entry); + + + + type Collector_Final_Controller is new Ada.Finalization.Limited_Controlled with null record; + + overriding procedure Finalize + (This : in out Collector_Final_Controller); + + Cleanup : Collector_Final_Controller; end Kompsos.Collector; |
