mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[ewasm] Add assertion for datasize/dataoffset in BinaryTransform
This commit is contained in:
parent
6d79a8885f
commit
13652bd4a9
@ -356,11 +356,15 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call)
|
|||||||
if (_call.functionName == "dataoffset")
|
if (_call.functionName == "dataoffset")
|
||||||
{
|
{
|
||||||
string name = get<StringLiteral>(_call.arguments.at(0)).value;
|
string name = get<StringLiteral>(_call.arguments.at(0)).value;
|
||||||
|
// TODO: support the case where name refers to the current object
|
||||||
|
yulAssert(m_subModulePosAndSize.count(name), "");
|
||||||
return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast<int64_t>(m_subModulePosAndSize.at(name).first));
|
return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast<int64_t>(m_subModulePosAndSize.at(name).first));
|
||||||
}
|
}
|
||||||
else if (_call.functionName == "datasize")
|
else if (_call.functionName == "datasize")
|
||||||
{
|
{
|
||||||
string name = get<StringLiteral>(_call.arguments.at(0)).value;
|
string name = get<StringLiteral>(_call.arguments.at(0)).value;
|
||||||
|
// TODO: support the case where name refers to the current object
|
||||||
|
yulAssert(m_subModulePosAndSize.count(name), "");
|
||||||
return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast<int64_t>(m_subModulePosAndSize.at(name).second));
|
return toBytes(Opcode::I64Const) + lebEncodeSigned(static_cast<int64_t>(m_subModulePosAndSize.at(name).second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user