Skip to content

Commit

Permalink
Preserve vector registers across helper calls on P
Browse files Browse the repository at this point in the history
Optionally preserve the vector registers in the assembly helpers on
Power. This is controlled by the
J9_EXTENDED_RUNTIME_USE_VECTOR_REGISTERS bit in the J9JavaVM
extendedRuntimeFlags field.

Fixes: #11752

[ci skip]

Signed-off-by: Graham Chapman <graham_chapman@ca.ibm.com>
  • Loading branch information
gacholio committed Apr 5, 2021
1 parent fe5d0ca commit eb5770b
Show file tree
Hide file tree
Showing 6 changed files with 389 additions and 34 deletions.
35 changes: 26 additions & 9 deletions runtime/codert_vm/pnathelp.m4
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dnl SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exc

include(phelpers.m4)

.file "pnathelp.s"
START_FILE("pnathelp.s")

define({CSECT_NAME},{pnathelp})

Expand Down Expand Up @@ -294,6 +294,31 @@ START_PROC($1)
END_PROC($1)
})

dnl Helpers that are at a method invocation point.
dnl
dnl See definition of SAVE_C_VOLATILE_REGS in phelpers.m4
dnl for details.

undefine({MUST_PRESERVE_FPR})
undefine({MUST_PRESERVE_VR})

PICBUILDER_DUAL_MODE_HELPER(jitLookupInterfaceMethod,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveInterfaceMethod,2)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveSpecialMethod,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveStaticMethod,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveVirtualMethod,2)
SLOW_PATH_ONLY_HELPER(jitInduceOSRAtCurrentPC,0)
SLOW_PATH_ONLY_HELPER(jitInduceOSRAtCurrentPCAndRecompile,0)
SLOW_PATH_ONLY_HELPER(jitRetranslateMethod,3)

dnl Helpers that are not at a method invocation point.
dnl
dnl See definition of SAVE_C_VOLATILE_REGS in phelpers.m4
dnl for details.

define({MUST_PRESERVE_FPR})
ifdef({ASM_J9VM_ENV_DATA64},{define({MUST_PRESERVE_VR})})

dnl Runtime helpers

DUAL_MODE_HELPER(jitNewValue,1)
Expand Down Expand Up @@ -356,18 +381,13 @@ dnl Only called from PicBuilder
PICBUILDER_FAST_PATH_ONLY_HELPER(jitMethodIsNative,1)
PICBUILDER_FAST_PATH_ONLY_HELPER(jitMethodIsSync,1)
PICBUILDER_FAST_PATH_ONLY_HELPER(jitResolvedFieldIsVolatile,3)
PICBUILDER_DUAL_MODE_HELPER(jitLookupInterfaceMethod,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveString,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveClass,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveClassFromStaticField,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveField,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveFieldSetter,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveStaticField,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveStaticFieldSetter,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveInterfaceMethod,2)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveSpecialMethod,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveStaticMethod,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveVirtualMethod,2)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveMethodType,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveMethodHandle,3)
PICBUILDER_SLOW_PATH_ONLY_HELPER(jitResolveInvokeDynamic,3)
Expand All @@ -385,7 +405,6 @@ dnl Recompilation helpers

SLOW_PATH_ONLY_HELPER(jitRetranslateCaller,2)
SLOW_PATH_ONLY_HELPER(jitRetranslateCallerWithPreparation,3)
SLOW_PATH_ONLY_HELPER(jitRetranslateMethod,3)

dnl Exception throw helpers

Expand Down Expand Up @@ -419,8 +438,6 @@ FAST_PATH_ONLY_HELPER_NO_RETURN_VALUE(jitWriteBarrierStoreMetronome,3)

dnl Misc

SLOW_PATH_ONLY_HELPER(jitInduceOSRAtCurrentPC,0)
SLOW_PATH_ONLY_HELPER(jitInduceOSRAtCurrentPCAndRecompile,0)
SLOW_PATH_ONLY_HELPER(jitNewInstanceImplAccessCheck,3)
SLOW_PATH_ONLY_HELPER_NO_EXCEPTION_NO_RETURN_VALUE(jitCallCFunction,3)
SLOW_PATH_ONLY_HELPER_NO_EXCEPTION_NO_RETURN_VALUE(jitCallJitAddPicToPatchOnClassUnload,2)
Expand Down
4 changes: 4 additions & 0 deletions runtime/jilgen/jilconsts.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,10 @@ writeConstants(OMRPortLibrary *OMRPORTLIB, IDATA fd)
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_preservedFPRs", offsetof(J9CInterpreterStackFrame, preservedFPRs)) |
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_jitGPRs", offsetof(J9CInterpreterStackFrame, jitGPRs)) |
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_jitFPRs", offsetof(J9CInterpreterStackFrame, jitFPRs)) |
#if defined(J9VM_ENV_DATA64)
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_jitVRs", offsetof(J9CInterpreterStackFrame, jitVRs)) |
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_preservedVRs", offsetof(J9CInterpreterStackFrame, preservedVRs)) |
#endif /* J9VM_ENV_DATA64 */
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_jitCR", offsetof(J9CInterpreterStackFrame, jitCR)) |
writeConstant(OMRPORTLIB, fd, "J9TR_cframe_jitLR", offsetof(J9CInterpreterStackFrame, jitLR)) |
#if !defined(LINUX) || defined(J9VM_ENV_DATA64)
Expand Down
4 changes: 2 additions & 2 deletions runtime/oti/JITInterface.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2020 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -87,9 +87,9 @@ typedef struct {
union {
UDATA numbered[32];
} gpr;
U_64 fpr[32];
UDATA cr;
UDATA lr;
U_64 fpr[32];
} J9JITRegisters;

