Skip to content

Commit

Permalink
refactor: don't copy popped frames (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrzlgnm committed Aug 28, 2023
1 parent 4ddfe3b commit 12235d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions source/vm/vm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ auto vm::push_frame(frame&& frm) -> void
m_frame_index++;
}

auto vm::pop_frame() -> frame
auto vm::pop_frame() -> frame&
{
m_frame_index--;
return m_frames[m_frame_index];
return m_frames.at(m_frame_index);
}

auto vm::push_closure(uint16_t const_idx, uint8_t num_free) -> void
Expand Down
2 changes: 1 addition & 1 deletion source/vm/vm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct vm

auto current_frame() -> frame&;
auto push_frame(frame&& frm) -> void;
auto pop_frame() -> frame;
auto pop_frame() -> frame&;
auto push_closure(uint16_t const_idx, uint8_t num_free) -> void;

constants_ptr m_constans;
Expand Down

0 comments on commit 12235d4

Please sign in to comment.