melonDS
melonDS copied to clipboard
ARMJit Compiler::Reset(): Cleaner way to fill memory with BRK.
See https://melonds.kuribo64.net/comments.php?id=137&cid=2971#comment2971
I have no way to test this because of a lack of debuggable high-power ARM devices, but I think this is right.
Let me test on my M1 with the full change.
Edit: Fails during build with the following error.
/Volumes/Extras HD/GitHub/melonDS/src/ARMJIT_A64/ARMJIT_Compiler.cpp:836:15: error: cannot initialize a variable of type 'u8 *const' (aka 'unsigned char *const') with an rvalue of type 'const u8 *' (aka 'const unsigned char ') u8 const rw_ptr = GetRWPtr(); ^ ~~~~~~~~~~
we break aliasing all the time, so while this is more correct, it's really a drop in the ocean
EDIT: also regarding your comment, on the post, it was different reason it crashed.
Ah there was a hidden const_cast in there before, that's even more sketchy. Well either way, fair enough, I just saw the blog post and my brain went 'wait this is not right'.
Ah there was a hidden const_cast in there before, that's even more sketchy. Well either way, fair enough, I just saw the blog post and my brain went 'wait this is not right'.
It's definitely not. It's not so much a full on crash as a hang when the JIT and FastMem are both enabled.
How about this now?
I mean we can merge this, though we still rely massively break aliasing on so many other places in so much more complex ways, that if the compiler ever bits back, it'll do somewhere else first.