Browse Source

Added a debug menu option to disable compiler optimization, for testing purposes

cl-refactor
Giacomo Tazzari 11 years ago
parent
commit
9fcc410516
  1. 9
      alethzero/Main.ui
  2. 19
      alethzero/MainWin.cpp
  3. 2
      alethzero/MainWin.h

9
alethzero/Main.ui

@ -185,6 +185,7 @@
<addaction name="killBlockchain"/>
<addaction name="inject"/>
<addaction name="forceMining"/>
<addaction name="disableCompilerOptimization"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Network"/>
@ -1667,6 +1668,14 @@ font-size: 14pt</string>
<string>&amp;Refresh</string>
</property>
</action>
<action name="disableCompilerOptimization">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Disable LLL Compiler Optimization</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>

19
alethzero/MainWin.cpp

@ -332,6 +332,12 @@ void Main::on_forceMining_triggered()
m_client->setForceMining(ui->forceMining->isChecked());
}
void Main::on_disableCompilerOptimization_triggered()
{
m_disableCompilerOptimization = ui->disableCompilerOptimization->isChecked();
on_data_textChanged();
}
void Main::load(QString _s)
{
QFile fin(_s);
@ -1302,9 +1308,7 @@ void Main::on_data_textChanged()
}
else
{
auto asmcode = eth::compileLLLToAsm(src, false);
auto asmcodeopt = eth::compileLLLToAsm(ui->data->toPlainText().toStdString(), true);
m_data = eth::compileLLL(ui->data->toPlainText().toStdString(), true, &errors);
m_data = eth::compileLLL(src, !m_disableCompilerOptimization, &errors);
if (errors.size())
{
try
@ -1319,7 +1323,14 @@ void Main::on_data_textChanged()
}
}
else
lll = "<h4>Opt</h4><pre>" + QString::fromStdString(asmcodeopt).toHtmlEscaped() + "</pre><h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>";
{
auto asmcode = eth::compileLLLToAsm(src, false);
lll = "<h4>Pre</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>";
if (!m_disableCompilerOptimization) {
asmcode = eth::compileLLLToAsm(src, true);
lll = "<h4>Opt</h4><pre>" + QString::fromStdString(asmcode).toHtmlEscaped() + "</pre>" + lll;
}
}
}
QString errs;
if (errors.size())

2
alethzero/MainWin.h

@ -138,6 +138,7 @@ private slots:
void on_debugDumpState_triggered(int _add = 1);
void on_debugDumpStatePre_triggered();
void on_refresh_triggered();
void on_disableCompilerOptimization_triggered();
signals:
void poll();
@ -221,6 +222,7 @@ private:
QMap<unsigned, unsigned> m_pcWarp;
QList<WorldState> m_history;
std::map<eth::u256, eth::bytes> m_codes; // and pcWarps
bool m_disableCompilerOptimization = false;
QNetworkAccessManager m_webCtrl;

Loading…
Cancel
Save