mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
ExecutionEngine stub and -i program option for interpreting EVM Code
This commit is contained in:
parent
f5eda1f1b3
commit
507ba06b49
3 changed files with 51 additions and 13 deletions
18
evmcc/ExecutionEngine.cpp
Normal file
18
evmcc/ExecutionEngine.cpp
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
#include "ExecutionEngine.h"
|
||||
|
||||
namespace evmcc
|
||||
{
|
||||
|
||||
ExecutionEngine::ExecutionEngine()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
int ExecutionEngine::run(const dev::bytes& bytecode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
17
evmcc/ExecutionEngine.h
Normal file
17
evmcc/ExecutionEngine.h
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <libdevcore/Common.h>
|
||||
|
||||
namespace evmcc
|
||||
{
|
||||
|
||||
class ExecutionEngine
|
||||
{
|
||||
public:
|
||||
ExecutionEngine();
|
||||
|
||||
int run(const dev::bytes& bytecode);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
#include <libevmface/Instruction.h>
|
||||
|
||||
#include "Compiler.h"
|
||||
#include "ExecutionEngine.h"
|
||||
|
||||
using namespace dev;
|
||||
|
||||
|
|
@ -27,28 +28,23 @@ int main(int argc, char** argv)
|
|||
std::string input_file;
|
||||
bool opt_dissassemble = false;
|
||||
bool opt_show_bytes = false;
|
||||
bool opt_compile = false;
|
||||
bool opt_compile = false;
|
||||
bool opt_interpret = false;
|
||||
bool opt_unknown = false;
|
||||
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
std::string option = argv[i];
|
||||
if (option == "-b")
|
||||
{
|
||||
opt_show_bytes = true;
|
||||
}
|
||||
else if (option == "-c")
|
||||
{
|
||||
opt_compile = true;
|
||||
}
|
||||
else if (option == "-d")
|
||||
{
|
||||
opt_dissassemble = true;
|
||||
}
|
||||
else if (option[0] != '-' && input_file.empty())
|
||||
{
|
||||
input_file = option;
|
||||
}
|
||||
opt_dissassemble = true;
|
||||
else if (option == "-i")
|
||||
opt_interpret = true;
|
||||
else if (option[0] != '-' && input_file.empty())
|
||||
input_file = option;
|
||||
else
|
||||
{
|
||||
opt_unknown = true;
|
||||
|
|
@ -58,7 +54,7 @@ int main(int argc, char** argv)
|
|||
|
||||
if (opt_unknown ||
|
||||
input_file.empty() ||
|
||||
(!opt_show_bytes && !opt_compile && !opt_dissassemble))
|
||||
(!opt_show_bytes && !opt_compile && !opt_dissassemble && !opt_interpret))
|
||||
{
|
||||
show_usage();
|
||||
exit(1);
|
||||
|
|
@ -94,5 +90,12 @@ int main(int argc, char** argv)
|
|||
evmcc::Compiler().compile(bytecode);
|
||||
}
|
||||
|
||||
if (opt_interpret)
|
||||
{
|
||||
auto engine = evmcc::ExecutionEngine();
|
||||
auto result = engine.run(bytecode);
|
||||
return result;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue