mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Fix compiling empty bytecode
This commit is contained in:
parent
c97ca249a0
commit
51fc9adfab
1 changed files with 5 additions and 3 deletions
|
|
@ -33,16 +33,18 @@ Compiler::Compiler():
|
||||||
void Compiler::createBasicBlocks(bytesConstRef bytecode)
|
void Compiler::createBasicBlocks(bytesConstRef bytecode)
|
||||||
{
|
{
|
||||||
std::set<ProgramCounter> splitPoints; // Sorted collections of instruction indices where basic blocks start/end
|
std::set<ProgramCounter> splitPoints; // Sorted collections of instruction indices where basic blocks start/end
|
||||||
splitPoints.insert(0); // First basic block
|
|
||||||
|
|
||||||
std::map<ProgramCounter, ProgramCounter> directJumpTargets;
|
std::map<ProgramCounter, ProgramCounter> directJumpTargets;
|
||||||
std::vector<ProgramCounter> indirectJumpTargets;
|
std::vector<ProgramCounter> indirectJumpTargets;
|
||||||
boost::dynamic_bitset<> validJumpTargets(bytecode.size());
|
boost::dynamic_bitset<> validJumpTargets(std::max(bytecode.size(), size_t(1)));
|
||||||
|
|
||||||
|
splitPoints.insert(0); // First basic block
|
||||||
|
validJumpTargets[0] = true;
|
||||||
|
|
||||||
for (auto curr = bytecode.begin(); curr != bytecode.end(); ++curr)
|
for (auto curr = bytecode.begin(); curr != bytecode.end(); ++curr)
|
||||||
{
|
{
|
||||||
ProgramCounter currentPC = curr - bytecode.begin();
|
ProgramCounter currentPC = curr - bytecode.begin();
|
||||||
validJumpTargets[currentPC] = 1;
|
validJumpTargets[currentPC] = true;
|
||||||
|
|
||||||
auto inst = static_cast<Instruction>(*curr);
|
auto inst = static_cast<Instruction>(*curr);
|
||||||
switch (inst)
|
switch (inst)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue