mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
parent
1cf3549116
commit
080cf20f84
4 changed files with 18 additions and 4 deletions
|
|
@ -925,6 +925,9 @@ void Compiler::linkBasicBlocks(Stack& stack)
|
||||||
{
|
{
|
||||||
auto& bbInfo = pair.second;
|
auto& bbInfo = pair.second;
|
||||||
|
|
||||||
|
if (bbInfo.predecessors.empty())
|
||||||
|
bbInfo.inputItems = 0; // no consequences for other blocks, so leave valuesChanged false
|
||||||
|
|
||||||
for (auto predInfo : bbInfo.predecessors)
|
for (auto predInfo : bbInfo.predecessors)
|
||||||
{
|
{
|
||||||
if (predInfo->outputItems < bbInfo.inputItems)
|
if (predInfo->outputItems < bbInfo.inputItems)
|
||||||
|
|
@ -996,11 +999,11 @@ void Compiler::dumpBasicBlockGraph(std::ostream& out)
|
||||||
|
|
||||||
std::vector<BasicBlock*> blocks;
|
std::vector<BasicBlock*> blocks;
|
||||||
for (auto& pair : this->basicBlocks)
|
for (auto& pair : this->basicBlocks)
|
||||||
{
|
|
||||||
blocks.push_back(&pair.second);
|
blocks.push_back(&pair.second);
|
||||||
}
|
if (m_jumpTableBlock.get())
|
||||||
blocks.push_back(m_jumpTableBlock.get());
|
blocks.push_back(m_jumpTableBlock.get());
|
||||||
blocks.push_back(m_badJumpBlock.get());
|
if (m_badJumpBlock.get())
|
||||||
|
blocks.push_back(m_badJumpBlock.get());
|
||||||
|
|
||||||
// Output nodes
|
// Output nodes
|
||||||
for (auto bb : blocks)
|
for (auto bb : blocks)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
#include "Stack.h"
|
#include "Stack.h"
|
||||||
#include "Runtime.h"
|
#include "Runtime.h"
|
||||||
|
#include "Type.h"
|
||||||
|
|
||||||
|
#include <csetjmp>
|
||||||
|
|
||||||
#include <llvm/IR/Function.h>
|
#include <llvm/IR/Function.h>
|
||||||
#include <llvm/IR/TypeBuilder.h>
|
#include <llvm/IR/TypeBuilder.h>
|
||||||
|
|
@ -51,9 +54,14 @@ extern "C"
|
||||||
|
|
||||||
using namespace dev::eth::jit;
|
using namespace dev::eth::jit;
|
||||||
|
|
||||||
|
extern std::jmp_buf* rt_jmpBuf;
|
||||||
|
|
||||||
EXPORT void stack_pop(i256* _ret)
|
EXPORT void stack_pop(i256* _ret)
|
||||||
{
|
{
|
||||||
auto& stack = Runtime::getStack();
|
auto& stack = Runtime::getStack();
|
||||||
|
if (stack.size() == 0)
|
||||||
|
longjmp(*rt_jmpBuf, static_cast<uint64_t>(ReturnCode::StackTooSmall));
|
||||||
|
|
||||||
assert(stack.size() > 0);
|
assert(stack.size() > 0);
|
||||||
*_ret = stack.back();
|
*_ret = stack.back();
|
||||||
stack.pop_back();
|
stack.pop_back();
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ enum class ReturnCode
|
||||||
|
|
||||||
BadJumpDestination = 101,
|
BadJumpDestination = 101,
|
||||||
OutOfGas = 102,
|
OutOfGas = 102,
|
||||||
|
StackTooSmall = 103
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Constant
|
struct Constant
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ bytes VM::go(ExtVMFace& _ext)
|
||||||
BOOST_THROW_EXCEPTION(BadJumpDestination());
|
BOOST_THROW_EXCEPTION(BadJumpDestination());
|
||||||
case 102:
|
case 102:
|
||||||
BOOST_THROW_EXCEPTION(OutOfGas());
|
BOOST_THROW_EXCEPTION(OutOfGas());
|
||||||
|
case 103:
|
||||||
|
BOOST_THROW_EXCEPTION(StackTooSmall(1,0));
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(engine.returnData);
|
return std::move(engine.returnData);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue