mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 17:34:34 +00:00
Naïve optimization of named _split_ multiple return valued when defer is never used
This is a naïve optimization but it helps a lot in the general case where callee temporary stack variables are not allocated to represent the named return values by using that specific memory. In the future, try to check if a specific named return value is ever used a `defer` within a procedure or not, or is ever passed to a nested procedure call (e.g. possibly escapes).
This commit is contained in:
@@ -1544,8 +1544,12 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty
|
||||
// NOTE(bill): Don't err here
|
||||
}
|
||||
|
||||
GB_ASSERT(decl->defer_use_checked == false);
|
||||
|
||||
check_stmt_list(ctx, bs->stmts, Stmt_CheckScopeDecls);
|
||||
|
||||
decl->defer_use_checked = true;
|
||||
|
||||
for_array(i, bs->stmts) {
|
||||
Ast *stmt = bs->stmts[i];
|
||||
if (stmt->kind == Ast_ValueDecl) {
|
||||
@@ -1580,6 +1584,7 @@ void check_proc_body(CheckerContext *ctx_, Token token, DeclInfo *decl, Type *ty
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
check_close_scope(ctx);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user