From 84e65c63e7482590d535e86f7660a00ae8a0cecb Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 17 Jul 2019 19:23:16 +0200 Subject: Start on amal program Fix mutex issue in lhs expr which can cause a deadlock when a file has an error and throws and doesn't close the mutex and another thread waits for that mutex. The mutex can instead be removed and ignore race conditions which are uncommon. This should improve memory usage and performance. --- src/ssa/ssa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ssa') diff --git a/src/ssa/ssa.c b/src/ssa/ssa.c index 34e3e3e..6e61bf1 100644 --- a/src/ssa/ssa.c +++ b/src/ssa/ssa.c @@ -17,7 +17,7 @@ do { \ } while(0) /* Max length of a string that fits in u16 */ -#define MAX_STRING_LENGTH ((2 << 16) - 1) +#define MAX_STRING_LENGTH UINT16_MAX static int compare_number(const void *a, const void *b) { const SsaNumber *lhs; @@ -54,7 +54,7 @@ int ssa_init(Ssa *self, ScopedAllocator *allocator) { return_if_error(buffer_init(&self->instructions, allocator)); return_if_error(hash_map_init(&self->intermediates_map, allocator, sizeof(SsaIntermediateIndex), compare_number, hash_number)); return_if_error(buffer_init(&self->intermediates, allocator)); - return_if_error(hash_map_init(&self->strings_map, allocator, sizeof(SsaStringIndex), hash_compare_string, amal_hash_string)); + return_if_error(hash_map_init(&self->strings_map, allocator, sizeof(SsaStringIndex), hash_map_compare_string, amal_hash_string)); return_if_error(buffer_init(&self->strings, allocator)); self->intermediate_counter = 0; self->string_counter = 0; -- cgit v1.2.3