Skip to content

Commit

Permalink
Nil var before loop
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <[email protected]>
  • Loading branch information
smarr committed Aug 6, 2021
1 parent 13435b7 commit dcdefbc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/som/compiler/bc/method_generation_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,21 +685,23 @@ def inline_to_do(self, parser):
block_literal_idx = self._bytecode[-1]

to_be_inlined = self._literals[block_literal_idx]
to_be_inlined.merge_scope_into(self)

block_arg = to_be_inlined.get_argument(1, 0)
i_var_idx = self.get_inlined_local_idx(block_arg, 0)

self._remove_last_bytecodes(1) # remove push_block*

self._is_currently_inlining_a_block = True
emit_dup_second(self)

emit_nil_local(self, i_var_idx)

loop_begin_idx = self.offset_of_next_instruction()
jump_offset_idx_to_end = emit_jump_if_greater_with_dummy_offset(self)

emit_dup(self)

to_be_inlined.merge_scope_into(self)

block_arg = to_be_inlined.get_argument(1, 0)
i_var_idx = self.get_inlined_local_idx(block_arg, 0)
emit_pop_local(self, i_var_idx, 0)

to_be_inlined.inline(self, False)
Expand Down

0 comments on commit dcdefbc

Please sign in to comment.