aboutsummaryrefslogtreecommitdiff
path: root/src/ssa
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2019-07-17 19:23:16 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-25 14:36:46 +0200
commit84e65c63e7482590d535e86f7660a00ae8a0cecb (patch)
treec79de87b7136e96b977003db85d43e5e676bbfc1 /src/ssa
parent85c654a102701958d3748e82ecac9c1bc4dbbcba (diff)
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.
Diffstat (limited to 'src/ssa')
-rw-r--r--src/ssa/ssa.c4
1 files changed, 2 insertions, 2 deletions
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;