mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Legacy codegeneration for immutable state variables.
This commit is contained in:
committed by
chriseth
parent
83cbfbb7bf
commit
04d8ad2ae1
@@ -80,6 +80,13 @@ unsigned AssemblyItem::bytesRequired(unsigned _addressLength) const
|
||||
case PushLibraryAddress:
|
||||
case PushDeployTimeAddress:
|
||||
return 1 + 20;
|
||||
case PushImmutable:
|
||||
return 1 + 32;
|
||||
case AssignImmutable:
|
||||
if (m_immutableOccurrences)
|
||||
return 1 + (3 + 32) * *m_immutableOccurrences;
|
||||
else
|
||||
return 1 + (3 + 32) * 1024; // 1024 occurrences are beyond the maximum code size anyways.
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -90,6 +97,8 @@ int AssemblyItem::arguments() const
|
||||
{
|
||||
if (type() == Operation)
|
||||
return instructionInfo(instruction()).args;
|
||||
else if (type() == AssignImmutable)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -108,6 +117,7 @@ int AssemblyItem::returnValues() const
|
||||
case PushSubSize:
|
||||
case PushProgramSize:
|
||||
case PushLibraryAddress:
|
||||
case PushImmutable:
|
||||
case PushDeployTimeAddress:
|
||||
return 1;
|
||||
case Tag:
|
||||
@@ -135,6 +145,7 @@ bool AssemblyItem::canBeFunctional() const
|
||||
case PushProgramSize:
|
||||
case PushLibraryAddress:
|
||||
case PushDeployTimeAddress:
|
||||
case PushImmutable:
|
||||
return true;
|
||||
case Tag:
|
||||
return false;
|
||||
@@ -210,6 +221,12 @@ string AssemblyItem::toAssemblyText() const
|
||||
case PushDeployTimeAddress:
|
||||
text = string("deployTimeAddress()");
|
||||
break;
|
||||
case PushImmutable:
|
||||
text = string("immutable(\"") + toHex(util::toCompactBigEndian(data(), 1), util::HexPrefix::Add) + "\")";
|
||||
break;
|
||||
case AssignImmutable:
|
||||
text = string("assignImmutable(\"") + toHex(util::toCompactBigEndian(data(), 1), util::HexPrefix::Add) + "\")";
|
||||
break;
|
||||
case UndefinedItem:
|
||||
assertThrow(false, AssemblyException, "Invalid assembly item.");
|
||||
break;
|
||||
@@ -275,6 +292,12 @@ ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item)
|
||||
case PushDeployTimeAddress:
|
||||
_out << " PushDeployTimeAddress";
|
||||
break;
|
||||
case PushImmutable:
|
||||
_out << " PushImmutable";
|
||||
break;
|
||||
case AssignImmutable:
|
||||
_out << " AssignImmutable";
|
||||
break;
|
||||
case UndefinedItem:
|
||||
_out << " ???";
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user