Merge pull request #11948 from ethereum/remove-assemblyitemtype-pushstring

Remove unused AssemblyItemType::PushString.
This commit is contained in:
chriseth 2021-09-13 19:39:59 +02:00 committed by GitHub
commit 49cde9d47b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 1 additions and 31 deletions

View File

@ -250,10 +250,6 @@ Json::Value Assembly::assemblyJSON(map<string, unsigned> const& _sourceIndices)
collection.append( collection.append(
createJsonValue("PUSH", sourceIndex, i.location().start, i.location().end, toStringInHex(i.data()), i.getJumpTypeAsString())); createJsonValue("PUSH", sourceIndex, i.location().start, i.location().end, toStringInHex(i.data()), i.getJumpTypeAsString()));
break; break;
case PushString:
collection.append(
createJsonValue("PUSH tag", sourceIndex, i.location().start, i.location().end, m_strings.at(h256(i.data()))));
break;
case PushTag: case PushTag:
if (i.data() == 0) if (i.data() == 0)
collection.append( collection.append(
@ -621,19 +617,6 @@ LinkerObject const& Assembly::assemble() const
case Operation: case Operation:
ret.bytecode.push_back(static_cast<uint8_t>(i.instruction())); ret.bytecode.push_back(static_cast<uint8_t>(i.instruction()));
break; break;
case PushString:
{
ret.bytecode.push_back(static_cast<uint8_t>(Instruction::PUSH32));
unsigned ii = 0;
for (auto j: m_strings.at(h256(i.data())))
if (++ii > 32)
break;
else
ret.bytecode.push_back(uint8_t(j));
while (ii++ < 32)
ret.bytecode.push_back(0);
break;
}
case Push: case Push:
{ {
unsigned b = max<unsigned>(1, util::bytesRequired(i.data())); unsigned b = max<unsigned>(1, util::bytesRequired(i.data()));

View File

@ -70,8 +70,6 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength) const
case Operation: case Operation:
case Tag: // 1 byte for the JUMPDEST case Tag: // 1 byte for the JUMPDEST
return 1; return 1;
case PushString:
return 1 + 32;
case Push: case Push:
return 1 + max<size_t>(1, util::bytesRequired(data())); return 1 + max<size_t>(1, util::bytesRequired(data()));
case PushSubSize: case PushSubSize:
@ -118,7 +116,6 @@ size_t AssemblyItem::returnValues() const
case Operation: case Operation:
return static_cast<size_t>(instructionInfo(instruction()).ret); return static_cast<size_t>(instructionInfo(instruction()).ret);
case Push: case Push:
case PushString:
case PushTag: case PushTag:
case PushData: case PushData:
case PushSub: case PushSub:
@ -147,7 +144,6 @@ bool AssemblyItem::canBeFunctional() const
case Operation: case Operation:
return !isDupInstruction(instruction()) && !isSwapInstruction(instruction()); return !isDupInstruction(instruction()) && !isSwapInstruction(instruction());
case Push: case Push:
case PushString:
case PushTag: case PushTag:
case PushData: case PushData:
case PushSub: case PushSub:
@ -195,9 +191,6 @@ string AssemblyItem::toAssemblyText(Assembly const& _assembly) const
case Push: case Push:
text = toHex(util::toCompactBigEndian(data(), 1), util::HexPrefix::Add); text = toHex(util::toCompactBigEndian(data(), 1), util::HexPrefix::Add);
break; break;
case PushString:
text = string("data_") + util::toHex(data());
break;
case PushTag: case PushTag:
{ {
size_t sub{0}; size_t sub{0};
@ -276,9 +269,6 @@ ostream& solidity::evmasm::operator<<(ostream& _out, AssemblyItem const& _item)
case Push: case Push:
_out << " PUSH " << hex << _item.data() << dec; _out << " PUSH " << hex << _item.data() << dec;
break; break;
case PushString:
_out << " PushString" << hex << (unsigned)_item.data() << dec;
break;
case PushTag: case PushTag:
{ {
size_t subId = _item.splitForeignPushTag().first; size_t subId = _item.splitForeignPushTag().first;

View File

@ -38,7 +38,6 @@ enum AssemblyItemType
UndefinedItem, UndefinedItem,
Operation, Operation,
Push, Push,
PushString,
PushTag, PushTag,
PushSub, PushSub,
PushSubSize, PushSubSize,

View File

@ -47,7 +47,6 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _
case Push: case Push:
case PushTag: case PushTag:
case PushData: case PushData:
case PushString:
case PushSub: case PushSub:
case PushSubSize: case PushSubSize:
case PushProgramSize: case PushProgramSize:

View File

@ -112,7 +112,7 @@ struct PushPop: SimplePeepholeOptimizerMethod<PushPop, 2>
auto t = _push.type(); auto t = _push.type();
return _pop == Instruction::POP && ( return _pop == Instruction::POP && (
SemanticInformation::isDupInstruction(_push) || SemanticInformation::isDupInstruction(_push) ||
t == Push || t == PushString || t == PushTag || t == PushSub || t == Push || t == PushTag || t == PushSub ||
t == PushSubSize || t == PushProgramSize || t == PushData || t == PushLibraryAddress t == PushSubSize || t == PushProgramSize || t == PushData || t == PushLibraryAddress
); );
} }

View File

@ -41,7 +41,6 @@ bool SemanticInformation::breaksCSEAnalysisBlock(AssemblyItem const& _item, bool
case VerbatimBytecode: case VerbatimBytecode:
return true; return true;
case Push: case Push:
case PushString:
case PushTag: case PushTag:
case PushSub: case PushSub:
case PushSubSize: case PushSubSize: