00:40 librasteve_ left 09:27 librasteve_ joined 16:28 MasterDuke joined
timo MasterDuke: want to extend the "put result of getenv into variable first" to the lines just above the last hunk of the patch? 16:34
MasterDuke hm, what file/lines? 16:36
moar.c:447 perhaps? 16:37
timo exactly 16:38
lying in bed last night I randomly thought the "optimization" to remove a `PHI r5(6) r5(5)` because it's "useless" is not right; at the very least we could use PHIs like that to signal in a BB after a BB ending in if or unless, what fact we learned about the value through the jump being taken 16:43
and I think we currently don't have something to propagate knowledge about values through branches like that 16:44
MasterDuke that seems like it could be valuable
timo I really want a format of spesh log that I can query with a pattern language of some kind :D 16:45
how good is your Prolog? :)
MasterDuke heh, that's a language i've never used at all 16:46
not even read much about it
but (good!) pattern languages are something i want in many places
timo it's only tangentially related, but it does let you express something like "queries against your data" 16:47
this also goes back to a discussion I had recently with maybe you maybe someone else about having an easier way to get backtracking for things other than matching against strings in raku 16:49
MasterDuke pr updated 16:50
not sure what you mean by "backtracking for things other than matching against strings"? 16:52
timo the context last time was angelic nondeterminism 16:53
where you can say "hey, give me the correct value from <a b c d e f>" and you get the right value
except of course you have to try any wrong values first in order to determine which one is the right one :) 16:54
MasterDuke hm
timo and your runtime will provide you with backtracking by going back to the point where you asked for the value if the result wasn't what you wanted
MasterDuke is that the sort of thing co-routines are used for? 16:55
timo something that lets you fork can do this for you
normally, co-routines are forwards-only I think?
but re-usable continuations can do this trivially
MasterDuke or complicated types systems? like using the type system in haskell to solve n-queens? 16:56
timo moar only has single-use ("one-shot") continuations
i think using type systems like that usually depends on the type solver trying out combinations for you if needed?
you can very easily do the kind of "try stuff out" if you explicitly write loops 16:57
for <a b c d> -> $first-choice { for <x y z> -> $second-choice { if is-correct($first-choice, $second-choice) { return $first-choice, $second-choice } } }; 16:58
the X meta-operator is often relevant there
MasterDuke btw, aphyr.com/posts/342-typing-the-tec...-interview seems like the sort of thing you've probably read already
if not, there's a short series of those 16:59
timo hm, I think I haven't read it yet, but the title feels familiar
the thing I was thinking of, getting the backtracking for free, would let you flatten all the loops in your code if you like 17:00
MasterDuke generally? or in the example above? 17:01
timo so it could turn into `my $first-choice = pick-right(<a b c d>); my $second-choice = pick-right(<x y z>); if !is-correct($first-choice, $second-choice) { backtrack }; return $first-choice, $second-choice;`
MasterDuke ah. seems sort of similar to `redo`, but i may be wildly off-base about that 17:03
timo oh, i've never used redo tbh. i should keep that in mind 17:05
MasterDuke i think i've used it once
timo but it's still different, since you want the next value to be tried, not the same value again
MasterDuke github.com/Raku/whateverable/blob/....raku#L152 17:07
timo it puts a new commit into the array and redoes the loop because the new commit lives at the same index? 17:11
MasterDuke yeah
timo I might personally have reached for something like a @todo queue where I might unshift a next item and do something like while @todo.pop -> $item { } 17:13
we don't have a while-defined, right? the `while @todo.pop -> $item` pattern doesn't really work very well if your @todo might have a 0 or "" or False in it legitimately 17:14
MasterDuke yep. that's annoyed me once or twice before 17:17
though in this case i was porting a perl script into raku, ~9 years ago. so i likely didn't even think of that 17:19
timo did you read what i wrote about the ball-larus algo a day or two ago? 17:22
MasterDuke i have the pdf open in a tab, but haven't read it yet
is it general graph theory? or something more specialized to compilers? 17:23
timo well, the use case I've looked at here is relevant to compilers, but I guess it generalizes pretty far? 17:26
i'm not sure what part of the whole thing is the ball-larus algorithm; i'm mostly interested in the numbering of path pieces so that every path can be "constructed" by adding a single constant integer at any decision point to a kind-of accumulator
now that i look closer at, and trying to really understand, the isexecutable code, it kind of looks wrong? 17:27
MasterDuke heh. i saw that it was in an `#ifdef WIN32` and figured i didn't (personally) need to look to much closer... 17:30
timo in theory it takes the PATHEXT env var which has a list of file extensions that are supposed to be executable (as in, if you write blabla in the cmd.exe it will look for blabla.com, blabla.exe, blabla.bat, blabla.cmd, ... and use the first one it finds)
and pathext is like .com;.exe;.bat;etcetc
the code we have now goes character by character (really, byte-by-byte) through the env var and sees if a case-insensitive string comparison with stricmp at the position matches against the file's actual extension (though I think it includes the dot, so that's good) 17:32
but if the file's extension is shorter than any entry in PATHEXT, only as many characters as the file extension are checked? 17:33
or does stricmp look until a null byte in all cases?
i don't see any mention of different string lengths in the microsoft documentation for _stricmp :) 17:35
so I don't think this code ever worked 17:36
except for the last entry in the array I guess? 17:37
Geth MoarVM/main: 72547f257b | MasterDuke17++ (committed using GitHub Web editor) | 3 files
Always check the return value of getenv() (#2002)

To prevent a possible NULL dereference. Also make a couple sections a little more consistent with the rest.
17:38
timo that is not relevant to this PR though
MasterDuke heh 17:39
timo 12 years old is this code :) 17:41
oh MasterDuke I talked to you about imhex didn't I? 17:46
MasterDuke hm, doesn't ring a bell 17:47
timo the imgui based hex editor program? hm, maybe not
MasterDuke looks interesting 17:50
timo I have a WIP .hexpat for .moarvm files 17:53
it creates a ton of entries in the structure view when using it on the core setting which the program wasn't so happy about last time I tried :D
MasterDuke ha, i can imagine 17:54
i love sql. i kind of just want everything to store data in an sqlite db and make it available for querying 17:59
timo if I make a speshlog-to-sqlite tool, will you help me search for some stuff? :D 18:00
MasterDuke for sure
timo dope
I worked briefly on something that would be a web frontend / viewer for spesh logs with crosslinking and moving relevant information closer together, like right now it's quite annoying to fish for the right Facts entry for the arguments of an op 18:09
though I think with some vimscript magic it could be not-so-hard to have a little split or panel that just does that correctly for me?
MasterDuke write an LSP for spesh logs? 18:11
timo i've never looked at how an LSP is implemented, no clue how much work it'd be for how much gain 18:15
MasterDuke same, this is pretty much just free association 18:18
tree sitter. there's another one
timo surely useful for at least syntax highlighting 18:21
MasterDuke speaking of sqlite, maybe it'd make sense to have an option to spit out the spesh log data directly into a sqlite db? we have precedent with profiles 18:23
timo "directly" into an sqlite db is a little bit of a stretch; the code in nqp that does that for profiles only generates sql text 18:24
MasterDuke well, almost. i guess we just emit sql statements
timo yeah
MasterDuke i wouldn't be opposed to (also) putting it right into an sqlite db 18:25
if anybody really wants to use another db i'm sure there are existing sqlite-to-<db engine of your choice> solutions 18:26
timo the issue really is whether to make a dependency on libsqlite 18:28
MasterDuke or build it ourselves, i believe it's pretty easy to do, just a single file 18:31
lizmat is libsqlite not supported on some platforms that currently *do* support rakudo ?
MasterDuke i doubt it
timo it's supported probably on everything out there 18:32
lizmat so that would not be a reason not to do it :-)
MasterDuke: re optimizing, so I was thinking that most infix ops would have the same trait, doing any constant folding
timo do we have any code in nqp land that tries to nativecall? do you need to write a lot of code to get a simple function from C called? 18:33
lizmat a custom function you mean? 18:34
MasterDuke lizmat: the legacy static optimizer does constant folding, but you're thinking of something beyond what it can do?
timo just a few functions from libsqlite3
lizmat MasterDuke: well, the static optimizer doing contant folding is basically from the top down, I'm more thinking bottom up 18:35
timo sqlite.org/c3ref/open.html
MasterDuke timo: github.com/Raku/nqp/blob/main/t/na...01-basic.t looks like there's something
timo ok cool, that's not so bad 18:36
lizmat raku.land/cpan:CTILMES/DB::SQLite
timo that's certainly not nqp code though?
lizmat Ah, I see what you mean... 18:37
well NativeCall depends on some NQP ops, but do they live in NQP ?
timo the test file MasterDuke dug up shows how to make nativecall calls in nqp, so that's good 18:41
the build system stuff I've had to do to make building fuzzing targets work is so nasty ;_; 18:49
MasterDuke timo: btw, do you have any opinions on moving from `-std=gnu99` to `-std=gnu11`?
timo does MSVC support that?
MasterDuke good question... 18:53
i assume it doesn't support `-std=gnu99` and we're probably just doing "standard" c99 with it? 18:55
timo presumably 19:00
MasterDuke ha. github.com/MoarVM/MoarVM/blob/main...up.pm#L422 19:03
while there's a small crowd online, any further thoughts on github.com/MoarVM/MoarVM/pull/1989 ? 19:05
lizmat meh, it keeps falling through the cracks 19:49
I'll merge it now
unless timo tells me not to in the next 15 mins :-) 19:50
timo the tests in that issue look reasonable, it's probably fine. i didn't look closely at the topic in general, sorry!
Geth MoarVM/main: 5149347a80 | MasterDuke17++ (committed using GitHub Web editor) | src/math/bigintops.c
Restore smallint optimization for nqp::mod_I (#1989)

Copies the implementation from rakudo.
19:51
21:33 MasterDuke left