Paweł Bylica
10 years ago
156 changed files with 0 additions and 5768 deletions
@ -1,51 +0,0 @@ |
|||||
cmake_policy(SET CMP0015 NEW) |
|
||||
|
|
||||
aux_source_directory(. SRC_LIST) |
|
||||
|
|
||||
include_directories(..) |
|
||||
|
|
||||
set(EXECUTABLE evmcc) |
|
||||
|
|
||||
add_executable(${EXECUTABLE} ${SRC_LIST}) |
|
||||
|
|
||||
target_link_libraries(${EXECUTABLE} boost_program_options) |
|
||||
target_link_libraries(${EXECUTABLE} devcore) |
|
||||
target_link_libraries(${EXECUTABLE} ethcore) |
|
||||
target_link_libraries(${EXECUTABLE} evmjit) |
|
||||
target_link_libraries(${EXECUTABLE} evm) |
|
||||
target_link_libraries(${EXECUTABLE} ethereum) |
|
||||
|
|
||||
if ("${TARGET_PLATFORM}" STREQUAL "w64") |
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") |
|
||||
target_link_libraries(${EXECUTABLE} gcc) |
|
||||
target_link_libraries(${EXECUTABLE} gdi32) |
|
||||
target_link_libraries(${EXECUTABLE} ws2_32) |
|
||||
target_link_libraries(${EXECUTABLE} mswsock) |
|
||||
target_link_libraries(${EXECUTABLE} shlwapi) |
|
||||
target_link_libraries(${EXECUTABLE} iphlpapi) |
|
||||
target_link_libraries(${EXECUTABLE} boost_thread_win32-mt-s) |
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS) |
|
||||
else () |
|
||||
find_package(Threads REQUIRED) |
|
||||
target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) |
|
||||
endif () |
|
||||
|
|
||||
# LLVM specific commands |
|
||||
|
|
||||
find_package(LLVM REQUIRED CONFIG) |
|
||||
|
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") |
|
||||
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") |
|
||||
|
|
||||
include_directories(${LLVM_INCLUDE_DIRS}) |
|
||||
add_definitions(${LLVM_DEFINITIONS}) |
|
||||
|
|
||||
llvm_map_components_to_libnames(llvm_libs bitwriter) |
|
||||
target_link_libraries(evmcc ${llvm_libs}) |
|
||||
|
|
||||
# end of LLVM specific commands |
|
||||
|
|
||||
|
|
||||
install( TARGETS ${EXECUTABLE} DESTINATION bin ) |
|
||||
|
|
||||
cmake_policy(SET CMP0015 NEW) |
|
@ -1,199 +0,0 @@ |
|||||
|
|
||||
#include <chrono> |
|
||||
#include <iostream> |
|
||||
#include <fstream> |
|
||||
#include <ostream> |
|
||||
#include <string> |
|
||||
#include <vector> |
|
||||
|
|
||||
#include <boost/algorithm/string.hpp> |
|
||||
#include <boost/program_options.hpp> |
|
||||
|
|
||||
#include <llvm/Bitcode/ReaderWriter.h> |
|
||||
#include <llvm/Support/raw_os_ostream.h> |
|
||||
|
|
||||
#include <libdevcore/Common.h> |
|
||||
#include <libdevcore/CommonIO.h> |
|
||||
#include <libevmcore/Instruction.h> |
|
||||
#include <libevm/ExtVMFace.h> |
|
||||
#include <libevmjit/Compiler.h> |
|
||||
#include <libevmjit/ExecutionEngine.h> |
|
||||
|
|
||||
|
|
||||
void parseProgramOptions(int _argc, char** _argv, boost::program_options::variables_map& _varMap) |
|
||||
{ |
|
||||
namespace opt = boost::program_options; |
|
||||
|
|
||||
opt::options_description explicitOpts("Allowed options"); |
|
||||
explicitOpts.add_options() |
|
||||
("help,h", "show usage information") |
|
||||
("compile,c", "compile the code to LLVM IR") |
|
||||
("interpret,i", "compile the code to LLVM IR and execute") |
|
||||
("gas,g", opt::value<size_t>(), "set initial gas for execution") |
|
||||
("disassemble,d", "dissassemble the code") |
|
||||
("dump-cfg", "dump control flow graph to graphviz file") |
|
||||
("dont-optimize", "turn off optimizations") |
|
||||
("optimize-stack", "optimize stack use between basic blocks (default: on)") |
|
||||
("rewrite-switch", "rewrite LLVM switch to branches (default: on)") |
|
||||
("output-ll", opt::value<std::string>(), "dump generated LLVM IR to file") |
|
||||
("output-bc", opt::value<std::string>(), "dump generated LLVM bitcode to file") |
|
||||
("show-logs", "output LOG statements to stderr") |
|
||||
("verbose,V", "enable verbose output"); |
|
||||
|
|
||||
opt::options_description implicitOpts("Input files"); |
|
||||
implicitOpts.add_options() |
|
||||
("input-file", opt::value<std::string>(), "input file"); |
|
||||
|
|
||||
opt::options_description allOpts(""); |
|
||||
allOpts.add(explicitOpts).add(implicitOpts); |
|
||||
|
|
||||
opt::positional_options_description inputOpts; |
|
||||
inputOpts.add("input-file", 1); |
|
||||
|
|
||||
const char* errorMsg = nullptr; |
|
||||
try |
|
||||
{ |
|
||||
auto parser = opt::command_line_parser(_argc, _argv).options(allOpts).positional(inputOpts); |
|
||||
opt::store(parser.run(), _varMap); |
|
||||
opt::notify(_varMap); |
|
||||
} |
|
||||
catch (boost::program_options::error& err) |
|
||||
{ |
|
||||
errorMsg = err.what(); |
|
||||
} |
|
||||
|
|
||||
if (!errorMsg && _varMap.count("input-file") == 0) |
|
||||
errorMsg = "missing input file name"; |
|
||||
|
|
||||
if (_varMap.count("disassemble") == 0 |
|
||||
&& _varMap.count("compile") == 0 |
|
||||
&& _varMap.count("interpret") == 0) |
|
||||
{ |
|
||||
errorMsg = "at least one of -c, -i, -d is required"; |
|
||||
} |
|
||||
|
|
||||
if (errorMsg || _varMap.count("help")) |
|
||||
{ |
|
||||
if (errorMsg) |
|
||||
std::cerr << "Error: " << errorMsg << std::endl; |
|
||||
|
|
||||
std::cout << "Usage: " << _argv[0] << " <options> input-file " << std::endl |
|
||||
<< explicitOpts << std::endl; |
|
||||
std::exit(errorMsg ? 1 : 0); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
int main(int argc, char** argv) |
|
||||
{ |
|
||||
boost::program_options::variables_map options; |
|
||||
parseProgramOptions(argc, argv, options); |
|
||||
|
|
||||
auto inputFile = options["input-file"].as<std::string>(); |
|
||||
std::ifstream ifs(inputFile); |
|
||||
if (!ifs.is_open()) |
|
||||
{ |
|
||||
std::cerr << "cannot open input file " << inputFile << std::endl; |
|
||||
exit(1); |
|
||||
} |
|
||||
|
|
||||
std::string src((std::istreambuf_iterator<char>(ifs)), |
|
||||
(std::istreambuf_iterator<char>())); |
|
||||
|
|
||||
boost::algorithm::trim(src); |
|
||||
|
|
||||
using namespace dev; |
|
||||
|
|
||||
bytes bytecode = fromHex(src); |
|
||||
|
|
||||
if (options.count("disassemble")) |
|
||||
{ |
|
||||
std::string assembly = eth::disassemble(bytecode); |
|
||||
std::cout << assembly << std::endl; |
|
||||
} |
|
||||
|
|
||||
if (options.count("compile") || options.count("interpret")) |
|
||||
{ |
|
||||
size_t initialGas = 10000; |
|
||||
|
|
||||
if (options.count("gas")) |
|
||||
initialGas = options["gas"].as<size_t>(); |
|
||||
|
|
||||
auto compilationStartTime = std::chrono::high_resolution_clock::now(); |
|
||||
|
|
||||
eth::jit::Compiler::Options compilerOptions; |
|
||||
compilerOptions.dumpCFG = options.count("dump-cfg") > 0; |
|
||||
bool optimize = options.count("dont-optimize") == 0; |
|
||||
compilerOptions.optimizeStack = optimize || options.count("optimize-stack") > 0; |
|
||||
compilerOptions.rewriteSwitchToBranches = optimize || options.count("rewrite-switch") > 0; |
|
||||
|
|
||||
auto compiler = eth::jit::Compiler(compilerOptions); |
|
||||
auto module = compiler.compile(bytecode); |
|
||||
|
|
||||
auto compilationEndTime = std::chrono::high_resolution_clock::now(); |
|
||||
|
|
||||
module->dump(); |
|
||||
|
|
||||
if (options.count("output-ll")) |
|
||||
{ |
|
||||
auto outputFile = options["output-ll"].as<std::string>(); |
|
||||
std::ofstream ofs(outputFile); |
|
||||
if (!ofs.is_open()) |
|
||||
{ |
|
||||
std::cerr << "cannot open output file " << outputFile << std::endl; |
|
||||
exit(1); |
|
||||
} |
|
||||
llvm::raw_os_ostream ros(ofs); |
|
||||
module->print(ros, nullptr); |
|
||||
ofs.close(); |
|
||||
} |
|
||||
|
|
||||
if (options.count("output-bc")) |
|
||||
{ |
|
||||
auto outputFile = options["output-bc"].as<std::string>(); |
|
||||
std::ofstream ofs(outputFile); |
|
||||
if (!ofs.is_open()) |
|
||||
{ |
|
||||
std::cerr << "cannot open output file " << outputFile << std::endl; |
|
||||
exit(1); |
|
||||
} |
|
||||
llvm::raw_os_ostream ros(ofs); |
|
||||
llvm::WriteBitcodeToFile(module.get(), ros); |
|
||||
ros.flush(); |
|
||||
ofs.close(); |
|
||||
} |
|
||||
|
|
||||
if (options.count("verbose")) |
|
||||
{ |
|
||||
std::cerr << "*** Compilation time: " |
|
||||
<< std::chrono::duration_cast<std::chrono::microseconds>(compilationEndTime - compilationStartTime).count() |
|
||||
<< std::endl; |
|
||||
} |
|
||||
|
|
||||
if (options.count("interpret")) |
|
||||
{ |
|
||||
auto engine = eth::jit::ExecutionEngine(); |
|
||||
u256 gas = initialGas; |
|
||||
|
|
||||
// Create fake ExtVM interface
|
|
||||
eth::ExtVMFace ext; |
|
||||
ext.myAddress = Address(1122334455667788); |
|
||||
ext.caller = Address(0xfacefacefaceface); |
|
||||
ext.origin = Address(101010101010101010); |
|
||||
ext.value = 0xabcd; |
|
||||
ext.gasPrice = 1002; |
|
||||
ext.previousBlock.hash = u256(1003); |
|
||||
ext.currentBlock.coinbaseAddress = Address(1004); |
|
||||
ext.currentBlock.timestamp = 1005; |
|
||||
ext.currentBlock.number = 1006; |
|
||||
ext.currentBlock.difficulty = 1007; |
|
||||
ext.currentBlock.gasLimit = 1008; |
|
||||
ext.data = std::string("Hello the Beautiful World of Ethereum!"); |
|
||||
ext.code = { 0x0d, 0x0e, 0x0a, 0x0d, 0x0b, 0x0e, 0xe, 0xf }; |
|
||||
|
|
||||
auto result = engine.run(std::move(module), gas, options.count("show-logs") > 0, ext); |
|
||||
return result; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
return 0; |
|
||||
} |
|
@ -1 +0,0 @@ |
|||||
60646107b760271460005560006001f2 |
|
@ -1,12 +0,0 @@ |
|||||
;; Should return (1975 + 39) `mod` 100 = 14 = 0x0e |
|
||||
(asm |
|
||||
100 |
|
||||
1975 |
|
||||
39 |
|
||||
ADDMOD |
|
||||
0 |
|
||||
MSTORE8 |
|
||||
0 |
|
||||
1 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60016001900160070260050160029004600490066021900560150160030260059007600303600960110860005460086000f2 |
|
@ -1,37 +0,0 @@ |
|||||
|
|
||||
(asm |
|
||||
1 |
|
||||
1 |
|
||||
SWAP1 |
|
||||
ADD ;; 2 |
|
||||
7 |
|
||||
MUL ;; 14 |
|
||||
5 |
|
||||
ADD ;; 19 |
|
||||
2 |
|
||||
SWAP1 |
|
||||
DIV ;; 9 |
|
||||
4 |
|
||||
SWAP1 |
|
||||
MOD ;; 1 |
|
||||
33 |
|
||||
SWAP1 |
|
||||
SDIV;; 0 |
|
||||
21 |
|
||||
ADD ;; 21 |
|
||||
3 |
|
||||
MUL ;; 63 |
|
||||
5 |
|
||||
SWAP1 |
|
||||
SMOD;; 3 |
|
||||
3 |
|
||||
SUB ;; 0 |
|
||||
9 |
|
||||
17 |
|
||||
EXP ;; 17^9 |
|
||||
0 |
|
||||
MSTORE |
|
||||
8 |
|
||||
0 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6201e2406000546000530960005460206000f2 |
|
@ -1,14 +0,0 @@ |
|||||
|
|
||||
(asm |
|
||||
123456 |
|
||||
0 |
|
||||
MSTORE |
|
||||
0 |
|
||||
MLOAD |
|
||||
BNOT |
|
||||
0 |
|
||||
MSTORE |
|
||||
32 |
|
||||
0 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60027ffedcba9876543210fedcba9876543210fedcba9876543210fedcba98765432100460005460206000f2 |
|
@ -1,10 +0,0 @@ |
|||||
(asm |
|
||||
0x2 |
|
||||
0xfedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210 |
|
||||
DIV |
|
||||
0 |
|
||||
MSTORE |
|
||||
32 |
|
||||
0 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60016001818101818101818101818101818101818101818101818101818101818101818101818101818101818101818101818101818101 |
|
@ -1,57 +0,0 @@ |
|||||
;; Fibbonacci unrolled |
|
||||
|
|
||||
(asm |
|
||||
1 |
|
||||
1 |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
DUP2 |
|
||||
DUP2 |
|
||||
ADD |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
7001234567890abcdef0fedcba09876543217001234567890abcdef0fedcba09876543217001234567890abcdef0fedcba0987654321020260005460206000f2 |
|
@ -1,13 +0,0 @@ |
|||||
(asm |
|
||||
0x1234567890abcdef0fedcba0987654321 |
|
||||
0x1234567890abcdef0fedcba0987654321 |
|
||||
0x1234567890abcdef0fedcba0987654321 |
|
||||
MUL |
|
||||
MUL |
|
||||
0 |
|
||||
MSTORE |
|
||||
32 |
|
||||
0 |
|
||||
RETURN |
|
||||
;; 47d0817e4167b1eb4f9fc722b133ef9d7d9a6fb4c2c1c442d000107a5e419561 |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6064601b60251560005560006001f2 |
|
@ -1,12 +0,0 @@ |
|||||
;; Should return (27 * 37) `mod` 100 = 99 = 0x63 |
|
||||
(asm |
|
||||
100 |
|
||||
27 |
|
||||
37 |
|
||||
MULMOD |
|
||||
0 |
|
||||
MSTORE8 |
|
||||
0 |
|
||||
1 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
4a |
|
@ -1 +0,0 @@ |
|||||
60326000600a37600053600a6014f2 |
|
@ -1,13 +0,0 @@ |
|||||
(asm |
|
||||
50 ;; byte count |
|
||||
0 ;; source index in calldata array |
|
||||
10 ;; dest index in memory |
|
||||
CALLDATACOPY |
|
||||
|
|
||||
0 |
|
||||
MLOAD ;; to dump memory |
|
||||
|
|
||||
10 |
|
||||
20 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
606464e8d4a510006000376000536000600af2 |
|
@ -1,13 +0,0 @@ |
|||||
(asm |
|
||||
100 ;; byte count |
|
||||
1000000000000 ;; source index in calldata array |
|
||||
0 ;; dest index in memory |
|
||||
CALLDATACOPY |
|
||||
|
|
||||
0 |
|
||||
MLOAD ;; to dump memory |
|
||||
|
|
||||
0 |
|
||||
10 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60146000600a39600053600a6014f2 |
|
@ -1,13 +0,0 @@ |
|||||
(asm |
|
||||
20 ;; byte count |
|
||||
0 ;; source index in code array |
|
||||
10 ;; dest index in memory |
|
||||
CODECOPY |
|
||||
|
|
||||
0 |
|
||||
MLOAD ;; to dump memory |
|
||||
|
|
||||
10 |
|
||||
20 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
606464e8d4a510006000396000536000600af2 |
|
@ -1,13 +0,0 @@ |
|||||
(asm |
|
||||
100 ;; byte count |
|
||||
1000000000000 ;; source index in code array |
|
||||
0 ;; dest index in memory |
|
||||
CODECOPY |
|
||||
|
|
||||
0 |
|
||||
MLOAD ;; to dump memory |
|
||||
|
|
||||
0 |
|
||||
10 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
3860006000396000536000600af2 |
|
@ -1,13 +0,0 @@ |
|||||
(asm |
|
||||
CODESIZE ;; byte count |
|
||||
0 ;; source index in code array |
|
||||
0 ;; dest index in memory |
|
||||
CODECOPY |
|
||||
|
|
||||
0 |
|
||||
MLOAD ;; to dump memory |
|
||||
|
|
||||
0 |
|
||||
10 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
5a3031333234363a4041424344455a36600035602635601335387f1111222233334444555566667777888899990000aaaabbbbccccddddeeeeffff600054602060006000f06020600060206000600030610bb8f1600053611000545b60200260002030ff60016002f2 |
|
@ -1,55 +0,0 @@ |
|||||
|
|
||||
(asm |
|
||||
PC |
|
||||
ADDRESS |
|
||||
BALANCE |
|
||||
CALLER |
|
||||
ORIGIN |
|
||||
CALLVALUE |
|
||||
CALLDATASIZE |
|
||||
GASPRICE |
|
||||
PREVHASH |
|
||||
COINBASE |
|
||||
TIMESTAMP |
|
||||
NUMBER |
|
||||
DIFFICULTY |
|
||||
GASLIMIT |
|
||||
PC |
|
||||
CALLDATASIZE |
|
||||
0 |
|
||||
CALLDATALOAD |
|
||||
38 |
|
||||
CALLDATALOAD |
|
||||
19 |
|
||||
CALLDATALOAD |
|
||||
CODESIZE |
|
||||
0x1111222233334444555566667777888899990000aaaabbbbccccddddeeeeffff |
|
||||
0 |
|
||||
MSTORE |
|
||||
32 |
|
||||
0 |
|
||||
0 |
|
||||
CREATE |
|
||||
32 |
|
||||
0 |
|
||||
32 |
|
||||
0 |
|
||||
0 |
|
||||
ADDRESS |
|
||||
3000 |
|
||||
CALL |
|
||||
0 |
|
||||
MLOAD |
|
||||
4096 |
|
||||
MSTORE |
|
||||
MSIZE |
|
||||
32 |
|
||||
MUL |
|
||||
0 |
|
||||
SHA3 |
|
||||
ADDRESS |
|
||||
SUICIDE |
|
||||
1 |
|
||||
2 |
|
||||
RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60c86000600a303c60005360006020f2 |
|
@ -1,11 +0,0 @@ |
|||||
(asm |
|
||||
200 ;; byte count |
|
||||
0 ;; source index in code array |
|
||||
10 ;; dest index in memory |
|
||||
ADDRESS |
|
||||
EXTCODECOPY |
|
||||
|
|
||||
0 MLOAD ;; to dump memory |
|
||||
|
|
||||
0 32 RETURN |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6104d26063576000606357 |
|
@ -1,9 +0,0 @@ |
|||||
|
|
||||
(asm |
|
||||
1234 |
|
||||
99 |
|
||||
SSTORE |
|
||||
0 |
|
||||
99 |
|
||||
SSTORE |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
607b607c60015760005760015660005603 |
|
@ -1,14 +0,0 @@ |
|||||
|
|
||||
(asm |
|
||||
123 |
|
||||
124 |
|
||||
1 |
|
||||
SSTORE |
|
||||
0 |
|
||||
SSTORE |
|
||||
1 |
|
||||
SLOAD |
|
||||
0 |
|
||||
SLOAD |
|
||||
SUB |
|
||||
) |
|
@ -1,7 +0,0 @@ |
|||||
let A m n = |
|
||||
if m == 0 then n+1 |
|
||||
else if n == 0 then A (m-1) 1 |
|
||||
else A (m-1) (A (m) (n-1)) |
|
||||
|
|
||||
return A 3 8 |
|
||||
|
|
@ -1 +0,0 @@ |
|||||
6009600360086012585d60005460206000f26000820e6047596000810e603859603460018303603084600185036012585d6012585d60445860436001830360016012585d604b5860018101905090509058 |
|
@ -1 +0,0 @@ |
|||||
601b602502585d |
|
@ -1,9 +0,0 @@ |
|||||
;; Indirect jump out of code |
|
||||
|
|
||||
(asm |
|
||||
27 |
|
||||
37 |
|
||||
MUL |
|
||||
JUMP |
|
||||
JUMPDEST |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60016003600302596000600058 |
|
@ -1,12 +0,0 @@ |
|||||
;; Indirect jump into data |
|
||||
|
|
||||
(asm |
|
||||
1 ;; 0 |
|
||||
3 |
|
||||
3 |
|
||||
MUL ;; 6 |
|
||||
JUMPI ;; 7 |
|
||||
0 ;; 8 |
|
||||
0 |
|
||||
JUMP |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6103e758 |
|
@ -1,6 +0,0 @@ |
|||||
;; Direct jump out of code. |
|
||||
|
|
||||
(asm |
|
||||
999 |
|
||||
JUMP |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6004586000600058 |
|
@ -1,9 +0,0 @@ |
|||||
;; Direct jump into data |
|
||||
|
|
||||
(asm |
|
||||
4 ;; 0 0-3 |
|
||||
JUMP ;; 2 |
|
||||
0 ;; 3 3-4 |
|
||||
0 ;; 5 4-7 |
|
||||
JUMP ;; 6 |
|
||||
) |
|
@ -1,5 +0,0 @@ |
|||||
let f n = n + 1 |
|
||||
|
|
||||
return f 2 |
|
||||
|
|
||||
|
|
@ -1 +0,0 @@ |
|||||
600760026010585d60005460206000f28060010190509058 |
|
@ -1,5 +0,0 @@ |
|||||
let f a b = a + b |
|
||||
|
|
||||
return f 2 3 |
|
||||
|
|
||||
|
|
@ -1 +0,0 @@ |
|||||
6009600260036012585d60005460206000f2818101905090509058 |
|
@ -1,5 +0,0 @@ |
|||||
let fac n = |
|
||||
if n == 0 then 1 |
|
||||
else n * fac (n-1) |
|
||||
|
|
||||
return fac 60 |
|
@ -1 +0,0 @@ |
|||||
6007603c6010585d60005460206000f26000810e6026596020600182036010585d8102602858600190509058 |
|
@ -1,5 +0,0 @@ |
|||||
let fac a n = |
|
||||
if n == 0 then a |
|
||||
else fac (a*n) (n-1) |
|
||||
|
|
||||
return fac 1 60 |
|
@ -1 +0,0 @@ |
|||||
60096001603c6012585d60005460206000f26000810e6029596025818302600183036012585d602a5881905090509058 |
|
@ -1,6 +0,0 @@ |
|||||
let fib n = |
|
||||
if n < 3 then 1 |
|
||||
else fib (n-1) + fib (n-2) |
|
||||
|
|
||||
return fib 10 |
|
||||
|
|
@ -1 +0,0 @@ |
|||||
6007600a6010585d60005460206000f26003810a602f596020600282036010585d602a600183036010585d01603158600190509058 |
|
@ -1 +0,0 @@ |
|||||
600a60805460006080530b0f60255960a0536080530160a054600160805303608054600558 |
|
@ -1,3 +0,0 @@ |
|||||
(for [i]:10 (> @i 0) [i](- @i 1) |
|
||||
[j](+ @i @j) |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6000608054600a6080530a0f60255960a0536080530160a054600160805301608054600558 |
|
@ -1,3 +0,0 @@ |
|||||
(for [i]:0 (< @i 10) [i](+ @i 1) |
|
||||
[j](+ @i @j) |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
return if 0 then 1 else 2 |
|
@ -1 +0,0 @@ |
|||||
60006300000010596002630000001258600160005460206000f2 |
|
@ -1 +0,0 @@ |
|||||
return if 1 then 1 else 2 |
|
@ -1 +0,0 @@ |
|||||
60016300000010596002630000001258600160005460206000f2 |
|
@ -1 +0,0 @@ |
|||||
600460030158005d6001600054 |
|
@ -1,13 +0,0 @@ |
|||||
;; Indirect JUMP |
|
||||
|
|
||||
(asm |
|
||||
4 ;; 0 |
|
||||
3 ;; 2 |
|
||||
ADD ;; 4 |
|
||||
JUMP ;; 5 |
|
||||
STOP ;; 6 |
|
||||
JUMPDEST ;; 7 |
|
||||
1 |
|
||||
0 |
|
||||
MSTORE |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
600860060158005d6001600054005d600260005400 |
|
@ -1,19 +0,0 @@ |
|||||
;; Indirect JUMP |
|
||||
|
|
||||
(asm |
|
||||
8 ;; 0 |
|
||||
6 ;; 2 |
|
||||
ADD ;; 4 |
|
||||
JUMP ;; 5 --> 14 |
|
||||
STOP ;; 6 |
|
||||
JUMPDEST ;; 7 |
|
||||
1 ;; 8 |
|
||||
0 ;; 10 |
|
||||
MSTORE ;; 12 |
|
||||
STOP ;; 13 |
|
||||
JUMPDEST ;; 14 |
|
||||
2 |
|
||||
0 |
|
||||
MSTORE |
|
||||
STOP |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6001600460050159005d6001600054 |
|
@ -1,14 +0,0 @@ |
|||||
;; Indirect JUMP |
|
||||
|
|
||||
(asm |
|
||||
1 ;; 0 |
|
||||
4 ;; 2 |
|
||||
5 ;; 4 |
|
||||
ADD ;; 6 |
|
||||
JUMPI ;; 7 |
|
||||
STOP ;; 8 |
|
||||
JUMPDEST ;; 9 |
|
||||
1 |
|
||||
0 |
|
||||
MSTORE |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
60006007600501596001600054005d00 |
|
@ -1,15 +0,0 @@ |
|||||
;; Indirect JUMP |
|
||||
|
|
||||
(asm |
|
||||
0 ;; 0 |
|
||||
7 ;; 2 |
|
||||
5 ;; 4 |
|
||||
ADD ;; 6 |
|
||||
JUMPI ;; 7 |
|
||||
1 ;; 8 |
|
||||
0 ;; 9 |
|
||||
MSTORE ;; 10 |
|
||||
STOP ;; 11 |
|
||||
JUMPDEST ;; 12 |
|
||||
STOP |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
600458006001600154 |
|
@ -1,11 +0,0 @@ |
|||||
;; Direct JUMP. |
|
||||
;; output: memory[1] == 1 |
|
||||
|
|
||||
(asm |
|
||||
4 ;; 0 |
|
||||
JUMP ;; 2 |
|
||||
STOP ;; 3 |
|
||||
1 ;; 4 |
|
||||
1 ;; 6 |
|
||||
MSTORE ;; 8 |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6008586001600154 |
|
@ -1,10 +0,0 @@ |
|||||
;; Direct JUMP to the end of code. |
|
||||
;; output: memory should have size 0. |
|
||||
|
|
||||
(asm |
|
||||
8 ;; 0 |
|
||||
JUMP ;; 2 |
|
||||
1 ;; 3 |
|
||||
1 ;; 5 |
|
||||
MSTORE ;; 7 |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
602a586001600154 |
|
@ -1,10 +0,0 @@ |
|||||
;; Direct JUMP past the end of code. |
|
||||
;; output: memory should have size 0. |
|
||||
|
|
||||
(asm |
|
||||
42 |
|
||||
JUMP |
|
||||
1 |
|
||||
1 |
|
||||
MSTORE |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
600b6009580000600558005d6001600154 |
|
@ -1,17 +0,0 @@ |
|||||
;; Direct JUMP. |
|
||||
;; output: memory[1] = 1 |
|
||||
|
|
||||
(asm |
|
||||
11 ;; 0 |
|
||||
9 ;; 2 |
|
||||
JUMP ;; 4 --> 9 |
|
||||
STOP ;; 5 |
|
||||
STOP ;; 6 |
|
||||
5 ;; 7 |
|
||||
JUMP ;; 9 --> 11 |
|
||||
STOP ;; 10 |
|
||||
JUMPDEST |
|
||||
1 ;; 11 |
|
||||
1 |
|
||||
MSTORE |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6005600e585d600160015400600f5800 |
|
@ -1,16 +0,0 @@ |
|||||
;; Direct JUMP. |
|
||||
;; output: memory[1] = 1 |
|
||||
|
|
||||
(asm |
|
||||
5 ;; 0 |
|
||||
14 ;; 2 |
|
||||
JUMP ;; 4 --> 14 |
|
||||
JUMPDEST ;; 5 |
|
||||
1 ;; 6 |
|
||||
1 ;; 8 |
|
||||
MSTORE ;; 10 |
|
||||
STOP ;; 11 |
|
||||
15 ;; 12 |
|
||||
JUMP ;; 14 --> 5 |
|
||||
STOP ;; 15 |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
600358600f600d58006014600758005d6001600154005d600260025400 |
|
@ -1,32 +0,0 @@ |
|||||
;; Direct JUMP. |
|
||||
;; output: memory[1] = 1 |
|
||||
|
|
||||
;; 0, 2 --> 3 .. 7 --> 13 -*-> 15 .. 19 |
|
||||
|
|
||||
(asm |
|
||||
3 ;; 0 |
|
||||
JUMP ;; 2 |
|
||||
|
|
||||
15 ;; 3 <- start |
|
||||
13 ;; 5 |
|
||||
JUMP ;; 7 <- b |
|
||||
STOP ;; 8 |
|
||||
|
|
||||
20 ;; 9 |
|
||||
7 ;; 11 |
|
||||
|
|
||||
JUMP ;; 13 <- a |
|
||||
STOP ;; 14 |
|
||||
|
|
||||
JUMPDEST ;; 15 <- c |
|
||||
1 ;; 16 |
|
||||
1 ;; 18 |
|
||||
MSTORE ;; 19 |
|
||||
STOP ;; 20 |
|
||||
|
|
||||
JUMPDEST ;; 21 <- d |
|
||||
2 ;; 22 |
|
||||
2 ;; 24 |
|
||||
MSTORE ;; 26 |
|
||||
STOP ;; 27 |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
600a6000545d6000536001900380600054600659 |
|
@ -1 +0,0 @@ |
|||||
(asm 10 0 MSTORE JUMPDEST 0 MLOAD 1 SWAP1 SUB DUP1 0 MSTORE 6 JUMPI) |
|
@ -1 +0,0 @@ |
|||||
600a600181038060025960005460015460025400 |
|
@ -1,27 +0,0 @@ |
|||||
;; Produces 1 2 3 4 5 6 7 8 9 10 on the stack and exits |
|
||||
|
|
||||
(asm |
|
||||
10 |
|
||||
|
|
||||
;; 2 |
|
||||
1 |
|
||||
DUP2 |
|
||||
SUB |
|
||||
DUP1 |
|
||||
2 |
|
||||
JUMPI |
|
||||
|
|
||||
;; stack = 1 2 3 4 5 6 7 8 9 10 |
|
||||
0 |
|
||||
MSTORE |
|
||||
1 |
|
||||
MSTORE |
|
||||
2 |
|
||||
MSTORE |
|
||||
;;3 |
|
||||
;;MSTORE |
|
||||
|
|
||||
STOP |
|
||||
) |
|
||||
|
|
||||
|
|
@ -1 +0,0 @@ |
|||||
600a80600190038060025960005460015460025400 |
|
@ -1,28 +0,0 @@ |
|||||
;; Produces 1 2 3 4 5 6 7 8 9 10 on the stack and exits |
|
||||
|
|
||||
(asm |
|
||||
10 |
|
||||
|
|
||||
;; 2 |
|
||||
DUP1 |
|
||||
1 |
|
||||
SWAP1 |
|
||||
SUB |
|
||||
DUP1 |
|
||||
2 |
|
||||
JUMPI |
|
||||
|
|
||||
;; stack = 1 2 3 4 5 6 7 8 9 10 |
|
||||
0 |
|
||||
MSTORE |
|
||||
1 |
|
||||
MSTORE |
|
||||
2 |
|
||||
MSTORE |
|
||||
;;3 |
|
||||
;;MSTORE |
|
||||
|
|
||||
STOP |
|
||||
) |
|
||||
|
|
||||
|
|
@ -1,4 +0,0 @@ |
|||||
let f n = |
|
||||
if n == 0 then 2 else f (n-1) |
|
||||
|
|
||||
return f 10 |
|
@ -1 +0,0 @@ |
|||||
6007600a6010585d60005460206000f26000810e6024596020600182036010585d602658600290509058 |
|
@ -1,10 +0,0 @@ |
|||||
.code: |
|
||||
PUSH 1 |
|
||||
NOT |
|
||||
PUSH [tag0] |
|
||||
JUMPI |
|
||||
PUSH 13 |
|
||||
PUSH 128 |
|
||||
MSTORE |
|
||||
tag0: |
|
||||
|
|
@ -1 +0,0 @@ |
|||||
60010f600b59600d608054 |
|
@ -1,2 +0,0 @@ |
|||||
(when (> 1 0) [i] 13) |
|
||||
|
|
@ -1 +0,0 @@ |
|||||
33604557602a8060106000396000f200604556330e0f602a59366080530a0f602a59602060805301356080533557604060805301608054600958 |
|
@ -1,10 +0,0 @@ |
|||||
{ |
|
||||
[[69]] (caller) |
|
||||
(return 0 (lll |
|
||||
(when (= (caller) @@69) |
|
||||
(for {} (< @i (calldatasize)) [i](+ @i 64) |
|
||||
[[ (calldataload @i) ]] (calldataload (+ @i 32)) |
|
||||
) |
|
||||
) |
|
||||
0)) |
|
||||
} |
|
@ -1 +0,0 @@ |
|||||
7f112233445566778899001122334455667788990011223344556677889900aabb6000137f112233445566778899001122334455667788990011223344556677889900aabb6001137f112233445566778899001122334455667788990011223344556677889900aabb6002137f112233445566778899001122334455667788990011223344556677889900aabb6003137f112233445566778899001122334455667788990011223344556677889900aabb6004137f112233445566778899001122334455667788990011223344556677889900aabb6005137f112233445566778899001122334455667788990011223344556677889900aabb6006137f112233445566778899001122334455667788990011223344556677889900aabb6007137f112233445566778899001122334455667788990011223344556677889900aabb6008137f112233445566778899001122334455667788990011223344556677889900aabb6009137f112233445566778899001122334455667788990011223344556677889900aabb600a137f112233445566778899001122334455667788990011223344556677889900aabb600b137f112233445566778899001122334455667788990011223344556677889900aabb600c137f112233445566778899001122334455667788990011223344556677889900aabb600d137f112233445566778899001122334455667788990011223344556677889900aabb600e137f112233445566778899001122334455667788990011223344556677889900aabb600f137f112233445566778899001122334455667788990011223344556677889900aabb6010137f112233445566778899001122334455667788990011223344556677889900aabb6011137f112233445566778899001122334455667788990011223344556677889900aabb6012137f112233445566778899001122334455667788990011223344556677889900aabb6013137f112233445566778899001122334455667788990011223344556677889900aabb6014137f112233445566778899001122334455667788990011223344556677889900aabb6015137f112233445566778899001122334455667788990011223344556677889900aabb6016137f112233445566778899001122334455667788990011223344556677889900aabb6017137f112233445566778899001122334455667788990011223344556677889900aabb6018137f112233445566778899001122334455667788990011223344556677889900aabb6019137f112233445566778899001122334455667788990011223344556677889900aabb601a137f112233445566778899001122334455667788990011223344556677889900aabb601b137f112233445566778899001122334455667788990011223344556677889900aabb601c137f112233445566778899001122334455667788990011223344556677889900aabb601d137f112233445566778899001122334455667788990011223344556677889900aabb601e137f112233445566778899001122334455667788990011223344556677889900aabb601f137f112233445566778899001122334455667788990011223344556677889900aabb6020137f112233445566778899001122334455667788990011223344556677889900aabb6107de13 |
|
@ -1,105 +0,0 @@ |
|||||
|
|
||||
(asm |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
0 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
1 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
2 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
3 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
4 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
5 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
6 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
7 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
8 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
9 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
10 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
11 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
12 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
13 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
14 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
15 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
16 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
17 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
18 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
19 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
20 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
21 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
22 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
23 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
24 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
25 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
26 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
27 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
28 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
29 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
30 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
31 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
32 |
|
||||
BYTE |
|
||||
0x112233445566778899001122334455667788990011223344556677889900aabb |
|
||||
2014 |
|
||||
BYTE |
|
||||
) |
|
@ -1 +0,0 @@ |
|||||
6001610d805b01556504409585d6df620493e05462061a80535b01 |
|
@ -1,15 +0,0 @@ |
|||||
|
|
||||
(asm ;; [] |
|
||||
1 |
|
||||
3456 |
|
||||
MSIZE |
|
||||
ADD |
|
||||
MSTORE8 ;; [02] |
|
||||
4675432994527 |
|
||||
300000 |
|
||||
MSTORE |
|
||||
400000 |
|
||||
MLOAD |
|
||||
MSIZE |
|
||||
ADD |
|
||||
) |
|
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue