Skip to content

Commit

Permalink
Runtime compressed refs work
Browse files Browse the repository at this point in the history
Support mixed mode in the Z JIT.

[ci skip]

Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
  • Loading branch information
gacholio committed Mar 4, 2020
1 parent 51d9fc6 commit 1ce2e50
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 21 deletions.
28 changes: 14 additions & 14 deletions runtime/compiler/z/runtime/PicBuilder.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,7 @@ LABEL(LcontinueLookup)
ZZ # Load address of interface table & slot number
LA r2,eq_intfAddr_inInterfaceSnippet(,r14)
L_GPR r1,(2*PTR_SIZE)(,J9SP) # Load this
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r1,J9TR_J9Object_class(,r1)
ZZ # Load lookup class offset
LLGFR r1,r1
Expand All @@ -1565,7 +1565,7 @@ LOAD_ADDR_FROM_TOC(r14,TR_S390jitLookupInterfaceMethod)
LR_GPR r14,r0
ZZ # return interpVtable offset in r2
L_GPR r1,(2*PTR_SIZE)(,J9SP) # Load this
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r3,J9TR_J9Object_class(,r1)
ZZ # Load offset of the lookup class
LLGFR r3,r3
Expand All @@ -1583,7 +1583,7 @@ LABEL(LcommonJitDispatch) # interpVtable offset in r2
LNR_GPR r2,r2 # negative the interpVtable offset
AHI_GPR r2,J9TR_InterpVTableOffset
LR_GPR r0,r2 # J9 requires the offset in R0
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r3,J9TR_J9Object_class(,r1)
ZZ # Load offset of the lookup class
LLGFR r3,r3
Expand Down Expand Up @@ -1653,7 +1653,7 @@ LABEL(ifCH1LcontinueLookup)
ZZ # Load address of interface table & slot number
LA r2,eq_intfAddr_inInterfaceSnippet(,r14)
L_GPR r1,(2*PTR_SIZE)(,J9SP) # Load this
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r1,J9TR_J9Object_class(,r1)
ZZ # Load lookup class offset
LLGFR r1,r1
Expand All @@ -1670,7 +1670,7 @@ LOAD_ADDR_FROM_TOC(r14,TR_S390jitLookupInterfaceMethod)

ZZ # return interpVtable offset in r2
L_GPR r1,(2*PTR_SIZE)(,J9SP) # Load this
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r3,J9TR_J9Object_class(,r1)
ZZ # Load offset of the lookup class
LLGFR r3,r3
Expand All @@ -1683,7 +1683,7 @@ ZZ # Load the addr of the lookup class
TM eq_methodCompiledFlagOffset(r3),J9TR_MethodNotCompiledBit
JNZ ifCH1LcommonJitDispatch

ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r2,J9TR_J9Object_class(,r1)
ZZ # Read class offset
LLGFR r2,r2
Expand Down Expand Up @@ -1827,7 +1827,7 @@ LABEL(ifCH1LcommonJitDispatch) # interpVtable offset in rEP
AHI_GPR rEP,J9TR_InterpVTableOffset
LR_GPR r0,rEP # J9 requires the offset in R0
L_GPR r1,(2*PTR_SIZE)(J9SP) # Restore "this"
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r3,J9TR_J9Object_class(,r1)
ZZ # Load offset of lookup class
LLGFR r3,r3
Expand Down Expand Up @@ -1896,7 +1896,7 @@ LABEL(ifCHMLcontinueLookup)
ZZ # Load address of interface table & slot number
LA r2,eq_intfAddr_inInterfaceSnippet(,r14)
L_GPR r1,(2*PTR_SIZE)(,J9SP) # Load this
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r1,J9TR_J9Object_class(,r1)
ZZ # Load offset of lookup class
LLGFR r1,r1
Expand All @@ -1913,7 +1913,7 @@ LOAD_ADDR_FROM_TOC(r14,TR_S390jitLookupInterfaceMethod)

ZZ # returned interpVtable offset in r2
L_GPR r1,(2*PTR_SIZE)(,J9SP) # Load this
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r3,J9TR_J9Object_class(,r1)
ZZ # Load offset of the lookup class
LLGFR r3,r3
Expand All @@ -1928,7 +1928,7 @@ ZZ # Load the address of the lookup class
JNZ ifCHMLcommonJitDispatch

ZZ #Load receiving object classPtr in R2
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r2,J9TR_J9Object_class(,r1)
ZZ # Read class offset
LLGFR r2,r2
Expand Down Expand Up @@ -1992,7 +1992,7 @@ LABEL(ifCHMLoopTillUpdate)

