From ec1a48e7b86fcd00127dd5a88d56c42083af1d78 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 18 Jul 2019 03:10:03 +0200 Subject: Setup structure for program execute --- include/ast.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'include/ast.h') diff --git a/include/ast.h b/include/ast.h index 2925f6c..f056db7 100644 --- a/include/ast.h +++ b/include/ast.h @@ -142,9 +142,12 @@ typedef struct { } VariableType; /* - Note: When resolving AST, more than one thread can end up resolving the same expressions at the same time. + Note: When resolving AST, multiple threads can end up resolving the same expressions at the same time. This is intentional. Instead of using mutex for every expression and locking/unlocking everytime which uses more memory and affects performance, we assume such race conditions are rare and let them happen. + TODO: Investigate possible deadlock when multiple threads resolve the same expression and that + expression has a recursive dependency and the threads execute @ast_resolve at the same speed, + leading to @ast_resolve running again for the same expression. */ struct LhsExpr { bool is_extern; @@ -210,7 +213,7 @@ typedef struct { Parser *parser; /* Borrowed. This is the parser that belongs to the thread */ /* Borrowed. This is the current scope. Note that this scope can belong to another parser (and thread), - as such, @parser and scope_get_parser(@scope) parser may not be the same + as such, @parser and scope_get_parser(@scope) parser may not be the same. */ Scope *scope; } AstCompilerContext; -- cgit v1.2.3