cex: derivation reference counting

* src/derivation.h, src/derivation.c: Make derivation struct opaque.
Add derivation_list type for clarity.
(derivation_list_new): New.
(derivation_list_append): New.
(derivation_list_prepend): New.
(derivation_new_leaf): New constructor for derivations with no
children.
* src/counterexample.c, src/parse-simulation.c,
* src/parse-simulation.h: Replace uses of gl_list_t containing
derivations with derivation_list and its API.
Replace calls of dervation_new using null children with
derivation_new_leaf.
* src/parse-simulation.c: replace ps_chunk and its API with typed
versions si_chunk and deriv_chunk.
* src/parse-simlation.h, src/parse-simulation.c: Remove
parse_state_retain_deriv in favor of derivation reference counting.
* src/counterexample.c: Remove search_state_retain_deriv.
This commit is contained in:
Vincent Imbimbo
2020-05-21 22:13:11 -04:00
committed by Akim Demaille
parent fc39ccab6b
commit 35c4a8e65e
5 changed files with 224 additions and 140 deletions

View File

@@ -86,7 +86,6 @@ void parse_state_retain (parse_state *ps);
* when its reference count reaches 1. This is used to
* free memory while the parse state is in a hash set. */
void parse_state_free_contents_early (parse_state *ps);
void parse_state_retain_deriv (parse_state *ps);
void free_parse_state (parse_state *ps);
/* counts the amount of shift and production steps in this parse state */
@@ -94,7 +93,7 @@ void parse_state_completed_steps (const parse_state *ps, int *shifts, int *produ
/* parse state getters */
bool parse_state_derivation_completed (const parse_state *ps);
const derivation *parse_state_derivation (const parse_state *ps);
derivation *parse_state_derivation (const parse_state *ps);
const state_item *parse_state_head (const parse_state *ps);
const state_item *parse_state_tail (const parse_state *ps);
int parse_state_length (const parse_state *ps);
@@ -102,7 +101,7 @@ int parse_state_depth (const parse_state *ps);
/* returns the linked lists that the parse state is supposed to represent */
void parse_state_lists (parse_state *ps, gl_list_t *state_items,
gl_list_t *derivs);
derivation_list *derivs);
/* various functions that return a list of states based off of
* whatever operation is simulated. After whatever operation, every possible