So as if to atone from my awful disassembler hack I wrote a really neat stack frame class. Say you’re writing some function that needs some non-volatile registers and maybe a local variable. You define the frame like this:
StackFrame frame = StackFrame(); const Register start_addr = frame.get_register(); const Register end_addr = frame.get_register(); const FloatRegister mr_floaty = frame.get_float_register(); const Address variable = frame.get_local_variable();
Once you defined the frame you just wrap your code with my funky new prolog
and epilog
macros and all the storing and restoring and stack pointer setting and alignment stuff gets done for you:
__ prolog (frame); __ addi (end_addr, start_addr, 8); __ lfd (mr_floaty, variable); __ call (some_func); __ epilog (frame);
As far as I can see the other OpenJDK architectures just do this kind of thing manually which for someone as slapdash as me is a whole world of pain.