IRC channel logs

2025-10-27.log

back to list of logs

<matrix_bridge><gtker> stikonas, oriansj: Any thoughts/opinions on https://github.com/oriansj/M2libc/pull/105?
<matrix_bridge><Andrius Štikonas> I'll take a look in the evening, should be fine I guess
<matrix_bridge><Andrius Štikonas> Jeremiah Orians: any thoughts from you?
<laurenth>oriansj: I ported pnut-exe to M2-Planet over the weekend. The experience was pretty smooth, the only 2 missing features being macros expanding to other macros. https://github.com/udem-dlteam/pnut/pull/208
<laurenth>I had to work around a few bugs as the commit messages show, I didn't have enough time to investigate and fix them
<laurenth>s/macros expanding to other macros/macros expanding to other macros and ternary operators
<matrix_bridge><gtker> laurenth: Regarding recursive macro expansion, does this branch fix your problems https://github.com/gtker/M2-Planet/tree/recursive-macro ?
<laurenth>Seems to work!
<matrix_bridge><gtker> Cool, created a PR https://github.com/oriansj/M2-Planet/pull/163 should be in main soon. I'll see if I can fix some of the other minor things as well
<laurenth>Great! Let me know if you want me to test again
<laurenth>If you want to iterate locally, I use the following command to compile pnut `M2-Planet --architecture x86 -D target_i386_linux -D NO_TERNARY_SUPPORT -D ONE_PASS_GENERATOR -D SMALL_HEAP -I $M2LIB --expand-includes --debug pnut.c > pnut.M1`
<Googulator>What's the difference between --expand-includes and M2-Mesoplanet?
<Googulator>Is Mesoplanet obsolete now?
<matrix_bridge><gtker> laurenth: Try the same branch again for a fix for github.com/udem-dlteam/pnut/pull/208/commits/4f7bf1452d3add8b8ef3fb3b3746fb67ee029641
<laurenth>That fixes it
<matrix_bridge><gtker> Sadly the other issues don't have fixes as easy as those but when the fixes get merged you should be able to drop those two commits at least
<laurenth>I can understand wanting to keep M2-Planet simple and I really don't mind keeping some work-arounds in pnut's codebase. And 2 out of 4 work-around commits is a still pretty good :-)
<matrix_bridge><gtker> It's not so much wanting to keep it simple as it is needing to do a rather large refactor in order to make information available when it is needed 🙂
<matrix_bridge><cosinusoidally> laurenth: good to see it's a fairly small change to support M2-Planet. Do you plan to add M2-Planet build into your CI? iirc pnut used to allocate its heap with mmap. If that's still the case that might block running pnut under builder-hex0. Could brk syscalls be used instead?
<laurenth>cosinusoidally: Yes, I plan to add M2-Planet to pnut's CI so it doesn't bitrot. Have you tried to build pnut-exe with the `USE_STACK_FOR_GLOBALS` option? It places globals on the stack instead of using mmap
<laurenth>It should be relatively straightforward to support brk instead of mmap since mmap is only called twice during initialization (once for globals, once for the heap) and with a fixed size
<matrix_bridge><cosinusoidally> I haven't had a chance to test USE_STACK_FOR_GLOBALS but presumably that would rely on being able to allocate large amounts of memory on the stack (and the heap would be on the stack too)? I think in theory under builder-hex0 the stack can be up to 117MB (according to https://github.com/ironmeld/builder-hex0/blob/main/builder-hex0.hex2#L70) but on Linux you'd likely be limited to 8MB by default.
<stikonas>gtker: merged
<stikonas> https://github.com/oriansj/M2-Planet/pull/160 has conflictsthough
<matrix_bridge><gtker> stikonas: Cool. I'll just push the submodule update directly
<stikonas>sure
<stikonas>what are the other things that we are missing in M2-Planet?
<stikonas>that had to be worked around there
<stikonas>hmm, I guess I'll take a look at that PR...
<matrix_bridge><gtker> https://github.com/udem-dlteam/pnut/pull/208/commits/5ebba8f4d48a81fa74173412d237bb0fca60ad45 https://github.com/udem-dlteam/pnut/pull/208/commits/a8a8601f298d2b40dd9ea58f7a28471ac1b286f6 https://github.com/udem-dlteam/pnut/pull/208/commits/ad302d56a43c5b2b0c4a3c7d6e9309288f4a179d as well as ternary operator
<stikonas>yeah, some of these are not easy to fix
<stikonas>without a proper parser