Browse Source

Merge pull request #2292 from chriseth/fix_appendingAssemblies

Fixed counter modification when appending assemblies.
cl-refactor
Gav Wood 10 years ago
parent
commit
51094b8120
  1. 3
      libdevcore/FixedHash.h
  2. 6
      libevmasm/Assembly.cpp
  3. 4
      libevmasm/AssemblyItem.cpp

3
libdevcore/FixedHash.h

@ -113,6 +113,9 @@ public:
/// @returns an abridged version of the hash as a user-readable hex string.
std::string abridged() const { return toHex(ref().cropped(0, 4)) + "\342\200\246"; }
/// @returns a version of the hash as a user-readable hex string that leaves out the middle part.
std::string abridgedMiddle() const { return toHex(ref().cropped(0, 4)) + "\342\200\246" + toHex(ref().cropped(N - 4)); }
/// @returns the hash as a user-readable hex string.
std::string hex() const { return toHex(ref()); }

6
libevmasm/Assembly.cpp

@ -41,7 +41,7 @@ void Assembly::append(Assembly const& _a)
if (i.type() == Tag || i.type() == PushTag)
i.setData(i.data() + m_usedTags);
else if (i.type() == PushSub || i.type() == PushSubSize)
i.setData(i.data() + m_usedTags);
i.setData(i.data() + m_subs.size());
append(i);
}
m_deposit = newDeposit;
@ -136,10 +136,10 @@ ostream& Assembly::streamAsm(ostream& _out, string const& _prefix, StringMap con
_out << " PUSH [tag" << dec << i.data() << "]";
break;
case PushSub:
_out << " PUSH [$" << h256(i.data()).abridged() << "]";
_out << " PUSH [$" << h256(i.data()).abridgedMiddle() << "]";
break;
case PushSubSize:
_out << " PUSH #[$" << h256(i.data()).abridged() << "]";
_out << " PUSH #[$" << h256(i.data()).abridgedMiddle() << "]";
break;
case PushProgramSize:
_out << " PUSHSIZE";

4
libevmasm/AssemblyItem.cpp

@ -110,10 +110,10 @@ ostream& dev::eth::operator<<(ostream& _out, AssemblyItem const& _item)
_out << " PushData " << hex << (unsigned)_item.data();
break;
case PushSub:
_out << " PushSub " << hex << h256(_item.data()).abridged();
_out << " PushSub " << hex << h256(_item.data()).abridgedMiddle();
break;
case PushSubSize:
_out << " PushSubSize " << hex << h256(_item.data()).abridged();
_out << " PushSubSize " << hex << h256(_item.data()).abridgedMiddle();
break;
case PushProgramSize:
_out << " PushProgramSize";

Loading…
Cancel
Save