mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Remove dummy int argument in entry function
This commit is contained in:
parent
2e1c90f828
commit
47d92e933a
3 changed files with 7 additions and 8 deletions
|
|
@ -157,10 +157,9 @@ std::unique_ptr<llvm::Module> Compiler::compile(bytes const& _bytecode)
|
|||
auto module = std::unique_ptr<llvm::Module>(new llvm::Module("main", m_builder.getContext()));
|
||||
|
||||
// Create main function
|
||||
llvm::Type* mainFuncArgTypes[] = {m_builder.getInt32Ty(), Type::RuntimePtr}; // There must be int in first place because LLVM does not support other signatures
|
||||
auto mainFuncType = llvm::FunctionType::get(Type::MainReturn, mainFuncArgTypes, false);
|
||||
auto mainFuncType = llvm::FunctionType::get(Type::MainReturn, Type::RuntimePtr, false);
|
||||
m_mainFunc = llvm::Function::Create(mainFuncType, llvm::Function::ExternalLinkage, "main", module.get());
|
||||
m_mainFunc->arg_begin()->getNextNode()->setName("rt");
|
||||
m_mainFunc->getArgumentList().front().setName("rt");
|
||||
|
||||
// Create the basic blocks.
|
||||
auto entryBlock = llvm::BasicBlock::Create(m_builder.getContext(), "entry", m_mainFunc);
|
||||
|
|
|
|||
|
|
@ -111,14 +111,14 @@ namespace
|
|||
{
|
||||
ReturnCode runEntryFunc(ExecBundle const& _exec, Runtime* _runtime)
|
||||
{
|
||||
typedef ReturnCode(*EntryFuncPtr)(int, Runtime*);
|
||||
typedef ReturnCode(*EntryFuncPtr)(Runtime*);
|
||||
auto entryFuncVoidPtr = _exec.engine->getPointerToFunction(_exec.entryFunc);
|
||||
auto entryFuncPtr = static_cast<EntryFuncPtr>(entryFuncVoidPtr);
|
||||
|
||||
ReturnCode returnCode{};
|
||||
auto sj = setjmp(_runtime->getJmpBuf());
|
||||
if (sj == 0)
|
||||
returnCode = entryFuncPtr(0, _runtime); // FIXME: Remove int argument
|
||||
returnCode = entryFuncPtr(_runtime);
|
||||
else
|
||||
returnCode = static_cast<ReturnCode>(sj);
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ RuntimeManager::RuntimeManager(llvm::IRBuilder<>& _builder): CompilerHelper(_bui
|
|||
|
||||
// Export data
|
||||
auto mainFunc = getMainFunction();
|
||||
llvm::Value* rtPtr = &mainFunc->getArgumentList().back();
|
||||
llvm::Value* rtPtr = &mainFunc->getArgumentList().front();
|
||||
m_builder.CreateStore(rtPtr, m_rtPtr);
|
||||
auto dataPtr = m_builder.CreateStructGEP(rtPtr, 0, "dataPtr");
|
||||
auto data = m_builder.CreateLoad(dataPtr, "data");
|
||||
|
|
@ -95,7 +95,7 @@ llvm::Value* RuntimeManager::getRuntimePtr()
|
|||
{
|
||||
// FIXME: Data ptr
|
||||
//if (auto mainFunc = getMainFunction())
|
||||
// return mainFunc->arg_begin()->getNextNode(); // Runtime is the second parameter of main function
|
||||
// return mainFunc->arg_begin(); // Runtime is the parameter of main function
|
||||
return m_builder.CreateLoad(m_rtPtr, "rt");
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ llvm::Value* RuntimeManager::getDataPtr()
|
|||
{
|
||||
// FIXME: Data ptr
|
||||
//if (auto mainFunc = getMainFunction())
|
||||
// return mainFunc->arg_begin()->getNextNode(); // Runtime is the second parameter of main function
|
||||
// return mainFunc->arg_begin(); // Runtime is the parameter of main function
|
||||
return m_builder.CreateLoad(m_dataPtr, "data");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue