IRC channel logs

2022-11-06.log

back to list of logs

<stikonas>oriansj: I've got simple global struct to work, so mix of e.g. integers and chars should be fine, stuff like (&a)->y seems to work too but right now I'm still having problems with arrays inside global structs...
<stikonas>do you think we can ignore them for the time being?
<stikonas>hmm, for some reason I think I get an extra dereference there...
<stikonas>hmm, that's probably something that might be fixable in dot processing function
<stikonas>after all . and [] kind of "cancel" each other in some sense
<stikonas>ok, adding if(match("[", global_token->s)) return; seems to fix it...
<muurkha>stikonas: how much complexity in the compiler was it to get the global struct to work?
<stikonas>muurkha: cc_core.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
<stikonas>(that's not counting tests, etc...)
<stikonas>I'll see if I can get local structs to work too
<stikonas>probably similar complexity
<stikonas>in general not too complex
<stikonas>took me maybe an hour...
<stikonas>muurkha: and I think I've mostly got local structs to work too
<stikonas>well, at least on amd64
<stikonas>(might need adjustment for arches where stack goes the other direction
<stikonas>and I might have also found a bug in M1...
<muurkha>cool
<stikonas>on riscv it fails to convert RD_A0 RS1_FP !-0 ADDI
<stikonas>in particular leaves !-0
<stikonas>hmm, I wonder if M1 should be able to deal with !-0 or M2-Planet should not spit "-0"...
<stikonas>oriansj: what do you think?
<stikonas>M1 fix is not too bad https://github.com/oriansj/mescc-tools/pull/38
<oriansj>stikonas: -0 is just 0; unless you are telling me that riscv did something completely insane
<oriansj>M2-Planet should be smart enough to know not to spit out -0; in fact M2libc wouldn't ever produce that output if one did: int2str(x, 10, TRUE);
<oriansj>the only way you could get M2-Planet to output -0 is if you did: emit_out("RD_A0 RS1_FP !-"); which ment you were putting the incorrect offset in the tracking structures
<stikonas[m]>Hmm, yeah, ignore that pr, it might indeed be wrong offset
<stikonas[m]>I did see some evidence of it being wrong in gdb after that pr
<stikonas[m]>Anyway, I'll look more tomorrow
<oriansj>I trust you'll find the cleanest (least hacky way)
<stikonas[m]>Hmm, it would be a bit cleaner if depth was more consistent between arches, some arches have depth positive and some negative and then do add or sub compared to base pointer
<stikonas[m]>For no particular reason... Unless I'm mistakes, they all grow stack downwards
<stikonas[m]>s/mistakes/mistaken/
<stikonas>oriansj: just to make sure since I'm not super familiar with knigt. On knight the stack still grows down?
<stikonas>oriansj: https://github.com/oriansj/M2-Planet/pull/44
<stikonas>both global and local structs seem to work now
<stikonas>hmm, I've converted that PR to draft for now
<stikonas>somehow M2-Planet tests pass but stage0-posix doesn't seem to work
<stikonas>(except for x86)
<stikonas>(no, x86 also fails)
<stikonas>argh, that's unrelated, that's due to my dirty M2libc folder
<stikonas>indeed stage0-posix seems to work with my M2-Planet changes