From 53305d4d0cc2277d6692205ced45b42ca517e871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 28 Sep 2022 11:11:29 +0200 Subject: [PATCH] eof: Do not pad code for EOF --- lib/evmone/baseline.cpp | 5 ++--- lib/evmone/baseline.hpp | 4 ++++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/evmone/baseline.cpp b/lib/evmone/baseline.cpp index 340df3cc1e..7c8b2b260c 100644 --- a/lib/evmone/baseline.cpp +++ b/lib/evmone/baseline.cpp @@ -71,9 +71,8 @@ CodeAnalysis analyze_legacy(bytes_view code) CodeAnalysis analyze_eof1(bytes_view eof_container, const EOF1Header& header) { - // TODO: Padding code for EOF is not needed. - const auto code = eof_container.substr(header.code_begin(), header.code_size); - return {pad_code(code), analyze_jumpdests(code)}; + const auto executable_code = eof_container.substr(header.code_begin(), header.code_size); + return {executable_code.data(), analyze_jumpdests(executable_code)}; } } // namespace diff --git a/lib/evmone/baseline.hpp b/lib/evmone/baseline.hpp index 49835d56fb..37d0da6c6b 100644 --- a/lib/evmone/baseline.hpp +++ b/lib/evmone/baseline.hpp @@ -37,6 +37,10 @@ class CodeAnalysis jumpdest_map{std::move(map)}, m_padded_code{std::move(padded_code)} {} + + CodeAnalysis(const uint8_t* code, JumpdestMap map) + : executable_code{code}, jumpdest_map{std::move(map)} + {} }; static_assert(std::is_move_constructible_v); static_assert(std::is_move_assignable_v);