aboutsummaryrefslogtreecommitdiff
path: root/include/parser.h
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 /include/parser.h
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 'include/parser.h')
-rw-r--r--include/parser.h7
1 files changed, 5 insertions, 2 deletions
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);