From 99882a76a722e9836a31110be0cbe3361ddc0f0f Mon Sep 17 00:00:00 2001 From: Christian Date: Thu, 6 Nov 2014 14:50:18 +0100 Subject: [PATCH] Moved instructions and assembly to new libevmcore. --- CMakeLists.txt | 2 +- alethzero/CMakeLists.txt | 2 +- eth/main.cpp | 2 +- iethxi/MainWin.cpp | 2 +- libethereum/Executive.h | 2 +- libethereum/State.cpp | 2 +- libevm/CMakeLists.txt | 2 +- libevm/ExtVMFace.h | 2 +- libevm/VM.h | 2 +- {liblll => libevmcore}/Assembly.cpp | 0 {liblll => libevmcore}/Assembly.h | 2 +- {libevmface => libevmcore}/CMakeLists.txt | 2 +- libevmcore/Exceptions.h | 36 ++++++++++++++++++++++ {libevmface => libevmcore}/Instruction.cpp | 0 {libevmface => libevmcore}/Instruction.h | 7 +---- liblll/All.h | 1 - liblll/CMakeLists.txt | 2 +- liblll/CodeFragment.cpp | 2 +- liblll/CodeFragment.h | 4 +-- liblll/Exceptions.h | 3 -- libpyserpent/CMakeLists.txt | 2 +- libqethereum/QmlEthereum.cpp | 2 +- libserpent/CMakeLists.txt | 2 +- libsolidity/CMakeLists.txt | 3 +- libsolidity/CompilerContext.h | 4 +-- libweb3jsonrpc/WebThreeStubServer.cpp | 2 +- lllc/CMakeLists.txt | 2 +- lllc/main.cpp | 2 +- neth/main.cpp | 2 +- sc/CMakeLists.txt | 2 +- test/createRandomTest.cpp | 2 +- test/vm.h | 2 +- third/CMakeLists.txt | 2 +- walleth/MainWin.cpp | 2 +- windows/LibEthereum.vcxproj | 8 ++--- windows/LibEthereum.vcxproj.filters | 16 +++++----- 36 files changed, 79 insertions(+), 53 deletions(-) rename {liblll => libevmcore}/Assembly.cpp (100%) rename {liblll => libevmcore}/Assembly.h (99%) rename {libevmface => libevmcore}/CMakeLists.txt (95%) create mode 100644 libevmcore/Exceptions.h rename {libevmface => libevmcore}/Instruction.cpp (100%) rename {libevmface => libevmcore}/Instruction.h (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index b4aa2352f..d8c517fef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,7 @@ include(EthDependenciesDeprecated) createBuildInfo() add_subdirectory(libdevcore) -add_subdirectory(libevmface) +add_subdirectory(libevmcore) add_subdirectory(liblll) add_subdirectory(libserpent) add_subdirectory(libsolidity) diff --git a/alethzero/CMakeLists.txt b/alethzero/CMakeLists.txt index 0da0acb4f..01dfb88dc 100644 --- a/alethzero/CMakeLists.txt +++ b/alethzero/CMakeLists.txt @@ -53,7 +53,7 @@ else () endif () qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets) -target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore devcrypto secp256k1 gmp ${CRYPTOPP_LS} serpent lll solidity evmface devcore web3jsonrpc jsqrc) +target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore devcrypto secp256k1 gmp ${CRYPTOPP_LS} serpent lll solidity evmcore devcore web3jsonrpc jsqrc) if (APPLE) # First have qt5 install plugins and frameworks diff --git a/eth/main.cpp b/eth/main.cpp index 759dd40d0..408654018 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -32,7 +32,7 @@ #include #endif #include -#include +#include #include #include #include diff --git a/iethxi/MainWin.cpp b/iethxi/MainWin.cpp index 276ff7630..2d5b57094 100644 --- a/iethxi/MainWin.cpp +++ b/iethxi/MainWin.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include "BuildInfo.h" diff --git a/libethereum/Executive.h b/libethereum/Executive.h index cdfe23966..930c2859b 100644 --- a/libethereum/Executive.h +++ b/libethereum/Executive.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include "Transaction.h" diff --git a/libethereum/State.cpp b/libethereum/State.cpp index c125a687b..c1e1ad88e 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include "BlockChain.h" diff --git a/libevm/CMakeLists.txt b/libevm/CMakeLists.txt index 0c31a9fc3..b4aa1eef2 100644 --- a/libevm/CMakeLists.txt +++ b/libevm/CMakeLists.txt @@ -17,7 +17,7 @@ include_directories(..) target_link_libraries(${EXECUTABLE} ethcore) target_link_libraries(${EXECUTABLE} devcrypto) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} secp256k1) target_link_libraries(${EXECUTABLE} gmp) diff --git a/libevm/ExtVMFace.h b/libevm/ExtVMFace.h index 62132a462..666e7e9e8 100644 --- a/libevm/ExtVMFace.h +++ b/libevm/ExtVMFace.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include diff --git a/libevm/VM.h b/libevm/VM.h index aa58bdbb1..d8f71dfc9 100644 --- a/libevm/VM.h +++ b/libevm/VM.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include "FeeStructure.h" diff --git a/liblll/Assembly.cpp b/libevmcore/Assembly.cpp similarity index 100% rename from liblll/Assembly.cpp rename to libevmcore/Assembly.cpp diff --git a/liblll/Assembly.h b/libevmcore/Assembly.h similarity index 99% rename from liblll/Assembly.h rename to libevmcore/Assembly.h index e39f1899b..ef5294a54 100644 --- a/liblll/Assembly.h +++ b/libevmcore/Assembly.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "Exceptions.h" namespace dev diff --git a/libevmface/CMakeLists.txt b/libevmcore/CMakeLists.txt similarity index 95% rename from libevmface/CMakeLists.txt rename to libevmcore/CMakeLists.txt index f82d2b96b..738303271 100644 --- a/libevmface/CMakeLists.txt +++ b/libevmcore/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") aux_source_directory(. SRC_LIST) -set(EXECUTABLE evmface) +set(EXECUTABLE evmcore) file(GLOB HEADERS "*.h") if(ETH_STATIC) diff --git a/libevmcore/Exceptions.h b/libevmcore/Exceptions.h new file mode 100644 index 000000000..57e1ac9c6 --- /dev/null +++ b/libevmcore/Exceptions.h @@ -0,0 +1,36 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum 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. + + cpp-ethereum 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 cpp-ethereum. If not, see . +*/ +/** @file Exceptions.h + * @author Christian + * @date 2014 + */ + +#pragma once + +#include + +namespace dev +{ +namespace eth +{ + +struct AssemblyException: virtual Exception {}; +struct InvalidDeposit: virtual AssemblyException {}; +struct InvalidOpcode: virtual AssemblyException {}; + +} +} diff --git a/libevmface/Instruction.cpp b/libevmcore/Instruction.cpp similarity index 100% rename from libevmface/Instruction.cpp rename to libevmcore/Instruction.cpp diff --git a/libevmface/Instruction.h b/libevmcore/Instruction.h similarity index 98% rename from libevmface/Instruction.h rename to libevmcore/Instruction.h index fadb5ab14..0892c50dc 100644 --- a/libevmface/Instruction.h +++ b/libevmcore/Instruction.h @@ -22,18 +22,13 @@ #pragma once #include -#include - -namespace boost { namespace spirit { class utree; } } -namespace sp = boost::spirit; +#include namespace dev { namespace eth { -struct InvalidOpcode: virtual Exception {}; - /// Virtual machine bytecode instruction. enum class Instruction: uint8_t { diff --git a/liblll/All.h b/liblll/All.h index ec6989e66..7c4192f62 100644 --- a/liblll/All.h +++ b/liblll/All.h @@ -1,6 +1,5 @@ #pragma once -#include "Assembly.h" #include "CodeFragment.h" #include "Compiler.h" #include "CompilerState.h" diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index cb50cc36e..8b1581785 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -15,7 +15,7 @@ endif() include_directories(..) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index 47df8f3b9..2c200caa5 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "CompilerState.h" #include "Parser.h" using namespace std; diff --git a/liblll/CodeFragment.h b/liblll/CodeFragment.h index d6ca86bbe..b24b474da 100644 --- a/liblll/CodeFragment.h +++ b/liblll/CodeFragment.h @@ -22,8 +22,8 @@ #pragma once #include -#include -#include "Assembly.h" +#include +#include #include "Exceptions.h" namespace boost { namespace spirit { class utree; } } diff --git a/liblll/Exceptions.h b/liblll/Exceptions.h index c45215f1a..1e9671b36 100644 --- a/liblll/Exceptions.h +++ b/liblll/Exceptions.h @@ -32,16 +32,13 @@ namespace eth class CompilerException: public dev::Exception {}; class InvalidOperation: public CompilerException {}; class IntegerOutOfRange: public CompilerException {}; -class StringTooLong: public CompilerException {}; class EmptyList: public CompilerException {}; class DataNotExecutable: public CompilerException {}; class IncorrectParameterCount: public CompilerException {}; -class InvalidDeposit: public CompilerException {}; class InvalidName: public CompilerException {}; class InvalidMacroArgs: public CompilerException {}; class InvalidLiteral: public CompilerException {}; class BareSymbol: public CompilerException {}; -class ExpectedLiteral: public CompilerException {}; } } diff --git a/libpyserpent/CMakeLists.txt b/libpyserpent/CMakeLists.txt index 5108000f4..e6f32ec81 100644 --- a/libpyserpent/CMakeLists.txt +++ b/libpyserpent/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories(..) target_link_libraries(${EXECUTABLE} serpent) target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) target_link_libraries(${EXECUTABLE} ${PYTHON_LS}) diff --git a/libqethereum/QmlEthereum.cpp b/libqethereum/QmlEthereum.cpp index a7ed3df4d..b1b926f42 100644 --- a/libqethereum/QmlEthereum.cpp +++ b/libqethereum/QmlEthereum.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/libserpent/CMakeLists.txt b/libserpent/CMakeLists.txt index 0090b5dc3..c2fe89cc0 100644 --- a/libserpent/CMakeLists.txt +++ b/libserpent/CMakeLists.txt @@ -16,7 +16,7 @@ endif() include_directories(..) target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) if("${TARGET_PLATFORM}" STREQUAL "w64") diff --git a/libsolidity/CMakeLists.txt b/libsolidity/CMakeLists.txt index f425bba48..f335dd754 100644 --- a/libsolidity/CMakeLists.txt +++ b/libsolidity/CMakeLists.txt @@ -16,8 +16,7 @@ file(GLOB HEADERS "*.h") include_directories(..) -# @todo we only depend on Assembly, not on all of lll -target_link_libraries(${EXECUTABLE} evmface devcore lll) +target_link_libraries(${EXECUTABLE} evmcore devcore) install( TARGETS ${EXECUTABLE} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib ) install( FILES ${HEADERS} DESTINATION include/${EXECUTABLE} ) diff --git a/libsolidity/CompilerContext.h b/libsolidity/CompilerContext.h index 46c4c72ab..088ef43bc 100644 --- a/libsolidity/CompilerContext.h +++ b/libsolidity/CompilerContext.h @@ -23,8 +23,8 @@ #pragma once #include -#include -#include +#include +#include #include namespace dev { diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index 89d45f4e0..abb3c87cb 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -22,7 +22,7 @@ */ #include "WebThreeStubServer.h" -#include +#include #include #include #include diff --git a/lllc/CMakeLists.txt b/lllc/CMakeLists.txt index 9d5e8c5ff..a9b53c74c 100644 --- a/lllc/CMakeLists.txt +++ b/lllc/CMakeLists.txt @@ -9,7 +9,7 @@ set(EXECUTABLE lllc) add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) if ("${TARGET_PLATFORM}" STREQUAL "w64") diff --git a/lllc/main.cpp b/lllc/main.cpp index a4c9df78c..1a44ee950 100644 --- a/lllc/main.cpp +++ b/lllc/main.cpp @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "BuildInfo.h" using namespace std; using namespace dev; diff --git a/neth/main.cpp b/neth/main.cpp index 06e22f963..6be555fbb 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -30,7 +30,7 @@ #include #endif #include -#include +#include #include #if ETH_JSONRPC #include diff --git a/sc/CMakeLists.txt b/sc/CMakeLists.txt index 3cacf78e6..9aa23b03b 100644 --- a/sc/CMakeLists.txt +++ b/sc/CMakeLists.txt @@ -10,7 +10,7 @@ add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} serpent) target_link_libraries(${EXECUTABLE} lll) -target_link_libraries(${EXECUTABLE} evmface) +target_link_libraries(${EXECUTABLE} evmcore) target_link_libraries(${EXECUTABLE} devcore) if ("${TARGET_PLATFORM}" STREQUAL "w64") diff --git a/test/createRandomTest.cpp b/test/createRandomTest.cpp index 28e4342d7..321e515d6 100644 --- a/test/createRandomTest.cpp +++ b/test/createRandomTest.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include "vm.h" using namespace std; diff --git a/test/vm.h b/test/vm.h index 1ed33e5fa..a52a02e31 100644 --- a/test/vm.h +++ b/test/vm.h @@ -29,7 +29,7 @@ along with cpp-ethereum. If not, see . #include "JsonSpiritHeaders.h" #include #include -#include +#include #include #include #include diff --git a/third/CMakeLists.txt b/third/CMakeLists.txt index 6edea7456..d5371b666 100644 --- a/third/CMakeLists.txt +++ b/third/CMakeLists.txt @@ -53,7 +53,7 @@ else () endif () qt5_use_modules(${EXECUTEABLE} Core)# Gui Widgets Network WebKit WebKitWidgets) -target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmface devcore web3jsonrpc jsqrc) +target_link_libraries(${EXECUTEABLE} webthree qethereum ethereum evm ethcore secp256k1 gmp ${CRYPTOPP_LS} serpent lll evmcore devcore web3jsonrpc jsqrc) if (APPLE) # First have qt5 install plugins and frameworks diff --git a/walleth/MainWin.cpp b/walleth/MainWin.cpp index 3fa5a9388..f56cad65d 100644 --- a/walleth/MainWin.cpp +++ b/walleth/MainWin.cpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include #include "BuildInfo.h" diff --git a/windows/LibEthereum.vcxproj b/windows/LibEthereum.vcxproj index c308f05e7..30deea983 100644 --- a/windows/LibEthereum.vcxproj +++ b/windows/LibEthereum.vcxproj @@ -125,7 +125,7 @@ - + true true @@ -341,7 +341,7 @@ - + true true @@ -367,7 +367,7 @@ true - + @@ -567,4 +567,4 @@ - \ No newline at end of file + diff --git a/windows/LibEthereum.vcxproj.filters b/windows/LibEthereum.vcxproj.filters index 137440619..514320472 100644 --- a/windows/LibEthereum.vcxproj.filters +++ b/windows/LibEthereum.vcxproj.filters @@ -37,8 +37,8 @@ libevm - - libevmface + + libevmcore liblll @@ -243,14 +243,14 @@ libevm - - libevmface + + libevmcore liblll - - liblll + + libevmcore liblll @@ -449,7 +449,7 @@ {37c37803-1515-47c1-b7e6-3879f4429ab3} - + {ed9ad1b3-700c-47f9-8548-a90b5ef179ac} @@ -471,4 +471,4 @@ {d838fece-fc20-42f6-bff5-97c236159b80} - \ No newline at end of file +