| ... | @@ -357,19 +357,9 @@ static void ir_ref_var(ZigVar *var) { | ... | @@ -357,19 +357,9 @@ static void ir_ref_var(ZigVar *var) { |
| 357 | } | 357 | } |
| 358 | | 358 | |
| 359 | ZigType *ir_analyze_type_expr(IrAnalyze *ira, Scope *scope, AstNode *node) { | 359 | ZigType *ir_analyze_type_expr(IrAnalyze *ira, Scope *scope, AstNode *node) { |
| 360 | ConstExprValue *result = ir_eval_const_value( ira->codegen | 360 | ConstExprValue *result = ir_eval_const_value(ira->codegen, scope, node, ira->codegen->builtin_types.entry_type, |
| 361 | , scope | 361 | ira->new_irb.exec->backward_branch_count, ira->new_irb.exec->backward_branch_quota, nullptr, nullptr, |
| 362 | , node | 362 | node, nullptr, ira->new_irb.exec, nullptr); |
| 363 | , ira->codegen->builtin_types.entry_type | | |
| 364 | , ira->new_irb.exec->backward_branch_count | | |
| 365 | , ira->new_irb.exec->backward_branch_quota | | |
| 366 | , nullptr | | |
| 367 | , nullptr | | |
| 368 | , node | | |
| 369 | , nullptr | | |
| 370 | , ira->new_irb.exec | | |
| 371 | , nullptr | | |
| 372 | ); | | |
| 373 | | 363 | |
| 374 | if (type_is_invalid(result->type)) | 364 | if (type_is_invalid(result->type)) |
| 375 | return ira->codegen->builtin_types.entry_invalid; | 365 | return ira->codegen->builtin_types.entry_invalid; |
| ... | @@ -7965,7 +7955,7 @@ static ConstExprValue *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec | ... | @@ -7965,7 +7955,7 @@ static ConstExprValue *ir_exec_const_result(CodeGen *codegen, IrExecutable *exec |
| 7965 | return &codegen->invalid_instruction->value; | 7955 | return &codegen->invalid_instruction->value; |
| 7966 | } | 7956 | } |
| 7967 | } | 7957 | } |
| 7968 | return &codegen->invalid_instruction->value; | 7958 | zig_unreachable(); |
| 7969 | } | 7959 | } |
| 7970 | | 7960 | |
| 7971 | static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *source_instruction) { | 7961 | static bool ir_emit_global_runtime_side_effect(IrAnalyze *ira, IrInstruction *source_instruction) { |
| ... | @@ -10227,16 +10217,18 @@ static IrInstruction *ir_unreach_error(IrAnalyze *ira) { | ... | @@ -10227,16 +10217,18 @@ static IrInstruction *ir_unreach_error(IrAnalyze *ira) { |
| 10227 | | 10217 | |
| 10228 | static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instruction) { | 10218 | static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instruction) { |
| 10229 | size_t *bbc = ira->new_irb.exec->backward_branch_count; | 10219 | size_t *bbc = ira->new_irb.exec->backward_branch_count; |
| 10230 | size_t quota = ira->new_irb.exec->backward_branch_quota; | 10220 | size_t *quota = ira->new_irb.exec->backward_branch_quota; |
| 10231 | | 10221 | |
| 10232 | // If we're already over quota, we've already given an error message for this. | 10222 | // If we're already over quota, we've already given an error message for this. |
| 10233 | if (*bbc > quota) { | 10223 | if (*bbc > *quota) { |
| | 10224 | assert(ira->codegen->errors.length > 0); |
| 10234 | return false; | 10225 | return false; |
| 10235 | } | 10226 | } |
| 10236 | | 10227 | |
| 10237 | *bbc += 1; | 10228 | *bbc += 1; |
| 10238 | if (*bbc > quota) { | 10229 | if (*bbc > *quota) { |
| 10239 | ir_add_error(ira, source_instruction, buf_sprintf("evaluation exceeded %" ZIG_PRI_usize " backwards branches", quota)); | 10230 | ir_add_error(ira, source_instruction, |
| | 10231 | buf_sprintf("evaluation exceeded %" ZIG_PRI_usize " backwards branches", *quota)); |
| 10240 | return false; | 10232 | return false; |
| 10241 | } | 10233 | } |
| 10242 | return true; | 10234 | return true; |
| ... | @@ -10317,7 +10309,7 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, Un | ... | @@ -10317,7 +10309,7 @@ static ConstExprValue *ir_resolve_const(IrAnalyze *ira, IrInstruction *value, Un |
| 10317 | } | 10309 | } |
| 10318 | | 10310 | |
| 10319 | ConstExprValue *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, | 10311 | ConstExprValue *ir_eval_const_value(CodeGen *codegen, Scope *scope, AstNode *node, |
| 10320 | ZigType *expected_type, size_t *backward_branch_count, size_t backward_branch_quota, | 10312 | ZigType *expected_type, size_t *backward_branch_count, size_t *backward_branch_quota, |
| 10321 | ZigFn *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name, | 10313 | ZigFn *fn_entry, Buf *c_import_buf, AstNode *source_node, Buf *exec_name, |
| 10322 | IrExecutable *parent_exec, AstNode *expected_type_source_node) | 10314 | IrExecutable *parent_exec, AstNode *expected_type_source_node) |
| 10323 | { | 10315 | { |
| ... | @@ -18983,8 +18975,8 @@ static IrInstruction *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ir | ... | @@ -18983,8 +18975,8 @@ static IrInstruction *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ir |
| 18983 | if (!ir_resolve_usize(ira, instruction->new_quota->child, &new_quota)) | 18975 | if (!ir_resolve_usize(ira, instruction->new_quota->child, &new_quota)) |
| 18984 | return ira->codegen->invalid_instruction; | 18976 | return ira->codegen->invalid_instruction; |
| 18985 | | 18977 | |
| 18986 | if (new_quota > ira->new_irb.exec->backward_branch_quota) { | 18978 | if (new_quota > *ira->new_irb.exec->backward_branch_quota) { |
| 18987 | ira->new_irb.exec->backward_branch_quota = new_quota; | 18979 | *ira->new_irb.exec->backward_branch_quota = new_quota; |
| 18988 | } | 18980 | } |
| 18989 | | 18981 | |
| 18990 | return ir_const_void(ira, &instruction->base); | 18982 | return ir_const_void(ira, &instruction->base); |