ykjit / yklua

yk-enabled Lua interpreter
4 stars 4 forks source link

Yk error - double free or corruption #22

Closed Pavel-Durov closed 1 year ago

Pavel-Durov commented 1 year ago

Error I got when running Yklua tests (YK build commit 8c8468967745e343df08966f00de02dc663945d7).

$ ../src/lua -e"_U=true" all.lua

***** FILE 'db.lua'*****
testing debug library and debug information
double free or corruption (!prev)
Aborted (core dumped)
Pavel-Durov commented 1 year ago

Adding print statements resolves this error.

diff --git a/yktracec/src/ykllvmwrap.cc b/yktracec/src/ykllvmwrap.cc
index dfa1ba1..503a985 100644
--- a/yktracec/src/ykllvmwrap.cc
+++ b/yktracec/src/ykllvmwrap.cc
@@ -404,13 +404,13 @@ void *compileIRTrace(FN Func, char *FuncNames[], size_t BBs[], size_t TraceLen,
   // will automatically wait to acquire a lock and release it when done. Once
   // we have assembled the trace we no longer need hold on to the AOT module as
   // it isn't needed for compilation.
-  errs() << "Before Createodule\n";
+  // errs() << "Before Createodule\n";
   ThreadAOTMod->withModuleDo([&](Module &AOTMod) {
     DIP.print(DebugIR::AOT, &AOTMod);
     std::tie(JITMod, TraceName, GlobalMappings, AOTMappingVec, GuardCount) =
         Func(&AOTMod, FuncNames, BBs, TraceLen, FAddrKeys, FAddrVals, FAddrLen);
   });
-  errs() << "After Createodule\n";
+  // errs() << "After Createodule\n";

   // If we failed to build the trace, return null.
   if (JITMod == nullptr) {
Pavel-Durov commented 1 year ago

Closing this issue. Rebuilding YK with updated submodules fixed it.