Prevent optimizer from changing certain parts of the code.

This commit is contained in:
Christian 2014-11-06 16:43:20 +01:00
parent 225fc8e1b3
commit b66e58d6c9

View File

@ -89,10 +89,11 @@ void Compiler::appendFunctionSelector(vector<ASTPointer<FunctionDefinition>> con
eth::AssemblyItem jumpTableStart = m_context.pushNewTag();
m_context << eth::Instruction::ADD << eth::Instruction::JUMP;
// jump table @todo it could be that the optimizer destroys this
m_context << jumpTableStart;
// jump table, tell the optimizer not to remove the JUMPDESTs
m_context << eth::AssemblyItem(eth::NoOptimizeBegin) << jumpTableStart;
for (pair<string, pair<FunctionDefinition const*, eth::AssemblyItem>> const& f: publicFunctions)
m_context.appendJumpTo(f.second.second) << eth::Instruction::JUMPDEST;
m_context << eth::AssemblyItem(eth::NoOptimizeEnd);
m_context << returnTag << eth::Instruction::STOP;