From df51734665ff945564283bf078002ffc5169398a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 20 Jun 2018 11:34:58 +0200 Subject: [PATCH] Move interpreter to its own aleth-interpreter library --- CMakeLists.txt | 2 ++ aleth-vm/main.cpp | 1 - aleth/main.cpp | 1 - libaleth-interpreter/CMakeLists.txt | 16 ++++++++++++++++ {libevm => libaleth-interpreter}/VM.cpp | 0 {libevm => libaleth-interpreter}/VM.h | 5 +++-- {libevm => libaleth-interpreter}/VMCalls.cpp | 0 {libevm => libaleth-interpreter}/VMConfig.h | 0 {libevm => libaleth-interpreter}/VMOpt.cpp | 0 {libevm => libaleth-interpreter}/VMSIMD.cpp | 0 {libevm => libaleth-interpreter}/VMValidate.cpp | 0 {libevm => libaleth-interpreter}/interpreter.h | 0 libevm/CMakeLists.txt | 11 ++--------- libevm/EVMC.cpp | 1 - libevm/LegacyVM.h | 3 ++- libevm/VMFactory.cpp | 3 ++- test/tools/jsontests/StateTests.cpp | 1 - test/tools/jsontests/vm.h | 1 - 18 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 libaleth-interpreter/CMakeLists.txt rename {libevm => libaleth-interpreter}/VM.cpp (100%) rename {libevm => libaleth-interpreter}/VM.h (99%) rename {libevm => libaleth-interpreter}/VMCalls.cpp (100%) rename {libevm => libaleth-interpreter}/VMConfig.h (100%) rename {libevm => libaleth-interpreter}/VMOpt.cpp (100%) rename {libevm => libaleth-interpreter}/VMSIMD.cpp (100%) rename {libevm => libaleth-interpreter}/VMValidate.cpp (100%) rename {libevm => libaleth-interpreter}/interpreter.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b1ce840325d..e6ce6dd85a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,8 @@ endif() #Global include path for all libs. include_directories("${CMAKE_SOURCE_DIR}") +add_subdirectory(libaleth-interpreter) + add_subdirectory(libdevcore) add_subdirectory(libdevcrypto) add_subdirectory(libp2p) diff --git a/aleth-vm/main.cpp b/aleth-vm/main.cpp index 585a56edebe..f40c3714819 100644 --- a/aleth-vm/main.cpp +++ b/aleth-vm/main.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include diff --git a/aleth/main.cpp b/aleth/main.cpp index 79bc2fef8c0..68e74bdf8c3 100644 --- a/aleth/main.cpp +++ b/aleth/main.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include diff --git a/libaleth-interpreter/CMakeLists.txt b/libaleth-interpreter/CMakeLists.txt new file mode 100644 index 00000000000..1ce4debe948 --- /dev/null +++ b/libaleth-interpreter/CMakeLists.txt @@ -0,0 +1,16 @@ +# Aleth: Ethereum C++ client, tools and libraries. +# Copyright 2018 Aleth Autors. +# Licensed under the GNU General Public License, Version 3. See the LICENSE file. + +add_library( + aleth-interpreter + interpreter.h + VM.cpp + VM.h + VMCalls.cpp + VMConfig.h + VMOpt.cpp + VMSIMD.cpp + VMValidate.cpp +) +target_link_libraries(aleth-interpreter PRIVATE devcore aleth-buildinfo evmc::evmc evmc::instructions) diff --git a/libevm/VM.cpp b/libaleth-interpreter/VM.cpp similarity index 100% rename from libevm/VM.cpp rename to libaleth-interpreter/VM.cpp diff --git a/libevm/VM.h b/libaleth-interpreter/VM.h similarity index 99% rename from libevm/VM.h rename to libaleth-interpreter/VM.h index d08ab35a26f..6e16830de44 100644 --- a/libevm/VM.h +++ b/libaleth-interpreter/VM.h @@ -17,9 +17,10 @@ #pragma once -#include "Instruction.h" #include "VMConfig.h" -#include "VMFace.h" + +#include +#include #include #include diff --git a/libevm/VMCalls.cpp b/libaleth-interpreter/VMCalls.cpp similarity index 100% rename from libevm/VMCalls.cpp rename to libaleth-interpreter/VMCalls.cpp diff --git a/libevm/VMConfig.h b/libaleth-interpreter/VMConfig.h similarity index 100% rename from libevm/VMConfig.h rename to libaleth-interpreter/VMConfig.h diff --git a/libevm/VMOpt.cpp b/libaleth-interpreter/VMOpt.cpp similarity index 100% rename from libevm/VMOpt.cpp rename to libaleth-interpreter/VMOpt.cpp diff --git a/libevm/VMSIMD.cpp b/libaleth-interpreter/VMSIMD.cpp similarity index 100% rename from libevm/VMSIMD.cpp rename to libaleth-interpreter/VMSIMD.cpp diff --git a/libevm/VMValidate.cpp b/libaleth-interpreter/VMValidate.cpp similarity index 100% rename from libevm/VMValidate.cpp rename to libaleth-interpreter/VMValidate.cpp diff --git a/libevm/interpreter.h b/libaleth-interpreter/interpreter.h similarity index 100% rename from libevm/interpreter.h rename to libaleth-interpreter/interpreter.h diff --git a/libevm/CMakeLists.txt b/libevm/CMakeLists.txt index 64646c5111c..f5a5330ab87 100644 --- a/libevm/CMakeLists.txt +++ b/libevm/CMakeLists.txt @@ -3,17 +3,10 @@ set(sources EVMC.cpp EVMC.h ExtVMFace.cpp ExtVMFace.h Instruction.cpp Instruction.h - interpreter.h LegacyVM.cpp LegacyVM.h LegacyVMCalls.cpp LegacyVMOpt.cpp VMFace.h - VMConfig.h - VM.cpp VM.h - VMCalls.cpp - VMOpt.cpp - VMSIMD.cpp - VMValidate.cpp VMFactory.cpp VMFactory.h ) @@ -21,8 +14,8 @@ add_library(evm ${sources}) target_link_libraries( evm - PUBLIC ethcore devcore evmc::evmc evmc::instructions - PRIVATE aleth-buildinfo jsoncpp_lib_static Boost::program_options ${CMAKE_DL_LIBS} + PUBLIC ethcore devcore evmc::evmc + PRIVATE aleth-interpreter aleth-buildinfo jsoncpp_lib_static Boost::program_options ${CMAKE_DL_LIBS} ) if(EVM_OPTIMIZE) diff --git a/libevm/EVMC.cpp b/libevm/EVMC.cpp index 92159cff446..1ec7e34a70b 100644 --- a/libevm/EVMC.cpp +++ b/libevm/EVMC.cpp @@ -4,7 +4,6 @@ #include "EVMC.h" #include -#include #include namespace dev diff --git a/libevm/LegacyVM.h b/libevm/LegacyVM.h index 266ca350107..0e7f779ab37 100644 --- a/libevm/LegacyVM.h +++ b/libevm/LegacyVM.h @@ -18,9 +18,10 @@ #pragma once #include "Instruction.h" -#include "VMConfig.h" #include "VMFace.h" +#include + namespace dev { namespace eth diff --git a/libevm/VMFactory.cpp b/libevm/VMFactory.cpp index 86f9d435358..652885b8fe5 100644 --- a/libevm/VMFactory.cpp +++ b/libevm/VMFactory.cpp @@ -18,7 +18,8 @@ #include "VMFactory.h" #include "EVMC.h" #include "LegacyVM.h" -#include "interpreter.h" + +#include #include #include diff --git a/test/tools/jsontests/StateTests.cpp b/test/tools/jsontests/StateTests.cpp index 95aeac0f181..a01946ee4d5 100644 --- a/test/tools/jsontests/StateTests.cpp +++ b/test/tools/jsontests/StateTests.cpp @@ -29,7 +29,6 @@ #include #include #include -#include #include #include #include diff --git a/test/tools/jsontests/vm.h b/test/tools/jsontests/vm.h index e0d39337f24..af9638a9b60 100644 --- a/test/tools/jsontests/vm.h +++ b/test/tools/jsontests/vm.h @@ -27,7 +27,6 @@ along with cpp-ethereum. If not, see . #include #include #include -#include #include #include #include