From c062eaeea09592cbdf7e5d732e992d0cdd8eedc5 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Thu, 1 Jun 2023 17:33:56 +0200 Subject: More scheduling --- src/map.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'src/map.c') diff --git a/src/map.c b/src/map.c index 16518e2..9f6a050 100644 --- a/src/map.c +++ b/src/map.c @@ -6,6 +6,7 @@ #include #include #include +#include static struct hashmap *all_terms; @@ -30,6 +31,8 @@ struct term *map_get(struct hashmap *map, hash_t hash) void map_set(struct hashmap *map, struct term *term) { + if (!hashmap_get(map, term->hash)) + schedule_add(term); // also add to schedule hashmap_set(map, &term, term->hash); } @@ -70,21 +73,3 @@ void map_dump(struct hashmap *map) } fprintf(stderr, "---\n\n"); } - -struct pqueue *map_to_pqueue(struct hashmap *map, pqueue_cmp_pri_f cmppri, - pqueue_get_pri_f getpri, pqueue_set_pos_f setpos) -{ - size_t size = hashmap_count(map) + 42; - struct pqueue *queue = pqueue_init(size, cmppri, getpri, setpos); - - size_t iter = 0; - void *iter_val; - while (hashmap_iter(map, &iter, &iter_val)) { - struct term *term = *(struct term **)iter_val; - if (term->type == APP && term->u.app.lhs->type == ABS) { - pqueue_insert(queue, term); - } - } - - return queue; -} -- cgit v1.2.3