ZZ current slot is now updated,
ZZ Lets see if it has same classPtr as we are trying to store
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r0,J9TR_J9Object_class(,r1)
ZZ # Read class offset
LLGFR r0,r0
Expand All @@ -2014,7 +2014,7 @@ ZZ slot we contended for last time
LABEL(ifCHMUpdateCacheSlot)
ZZ store class pointer and method EP in the current empty slot
ST_GPR r3,PTR_SIZE(,r1)
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
ST r2,0(,r1)
},{dnl
ST_GPR r2,0(,r1)
Expand All @@ -2028,7 +2028,7 @@ ZZ Load pic address as second address
L_GPR r0,J9TR_J9Class_classLoader(CARG1)

ZZ Load class pointer as first argument
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L CARG1,0(CARG2) # May need to convert offset to J9Class
LLGFR CARG1,CARG1
},{dnl
Expand Down Expand Up @@ -2112,7 +2112,7 @@ LABEL(ifCHMLcommonJitDispatch) # interpVtable offset in rEP
AHI_GPR rEP,J9TR_InterpVTableOffset
LR_GPR r0,rEP # J9 requires the offset in R0
L_GPR r1,(2*PTR_SIZE)(J9SP) # Restore "this"
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
L r3,J9TR_J9Object_class(,r1)
ZZ # Load offset of the lookup class
LLGFR r3,r3
Expand Down
6 changes: 3 additions & 3 deletions runtime/compiler/z/runtime/Recompilation.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ define(`ZZ',`**')
define(`ZZ',`##')
')dnl

ZZ Copyright (c) 2000, 2019 IBM Corp. and others
ZZ Copyright (c) 2000, 2020 IBM Corp. and others
ZZ
ZZ This program and the accompanying materials are made
ZZ available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -953,7 +953,7 @@ ZZ rEP - new method Entry Point

ZZ Get the lastCacheSlot pointer into r3.
L_GPR r3,eq_lastCachedSlotField_inInterfaceSnippet(r2)
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
ZZ Load the class offset (32 bits)
L r0,J9TR_J9Object_class(,r1)
LLGFR r0,r0
Expand All @@ -973,7 +973,7 @@ ZZ slots or slots are uninitialized.
JL LJumpToNewRoutine

ZZ Compare our class pointer with the class pointer in current slot
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
CL r0,0(,r3)
},{dnl
CL_GPR r0,0(,r3)
Expand Down
43 changes: 41 additions & 2 deletions runtime/compiler/z/runtime/s390_macros.inc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ZZ Copyright (c) 2000, 2019 IBM Corp. and others
ZZ Copyright (c) 2000, 2020 IBM Corp. and others
ZZ
ZZ This program and the accompanying materials are made
ZZ available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -540,7 +540,7 @@ define(MTComputeStaticAddress,{dnl
NILH r2,0 # get col index
SLLG r2,r2,0(r1) # col offset, data size

ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
IfCompressedElse({dnl
LGR r14,r0 # restore r14
LG r1,28(,r14) # load CP word
SRLG r1,r1,8 # shift amount
Expand All @@ -557,3 +557,42 @@ ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
LABEL(LMTComputeStaticAddress$1End)
})dnl

ZZ ============================================================
ZZ Perform either the compressed or non-compressed code path.
ZZ inputs:
ZZ r13 = current J9VMThread
ZZ $1 = compressed code block
ZZ $2 = non-compressed code block
ZZ
ZZ On compressed-only builds, this evaluates to $1
ZZ On full-only builds, this evaluates to $2
ZZ On mixed builds, a runtime test is inserted and both code paths
ZZ are evaluated.
ZZ ============================================================

define({CONCAT},$1$2)dnl
define({SYM_COUNT},0)dnl
define({GENSYM},{dnl
define({SYM_COUNT},eval(1+SYM_COUNT))dnl
define({CURRENT_FULL},CONCAT(full,SYM_COUNT))dnl
define({CURRENT_DONE},CONCAT(done,SYM_COUNT))dnl
})dnl

ZZ The ugly formatting in this macro is due to restrictions
ZZ in the assembler regarding line length and spacing before
ZZ comments.

define({IfCompressedElse},{dnl
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{dnl
ifdef({ASM_OMR_GC_FULL_POINTERS},{dnl
GENSYM
TM J9TR_VMThreadCompressObjectReferences(r13),1
JZ CURRENT_FULL
$1
j CURRENT_DONE
LABEL(CURRENT_FULL)
$2
LABEL(CURRENT_DONE)
},{$1})dnl
},{$2})dnl
})dnl
8 changes: 6 additions & 2 deletions runtime/vm/zcinterp.m4
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dnl Copyright (c) 2017, 2019 IBM Corp. and others
dnl Copyright (c) 2017, 2020 IBM Corp. and others
dnl
dnl This program and the accompanying materials are made available under
dnl the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -195,6 +195,10 @@ PLACE_LABEL(L_GS_CALL_HELPER)
dnl Load the updated object pointer into CARG2
LG CARG1,J9TR_VMThread_gsParameters_operandAddr(J9VMTHREAD)
ifdef({ASM_OMR_GC_COMPRESSED_POINTERS},{
ifdef({ASM_OMR_GC_FULL_POINTERS},{
TM J9TR_VMThreadCompressObjectReferences(J9VMTHREAD),1
JZ LABEL_NAME(L_GS_SKIP_SHIFT)
}) dnl ASM_OMR_GC_FULL_POINTERS
dnl Some objects may be stored in a decompressed format on the heap.
dnl A typical example of this may be static objects. For such objects
dnl we must not decompress via the compressedPointersShift value. To
Expand All @@ -208,7 +212,7 @@ dnl mainline and check whether it is an LGG or LLGFSG instruction.
LG CARG2,J9TR_JavaVM_compressedPointersShift(CARG2)
SLLG CARG2,CARG1,0(CARG2)
J LABEL_NAME(L_GS_DONE_SHIFT)
})
}) dnl ASM_OMR_GC_COMPRESSED_POINTERS

PLACE_LABEL(L_GS_SKIP_SHIFT)
LG CARG2,0(CARG1)
Expand Down

0 comments on commit 1ce2e50

Please sign in to comment.