Skip to content

Commit

Permalink
fix(VM): register initialisation
Browse files Browse the repository at this point in the history
  • Loading branch information
berdal84 committed Mar 28, 2022
1 parent 65347b2 commit d0895fb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/src/VM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ VM::VM()
, m_next_node(nullptr)
, m_program_asm_code(nullptr)
{

clear_registers();
}

void VM::advance_cursor(i64 _amount)
Expand All @@ -37,6 +37,7 @@ void VM::clear_registers()
{
m_register[i].reset();
}
init_instruction_pointer();
}
void VM::run_program()
{
Expand All @@ -45,7 +46,6 @@ void VM::run_program()
m_is_program_running = true;

clear_registers();
init_instruction_pointer(); // uses register, need to be done after clear.

while( is_there_a_next_instr() && get_next_instr()->type != Instr_t::ret )
{
Expand Down Expand Up @@ -350,7 +350,6 @@ void VM::debug_program()
m_is_debugging = true;
m_is_program_running = true;
clear_registers();
init_instruction_pointer(); // uses register, need to be done after clear.
m_next_node = m_program_asm_code->get_meta_data().root_node;
LOG_MESSAGE("VM", "Debugging program ...\n")
}
Expand Down

0 comments on commit d0895fb

Please sign in to comment.