IRC channel logs

2025-03-25.log

back to list of logs

<matrix_bridge><gtker> oriansj: Why did you end up creating the "// CONSTANT BLA 1" syntax instead of just treating "#DEFINE BLA 1" as a constant?
<ekaitz>janneke: sent you a documentation patch for Mes, if it needs some extra work in the docs to accomodate that kind of explanation
<ekaitz>I also plan to add documentation about the Mes interpreter internals, once it's reworked
<ekaitz>for the moment i tried to be the less intrusive as possible with the rest of the document
<matrix_bridge><Andrius Štikonas> gtker I guess early versions of cc_x86 had # as a comment and it was processed very early (in tokenizer)
<janneke>ekaitz: thanks
<ekaitz>stikonas: interesting how my if->switch change makes gcc -O0 20% faster but it's unoticeable in M2Planet
<stikonas>hmm, I guess gcc can optimize things better
<stikonas>still I guess it's not bad that gcc build is faster
<stikonas>and switch should be easier toread
<stikonas>than lots of if/else if /else blocks
<ekaitz>yeah of course
<ekaitz>structurally speaking the changes I did are only in the garbage collector
<ekaitz>so it makes sense that the impact is kind of small in both cases anyway
<ekaitz>stikonas: in M2-Planet I can rely on checking the first field of structs vs integers?
<stikonas>what do you mean?
<ekaitz>ugh superhard to explain
<stikonas>any code example somewhere?
<ekaitz>let me write something
<stikonas>I guess that's why I'm confused
<ekaitz>yeah.. haha
<ekaitz>ugh i don't remember how it was
<ekaitz>i know it was written somewhere in a book, let me find
<ekaitz>okay i think I got something
<ekaitz>the proper question would be: can I cast pointers in M2Planet?
<ekaitz>are the struct fields in order and all that?
<stikonas>there is no casting in M2-Planet
<stikonas>struct fields are in order though
<stikonas>casting, e.g. (void*) int_pointer is not allowed yet
<stikonas>but you could assign them I think
<stikonas>e.g. void_pointer = int_pointer;
<ekaitz>oh
<ekaitz>good
<ekaitz>yeah this is enough i think
<ekaitz>so i can reassing a pointer to a struct to an int pointer and it will get the first field of the struct (if it's an int)
<stikonas>I think this should work
<stikonas>but best to test it
<ekaitz>okay great
<stikonas>well, if something doesn't work, feel free to report
<stikonas>we fixed that switch issue that you had...
<ekaitz>:)
<ekaitz>uugh i thought this thing was going to be easier but Mes compares things by pointer
<ekaitz>very interesting, i will need to rewrite many things :)
<stikonas>I'm not too familiar with mes... I mostly looked at meslibc and mescc
<ekaitz>it's a very simple interpreter, pretty short, but in a couple of places it gets interesting
<ekaitz>and now M2-Planet supports pointer arithmetic, right?
<stikonas>ekaitz: partiallty
<mihi>ekaitz: gcc will compile switch to a jump table even with -O0: https://godbolt.org/z/6McTcasTo I'm pretty sure M2-Planet does not.
<stikonas>yeah, looks like mes/src/*.c has similar size as M2-Planet these days
<ekaitz>mihi: oh! yeah that must be a huge improvement in performance
<ekaitz>stikonas: yes! it's very small
<ekaitz>the complexity really is in mescc i think
<stikonas>and mescc also needs nyacc
<stikonas>ekaitz: as for pointer arithmetic, it is supported in += -= ++ and --
<stikonas>but not for + and -
<stikonas>++ and -- are unreleased though, not part of 1.12
<stikonas>so if you can, port pointer arithmetic cases to += or -=
<ekaitz>okay
<stikonas>form the current #if __M2__ blocks
<stikonas>I think there aren't that many of those
<stikonas>there is include/mes/mes.h:#define M2_CELL_SIZE sizeof (struct scm)
<stikonas>I guess e.g. something like cell_zero = cell_arena + M2_CELL_SIZE; could now be written cell_zero = cell_arena; cell_zero += 1;
<stikonas> cell_zero = cell_arena + 1 wouldn't work yet
<ekaitz>okay
<ekaitz>good