16 yrs old - she/her
tldr: i work in rust and ts, i love mv-calculus, react, reverse-engineering and algorithms
experienced heaviest in rust and typescript but i can also work in objective c, c#, python, etc
i've messed a lot with the react internals and i understand how the rendering process works to a good extent. i've worked on tools which require hoisting react to hook its methods and as such i understand how the tree works, how hooks work internally, how to optimize the code, how the react dispatcher and virtual dom works, how react-dom renders the react tree, etc.
my main source of knowledge is reverse engineering- specifically discord react native client modifications
i also have an ongoing project for my own c-style language called Elle that i wrote in Rust which uses the QBE compiler backend
if you want more info, check out my github i guess
From Rosie to ~mpu/qbe
> All other instructions must just deal with scalars and pointers. That makes sense why I can declare it on `call` but not `copy`. Thank you!
From Rosie to ~mpu/qbe
Throughout my time of using QBE, I've noticed various assembly generation which is incorrect on my arm64_apple machine. I am not smart enough to debug them myself, however I thought the least I could do is to compile them all into a single detailed post that outlines the bug, the fix, and a basic example to reproduce. For all of these, the command I am using to build is: ```sh qbe -o dist/test.s dist/test.ssa && cc -o dist/out dist/test.s ``` I'm not sure what version of QBE I am using because I couldn't find it in the source code or via the `qbe` command itself, however I am pretty
From Rosie to ~mpu/qbe
That makes sense I suppose, considering GEP essentially just does load and store instructions internally, thank you! One thing I'm still confused about though, is why this: ```qbe %foo.addr =:Foo call $getFoo() %foo.copy =:Foo copy %foo.addr ``` throws an exception, but this: ```qbe %foo.addr =:Foo call $getFoo()
From Rosie to ~mpu/qbe
Nevermind, this snippet: ```qbe export function w $main() { @start %foo.addr =:Foo call $getFoo() %foo.copy =:Foo copy %foo.addr %foo.a =w loadw %foo.copy call $printf(l $test, ..., w %foo.a) ret 0 } ``` actually exits with "size class must be w, l, s, or d". It wasn't in my
From Rosie to ~mpu/qbe
I know you can create a structure/typedef in QBE quite easily, where ```elle struct Foo { int a; string b; double c; }; ``` maps almost exactly to ```qbe type :Foo = { w, l, d }
From Rosie to ~mpu/qbe
> the way you allocate memory on the stack of a function and return it is unsafe. I know, a better approach would probably have been just allocate on the heap with malloc. However in a function like this: ```elle fn concat(int size, ...) { variadic args[size * #size(string)]; defer free(args); string strings[size]; int sizes[size]; long length = 0;
From Rosie to ~mpu/qbe
I did this in my build process temporarily: ```makefile $(TMP_PATH)/out.tmp3.s: $(TMP_PATH)/out.tmp2.s sed -E 's/and\t(.*), #(.*), lsl (.*)/lsl\t\1, \3\n\tand\t\1, #\2/g' $< > $@ ``` but I would love to know whether this is an issue I caused due to incompetence or due to QBE screwing up codegen.
From Rosie to ~mpu/qbe
I wrote this simple program that allocates memory on the stack with a specified size in another function and returns a pointer to that memory: ```elle external fn printf(string formatter, ...); fn doSomething(long size) { int items[size]; items[0] = 100; return items; } pub fn main() { int *res = doSomething(10);
From Rosie 🌺 to ~mpu/qbe
I've figured out what the issue was. It turns out when I tried changing $callback to %callback, I wasn't taking into account that temporaries created in the language have a small tmp_counter at the end, so even though the real name is "callback" the name when emitting the IR is "callback.10". When adding that tmp_counter to the end to make it `call %callback.10(l %arg)` it now works. Thank you, as I would not have realised this if I didn't try messing around with the example you sent.
From Rosie 🌺 to ~mpu/qbe
I have reached a point in my compiler where I wanted to try and implement function pointers and therefore polymorphism. Take this simple example written in the language I'm developing: ```cpp pub fn main() { char *test = "Hello World!"; // Expected result: "H e l l o W o r l d !" loop(test, formattedPrint); printf!("\n"); return 0;