You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
653 B
37 lines
653 B
10 years ago
|
#include "ExecutionEngine.h"
|
||
|
|
||
|
extern "C"
|
||
|
{
|
||
|
|
||
10 years ago
|
using namespace dev::eth::jit;
|
||
10 years ago
|
|
||
10 years ago
|
void* evmjit_create() noexcept
|
||
|
{
|
||
|
return new(std::nothrow) ExecutionEngine;
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
void evmjit_destroy(ExecutionEngine* _engine) noexcept
|
||
|
{
|
||
|
delete _engine;
|
||
|
}
|
||
10 years ago
|
|
||
10 years ago
|
int evmjit_run(ExecutionEngine* _engine, RuntimeData* _data, Env* _env) noexcept
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
auto codePtr = _data->code;
|
||
|
auto codeSize = _data->codeSize;
|
||
|
bytes bytecode;
|
||
|
bytecode.insert(bytecode.end(), codePtr, codePtr + codeSize);
|
||
10 years ago
|
|
||
10 years ago
|
auto returnCode = _engine->run(bytecode, _data, _env);
|
||
|
return static_cast<int>(returnCode);
|
||
|
}
|
||
|
catch(...)
|
||
10 years ago
|
{
|
||
10 years ago
|
return static_cast<int>(ReturnCode::UnexpectedException);
|
||
10 years ago
|
}
|
||
10 years ago
|
}
|
||
|
|
||
|
}
|