Skip to content

Commit

Permalink
[skip ci] Explain in comment why match default arm is emitted first
Browse files Browse the repository at this point in the history
  • Loading branch information
iluuu1994 committed Jul 11, 2020
1 parent 6085c82 commit 9bf1e53
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -5297,6 +5297,8 @@ void zend_compile_match(znode *result, zend_ast *ast)
uint32_t cond_count = 0;
uint32_t *jmp_end_opnums = safe_emalloc(sizeof(uint32_t), arms->children, 0);

// The default arm is emitted first to avoid live range issues where the tmpvar for the
// arm result is freed even though it has not been initialized yet.
if (!has_default_arm) {
if (!uses_jumptable) {
zend_update_jump_target_to_next(opnum_default_jmp);
Expand Down

0 comments on commit 9bf1e53

Please sign in to comment.