5 Okay so SummerCoat runs this code, but RatufaCoat crashes. On x86 it runs
6 okay until it tries to intern a string and on PowerPC is breaks after
7 garbage collection on a return.
11 Okay PowerPC runs fine, so this means it is a byte swapping issue
16 Crashes on 32-bit and 64-bit x86 so definitely an endianess issue.
20 I wonder if I write a UTF somewhere.
24 Okay so there is an actual write to ROM, I wonder if it happens on big endian
29 Okay it does, just does not lead to a crash.
33 Okay so what is being written to ROM ends up being the vtable. So what happens
34 is that our vtable entry is read in. Then we do a ref count on it when we are
39 Okay so this is an issue with `INVOKEVIRTUAL`, it seems that is is uncounting
40 volatile registers. And looking at reference pushing I exactly see why. I am
41 using a fixed base for values instead of the volatile get.
45 I am going to add a very basic debug print which just takes two characters and
50 I believe returned values need to be ref-counted. Why? Because even if we pass
51 an object to a method that is `this`, if it returns `this` then we will drop a
52 count. And that is basically what the initial case for `jvmLoadString()`.
56 So a garbage collection is happening. I do know the `byte[]` gets GCed but it
57 seems the string is being GCed too?
61 Okay so it seems that `jvmLoadString()` is returning `1`.
65 I see no issue from the caller side, so it has to be from `jvmLoadString()`.
69 Maybe the copy from return is incorrect?
73 Okay this sequence tells me that we do have an interned string returned but it
74 ends up returning the value 1 instead of the value we want to return. Which is
75 a bit strange. I know previously I used return registers as temporary values,
76 so is such a thing still happening?
97 I believe I have an idea of what is happening. I am copying the value to the
98 return register, but before I actually return from the method the code
99 generator generates code which can run the garbage collector. And the return
100 register is not valid after and invoke, it must immedietly return. So I do
101 know that the GC is being called to cleanup the `byte[]` object and then some
102 kind of code in there causes `1` to be set to the return register. So I need
103 to copy the value much later and after all the cleanup has happened.
107 So now I have another issue where it seems that the values passed to the
108 object array are exactly the same index or similar. Or the access of the
109 array is wrong? But the wrong access is unlikely maybe?