| ... | @@ -7604,13 +7604,13 @@ static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instru | ... | @@ -7604,13 +7604,13 @@ static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instru |
| 7604 | size_t *bbc = ira->new_irb.exec->backward_branch_count; | 7604 | size_t *bbc = ira->new_irb.exec->backward_branch_count; |
| 7605 | size_t quota = ira->new_irb.exec->backward_branch_quota; | 7605 | size_t quota = ira->new_irb.exec->backward_branch_quota; |
| 7606 | | 7606 | |
| 7607 | if (ira->new_irb.exec->reported_quota_exceeded) { | 7607 | // If we're already over quota, we've already given an error message for this. |
| | 7608 | if (*bbc > quota) { |
| 7608 | return false; | 7609 | return false; |
| 7609 | } | 7610 | } |
| 7610 | | 7611 | |
| 7611 | *bbc += 1; | 7612 | *bbc += 1; |
| 7612 | if (*bbc > quota) { | 7613 | if (*bbc > quota) { |
| 7613 | ira->new_irb.exec->reported_quota_exceeded = true; | | |
| 7614 | ir_add_error(ira, source_instruction, buf_sprintf("evaluation exceeded %" ZIG_PRI_usize " backwards branches", quota)); | 7614 | ir_add_error(ira, source_instruction, buf_sprintf("evaluation exceeded %" ZIG_PRI_usize " backwards branches", quota)); |
| 7615 | return false; | 7615 | return false; |
| 7616 | } | 7616 | } |
| ... | @@ -13285,6 +13285,12 @@ static TypeTableEntry *ir_analyze_instruction_type_id(IrAnalyze *ira, | ... | @@ -13285,6 +13285,12 @@ static TypeTableEntry *ir_analyze_instruction_type_id(IrAnalyze *ira, |
| 13285 | static TypeTableEntry *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira, | 13285 | static TypeTableEntry *ir_analyze_instruction_set_eval_branch_quota(IrAnalyze *ira, |
| 13286 | IrInstructionSetEvalBranchQuota *instruction) | 13286 | IrInstructionSetEvalBranchQuota *instruction) |
| 13287 | { | 13287 | { |
| | 13288 | if (ira->new_irb.exec->parent_exec != nullptr) { |
| | 13289 | ir_add_error(ira, &instruction->base, |
| | 13290 | buf_sprintf("@setEvalBranchQuota must be called from the top of the comptime stack")); |
| | 13291 | return ira->codegen->builtin_types.entry_invalid; |
| | 13292 | } |
| | 13293 | |
| 13288 | uint64_t new_quota; | 13294 | uint64_t new_quota; |
| 13289 | if (!ir_resolve_usize(ira, instruction->new_quota->other, &new_quota)) | 13295 | if (!ir_resolve_usize(ira, instruction->new_quota->other, &new_quota)) |
| 13290 | return ira->codegen->builtin_types.entry_invalid; | 13296 | return ira->codegen->builtin_types.entry_invalid; |