Browse Source

Start of pinhole optimiser. Minor fix for debugger.

cl-refactor
Gav Wood 11 years ago
parent
commit
6657fa7a63
  1. 3
      alethzero/MainWin.cpp
  2. 3
      libethereum/Executive.cpp
  3. 2
      liblll/Assembly.cpp
  4. 4
      liblll/Assembly.h

3
alethzero/MainWin.cpp

@ -840,11 +840,12 @@ void Main::on_data_textChanged()
if (isCreation()) if (isCreation())
{ {
vector<string> errors; vector<string> errors;
auto asmcode = eth::compileLLLToAsm(ui->data->toPlainText().toStdString());
m_data = compileLLL(ui->data->toPlainText().toStdString(), &errors); m_data = compileLLL(ui->data->toPlainText().toStdString(), &errors);
for (auto const& i: errors) for (auto const& i: errors)
cwarn << i; cwarn << i;
ui->code->setHtml("<h4>Code</h4>" + QString::fromStdString(disassemble(m_data)).toHtmlEscaped()); ui->code->setHtml("<h4>Code</h4>" + QString::fromStdString(disassemble(m_data)).toHtmlEscaped() + "<p/><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>");
ui->gas->setMinimum((qint64)state().createGas(m_data.size(), 0)); ui->gas->setMinimum((qint64)state().createGas(m_data.size(), 0));
if (!ui->gas->isEnabled()) if (!ui->gas->isEnabled())
ui->gas->setValue(m_backupGas); ui->gas->setValue(m_backupGas);

3
libethereum/Executive.cpp

@ -161,6 +161,7 @@ bool Executive::go(uint64_t _steps)
try try
{ {
#if ETH_VMTRACE #if ETH_VMTRACE
if (_steps == (uint64_t)0 - 1)
for (uint64_t s = 0;; ++s) for (uint64_t s = 0;; ++s)
{ {
ostringstream o; ostringstream o;
@ -182,6 +183,8 @@ bool Executive::go(uint64_t _steps)
} }
catch (StepsDone const&) {} catch (StepsDone const&) {}
} }
else
m_out = m_vm->go(*m_ext, _steps);
#else #else
m_out = m_vm->go(*m_ext, _steps); m_out = m_vm->go(*m_ext, _steps);
#endif #endif

2
liblll/Assembly.cpp

@ -144,6 +144,8 @@ AssemblyItem const& Assembly::append(AssemblyItem const& _i)
void Assembly::optimise() void Assembly::optimise()
{ {
std::vector<pair< vector<int>, function< vector<AssemblyItem>(vector<AssemblyItem>) > >> rules;
// rules.insert(make_pair({(int)Instruction::ADD, (int)Instruction::ADD, -(int)Push}, []() {}));
} }
bytes Assembly::assemble() const bytes Assembly::assemble() const

4
liblll/Assembly.h

@ -51,11 +51,15 @@ public:
int deposit() const; int deposit() const;
bool operator==(int _mask) const { return -_mask == (int)m_type || (m_type == Operation && _mask == (int)m_data); }
private: private:
AssemblyItemType m_type; AssemblyItemType m_type;
u256 m_data; u256 m_data;
}; };
inline bool operator==(int _i, AssemblyItem _ai) { return _ai.operator==(_i); }
class Assembly class Assembly
{ {
public: public:

Loading…
Cancel
Save