Change push allocator system; update core libraries

This commit is contained in:
gingerBill
2017-11-09 22:48:00 +00:00
parent dbb070524f
commit eb4b3f5976
12 changed files with 162 additions and 177 deletions
-26
View File
@@ -7251,32 +7251,6 @@ void ir_build_stmt_internal(irProcedure *proc, AstNode *node) {
case_end;
case_ast_node(pa, PushAllocator, node);
ir_emit_comment(proc, str_lit("push_allocator"));
irValue *new_allocator = ir_build_expr(proc, pa->expr);
ir_open_scope(proc);
irValue *prev = ir_find_or_generate_context_ptr(proc);
irValue *next = ir_add_local_generated(proc, t_context);
ir_emit_store(proc, next, ir_emit_load(proc, prev));
Selection sel = lookup_field(proc->module->allocator, t_context, str_lit("allocator"), false);
irValue *gep = ir_emit_deep_field_gep(proc, next, sel);
ir_emit_store(proc, gep, new_allocator);
array_add(&proc->context_stack, next);
defer (array_pop(&proc->context_stack));
// TODO(bill): is this too leaky?
ir_build_stmt(proc, pa->body);
ir_close_scope(proc, irDeferExit_Default, nullptr);
case_end;
case_ast_node(pc, PushContext, node);
ir_emit_comment(proc, str_lit("push_context"));
irValue *new_context = ir_build_expr(proc, pc->expr);