Skip to content

Commit

Permalink
Add code_index to ExecutionState
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Sep 13, 2022
1 parent 72c70b4 commit 4a7c4be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/evmone/execution_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ class ExecutionState
size_t output_offset = 0;
size_t output_size = 0;

size_t code_index = 0;

private:
evmc_tx_context m_tx = {};

Expand Down Expand Up @@ -193,6 +195,7 @@ class ExecutionState
output_offset = 0;
output_size = 0;
m_tx = {};
code_index = 0;
}

[[nodiscard]] bool in_static_mode() const { return (msg->flags & EVMC_STATIC) != 0; }
Expand Down
3 changes: 1 addition & 2 deletions lib/evmone/instructions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,7 @@ inline evmc_status_code sstore(StackTop stack, ExecutionState& state) noexcept
/// Internal jump implementation for JUMP/JUMPI instructions.
inline code_iterator jump_impl(ExecutionState& state, const uint256& dst) noexcept
{
// TODO get section index from ExecutionState
const auto& jumpdest_map = state.analysis.baseline->jumpdest_maps[0];
const auto& jumpdest_map = state.analysis.baseline->jumpdest_maps[state.code_index];
if (dst >= jumpdest_map.size() || !jumpdest_map[static_cast<size_t>(dst)])
{
state.status = EVMC_BAD_JUMP_DESTINATION;
Expand Down

0 comments on commit 4a7c4be

Please sign in to comment.