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. --- include/parser.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/parser.h') diff --git a/include/parser.h b/include/parser.h index 491815f..bc205f0 100644 --- a/include/parser.h +++ b/include/parser.h @@ -4,6 +4,7 @@ #include "std/buffer_view.h" #include "std/scoped_allocator.h" #include "std/thread.h" +#include "bytecode/bytecode.h" #include "tokenizer.h" #include "ast.h" #include "defs.h" @@ -39,17 +40,19 @@ struct Parser { LhsExpr file_decl; Scope *current_scope; bool has_func_parent; - ScopedAllocator *allocator; /* borrowed. Copied from @compiler for faster access to allocator */ + /* Borrowed from @compiler for faster access to allocator. The allocator is thread-specific */ + ScopedAllocator *allocator; amal_compiler *compiler; Ssa *ssa; bool started; TokenizerError error; ErrorContext error_context; jmp_buf parse_env; + Bytecode bytecode; }; CHECK_RESULT int parser_thread_data_init(ParserThreadData *self); -CHECK_RESULT int parser_thread_data_deinit(ParserThreadData *self); +void parser_thread_data_deinit(ParserThreadData *self); CHECK_RESULT int parser_thread_data_start(ParserThreadData *self, AmalThreadCallbackFunc callback_func, void *userdata); CHECK_RESULT int parser_thread_data_join(ParserThreadData *self, void **result); -- cgit v1.2.3