ykjit / yklua

yk-enabled Lua interpreter
4 stars 4 forks source link

Failing test - big.lua #55

Open Pavel-Durov opened 1 year ago

Pavel-Durov commented 1 year ago

Issue

Failing big.lua test.

Reproduction Steps

$ YKD_SERIALISE_COMPILATION=1 ../src/lua big.lua 
testing large tables
../src/lua: attempt to yield from outside a coroutine
stack traceback:
        [C]: in function 'coroutine.yield'
        big.lua:56: in main chunk
        [C]: in ?

$ YKD_SERIALISE_COMPILATION=0 ../src/lua big.lua
testing large tables
../src/lua: attempt to yield from outside a coroutine
stack traceback:
        [C]: in function 'coroutine.yield'
        big.lua:56: in main chunk
        [C]: in ?
lua: yk-fork/ykllvm/llvm/include/llvm/Support/Casting.h:579: decltype(auto) llvm::cast(From*) [with To = llvm::PointerType; From = llvm::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
Aborted (core dumped)

Backtrace

$ YKD_SERIALISE_COMPILATION=0 gdb --args ../src/lua big.lua
/yklua-fork/src/lua: attempt to yield from outside a coroutine
stack traceback:
        [C]: in function 'coroutine.yield'
        big.lua:56: in main chunk
        [C]: in ?
lua: /yk-fork/ykllvm/llvm/include/llvm/Support/Casting.h:579: decltype(auto) llvm::cast(From*) [with To = llvm::PointerType; From = llvm::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.

Thread 3 "lua" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffee346640 (LWP 709175)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
49      ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:49
#1  0x00007ffff78e2864 in __GI_abort () at abort.c:79
#2  0x00007ffff78e2749 in __assert_fail_base (fmt=0x7ffff7a6bf78 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=0x7ffff5e99218 "isa<To>(Val) && \"cast<Ty>() argument of incompatible type!\"", 
    file=0x7ffff5e99148 "/yk-fork/ykllvm/llvm/include/llvm/Support/Casting.h", line=579, function=<optimised out>) at assert.c:92
#3  0x00007ffff78f43d6 in __GI___assert_fail (assertion=0x7ffff5e99218 "isa<To>(Val) && \"cast<Ty>() argument of incompatible type!\"", 
    file=0x7ffff5e99148 "/yk-fork/ykllvm/llvm/include/llvm/Support/Casting.h", line=579, 
    function=0x7ffff5e9af20 "decltype(auto) llvm::cast(From*) [with To = llvm::PointerType; From = llvm::Type]") at assert.c:101
#4  0x00007ffff5d66abc in llvm::Function::getContext() const () from /yk-fork/target/debug/ykllvm/lib/libLLVMCore.so.16git
#5  0x00007ffff48a0914 in llvm::RAGreedy::selectOrSplit(llvm::LiveInterval const&, llvm::SmallVectorImpl<llvm::Register>&) ()
   from /yk-fork/target/debug/ykllvm/lib/../lib/libLLVMCodeGen.so.16git
#6  0x00007ffff4873322 in llvm::RegAllocBase::allocatePhysRegs() () from /yk-fork/target/debug/ykllvm/lib/../lib/libLLVMCodeGen.so.16git
#7  0x00007ffff489b205 in llvm::RAGreedy::runOnMachineFunction(llvm::MachineFunction&) ()
   from /yk-fork/target/debug/ykllvm/lib/../lib/libLLVMCodeGen.so.16git
#8  0x00007ffff46a9602 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) [clone .part.0] ()
   from /yk-fork/target/debug/ykllvm/lib/../lib/libLLVMCodeGen.so.16git
#9  0x00007ffff5de29ec in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /yk-fork/target/debug/ykllvm/lib/libLLVMCore.so.16git
#10 0x00007ffff5de2c19 in llvm::FPPassManager::runOnModule(llvm::Module&) () from /yk-fork/target/debug/ykllvm/lib/libLLVMCore.so.16git
#11 0x00007ffff5de3475 in llvm::legacy::PassManagerImpl::run(llvm::Module&) () from /yk-fork/target/debug/ykllvm/lib/libLLVMCore.so.16git
#12 0x00007ffff69498b6 in llvm::MCJIT::emitObject(llvm::Module*) () from /yk-fork/target/debug/ykllvm/lib/libLLVMMCJIT.so.16git
#13 0x00007ffff694a2b9 in llvm::MCJIT::generateCodeForModule(llvm::Module*) () from /yk-fork/target/debug/ykllvm/lib/libLLVMMCJIT.so.16git
#14 0x00007ffff6944c38 in llvm::MCJIT::finalizeObject() () from /yk-fork/target/debug/ykllvm/lib/libLLVMMCJIT.so.16git
#15 0x00007ffff7cb6a91 in compileModule (TraceName="__yk_compiled_trace_0", M=0x7fffe8171050, GlobalMappings=std::map with 2 elements = {...}, LiveAOTVals=0x7fffeaafb040, 
    GuardCount=32) at src/ykllvmwrap.cc:266