#elif defined(J9VM_ARCH_S390)
Expand Down
16 changes: 12 additions & 4 deletions runtime/oti/j9nonbuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -5614,16 +5614,20 @@ typedef struct J9CInterpreterStackFrame {
UDATA currentTOC; /* callee saves incoming TOC in own frame */
UDATA outgoingArguments[J9_INLINE_JNI_MAX_ARG_COUNT];
UDATA jitGPRs[32]; /* r0-r31 */
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
UDATA jitCR;
UDATA jitLR;
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
#if defined(J9VM_ENV_DATA64)
U_8 jitVRs[52 * 16]; /* vsr0-vsr51 */
UDATA align[3];
#else /* J9VM_ENV_DATA64 */
UDATA align[1];
#endif /* J9VM_ENV_DATA64 */
UDATA preservedGPRs[19]; /* r13-r31 */
U_8 preservedFPRs[18 * 8]; /* fp14-31 */
#if defined(J9VM_ENV_DATA64)
U_8 preservedVRs[12 * 16]; /* vsr52-vsr63 */
#endif /* J9VM_ENV_DATA64 */
#elif defined(J9VM_ENV_DATA64) /* AIXPPC */
#if defined(J9VM_ENV_LITTLE_ENDIAN)
/* Linux PPC 64 LE
Expand All @@ -5636,12 +5640,14 @@ typedef struct J9CInterpreterStackFrame {
UDATA currentTOC; /* callee saves own TOC in own frame */
UDATA outgoingArguments[J9_INLINE_JNI_MAX_ARG_COUNT];
UDATA jitGPRs[32]; /* r0-r31 */
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
UDATA jitCR;
UDATA jitLR;
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
U_8 jitVRs[52 * 16]; /* vsr0-vsr51 */
UDATA align[6];
UDATA preservedGPRs[18]; /* r14-r31 */
U_8 preservedFPRs[18 * 8]; /* fp14-31 */
U_8 preservedVRs[12 * 16]; /* vsr52-vsr63 */
#else /* J9VM_ENV_LITTLE_ENDIAN */
/* Linux PPC 64 BE
*
Expand All @@ -5655,12 +5661,14 @@ typedef struct J9CInterpreterStackFrame {
UDATA currentTOC; /* callee saves own TOC in own frame */
UDATA outgoingArguments[J9_INLINE_JNI_MAX_ARG_COUNT];
UDATA jitGPRs[32]; /* r0-r31 */
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
UDATA jitCR;
UDATA jitLR;
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
U_8 jitVRs[52 * 16]; /* vsr0-vsr51 */
UDATA align[4];
UDATA preservedGPRs[18]; /* r14-r31 */
U_8 preservedFPRs[18 * 8]; /* fp14-31 */
U_8 preservedVRs[12 * 16]; /* vsr52-vsr63 */
#endif /* J9VM_ENV_LITTLE_ENDIAN */
#else /* J9VM_ENV_DATA64 */
#if defined(J9VM_ENV_LITTLE_ENDIAN)
Expand All @@ -5675,9 +5683,9 @@ typedef struct J9CInterpreterStackFrame {
UDATA preservedLR; /* callee saves in caller frame */
UDATA outgoingArguments[J9_INLINE_JNI_MAX_ARG_COUNT];
UDATA jitGPRs[32]; /* r0-r31 */
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
UDATA jitCR;
UDATA jitLR;
U_8 jitFPRs[32 * 8]; /* fp0-fp31 */
UDATA preservedCR; /* callee saves in own frame */
UDATA preservedGPRs[19]; /* r13-r31 */
U_8 preservedFPRs[18 * 8]; /* fp14-31 */
Expand Down
Loading

0 comments on commit eb5770b

Please sign in to comment.