IRC channel logs
2025-03-15.log
back to list of logs
<stikonas>janneke: hi. I've sent you a patch that synchs M1 defines for x86 and x86_64 from M2libc <stikonas>there were some codegen changes in M2-Planet git repo <stikonas>well, it also removes old style (capitalized long) defines too <stikonas>hopefully we had long enough transition period that nobody would be using very old M2-Planet anymore with mes <janneke>stikonas: right -- except that the (guix shell description in the) mes repository itself is still at 1.11.0 :) <janneke>i'll apply this to "wip" for now but it should probably go to master after bumping m2-planet <stikonas>yeah, 1.11.0 should work with new defines I think <stikonas>but yeah, we probably want this in some dot release soonish <stikonas>I'll try to test bootstrap before releasing stage0-posix/M2-Planet <janneke>"<stikonas> yeah, 1.11.0 should work with new defines I think" <janneke>are you using the mes lib c work in "wip" yet? <janneke>i was hoping it would enable skipping musl...buit yeah, it doesn't <stikonas>last few weeks I was busy reviewing all those patches from gtker... <ekaitz>i started trying things on top of master <stikonas>M2-Planet changelog is huge this time... <stikonas>and then still need to test bootstrap... <stikonas>well, at least to make sure mes-m2 works <stikonas>I'll try to make release soonish, perhaps today <stikonas>and if more patches keep coming, we can always have the next release sooner rather than later <stikonas>argh, I think current master is broken :( <stikonas>looks like it might be switch / case rework <stikonas>oh indeed, it has a complicated switch expression... switch(0xFF & global->readCur[7]) <stikonas>this only happens with bootstrapped M2-Planet... <stikonas>but not with M2-Planet compiled with GCC <stikonas>yeah, so hard to debug... no good debug symbols... <stikonas>well, it crashes somewhere in process_switch_iter <ekaitz>i also was going to ask about if vs switch <ekaitz>how much faster is switch? in M2? <stikonas>so definitely something is wrong with that switch commit. And you wanted that release specifically for that release <ekaitz>stikonas: it's also ok if we only support numbers <stikonas>oriansj checked at some point, switch generates better assembly than if/else <stikonas>and it works with GCC compiled M2-Planet <stikonas>well, we had plenty of those kind of bugs when we worked on bootstrapping tcc and gcc on riscv64... <stikonas>I don't recall any in M2-Planet before... <stikonas>I had int value = constant_expression(); <stikonas>but effectively it is inside manual "goto" loop <ekaitz>janneke: should I rebase to wip and continue there? <janneke>ekaitz: probably...if it works for you <ekaitz>janneke: if it's broken I won't, is it? <janneke>ekaitz: i don't think so; it just won't build gcc4 without musl just yet <stikonas>ok, so far no issues in testing (appart from the expected missing M1 defines in the released mes) <ekaitz>stikonas: keep me posted if you make the release <stikonas>need to do mescc-tools, mescc-tools-extra, M2-Planet, M2-Mesoplanet and combined stage0-posix <stikonas>need to upload to savannah too I think... <stikonas>just need to do combined stage0-posix release... <stikonas>make sure to download non-autogenerated one but uploaded one <stikonas>(autogenerated one does not include submodules) <ekaitz>the correct path is already written <ekaitz>i need to try this a little bit better <ekaitz>i'm sure i just screwed up in my code hehe <matrix_bridge><gtker> It shouldn't segfault, even if you pass it invalid code <stikonas>still need to email to bootstrappable builds (and perhaps reproducible builds) mailing list <ekaitz>i'm surely just doing some stupid shit <ekaitz>it only happens when built with M2Planet <stikonas>so mes->mescc built with M2-Planet works? <ekaitz>yeah but I have another swtich taht works <ekaitz>stikonas: i simplified the commit <ekaitz>do you see anything that is not equivalent there? <ekaitz>i had it simpler before but I just wanted to make everything superobvious and not touch much of what it was already there <ekaitz>oh if I try to build it by hand it works? <ekaitz>i have to check the actual command that is running here because there's too much tooling <ekaitz>gdb says mes is not in executable format <ekaitz>and the segfault was introduced here <ekaitz>i'm pretty sure my change keeps the same behavior but, am i missing something? <ekaitz>maybe is there some weird case I'm not handling properly? <stikonas>ok, I've send stage0-posix release mail to bootstrappable and rb-general mailing lists <ekaitz>can I make M2-Planet only assemble files? <ekaitz>well it does only assemble, doesn't it <ekaitz>maybe I can take a look to the output before it is compiled to `mes` binary <matrix_bridge><gtker> ekaitz: With "--dirty-mode" it won't delete intermediate files and you can inspect them. The M1 files are the closest to assembly <stikonas>--dirty mode I guess is for M2-Mesoplanet <stikonas>well, M2-Planet indeed will just assemble, it won't do anythign more <stikonas>and that assembly will have a few comments too, so will help you understand where you are <ekaitz>i have the same function compiled with the ifs and without them <stikonas>well, instructions that we use are not that different from riscv <stikonas>but you could use riscv build too for this :D <ekaitz>what i did is to convert my switch back to an if but with the same structure <ekaitz>so it's me that I didn't understand the code path properly <ekaitz>i just repeated the code using switches instead of the if and the values are different <ekaitz>SWITCH___________________________________________ <ekaitz>1011666872 1014045680 475200264 536466608 538845416 1011666872 1014045680 <ekaitz>IFS______________________________________________ <ekaitz>1011666872 1014045680 475200264 536466608 538845416 536466608 538845416 <ekaitz>1014045680 - 538845416 = 475200264 <ekaitz>so, it's using the d value without the - dist <ekaitz>so it's falling in the default case when it shouldn't <ekaitz>it's falling always in the default case <ekaitz>stikonas: i'd say the switch is broken <ekaitz>the other switch works, because the default is empty <ekaitz>idk why the other one works, maybe it's because this one has numbers and the other has characters <ekaitz>i bet it can be reproduced as is <ekaitz>what else can it be? the switch there is so obvious... <ekaitz>the only case that doesn't fall in the default is the 0 case <ekaitz>which should fall in the default <ekaitz>i replaced the constants with the actual value <ekaitz>so the defines are not being expanded <ekaitz>also the enums don't work (i tried) <ekaitz>shouldn't the columns be after the number? <ekaitz>the preprocessing should replace those shouldn't it? <ekaitz>oh maybe not because I see some STACK_SIZE out there too <ekaitz>in any case, why is the colon before the number? <stikonas>those colons are processed by M2-Planet tokenizer <ekaitz>so the preprocessor converts C to something else? <ekaitz>because the first works and the second goes to default <ekaitz>in my code the defines don't work but the number does <stikonas>so that if statement only works on numbers <stikonas>I migth not have time to fix it until end of March though <ekaitz>with the enums el output is the same <stikonas>ekaitz: yeah, so I think what is happening <stikonas>but typedefs and enums are processed in the next block <stikonas>but see next block deals with variables and then block after that with numbers <stikonas>should actually just strip : and pass to the next 2 blocks (variables and numbers) <stikonas>so I think I mostly understand why it happens <stikonas>we can release M2-Planet 1.12.1 later once this is fixed... <ekaitz>i may try to fix it but I have short time blocks and it's going to be hard <matrix_bridge><gtker> stikonas: Are you working on a patch or do you want me to open a PR? <stikonas>well, I tried a bit of experimenting, but didn't get anything working <stikonas>but I think the problem is in constant_unary_expression in the handling of : <stikonas>ekaitz: also note that those constant expressions (in case and in other places such as array size) don't respect operator priority <stikonas>gtker probably even switch.c in our testsuite <matrix_bridge><gtker> Is there a failing program I can test against? As far as I can see we're using an enum in the switch.c tests <stikonas>but anyway, I don't have any testcase either <stikonas>ekaitz: can you help gtker with testcase? <stikonas>that inverse : behavious is somewhat annoying :( <ekaitz>oh sorry guys I was going to send you one but I was busy <ekaitz>that's consistent with what I experienced <matrix_bridge><gtker> stikonas: Yeah, it might be. At least for case values since they aren't labels. Might be annoying since we need to add state to the tokenizer for when the previous token was "case" <stikonas>well, I was thinking about undoing it completely <stikonas>and then for labels, check if next token is : <matrix_bridge><gtker> Hmm, yeah, that would also work and might be cleaner. It would probably require relatively large changes though? <matrix_bridge><gtker> I believe I have a slightly hacky workaround for now. But it's probably a good idea to fix labels <matrix_bridge><gtker> I'll add a few more tests and create a PR. Probably within 20 minutes <ekaitz>yup i was thinking on doing something similar but I don't know the codebase <ekaitz>it's not obvious to, but I'll try <stikonas>see if this M2-Planet commit helps with you bigger case <ekaitz>i'm trying to get the patch and all and github doesn't provide it <ekaitz>oh if I add .patch to the url it gives it to me <ekaitz>but let me try properly just in case