#16 0x00007ffff7cb85ab in compileIRTrace<std::tuple<llvm::Module*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::map<llvm::GlobalValue*, void*, std::less<llvm::GlobalValue*>, std::allocator<std::pair<llvm::GlobalValue* const, void*> > >, void*, unsigned long> (*)(llvm::Module*, char**, unsigned long*, unsigned long, char**, void**, unsigned long)> (Func=0x7ffff7cc2910 <createModule[abi:cxx11](llvm::Module*, char**, unsigned long*, unsigned long, char**, void**, unsigned long)>, 
    FuncNames=0x7fffe808a960, BBs=0x7fffe808ad80, TraceLen=130, FAddrKeys=0x7fffe808a1b0, FAddrVals=0x7fffe808a200, FAddrLen=8, 
    BitcodeData=0x257f10 <llvm.embedded.module+8>, BitcodeLen=3612476, DebugInfoFD=-1, DebugInfoPath=0x0) at src/ykllvmwrap.cc:442
#17 0x00007ffff7cb82de in __yktracec_irtrace_compile (FuncNames=0x7fffe808a960, BBs=0x7fffe808ad80, TraceLen=130, FAddrKeys=0x7fffe808a1b0, FAddrVals=0x7fffe808a200, 
    FAddrLen=8, BitcodeData=0x257f10 <llvm.embedded.module+8>, BitcodeLen=3612476, DebugInfoFD=-1, DebugInfoPath=0x0) at src/ykllvmwrap.cc:450
#18 0x00007ffff7b20398 in ykrt::trace::IRTrace::compile (self=0x7fffee345670) at ykrt/src/trace/mod.rs:178
--Type <RET> for more, q to quit, c to continue without paging--
#19 0x00007ffff7b35ae7 in ykrt::mt::{impl#0}::queue_compile_job::{closure#0} () at ykrt/src/mt.rs:389
#20 0x00007ffff7b05afe in core::ops::function::FnOnce::call_once<ykrt::mt::{impl#0}::queue_compile_job::{closure_env#0}, ()> ()
    at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/ops/function.rs:250
#21 0x00007ffff7b36ffd in alloc::boxed::{impl#47}::call_once<(), (dyn core::ops::function::FnOnce<(), Output=()> + core::marker::Send), alloc::alloc::Global> (self=..., 
    args=()) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/alloc/src/boxed.rs:1985
#22 0x00007ffff7b0e52b in lock_api::mutex::MutexGuard<parking_lot::raw_mutex::RawMutex, alloc::collections::vec_deque::VecDeque<alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=()> + core::marker::Send), alloc::alloc::Global>, alloc::alloc::Global>>::unlocked<parking_lot::raw_mutex::RawMutex, alloc::collections::vec_deque::VecDeque<alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=()> + core::marker::Send), alloc::alloc::Global>, alloc::alloc::Global>, alloc::boxed::Box<(dyn core::ops::function::FnOnce<(), Output=()> + core::marker::Send), alloc::alloc::Global>, ()> (s=0x7fffee345910, f=...)
    at /home/kimchi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/lock_api-0.4.10/src/mutex.rs:567
#23 0x00007ffff7b341d1 in ykrt::mt::{impl#0}::queue_job::{closure#0} () at ykrt/src/mt.rs:161
#24 0x00007ffff7b4c4e3 in std::sys_common::backtrace::__rust_begin_short_backtrace<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()> (f=...)
    at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/std/src/sys_common/backtrace.rs:135
#25 0x00007ffff7b22034 in std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure#0}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()> ()
    at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/std/src/thread/mod.rs:529
#26 0x00007ffff7b37ee4 in core::panic::unwind_safe::{impl#23}::call_once<(), std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()>> (self=...) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/panic/unwind_safe.rs:271
#27 0x00007ffff7b322f7 in std::panicking::try::do_call<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()>>, ()> (data=0x7fffee345a60) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/std/src/panicking.rs:500
#28 0x00007ffff7b325eb in __rust_try () from /yk-fork/bin/../target/debug/deps/libykcapi.so
#29 0x00007ffff7b3227e in std::panicking::try<(), core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()>>> (f=...) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/std/src/panicking.rs:464
#30 0x00007ffff7b21e5e in std::panic::catch_unwind<core::panic::unwind_safe::AssertUnwindSafe<std::thread::{impl#0}::spawn_unchecked_::{closure#1}::{closure_env#0}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()>>, ()> (f=...) at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/std/src/panic.rs:142
#31 std::thread::{impl#0}::spawn_unchecked_::{closure#1}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()> ()
    at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/std/src/thread/mod.rs:528
#32 0x00007ffff7b05a7f in core::ops::function::FnOnce::call_once<std::thread::{impl#0}::spawn_unchecked_::{closure_env#1}<ykrt::mt::{impl#0}::queue_job::{closure_env#0}, ()>, ()> () at /rustc/8c74a5d27c644a0f7a22bb2fa8dd3ff8257bc220/library/core/src/ops/function.rs:250
#33 0x00007ffff7d361c5 in alloc::boxed::{impl#47}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at library/alloc/src/boxed.rs:1985
#34 alloc::boxed::{impl#47}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> ()
    at library/alloc/src/boxed.rs:1985
#35 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
--Type <RET> for more, q to quit, c to continue without paging--
#36 0x00007ffff588f450 in start_thread (arg=0x7fffee346640) at pthread_create.c:473
#37 0x00007ffff79d3d53 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
$ YKD_SERIALISE_COMPILATION=1 gdb --args ../src/lua big.lua
yklua-fork/src/lua: attempt to yield from outside a coroutine
stack traceback:
        [C]: in function 'coroutine.yield'
        big.lua:56: in main chunk
        [C]: in ?
[Inferior 1 (process 710318) exited with code 01]
(gdb) bt
No stack.

Versions

YkLua - buildbot-locals-test/fb6b1763b22f75715ded5b033f9b3f9f4ec9764e YK - master/a690e6eaf7253a4fa9c04bb54406c07b7efc0085