ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
orivej has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]
orivej has joined #picolisp
mtsd has joined #picolisp
pointfree has joined #picolisp
<Regenaxer> tankf33der, whenever you have time, let's try to find the ht:Fmt bug
<Regenaxer> What we know is that it finds 'abc' despite "abc" is given
<Regenaxer> I think this is enough as a test
<Regenaxer> : abc
<Regenaxer> -> NIL
<Regenaxer> : (ht:Fmt "abc")
<Regenaxer> -> "abc"
<Regenaxer> BUT in your case it return "$abc"
orivej has quit [Ping timeout: 246 seconds]
<Regenaxer> http://ix.io/2UXU
<Regenaxer> We must debug why findSym() returns TRUE here
<Regenaxer> This depends on optimization again, no?
<Regenaxer> Do you think you can debug what goes wrong?
<Regenaxer> e.g. insert dbg() calls?
<Regenaxer> In 'findSym' either (? (atom Lst) or (? (== Sym (isIntern returns TRUE
<Regenaxer> no, not (atom Lst) o
<Regenaxer> It must be (? (== Sym (isIntern Name ...
<Regenaxer> but I cannot imagine how
orivej has joined #picolisp
<tankf33der> Morning
<tankf33der> today i will be availae
<Regenaxer> Cheers tankf33der!
<Regenaxer> Great!
<tankf33der> today i can do my part after 5h
<Regenaxer> It is a mysterious bug
<tankf33der> And till evening
<Regenaxer> any time ok
<Regenaxer> Do you think you can debug on the PilSrc level?
<Regenaxer> No complicated test necessary
<Regenaxer> just two repl lines (see above)
<tankf33der> i never did before
<Regenaxer> Just internal 'abc' must exist
<Regenaxer> I think you used (dbg ) once
<Regenaxer> (dbg 1 X)
<Regenaxer> 1 can be any number, is only used to trace the 'dbg' calls
<Regenaxer> You can do rapid tests by editing PilSrc in one terminal and repeat from shell history in the other:
<Regenaxer> $ (cd src; make) && ./pil -'quote abc' -'ht:Prin "abc"' -bye +
<Regenaxer> For example, you could put a (dbg 1 X) before ((findSym X Nm ...
<Regenaxer> to see if X is the internal 'abc' or the transient "abc" (the latter is expected)
<Regenaxer> Somewhere something must go wrong
<Regenaxer> and I have absolutely no idea atm :(
<Regenaxer> I meant before the (cond ..) of course, not directly before ((findSym ...
aw- has joined #picolisp
pointfree has quit [Quit: Connection closed for inactivity]
aw- has quit [Quit: Leaving.]
orivej has quit [Ping timeout: 260 seconds]
orivej has joined #picolisp
<tankf33der> Will start setup debug in 20mins
<Regenaxer> Cool
<tankf33der> reading chat log
orivej has quit [Ping timeout: 252 seconds]
<tankf33der> cant start pil in gc+ mode
<tankf33der> checking from scratch
<Regenaxer> gc+ is not needed here
orivej has joined #picolisp
<tankf33der> but it fails
<tankf33der> immediatly
<tankf33der> never seen before
<Regenaxer> oh
<Regenaxer> It crashes immediately if too early
<tankf33der> i have a special Jam
<Regenaxer> yes, ok
<tankf33der> i have a special branch in git for this
<tankf33der> checking
<Regenaxer> hmm, I don't remember gc+
<Regenaxer> In any case it should not be active before fully initialized
<tankf33der> i know
<Regenaxer> yeah
<tankf33der> last time i use it in nov.2020
<tankf33der> ha
<tankf33der> it started as picolisp
<tankf33der> and crashing in pil
<tankf33der> it crashing if run ./pil +
<tankf33der> OK if run ./pil
<Regenaxer> hmm, debug mode?
<tankf33der> pil
<tankf33der> : (apply * (range 1 10))
<tankf33der> : (apply * (range 1 1000))
<tankf33der> -> 3628800
<tankf33der> -> 93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000
<tankf33der> : (apply * (range 1 100))
<tankf33der> Segmentation fault (core dumped)
<tankf33der> under llvm11
<Regenaxer> Stack
<Regenaxer> Here on Termux I have 11 and
<Regenaxer> $ ulimit -s
<Regenaxer> 262144
<tankf33der> always was ok 16K from starting
<Regenaxer> Does it depend on optim?
<Regenaxer> Different -Ox uses different stack sizes
<tankf33der> let me try to gc+ without yesterday's patch
<tankf33der> and wihout opt too
<Regenaxer> yesterday only 'stem' changed in a minimal way
<tankf33der> this is not opt and stack depth
<tankf33der> crashed under llvm-as and unlimited stack
<tankf33der> generating debug trace
<Regenaxer> A very bad day today
<Regenaxer> Suddenly PilBox crashes on my wife's phone! Used to work all the time :(
<tankf33der> forget about gc+ crash. continue
<Regenaxer> hmm
<tankf33der> i am incorrectly rebuilt binary when switched between branches
<tankf33der> i will write a note for future how correctly do it
<Regenaxer> ok, this would explain
<tankf33der> i forgot about all edge cases.
<Regenaxer> :)
<tankf33der> so now i have working gc+ now
<Regenaxer> perfect :)
<tankf33der> continue
<tankf33der> now i must repeat all this on llvm12
<Regenaxer> I hope we find the problem
<Regenaxer> First make sure it is not related to optim
<Regenaxer> As I said, this test should do:
<Regenaxer> $ (cd src; make) && ./pil -'quote abc' -'ht:Prin "abc"' -bye +
<tankf33der> : abc
<tankf33der> -> abc
<tankf33der> : 'abc
<tankf33der> # pil
<tankf33der> -> NIL
<tankf33der> : (ht:Prin "abc")
<tankf33der> abc-> "abc"
<tankf33der> : (ht:Fmt "abc")
<tankf33der> -> "$abc"
<tankf33der> :
<tankf33der> this is under gc+
<tankf33der> switching back to normal mode
<Regenaxer> looks all good
<tankf33der> prin and fmt different results
<Regenaxer> : abc -> NIL is enough
<Regenaxer> yes, correct
<Regenaxer> that's the purpose of ht:Fmt
<tankf33der> but this is llvm12
<Regenaxer> preparing the Lisp types for server URL format
<Regenaxer> sorry
<Regenaxer> I looked not good enough
<Regenaxer> -> "$abc" is wrong
<tankf33der> sure
<Regenaxer> "$" means internal symbol
<Regenaxer> ht:Prin is not interesting here
<Regenaxer> The problem is only ht:Fmt right?
<tankf33der> right
<tankf33der> $ (cd src; make) && ./pil -'quote abc' -'ht:Prin "abc"' -bye +
<tankf33der> but you wrote Prin
<Regenaxer> and only if the transient symbol already exists as internal with the same name
<Regenaxer> oh!
<Regenaxer> Sorry!
<Regenaxer> yeah
<Regenaxer> Can you also test this:
<Regenaxer> $ (cd src; make) && ./pil -'ht:Fmt "car"' -bye +
<Regenaxer> As 'car' is intern, it should also give the wrong output
<Regenaxer> i.e. "$car"
<Regenaxer> moment, still wrong of course
<Regenaxer> So:
<Regenaxer> $ (cd src; make) && ./pil -'println (ht:Fmt "car")' -bye +
<Regenaxer> Here I get "car"
<Regenaxer> I suspect you get "$car", no?
<tankf33der> $car
<tankf33der> :)
<Regenaxer> ok
<tankf33der> so, ok, warmup is done, ready for debug
<Regenaxer> So this is the simplest test :)
<Regenaxer> yesss
<tankf33der> [ht.l:92] !? (dbd 1 X)
<tankf33der> dbd -- Undefined
<tankf33der> make: *** [Makefile:63: ht.ll] Error 1
<Regenaxer> (dbg ..) for "debug"
<tankf33der> how to rebuild ?
<Regenaxer> As in the command line
<Regenaxer> $ (cd src; make) && ./pil ...
<Regenaxer> so you just need to reload the history line
<tankf33der> i inserted dbg call in ht.l and wanted rebuild
<Regenaxer> yes
<Regenaxer> make
<tankf33der> failed
<tankf33der> posted above
<Regenaxer> ah
<tankf33der> [root@fedora src]# make
<tankf33der> dbd -- Undefined
<tankf33der> make: *** [Makefile:63: ht.ll] Error 1
<tankf33der> [ht.l:92] !? (dbd 1 X)
<Regenaxer> yes, 'dbg' is only in base.ll
<Regenaxer> It must be dbg
<tankf33der> ah
<tankf33der> :)
<Regenaxer> Not sure if accessible in ht.l
<Regenaxer> needs a declaration perhaps
<tankf33der> # pil -'println (ht:Fmt "car")' -bye +
<tankf33der> 1 "car"
<tankf33der> "$car"
<Regenaxer> cool!
<Regenaxer> So ni decl needed
<Regenaxer> all right so far :)
<tankf33der> ok
<Regenaxer> 1 "car" is before findSym?
<tankf33der> yeap and before cond
<Regenaxer> ok
<Regenaxer> So before the cond X is correct
<Regenaxer> Can you now debug into src/sym.l into findSym?
<tankf33der> yeap
<tankf33der> what to insert and where ?
<Regenaxer> Perhaps a line after (? (atom Lst) NO)
<Regenaxer> (dbg 2 Sym)
<Regenaxer> Sym must be also "car"
<Regenaxer> Will give a lot of output though
<Regenaxer> as findSym is called a *lot* :)
<tankf33der> [root@fedora src]# pil -'println (ht:Fmt "car")' -bye +
<tankf33der> 1 "car"
<tankf33der> 2 "car"
<tankf33der> "$car"
<tankf33der> [root@fedora src]#
<tankf33der> only this
<Regenaxer> ok, good
<Regenaxer> So isintern fails?
<Regenaxer> (? (== Sym (dbg 3 (isIntern Name (cdar (car Lst)))) YES))
<Regenaxer> 'isIntern' should return 'car' (internal)
<Regenaxer> But then == fails
<tankf33der> (de i1 findSym (Sym Name Lst)
<tankf33der> (? (atom Lst) NO)
<tankf33der> (dbg 2 Sym)
<tankf33der> (loop
<tankf33der> (? (== Sym (dbg 3 (isIntern Name (cdar (car Lst)))) YES))
<tankf33der> (shift Lst) ) )
<Regenaxer> 'findSym' is probably correct, as it is used a lot in other places during I/O
<tankf33der> i have this and base.ll failed to compile
<tankf33der> [root@fedora src]# make
<tankf33der> opt: base.ll:21531:10: error: expected value token
<tankf33der> pil64 lib/llvm.l main.l -bye > base.ll
<tankf33der> mv base.map ../lib/map
<tankf33der> opt -O3 -o base.bc base.ll
<tankf33der> ret i1 void
<tankf33der> ^
<tankf33der> [root@fedora src]#
<tankf33der> make: *** [Makefile:33: base.bc] Error 1
<Regenaxer> I have the parens wrong
<Regenaxer> (? (== Sym (dbg 3 (isIntern Name (cdar (car Lst))))) YES)
<tankf33der> ok
<Regenaxer> (dbg ) around the isIntern call
<Regenaxer> please also (dbg 4 T) in the next line
<Regenaxer> So we see when == succeeds
<Regenaxer> (dbg 4 $T) !!
<Regenaxer> needs $T for the 'T' symbol
<tankf33der> [root@fedora src]# pil -'println (ht:Fmt "car")' -bye +
<tankf33der> 2 "car"
<tankf33der> 3 car
<tankf33der> 4 T
<tankf33der> 1 "car"
<tankf33der> "$car"
<tankf33der> [root@fedora src]#
<Regenaxer> Ok, so == does not fire. good
<Regenaxer> So (? (atom Lst) NO) must return
<Regenaxer> but with NO
<Regenaxer> Why is (call $Put (char "$")) then called in ht.l ?
<Regenaxer> one more: (? (atom Lst) (dbg 5 $Nil) NO)
<Regenaxer> so we should see "5 NIL" after the "4 T"
<tankf33der> [root@fedora src]# pil -'println (ht:Fmt "car")' -bye +
<tankf33der> 2 "car"
<tankf33der> 1 "car"
<tankf33der> 3 car
<tankf33der> 4 T
<tankf33der> 5 NIL
<tankf33der> "car"
<tankf33der> [root@fedora src]#
<Regenaxer> uh, now "car" !!
<Regenaxer> 5 NIL is as expected
<Regenaxer> but the result changed
<tankf33der> yea
<Regenaxer> A heisenbug again
<tankf33der> (de i1 findSym (Sym Name Lst)
<tankf33der> (? (atom Lst) (dbg 5 $Nil) NO)
<tankf33der> (loop
<tankf33der> (dbg 2 Sym)
<tankf33der> (? (== Sym (dbg 3 (isIntern Name (cdar (car Lst))))) YES)
<tankf33der> (dbg 4 $T)
<tankf33der> (shift Lst) ) )
<Regenaxer> yes, good
<tankf33der> if i remove -Oxxx from opt it is gone
<Regenaxer> Interesting
<Regenaxer> hmm, what is wrong? Is it pil like in 'stem', or is it optim?
<Regenaxer> I suspect pil
<Regenaxer> The dbg calls use more stack or something
<Regenaxer> and so things change a little
<Regenaxer> I think findSym is correct, it is called everywhere
<Regenaxer> Can you send me ht.ll and src/ht.s ?
<Regenaxer> After undoing all dbg's
<tankf33der> doing
<Regenaxer> is it x86 ?
<Regenaxer> the .s
<tankf33der> yeap
<Regenaxer> good
<Regenaxer> (easier to read)
<Regenaxer> I lost overview. How does it depend on optim?
<Regenaxer> it works without any -Ox ?
<tankf33der> yeap
<tankf33der> do you need ll and s without -Ox ?
<Regenaxer> and -O1 already fails?
<tankf33der> yeap
<Regenaxer> the .ll is always the same, but the .s I need for the lowest -Ox that fails
<tankf33der> -O1 then
<Regenaxer> ok
<Regenaxer> I think lower O's are more close to the source in ht.ll
<Regenaxer> so easier to see what they do
<Regenaxer> Thanks! I study now :)
<Regenaxer> tough
<Regenaxer> Too many assumptions about the execution environment
orivej has quit [Ping timeout: 252 seconds]
<tankf33der> let me try on llvm13
<Regenaxer> good
<tankf33der> the same $car
<Regenaxer> and -O0 is ok?
<tankf33der> car
<Regenaxer> so the same as 12
<tankf33der> llvm12 -O0 is car
<tankf33der> maybe -O0 is the same as calling without any -Ox
<Regenaxer> probably
<Regenaxer> findSym returns NO, right?
<tankf33der> hm
<tankf33der> how to check ?
<Regenaxer> I conclude this from (? (atom Lst) (dbg 5 $Nil) NO)
<Regenaxer> NO is zero
<Regenaxer> The asm says
<Regenaxer> callq findSym@PLT
<Regenaxer> testq %rax, %rax
<Regenaxer> je .LBB3_15
<Regenaxer> %rax must be zero
<Regenaxer> Makes no sense to me
<Regenaxer> Can you look into base.s and find findSym ?
<Regenaxer> and see if it sets %rax to zero?
<tankf33der> base.s ?
<tankf33der> or picolisp.s ?
<Regenaxer> yes, sorry
<Regenaxer> globl findSym
<Regenaxer> a very short function
<tankf33der> find yourself, this is llvm12, with dbg
<Regenaxer> ok
<Regenaxer> No dbg though
<Regenaxer> ah, no, there is dbg
aw- has joined #picolisp
<tankf33der> afk.
<Regenaxer> Can you send me again?
<Regenaxer> Without dbg ?
<Regenaxer> I think *with* dbg it worked
<Regenaxer> I think I found the error
<Regenaxer> in the ASM code of findSym
<Regenaxer> not sure
<Regenaxer> Registe %r13b
<Regenaxer> register
<Regenaxer> afp
aw- has quit [Quit: Leaving.]
<Regenaxer> ret
<Regenaxer> Yay! That is it!
<Regenaxer> The interface for findSym in ht.l is wrong
<Regenaxer> findSym sets %r13b (a byte!) but ht:Fmt expects 64 bits
<Regenaxer> In the end it is my fault
<Regenaxer> The declarations of findSym and other functions from base.ll are not complete
<tankf33der> Back
<Regenaxer> I fix now
<tankf33der> What should i do?
<Regenaxer> Nothing
<Regenaxer> I fix some declarations
<Regenaxer> I check all
<Regenaxer> but in this case in ht.l
<Regenaxer> (de T findSym (any any any))
<Regenaxer> must be
<Regenaxer> (de T i1 findSym (any any any))
<Regenaxer> you can modify manually and test meanwhile
<Regenaxer> I'm sure this is the reason
<Regenaxer> cause I see whay findSym returns on the ASM level in %rax
<Regenaxer> This explains the behavior
<Regenaxer> it returns zero in th lowest *byte* of %rax
<Regenaxer> but ht:Fmt checks the whole 64 bits of %rax
<Regenaxer> so it is always true and "$" is added
<tankf33der> [root@fedora src]# pil -'println (ht:Fmt "car")' -bye +
<tankf33der> 4 T
<tankf33der> 2 "car"
<tankf33der> 1 "car"
<tankf33der> 5 NIL
<tankf33der> 3 car
<tankf33der> "car"
<tankf33der> [root@fedora src]#
<tankf33der> this is it!
<Regenaxer> :))
<tankf33der> all tests passed on llvm12
<Regenaxer> Great
<Regenaxer> I checked all
<Regenaxer> I think only findSym in ht.l was wrong
<Regenaxer> I release now
<tankf33der> llvm13 is ok too !
<Regenaxer> Done. Thanks a lot tankf33der!!
<tankf33der> :)
<Regenaxer> Very useful inputs
<tankf33der> afk. i will test whole in 20mins
<Regenaxer> Good :)
<Regenaxer> Now I must debug PilBox :(
<tankf33der> llvm 7,11-13 passed ALL!
<Regenaxer> Wuff!
<tankf33der> this is first time ever.
<tankf33der> Perfect.
<Regenaxer> Indeed. Good day after all :)
<tankf33der> :)
<tankf33der> watching this, trying understand what i watching :)
<Regenaxer> hmm, some kind of ir-level optim?
<tankf33der> Testing tool
<Regenaxer> ok
<tankf33der> i see llvm-reduce and bugpoint not for us, but for llvm developers or when llvm will crash under pil
<tankf33der> issue closed.
<tankf33der> afk.
<tankf33der> Llvm10 passee.
aw- has joined #picolisp
<Regenaxer> Sorry, sudden visitors
orivej has joined #picolisp
Seteeri has joined #picolisp
mtsd has quit [Ping timeout: 246 seconds]
amirouche has joined #picolisp
Seteeri has quit [Quit: Leaving]
ChanServ has quit [shutting down]
ChanServ has joined #picolisp
orivej has quit [Ping timeout: 240 seconds]