|
@ -42,7 +42,7 @@ std::array<FuncDesc, sizeOf<EnvFunc>::value> const& getEnvFuncDescs() |
|
|
FuncDesc{"env_sha3", getFunctionType(Type::Void, {Type::BytePtr, Type::Size, Type::WordPtr})}, |
|
|
FuncDesc{"env_sha3", getFunctionType(Type::Void, {Type::BytePtr, Type::Size, Type::WordPtr})}, |
|
|
FuncDesc{"env_balance", getFunctionType(Type::Void, {Type::EnvPtr, Type::WordPtr, Type::WordPtr})}, |
|
|
FuncDesc{"env_balance", getFunctionType(Type::Void, {Type::EnvPtr, Type::WordPtr, Type::WordPtr})}, |
|
|
FuncDesc{"env_create", getFunctionType(Type::Void, {Type::EnvPtr, Type::GasPtr, Type::WordPtr, Type::BytePtr, Type::Size, Type::WordPtr})}, |
|
|
FuncDesc{"env_create", getFunctionType(Type::Void, {Type::EnvPtr, Type::GasPtr, Type::WordPtr, Type::BytePtr, Type::Size, Type::WordPtr})}, |
|
|
FuncDesc{"env_call", getFunctionType(Type::Bool, {Type::EnvPtr, Type::WordPtr, Type::WordPtr, Type::WordPtr, Type::BytePtr, Type::Size, Type::BytePtr, Type::Size, Type::WordPtr})}, |
|
|
FuncDesc{"env_call", getFunctionType(Type::Bool, {Type::EnvPtr, Type::GasPtr, Type::WordPtr, Type::WordPtr, Type::BytePtr, Type::Size, Type::BytePtr, Type::Size, Type::WordPtr})}, |
|
|
FuncDesc{"env_log", getFunctionType(Type::Void, {Type::EnvPtr, Type::BytePtr, Type::Size, Type::WordPtr, Type::WordPtr, Type::WordPtr, Type::WordPtr})}, |
|
|
FuncDesc{"env_log", getFunctionType(Type::Void, {Type::EnvPtr, Type::BytePtr, Type::Size, Type::WordPtr, Type::WordPtr, Type::WordPtr, Type::WordPtr})}, |
|
|
FuncDesc{"env_blockhash", getFunctionType(Type::Void, {Type::EnvPtr, Type::WordPtr, Type::WordPtr})}, |
|
|
FuncDesc{"env_blockhash", getFunctionType(Type::Void, {Type::EnvPtr, Type::WordPtr, Type::WordPtr})}, |
|
|
FuncDesc{"env_extcode", getFunctionType(Type::BytePtr, {Type::EnvPtr, Type::WordPtr, Type::Size->getPointerTo()})}, |
|
|
FuncDesc{"env_extcode", getFunctionType(Type::BytePtr, {Type::EnvPtr, Type::WordPtr, Type::Size->getPointerTo()})}, |
|
@ -137,17 +137,15 @@ llvm::Value* Ext::create(llvm::Value* _endowment, llvm::Value* _initOff, llvm::V |
|
|
return address; |
|
|
return address; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
llvm::Value* Ext::call(llvm::Value*& _gas, llvm::Value* _receiveAddress, llvm::Value* _value, llvm::Value* _inOff, llvm::Value* _inSize, llvm::Value* _outOff, llvm::Value* _outSize, llvm::Value* _codeAddress) |
|
|
llvm::Value* Ext::call(llvm::Value* _receiveAddress, llvm::Value* _value, llvm::Value* _inOff, llvm::Value* _inSize, llvm::Value* _outOff, llvm::Value* _outSize, llvm::Value* _codeAddress) |
|
|
{ |
|
|
{ |
|
|
auto gas = byPtr(_gas); |
|
|
|
|
|
auto receiveAddress = Endianness::toBE(m_builder, _receiveAddress); |
|
|
auto receiveAddress = Endianness::toBE(m_builder, _receiveAddress); |
|
|
auto inBeg = m_memoryMan.getBytePtr(_inOff); |
|
|
auto inBeg = m_memoryMan.getBytePtr(_inOff); |
|
|
auto inSize = m_builder.CreateTrunc(_inSize, Type::Size, "in.size"); |
|
|
auto inSize = m_builder.CreateTrunc(_inSize, Type::Size, "in.size"); |
|
|
auto outBeg = m_memoryMan.getBytePtr(_outOff); |
|
|
auto outBeg = m_memoryMan.getBytePtr(_outOff); |
|
|
auto outSize = m_builder.CreateTrunc(_outSize, Type::Size, "out.size"); |
|
|
auto outSize = m_builder.CreateTrunc(_outSize, Type::Size, "out.size"); |
|
|
auto codeAddress = Endianness::toBE(m_builder, _codeAddress); |
|
|
auto codeAddress = Endianness::toBE(m_builder, _codeAddress); |
|
|
auto ret = createCall(EnvFunc::call, {getRuntimeManager().getEnvPtr(), gas, byPtr(receiveAddress), byPtr(_value), inBeg, inSize, outBeg, outSize, byPtr(codeAddress)}); |
|
|
auto ret = createCall(EnvFunc::call, {getRuntimeManager().getEnvPtr(), getRuntimeManager().getGasPtr(), byPtr(receiveAddress), byPtr(_value), inBeg, inSize, outBeg, outSize, byPtr(codeAddress)}); |
|
|
_gas = m_builder.CreateLoad(gas); // Return gas
|
|
|
|
|
|
return m_builder.CreateZExt(ret, Type::Word, "ret"); |
|
|
return m_builder.CreateZExt(ret, Type::Word, "ret"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|