Browse Source

C Interface draft 1

cl-refactor
Paweł Bylica 10 years ago
parent
commit
965af120d6
  1. 30
      libevmjit/interface.c
  2. 1
      windows/LibEvmJit.vcxproj
  3. 3
      windows/LibEvmJit.vcxproj.filters

30
libevmjit/interface.c

@ -0,0 +1,30 @@
#include <stdint.h>
// JIT object opaque type
typedef struct evm_jit evm_jit;
// Contract execution return code
typedef int evm_jit_return_code;
// Host-endian 256-bit integer type
typedef struct i256 i256;
// Big-endian right aligned 256-bit hash
typedef struct h256 h256;
// Runtime data struct - must be provided by external language (Go, C++, Python)
typedef struct evm_jit_rt evm_jit_rt;
// Runtime callback functions - implementations must be provided by external language (Go, C++, Python)
void evm_jit_rt_sload(evm_jit_rt* _rt, i256* _index, i256* _ret);
void evm_jit_rt_sstore(evm_jit_rt* _rt, i256* _index, i256* _value);
void evm_jit_rt_balance(evm_jit_rt* _rt, h256* _address, i256* _ret);
// And so on...
evm_jit* evm_jit_create(evm_jit_rt* _runtime_data);
evm_jit_return_code evm_jit_execute(evm_jit* _jit);
void evm_jit_get_return_data(evm_jit* _jit, char* _return_data_offset, size_t* _return_data_size);
void evm_jit_destroy(evm_jit* _jit);

1
windows/LibEvmJit.vcxproj

@ -131,6 +131,7 @@
<ClCompile Include="..\libevmjit\ExecutionEngine.cpp" />
<ClCompile Include="..\libevmjit\Ext.cpp" />
<ClCompile Include="..\libevmjit\GasMeter.cpp" />
<ClCompile Include="..\libevmjit\interface.c" />
<ClCompile Include="..\libevmjit\Memory.cpp" />
<ClCompile Include="..\libevmjit\Runtime.cpp" />
<ClCompile Include="..\libevmjit\Stack.cpp" />

3
windows/LibEvmJit.vcxproj.filters

@ -48,6 +48,9 @@
<ClCompile Include="..\libevmjit\Arith256.cpp">
<Filter>libevmjit</Filter>
</ClCompile>
<ClCompile Include="..\libevmjit\interface.c">
<Filter>libevmjit</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\libevmjit\BasicBlock.h">

Loading…
Cancel
Save