@@ -63,38 +63,20 @@ AssemblyItem AssemblyItem::toSubAssemblyTag(SubAssemblyID _subId) const
6363
6464std::pair<SubAssemblyID, size_t > AssemblyItem::splitForeignPushTag () const
6565{
66- solAssert (m_type == PushTag || m_type == Tag || m_type == RelativeJump || m_type == ConditionalRelativeJump );
66+ solAssert (m_type == PushTag || m_type == Tag);
6767 u256 combined = u256 (data ());
6868 // the combined u256 is 'dirty', so we can't use the conversion constructor of SubAssemblyID here
6969 SubAssemblyID const subID{static_cast <SubAssemblyID::ValueType>((combined >> 64 ) - 1 )};
7070 size_t tag = static_cast <size_t >(combined & 0xffffffffffffffffULL );
7171 return std::make_pair (subID, tag);
7272}
7373
74- size_t AssemblyItem::relativeJumpTagID () const
75- {
76- solAssert (m_type == RelativeJump || m_type == ConditionalRelativeJump);
77- auto const [subId, tagId] = splitForeignPushTag ();
78- solAssert (subId.empty (), " Relative jump to sub" );
79- return tagId;
80- }
81-
8274std::pair<std::string, std::string> AssemblyItem::nameAndData (langutil::EVMVersion _evmVersion) const
8375{
8476 switch (type ())
8577 {
8678 case Operation:
87- case EOFCreate:
88- case ReturnContract:
89- case RelativeJump:
90- case ConditionalRelativeJump:
91- case CallF:
92- case JumpF:
93- case RetF:
9479 return {instructionInfo (instruction (), _evmVersion).name , " " };
95- case SwapN:
96- case DupN:
97- return {instructionInfo (instruction (), _evmVersion).name , util::toString (static_cast <size_t >(data ())) };
9880 case Push:
9981 return {" PUSH" , toStringInHex (data ())};
10082 case PushTag:
@@ -122,8 +104,6 @@ std::pair<std::string, std::string> AssemblyItem::nameAndData(langutil::EVMVersi
122104 return {" PUSH data" , toStringInHex (data ())};
123105 case VerbatimBytecode:
124106 return {" VERBATIM" , util::toHex (verbatimData ())};
125- case AuxDataLoadN:
126- return {" AUXDATALOADN" , util::toString (data ())};
127107 case UndefinedItem:
128108 solAssert (false );
129109 }
@@ -133,8 +113,7 @@ std::pair<std::string, std::string> AssemblyItem::nameAndData(langutil::EVMVersi
133113
134114void AssemblyItem::setPushTagSubIdAndTag (SubAssemblyID _subId, size_t _tag)
135115{
136- solAssert (m_type == PushTag || m_type == Tag || m_type == RelativeJump || m_type == ConditionalRelativeJump);
137- solAssert (!(m_type == RelativeJump || m_type == ConditionalRelativeJump) || _subId.empty ());
116+ solAssert (m_type == PushTag || m_type == Tag);
138117 u256 data = _tag;
139118 if (!_subId.empty ())
140119 data |= (u256 (_subId.value ) + 1 ) << 64 ;
@@ -147,7 +126,6 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength, langutil::EVMVersion _
147126 {
148127 case Operation:
149128 case Tag: // 1 byte for the JUMPDEST
150- case RetF:
151129 return 1 ;
152130 case Push:
153131 return
@@ -187,20 +165,6 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength, langutil::EVMVersion _
187165 }
188166 case VerbatimBytecode:
189167 return std::get<2 >(*m_verbatimBytecode).size ();
190- case RelativeJump:
191- case ConditionalRelativeJump:
192- case AuxDataLoadN:
193- case JumpF:
194- case CallF:
195- return 1 + 2 ;
196- case EOFCreate:
197- return 2 ;
198- case ReturnContract:
199- return 2 ;
200- case SwapN:
201- return 2 ;
202- case DupN:
203- return 2 ;
204168 case UndefinedItem:
205169 solAssert (false );
206170 }
@@ -210,15 +174,8 @@ size_t AssemblyItem::bytesRequired(size_t _addressLength, langutil::EVMVersion _
210174
211175size_t AssemblyItem::arguments () const
212176{
213- if (type () == CallF || type () == JumpF)
214- return functionSignature ().argsNum ;
215- else if (type () == SwapN)
216- return static_cast <size_t >(data ()) + 1 ;
217- else if (type () == DupN)
218- return static_cast <size_t >(data ());
219- else if (hasInstruction ())
177+ if (hasInstruction ())
220178 {
221- solAssert (instruction () != Instruction::CALLF && instruction () != Instruction::JUMPF );
222179 // The latest EVMVersion is used here, since the InstructionInfo is assumed to be
223180 // the same across all EVM versions except for the instruction name.
224181 return static_cast <size_t >(instructionInfo (instruction (), EVMVersion ()).args );
@@ -236,17 +193,9 @@ size_t AssemblyItem::returnValues() const
236193 switch (m_type)
237194 {
238195 case Operation:
239- case EOFCreate:
240- case ReturnContract:
241- case RelativeJump:
242- case ConditionalRelativeJump:
243- case RetF:
244196 // The latest EVMVersion is used here, since the InstructionInfo is assumed to be
245197 // the same across all EVM versions except for the instruction name.
246198 return static_cast <size_t >(instructionInfo (instruction (), EVMVersion ()).ret );
247- case SwapN:
248- case DupN:
249- return static_cast <size_t >(data ()) + 1 ;
250199 case Push:
251200 case PushTag:
252201 case PushData:
@@ -261,11 +210,6 @@ size_t AssemblyItem::returnValues() const
261210 return 0 ;
262211 case VerbatimBytecode:
263212 return std::get<1 >(*m_verbatimBytecode);
264- case AuxDataLoadN:
265- return 1 ;
266- case JumpF:
267- case CallF:
268- return functionSignature ().retsNum ;
269213 case AssignImmutable:
270214 case UndefinedItem:
271215 break ;
@@ -280,16 +224,6 @@ bool AssemblyItem::canBeFunctional() const
280224 switch (m_type)
281225 {
282226 case Operation:
283- case EOFCreate:
284- case ReturnContract:
285- case RelativeJump:
286- case ConditionalRelativeJump:
287- case CallF:
288- case JumpF:
289- case SwapN:
290- case DupN:
291- case RetF:
292- return !SemanticInformation::isDupInstruction (*this ) && !SemanticInformation::isSwapInstruction (*this );
293227 case Push:
294228 case PushTag:
295229 case PushData:
@@ -299,7 +233,6 @@ bool AssemblyItem::canBeFunctional() const
299233 case PushLibraryAddress:
300234 case PushDeployTimeAddress:
301235 case PushImmutable:
302- case AuxDataLoadN:
303236 return true ;
304237 case Tag:
305238 return false ;
@@ -401,37 +334,6 @@ std::string AssemblyItem::toAssemblyText(Assembly const& _assembly) const
401334 case VerbatimBytecode:
402335 text = std::string (" verbatimbytecode_" ) + util::toHex (std::get<2 >(*m_verbatimBytecode));
403336 break ;
404- case AuxDataLoadN:
405- assertThrow (data () <= std::numeric_limits<size_t >::max (), AssemblyException, " Invalid auxdataloadn argument." );
406- text = " auxdataloadn{" + std::to_string (static_cast <size_t >(data ())) + " }" ;
407- break ;
408- case EOFCreate:
409- text = " eofcreate{" + std::to_string (static_cast <size_t >(data ())) + " }" ;
410- break ;
411- case ReturnContract:
412- text = " returncontract{" + std::to_string (static_cast <size_t >(data ())) + " }" ;
413- break ;
414- case RelativeJump:
415- text = " rjump{" + std::string (" tag_" ) + std::to_string (relativeJumpTagID ()) + " }" ;
416- break ;
417- case ConditionalRelativeJump:
418- text = " rjumpi{" + std::string (" tag_" ) + std::to_string (relativeJumpTagID ()) + " }" ;
419- break ;
420- case CallF:
421- text = " callf{" + std::string (" code_section_" ) + std::to_string (static_cast <size_t >(data ())) + " }" ;
422- break ;
423- case JumpF:
424- text = " jumpf{" + std::string (" code_section_" ) + std::to_string (static_cast <size_t >(data ())) + " }" ;
425- break ;
426- case RetF:
427- text = " retf" ;
428- break ;
429- case SwapN:
430- text = " swapn{" + std::to_string (static_cast <size_t >(data ())) + " }" ;
431- break ;
432- case DupN:
433- text = " dupn{" + std::to_string (static_cast <size_t >(data ())) + " }" ;
434- break ;
435337 }
436338 if (m_jumpType == JumpType::IntoFunction || m_jumpType == JumpType::OutOfFunction)
437339 {
@@ -450,15 +352,6 @@ std::ostream& solidity::evmasm::operator<<(std::ostream& _out, AssemblyItem cons
450352 switch (_item.type ())
451353 {
452354 case Operation:
453- case EOFCreate:
454- case ReturnContract:
455- case RelativeJump:
456- case ConditionalRelativeJump:
457- case CallF:
458- case JumpF:
459- case RetF:
460- case SwapN:
461- case DupN:
462355 _out << " " << instructionInfo (_item.instruction (), EVMVersion ()).name ;
463356 if (_item.instruction () == Instruction::JUMP || _item.instruction () == Instruction::JUMPI )
464357 _out << " \t " << _item.getJumpTypeAsString ();
@@ -508,9 +401,6 @@ std::ostream& solidity::evmasm::operator<<(std::ostream& _out, AssemblyItem cons
508401 case VerbatimBytecode:
509402 _out << " Verbatim " << util::toHex (_item.verbatimData ());
510403 break ;
511- case AuxDataLoadN:
512- _out << " AuxDataLoadN " << util::toString (_item.data ());
513- break ;
514404 case UndefinedItem:
515405 _out << " ???" ;
516406 break ;
@@ -563,9 +453,9 @@ std::string AssemblyItem::computeSourceMapping(
563453 static_cast <int >(_sourceIndicesMap.at (*location.sourceName )) :
564454 -1 ;
565455 char jump = ' -' ;
566- if (item.getJumpType () == evmasm::AssemblyItem::JumpType::IntoFunction || item. type () == CallF || item. type () == JumpF )
456+ if (item.getJumpType () == evmasm::AssemblyItem::JumpType::IntoFunction)
567457 jump = ' i' ;
568- else if (item.getJumpType () == evmasm::AssemblyItem::JumpType::OutOfFunction || item. type () == RetF )
458+ else if (item.getJumpType () == evmasm::AssemblyItem::JumpType::OutOfFunction)
569459 jump = ' o' ;
570460 int modifierDepth = static_cast <int >(item.m_modifierDepth );
571461
0 commit comments