beneroth changed the topic of #picolisp to: PicoLisp language | The scalpel of software development | Channel Log: https://libera.irclog.whitequark.org/picolisp | Check www.picolisp.com for more information
<tankf33der> Morning
<abu[7]> Hi tankf33der
<abu[7]> Started search for enlightment
<tankf33der> ok
<abu[7]> I find no variable illegal to the setjmp rules
<abu[7]> The diff to the old version before our changes shows nothing critical
<abu[7]> Debugging is difficult. dbg's change the bihavior, and on the asm level it is nearly impossible
beneroth_ has joined #picolisp
chexum has quit [Ping timeout: 260 seconds]
beneroth has quit [Ping timeout: 260 seconds]
chexum has joined #picolisp
<tankf33der> i will be passive in july
<abu[7]> Vacation?
<tankf33der> yeap
<abu[7]> ok
<abu[7]> I just found that LLVM has built-in setjmp/longjmp intrinsics
<abu[7]> Currently I call the libc functions
<abu[7]> Don't know if this might be a problem
<tankf33der> eh
<abu[7]> Also, don't know if they are also in older LLVM versions
<tankf33der> Experience is the best test.
<abu[7]> T
<abu[7]> In any case it should not be worse
<tankf33der> I did it
<tankf33der> Latest Debian, llvm version vs. optimization
<abu[7]> Wow, great!
<tankf33der> latest pil21
<abu[7]> So -O1 works everywhere
<tankf33der> on debian yes :)
<abu[7]> T
<tankf33der> Freebsd14 the same table
<abu[7]> Indeed, plus you tested also 12
<abu[7]> I think I cannot use the intrinsics, they seem to be for internal usage
<abu[7]> I wrote a dummy C program, and it also does not use them
<abu[7]> setjmp takes a pointer to five word buffer. The front end places the frame pointer in the first word ...
<abu[7]> "The llvm.eh.sjlj intrinsics are used internally within LLVM’s backend"
<tankf33der> aha
<abu[7]> So I'm again at point zero
<tankf33der> how to check you jumps and returns correctly?
<abu[7]> That's the question :(
<abu[7]> The question is if all registers are properly preserved on the CPU level
<tankf33der> how to prove ?
<abu[7]> Somehow variables are changed
<abu[7]> No idea
<abu[7]> I just see that 'Dst:' is changed
<tankf33der> Dst vs. rst typo somewhere ?
<abu[7]> No, it works usually
<abu[7]> would always break
<tankf33der> ok
<tankf33der> extend lint for build context ?
<abu[7]> I tried, but there is nothing to lint actually. 'de' does not define a function, but is redefined to output llvm code
<tankf33der> somewhere must be a key
<abu[7]> I think the generated base.ll is correct
<abu[7]> Right!
<tankf33der> disable non-related code to run co, only core and co
<abu[7]> I run only (co 'a (yield 1)), so no non-related code should interfer I think
<tankf33der> without pil ? only bin/picolisp
<tankf33der> ?
<abu[7]> I can see that 'a' is started, yields back to 'T', then 'a' again and 'run' returns
<abu[7]> Nothing else executes
<tankf33der> ok
<abu[7]> But even if we did so, we don't know the reason
<tankf33der> do you debug on termux or debian ?
<abu[7]> Both, but never saw the problem on Termux
<abu[7]> (ie. Arm64)
<tankf33der> try debug on debian, you could compile with different llvm versions
<abu[7]> This would not help, I *have* a case where it fails. If it does not fail, we cannot find the problem
<tankf33der> what if you must save related before jump and restore it on return?
<abu[7]> I cannot I think
<abu[7]> Dst: is not changed by the code
<abu[7]> It changes automagically
<tankf33der> ok
<abu[7]> If I do something with it, it does not change
<abu[7]> but perhaps some other var
<abu[7]> Really a Mystery!
<tankf33der> what is your llvm version on arm?
<abu[7]> I don't ever know whether 'Dst:' is in a register (which is perhaps not properly saved across setjmp/longjmp), or on the stack (perhaps overwritten by buggy code), or both
<abu[7]> 18
<abu[7]> s/ever/even
<abu[7]> But if the stack were overwritten, the value in Dst: would be more random
<abu[7]> But it has a valid (though wrong) pointer
<abu[7]> And the program would crash at *this* place
<abu[7]> (more on the stack overwritten)
<abu[7]> It crashes later, when the value of Dst: is actually used
<tankf33der> What if all long-setjmps are used incorrectly and the code breaking is a coincidence, and you do not step on a landmine?
<abu[7]> Can you explain a little more?
<abu[7]> If used incorrectly it would not be a coincidence
<tankf33der> what functions are use long-setjmps? they could crash too
<tankf33der> i can try to test
<tankf33der> i have 30mins
<abu[7]> In Pil 'catch', 'err', 'co', 'yield' and 'main' call setjmp iirc
<tankf33der> ok
<abu[7]> Longjmp is in 'err', 'throm' and 'co'/'yield'
<abu[7]> throw*
<abu[7]> Perhaps more places
<abu[7]> They all work correctly it seems, just a var gets changed ;)
<abu[7]> Strange is that we did not notice before
<abu[7]> The changes last week were minimal, and reverting some of them did not help
<abu[7]> Reverting *all* probably helps, but then again we don't know what it was
<abu[7]> and we were back to bugs
<tankf33der> do not revert, push forward
<abu[7]> Yes, better
<abu[7]> I should dump all registers before and after 'run' and see if any of those reserved for register vars by the x86 ABI has changed
<abu[7]> Even if a register changed illegally, what to do then? Bug report? How to explain it to the LLVM devs?
<abu[7]> "Please debug my Pil code" :D
<tankf33der> :)
<abu[7]> Can you see a pattern if it depends on the x86 libc version?
<abu[7]> set/longjmp glue code is in libc
<tankf33der> debian and freebsd are different, no pattern
<abu[7]> good
<tankf33der> and alpine vs. debian are different
<abu[7]> ok
<tankf33der> catch-throw no errors
<abu[7]> Perhaps ask in #llvm on irc.oftc.net? Or some
<abu[7]> catch and throw do not use any vars before or after the jump
<tankf33der> i do not believe they help
<abu[7]> co is very involved compared to them
<abu[7]> Yeah, probably
<tankf33der> nikic@php.net
<abu[7]> 481 users on #llvm
<tankf33der> Nikita Popov
<tankf33der> try better this email with short question
<abu[7]> Who is he?
<tankf33der> write blog posts about llvm
<abu[7]> He seems more a llvm user, not backend developer
<tankf33der> afk
<abu[7]> I believe he uses C probably
<abu[7]> ok, see you!
<tankf33der> I belive in llvm and their 200k tests for the project
<abu[7]> Me too
<tankf33der> Archlinux table
<abu[7]> OK, so 1 is all right
<abu[7]> I just noticed I was searching at the wrong place all the time!
<abu[7]> It is not Dst
<abu[7]> Dst: is correct, but we end up in the wrong co frame
<abu[7]> Searching from that point backwards again
<abu[7]> (I'm in the woods though)
<abu[7]> Will do when home
<tankf33der> Ok
<abu[7]> Hmm, no, Dst: *is* changed, the co frame is correct
<abu[7]> BTw, also on Debian with 16 it crashes sometimes when I add or remove dbg prints. So it is not predictable at all :(
<abu[7]> I give up for today. I believe that somewhere the CPU frame pointer %rbp is not preserved (while the stack pointer %rsp is correct)