mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Fix exporting Env callback symbols
This commit is contained in:
parent
7db676c012
commit
b8e0ad1fd4
2 changed files with 13 additions and 12 deletions
|
|
@ -11,11 +11,6 @@
|
||||||
|
|
||||||
#include "../libevmjit/Utils.h"
|
#include "../libevmjit/Utils.h"
|
||||||
|
|
||||||
namespace dev
|
|
||||||
{
|
|
||||||
namespace eth
|
|
||||||
{
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
@ -24,7 +19,10 @@ extern "C"
|
||||||
#define EXPORT
|
#define EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace jit;
|
using namespace dev;
|
||||||
|
using namespace dev::eth;
|
||||||
|
using jit::i256;
|
||||||
|
using jit::eth2llvm;
|
||||||
|
|
||||||
EXPORT void ext_store(ExtVMFace* _env, i256* _index, i256* o_value)
|
EXPORT void ext_store(ExtVMFace* _env, i256* _index, i256* o_value)
|
||||||
{
|
{
|
||||||
|
|
@ -44,13 +42,12 @@ extern "C"
|
||||||
_env->setStore(index, value); // Interface uses native endianness
|
_env->setStore(index, value); // Interface uses native endianness
|
||||||
}
|
}
|
||||||
|
|
||||||
EXPORT void ext_calldataload(ExtVMFace* _env, i256* _index, i256* o_value)
|
EXPORT void ext_calldataload(ExtVMFace* _env, i256* _index, ::byte* o_value)
|
||||||
{
|
{
|
||||||
auto index = static_cast<size_t>(llvm2eth(*_index));
|
auto index = static_cast<size_t>(llvm2eth(*_index));
|
||||||
assert(index + 31 > index); // TODO: Handle large index
|
assert(index + 31 > index); // TODO: Handle large index
|
||||||
auto b = reinterpret_cast<byte*>(o_value);
|
|
||||||
for (size_t i = index, j = 0; i <= index + 31; ++i, ++j)
|
for (size_t i = index, j = 0; i <= index + 31; ++i, ++j)
|
||||||
b[j] = i < _env->data.size() ? _env->data[i] : 0; // Keep Big Endian
|
o_value[j] = i < _env->data.size() ? _env->data[i] : 0; // Keep Big Endian
|
||||||
// TODO: It all can be done by adding padding to data or by using min() algorithm without branch
|
// TODO: It all can be done by adding padding to data or by using min() algorithm without branch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -209,6 +206,3 @@ extern "C"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -65,3 +65,10 @@ bytesConstRef VM::go(ExtVMFace& _ext, OnOpFunc const&, uint64_t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// MSVS linker ignores export symbols in Env.cpp if nothing point at least one of them
|
||||||
|
extern "C" void ext_store();
|
||||||
|
void linkerWorkaround() { ext_store(); }
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue