Skip to content

Commit

Permalink
Merge pull request #13673 from ethereum/import-asm-json-updated
Browse files Browse the repository at this point in the history
Add support to import evm assembly json (updated).
  • Loading branch information
ekpyron authored Oct 24, 2023
2 parents 2cce9c7 + 91c7b32 commit c7e5212
Show file tree
Hide file tree
Showing 89 changed files with 3,031 additions and 113 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ jobs:

t_osx_cli:
<<: *base_osx
parallelism: 7 # Should match number of tests in .circleci/cli.sh
parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py
steps:
- checkout
- install_dependencies_osx
Expand Down Expand Up @@ -1218,7 +1218,7 @@ jobs:

t_ubu_cli: &t_ubu_cli
<<: *base_ubuntu2204_small
parallelism: 7 # Should match number of tests in .circleci/cli.sh
parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py
steps:
- cmdline_tests

Expand All @@ -1237,7 +1237,7 @@ jobs:
t_ubu_asan_cli:
# Runs slightly faster on medium but we only run it nightly so efficiency matters more.
<<: *base_ubuntu2204
parallelism: 7 # Should match number of tests in .circleci/cli.sh
parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py
environment:
<<: *base_ubuntu2204_env
ASAN_OPTIONS: check_initialization_order=true:detect_stack_use_after_return=true:strict_init_order=true:strict_string_checks=true:detect_invalid_pointer_pairs=2
Expand Down Expand Up @@ -1286,7 +1286,7 @@ jobs:

t_ubu_ubsan_clang_cli:
<<: *base_ubuntu2204_clang
parallelism: 7 # Should match number of tests in .circleci/cli.sh
parallelism: 8 # Should match number of tests in .circleci/parallel_cli_tests.py
steps:
- cmdline_tests

Expand Down
1 change: 1 addition & 0 deletions .circleci/parallel_cli_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# TODO: We should switch to time-based splitting but that requires JUnit XML report support in cmdlineTests.sh.
tests_to_run_in_parallel = [
'~ast_import_export', # ~7 min
'~evmasm_import_export', # ~5 min
'~ast_export_with_stop_after_parsing', # ~4 min
'~soljson_via_fuzzer', # ~3 min
'~via_ir_equivalence', # ~1 min
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Language Features:
Compiler Features:
* Code Generator: Remove redundant overflow checks of certain ``for`` loops when the counter variable cannot overflow.
* Commandline Interface: Add ``--no-import-callback`` option that prevents the compiler from loading source files not given explicitly on the CLI or in Standard JSON input.
* Commandline Interface: Add an experimental ``--import-asm-json`` option that can import EVM assembly in the format used by ``--asm-json``.
* Commandline Interface: Use proper severity and coloring also for error messages produced outside of the compilation pipeline.
* EVM: Deprecate support for "homestead", "tangerineWhistle", "spuriousDragon" and "byzantium" EVM versions.
* Parser: Remove the experimental error recovery mode (``--error-recovery`` / ``settings.parserErrorRecovery``).
Expand Down
54 changes: 54 additions & 0 deletions libevmasm/AbstractAssemblyStack.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
This file is part of solidity.
solidity is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
solidity is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with solidity. If not, see <http://www.gnu.org/licenses/>.
*/
// SPDX-License-Identifier: GPL-3.0

#pragma once

#include <libevmasm/LinkerObject.h>

#include <libsolutil/Common.h>
#include <libsolutil/JSON.h>

#include <string>
#include <vector>

namespace solidity::evmasm
{

class AbstractAssemblyStack
{
public:
virtual ~AbstractAssemblyStack() {}

virtual LinkerObject const& object(std::string const& _contractName) const = 0;
virtual LinkerObject const& runtimeObject(std::string const& _contractName) const = 0;

virtual std::string const* sourceMapping(std::string const& _contractName) const = 0;
virtual std::string const* runtimeSourceMapping(std::string const& _contractName) const = 0;

virtual Json::Value assemblyJSON(std::string const& _contractName) const = 0;
virtual std::string assemblyString(std::string const& _contractName, StringMap const& _sourceCodes) const = 0;

virtual std::string const filesystemFriendlyName(std::string const& _contractName) const = 0;

virtual std::vector<std::string> contractNames() const = 0;
virtual std::vector<std::string> sourceNames() const = 0;

virtual bool compilationSuccessful() const = 0;
};

} // namespace solidity::evmasm
Loading

0 comments on commit c7e5212

Please sign in to comment.