Repository navigation
RISC-V: reimplement c_cInterpreter - #12982
Conversation
|
jenkins test sanity xlinux jdk11 |
|
Looks like jenkins is not listening to me... |
Only committers can trigger PR testing. |
|
Since this change is specific to RISC-V, I don't see why we need to test sanity on xlinux. I assume this is tested on RISC-V? |
|
@gacholio are you able to review the assembler? |
I'll try and take a look next week - I'm not familiar with the instruction set. |
|
Polite ping. |
There was a problem hiding this comment.
This seems confusing - why is 2 being stored in slot 18?
There was a problem hiding this comment.
In fact, I think it may be incorrect - the save area referred to by these macros is for the stack frame described by:
#elif defined(J9VM_ARCH_RISCV) /* J9VM_ARCH_ARM */
UDATA preservedGPRs[11]; /* x2, x8, x9, and x18-x25 */
U_8 preservedFPRs[32 * 8]; /* f0-f31 */
UDATA jitGPRs[32]; /* x0-x31 */
U_8 jitFPRs[32 * 8]; /* f0-f31 */
U_8 padding[8]; /* padding to 16-byte boundary */
So there are only 11 slots - index 18 is somewhere in the middle of the FPR save area.
There was a problem hiding this comment.
Yes, you're right, this seems wrong. Will fix it soon. Thanks!
f434361 to
55abf6e
Compare
|
@gacholio I just pushed new version (55abf6e). Changes:
Hope this is better. |
|
I am going on vacation for a week. I will try to take a look, but no guarantees. |
|
No problem at all, take it easy. I have bug(s) in JIT to chase. Thanks! |
The JIT register save area has (must have) space for all 32 registers so we shall save them in slots corresponding with their architectural numbers (s0 is x8, therefor should be save to slot 8)
On RISC-V there's no designated FP register (and when used, it's s0).
Signed-off-by: Jan Vrany <jan.vrany@fit.cvut.cz>
55abf6e to
329249e
Compare
|
Just pushed an update to fix few more issues I found when debugging JIT (1a2f97d, 5263cb2). Hope I got it right this time. |
|
This looks good in general. There are lots of seemingly extra blank lines. It would also be good to describe the register layout - is I also don't understand the JIT register layout - there's a large gap in the saves between s1 and s2. Really, s0 should be in save slot 0, etc in order for the stack walker to work with the JIT register maps. |
|
@gacholio Sorry for the late reply, I'm not pretending I understand all the consequence of the layout - all my understanding of how this works come from reading the (some) of the code. Here I merely did what AArhc64 does. Below is the table summarizing registers and their roles:
(+) empty means same role as in system linkage Basically:
|
|
Ah I see the confusion between the two register names - I suggest simply working in terms of |
I'd rather work in terms of ABI names - I use ABI names consistently among the codebase. Compiler code uses them too.
Sorry, I do not understand why would one need aliases. |
|
What can be done is to change |
|
The JIT does not follow any ABI but its own, so I don't personally think it makes sense to use the ABI names there, as they provide no benefit. I would use the x names for anything dealing with JIT registers (it's important the the register numbers match up with the appropriate bits in the register map, so numbering them simply makes sense). Using the ABI names makes sense when dealing with the C ABI, like the preserved registers in the C callin, the arg registers and return address. Is the JIT code using the same return address register as C? Perhaps someone from the JIT team should also comment. @0xdaryl @fjeremic |
|
The private linkage (JIT linkage) as I implemented it uses the same registers for same purpose as the system linkage, and https://github.com/eclipse/omr/blob/master/compiler/riscv/codegen/RVSystemLinkage.cpp#L68-L104 I think AArch64 does similar thing.
Sorry, I still do not understand what this exactly means. Do you mean saved / volatile registers must be numbered consecutively? That is, we cannot have the "gap" in JIT-saved registers? I think need to do my homework first and understand that part of the code.
Yes. Also same argument / return GPRs / FPRs, same temporary registers, same saved registers (except |
|
Bit 0 in the register map maps to x0, bit 1 to x1, etc, so at the very least, you need to be able to derive the true register number from the ABI alias when constructing the map (I would be surprised if the internal representation of a register didn't know it's real index). The register map is for GC purposes - it has a bit for every register that can possibly hold an object pointer. The preserved map is unrelated, but still ordered (e.g. So, when preserving registers in the helpers, to me it would be much clearer to store x0 into JIT GPR save slot 0, etc, rather than using the ABI names there, as there would end up being a confusing mix of the names. If this really bothers you, perhaps add extra helper macros to store the ABI registers by number that add the appropriate offset into the numbered GPR area - this would be a lot clearer than store s0 into GPR slot 8, etc. |
Indeed it does. Register definitions are generated from https://github.com/janvrany/omr/blob/jv/riscv-devel/compiler/riscv/codegen/riscv-regs.h
This is exacty what the code does at is is now except is uses ABI names, not
Do you mean that for - say Would this be fine with you? This is certainly fine with me. |
|
I was thinking something different, but that seems just as good. |
Perfect, will do soon! Thanks a lot! |
In general no. For private (JIT to JIT) linkage we use the same registers on the same processor irrespective of OS, however the system linkage may use different registers depending on OS. A clear example of this can be found on the system linkage where on Linux the return register is GPR2 and on z/OS (64-bit) the return register is GPR3. In JIT private linkage the return register is GPR2 always: openj9/runtime/compiler/z/codegen/S390PrivateLinkage.cpp Lines 93 to 96 in 8d0389c There is a reference document for system linkage here: |
…ic register name This commit changes both macros so that they take symbolic ABI register names (`s0`, `a5`) rather than index to save area. The conversion from register name to offset is entirely hidden to users of these macros.
|
@gacholio It took longer than expected. In the end I settled passing symbolic register names to openj9/runtime/vm/riscvcinterp.m4 Lines 30 to 36 in 11cd4dc |
|
Very polite ping. |
|
Sorry for the (long) delay. |
gacholio
left a comment
There was a problem hiding this comment.
One missing thing - the module.xml must be updated. Please search for rv64cinterp and replace with riscvcinterp. In the same file, there's a reference to the nojit version that should be deleted.
|
jenkins compile zlinux jdk8 |
This PR reimplements
c_cInterpreterin assembly in order to support transition from JIT code to interpreter and back.