Skip to content

Commit e290f0f

Browse files
committed
LLVMCompilerContext: Fix false undefined procedures
1 parent 53a8a1e commit e290f0f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/engine/internal/llvm/llvmcompilercontext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const std::unordered_map<function_id_t, LLVMExecutableCode *> &LLVMCompilerConte
6868

6969
void LLVMCompilerContext::addDefinedProcedure(BlockPrototype *prototype)
7070
{
71-
m_definedProcedures.insert(prototype);
71+
m_definedProcedures.insert(prototype->procCode());
7272
}
7373

7474
void LLVMCompilerContext::addUsedProcedure(BlockPrototype *prototype, const std::string &functionName)
@@ -208,7 +208,7 @@ void LLVMCompilerContext::createProcedureShims()
208208
llvm::IRBuilder<> builder(*m_llvmCtx);
209209

210210
for (const auto &[prototype, name] : m_usedProcedures) {
211-
if (m_definedProcedures.find(prototype) == m_definedProcedures.cend()) {
211+
if (m_definedProcedures.find(prototype->procCode()) == m_definedProcedures.cend()) {
212212
std::cout << "warning: procedure \"" << prototype->procCode() << "\" is not defined" << std::endl;
213213

214214
// We need to define shims for undefined procedures (the JIT compiler crashes without them)

src/engine/internal/llvm/llvmcompilercontext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ class LIBSCRATCHCPP_TEST_EXPORT LLVMCompilerContext : public CompilerContext
100100
llvm::StructType *m_stringPtrType = nullptr;
101101
llvm::Type *m_functionIdType = nullptr;
102102

103-
std::unordered_set<BlockPrototype *> m_definedProcedures;
103+
std::unordered_set<std::string> m_definedProcedures;
104104
std::unordered_map<BlockPrototype *, std::string> m_usedProcedures;
105105
};
106106

0 commit comments

Comments
 (0)