mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
1. Indenting spaces converted to tabs
2. Options changed: -G --> -g
This commit is contained in:
parent
d5ddbfadbb
commit
6bf994de4d
1 changed files with 65 additions and 52 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
|
@ -32,6 +33,7 @@ int main(int argc, char** argv)
|
||||||
bool opt_interpret = false;
|
bool opt_interpret = false;
|
||||||
bool opt_dump_graph = false;
|
bool opt_dump_graph = false;
|
||||||
bool opt_unknown = false;
|
bool opt_unknown = false;
|
||||||
|
bool opt_verbose = false;
|
||||||
size_t initialGas = 10000;
|
size_t initialGas = 10000;
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
|
|
@ -45,14 +47,16 @@ int main(int argc, char** argv)
|
||||||
opt_dissassemble = true;
|
opt_dissassemble = true;
|
||||||
else if (option == "-i")
|
else if (option == "-i")
|
||||||
opt_interpret = true;
|
opt_interpret = true;
|
||||||
else if (option == "-g")
|
else if (option == "--dump-cfg")
|
||||||
opt_dump_graph = true;
|
opt_dump_graph = true;
|
||||||
else if (option == "-G" && i + 1 < argc)
|
else if (option == "-g" && i + 1 < argc)
|
||||||
{
|
{
|
||||||
std::string gasValue = argv[++i];
|
std::string gasValue = argv[++i];
|
||||||
initialGas = boost::lexical_cast<size_t>(gasValue);
|
initialGas = boost::lexical_cast<size_t>(gasValue);
|
||||||
std::cerr << "Initial gas set to " << initialGas << "\n";
|
std::cerr << "Initial gas set to " << initialGas << "\n";
|
||||||
}
|
}
|
||||||
|
else if (option == "-v")
|
||||||
|
opt_verbose = true;
|
||||||
else if (option[0] != '-' && input_file.empty())
|
else if (option[0] != '-' && input_file.empty())
|
||||||
input_file = option;
|
input_file = option;
|
||||||
else
|
else
|
||||||
|
|
@ -87,9 +91,7 @@ int main(int argc, char** argv)
|
||||||
bytes bytecode = fromHex(src);
|
bytes bytecode = fromHex(src);
|
||||||
|
|
||||||
if (opt_show_bytes)
|
if (opt_show_bytes)
|
||||||
{
|
|
||||||
std::cout << memDump(bytecode) << std::endl;
|
std::cout << memDump(bytecode) << std::endl;
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_dissassemble)
|
if (opt_dissassemble)
|
||||||
{
|
{
|
||||||
|
|
@ -99,11 +101,22 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (opt_compile || opt_interpret)
|
if (opt_compile || opt_interpret)
|
||||||
{
|
{
|
||||||
|
auto compilationStartTime = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
auto compiler = eth::jit::Compiler();
|
auto compiler = eth::jit::Compiler();
|
||||||
auto module = compiler.compile({bytecode.data(), bytecode.size()});
|
auto module = compiler.compile({bytecode.data(), bytecode.size()});
|
||||||
|
|
||||||
|
auto compilationEndTime = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
module->dump();
|
module->dump();
|
||||||
|
|
||||||
|
if (opt_verbose)
|
||||||
|
{
|
||||||
|
std::cerr << "*** Compilation time: "
|
||||||
|
<< std::chrono::duration_cast<std::chrono::microseconds>(compilationEndTime - compilationStartTime).count()
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
if (opt_dump_graph)
|
if (opt_dump_graph)
|
||||||
{
|
{
|
||||||
std::ofstream ofs("blocks.dot");
|
std::ofstream ofs("blocks.dot");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue