Skip to content

Commit f6940e2

Browse files
authored
Merge pull request #22171 from rmnattas/p-itablewalk
Insert iTableWalk in _interfaceSlotsUnavailable
2 parents 36f7bf0 + 7910c6a commit f6940e2

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

runtime/compiler/p/runtime/PicBuilder.spp

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2634,16 +2634,50 @@ _interfaceSlotsUnavailable:
26342634
staddr r10, -8*ALen(J9SP) ! Replaced staddru r10, -8*ALen(J9SP) for P6 perf
26352635
staddr r9, -7*ALen(J9SP)
26362636
#ifndef NO_HELPER_LASTITABLE_CHECK
2637-
! Before going to the VM helper, check if the receiver class lastITable matches the interface class
2638-
! of the method being called and if so, use it to quickly look up the vtable offset and make the call
2637+
! Before iTable walk or going to the VM helper, check if the receiver class lastITable matches the interface
2638+
! class of the method being called and if so, use it to quickly look up the vtable offset and make the call
26392639
LOAD_CLASS(r10,r3) ! Load the class
26402640
maskVFT(r10)
26412641
laddr r12, 3*ALen(r11) ! Load the interface class of the method from the snippet
26422642
laddr r9, J9TR_J9Class_lastITable(r10) ! Load the cached last ITable
26432643
laddr r0, J9TR_J9ITable_interfaceClass(r9) ! Load the interface class whose ITable this is
26442644
cmpl cr0, CmpAddr, r12, r0
2645+
#ifndef NO_ITABLEWALK_CHECK
2646+
beq .L.hitITable
2647+
! Before going to the VM helper do iTable walk N times
2648+
! check iTable[0]
2649+
laddr r9, J9TR_J9Class_iTable(r10) ! Load the iTable pointer
2650+
cmpi cr0, CmpAddr, r9, 0 ! check iTable != null
2651+
beq .L.callHelper
2652+
laddr r0, J9TR_J9ITable_interfaceClass(r9) ! Load iTable class
2653+
cmpl cr0, CmpAddr, r12, r0
2654+
beq .L.hitITable
2655+
! check iTable[1]
2656+
laddr r9, J9TR_J9ITable_next(r9) ! Load the next iTable pointer
2657+
cmpi cr0, CmpAddr, r9, 0 ! check iTable != null
2658+
beq .L.callHelper
2659+
laddr r0, J9TR_J9ITable_interfaceClass(r9) ! Load iTable class
2660+
cmpl cr0, CmpAddr, r12, r0
2661+
beq .L.hitITable
2662+
! check iTable[2]
2663+
laddr r9, J9TR_J9ITable_next(r9) ! Load the next iTable pointer
2664+
cmpi cr0, CmpAddr, r9, 0 ! check iTable != null
2665+
beq .L.callHelper
2666+
laddr r0, J9TR_J9ITable_interfaceClass(r9) ! Load iTable class
2667+
cmpl cr0, CmpAddr, r12, r0
2668+
beq .L.hitITable
2669+
! check iTable[3]
2670+
laddr r9, J9TR_J9ITable_next(r9) ! Load the next iTable pointer
2671+
cmpi cr0, CmpAddr, r9, 0 ! check iTable != null
2672+
beq .L.callHelper
2673+
laddr r0, J9TR_J9ITable_interfaceClass(r9) ! Load iTable class
2674+
cmpl cr0, CmpAddr, r12, r0
2675+
bne .L.callHelper
2676+
#else
26452677
bne .L.callHelper
2678+
#endif /* ~NO_ITABLEWALK_CHECK */
26462679
! lastITable is a match
2680+
.L.hitITable:
26472681
laddr r12, 4*ALen(r11) ! Load the itable offset from the snippet
26482682
andi. r0, r12, J9TR_J9_ITABLE_OFFSET_TAG_BITS ! Call the helper if the itable offset is tagged
26492683
bne .L.callHelper

runtime/jilgen/jilconsts.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,13 +532,15 @@ writeConstants(OMRPortLibrary *OMRPORTLIB, IDATA fd)
532532

533533
/* J9Class */
534534
writeConstant(OMRPORTLIB, fd, "J9TR_J9Class_classLoader", offsetof(J9Class, classLoader)) |
535+
writeConstant(OMRPORTLIB, fd, "J9TR_J9Class_iTable", offsetof(J9Class, iTable)) |
535536
writeConstant(OMRPORTLIB, fd, "J9TR_J9Class_lastITable", offsetof(J9Class, lastITable)) |
536537
writeConstant(OMRPORTLIB, fd, "J9TR_J9Class_lockOffset", offsetof(J9Class, lockOffset)) |
537538
writeConstant(OMRPORTLIB, fd, "J9TR_ArrayClass_componentType", offsetof(J9ArrayClass, componentType)) |
538539

539540
/* J9ITable */
540541
writeConstant(OMRPORTLIB, fd, "J9TR_ITableOffset", sizeof(J9ITable)) |
541542
writeConstant(OMRPORTLIB, fd, "J9TR_J9ITable_interfaceClass", offsetof(J9ITable, interfaceClass)) |
543+
writeConstant(OMRPORTLIB, fd, "J9TR_J9ITable_next", offsetof(J9ITable, next)) |
542544

543545
/* J9Method */
544546
writeConstant(OMRPORTLIB, fd, "J9TR_MethodFlagsOffset", offsetof(J9Method, constantPool)) |

0 commit comments

Comments
 (0)