Skip to content

Commit

Permalink
Add a method to get maximum heap size for zOS compressedrefs mode
Browse files Browse the repository at this point in the history
The heap size is determined via getUserExtendedPrivateAreaMemoryType();
Moved omriarv64.h from port/zos390 to include_core/unix/zos;
Added two constants MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_COMPRESSEDREFS &
MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_3BIT_SHIFT_COMPRESSEDREFS (moved from
OpenJ9 project)

Signed-off-by: Jason Feng <fengj@ca.ibm.com>
  • Loading branch information
JasonFengJ9 committed May 31, 2021
1 parent 0174f25 commit bc31ba4
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include_core/omrgcconsts.h
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ typedef enum {
#define SUBALLOCATOR_ALIGNMENT (8*1024*1024)
#endif /* defined(AIXPPC) */

#define MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_COMPRESSEDREFS ((U_64)57 * 1024 * 1024 * 1024)
#define MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_3BIT_SHIFT_COMPRESSEDREFS ((U_64)25 * 1024 * 1024 * 1024)

#if defined(OMR_GC_REALTIME)
#define METRONOME_DEFAULT_HRT_PERIOD_MICRO 1000 /* This gives vanilla linux a chance to use the HRT */
#define METRONOME_DEFAULT_BEAT_MICRO 3000
Expand Down
33 changes: 33 additions & 0 deletions include_core/omriarv64.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*******************************************************************************
* Copyright (c) 2021, 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
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] http://openjdk.java.net/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
*******************************************************************************/

/*
* @ddr_namespace: default
*/

#include "omrcomp.h"

#if defined(J9ZOS39064)
#include "unix/zos/omriarv64.h"
#else
#error Only legal on ZOS 64bit
#endif
10 changes: 9 additions & 1 deletion include_core/omrutil.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2018 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 @@ -353,6 +353,14 @@ void OMRZeroMemory(void *ptr, uintptr_t length);
*/
void j9memset(void *dest, intptr_t value, uintptr_t size);

#if defined(J9ZOS39064)
/**
* @brief get maximum heap size allowed for zOS compressedrefs mode
* @return the heap size allowed
*/
U_64 zosGetMaxHeapSizeForCR(void);
#endif /* defined(J9ZOS39064) */

/* ---------------- wildcard.c ---------------- */

/**
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions port/zos390/omrvmem.c
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 @@ -194,7 +194,7 @@ int omrdiscard_data(void *address, int numFrames);
/* omrget_userExtendedPrivateAreaMemoryType.s */
#pragma linkage (GETTTT,OS)
#pragma map (getUserExtendedPrivateAreaMemoryType,"GETTTT")
uintptr_t getUserExtendedPrivateAreaMemoryType();
uintptr_t getUserExtendedPrivateAreaMemoryType(void);

static BOOLEAN isRmode64Supported();
static void * reserve_memory_with_moservices(struct OMRPortLibrary *portLibrary, struct J9PortVmemIdentifier *identifier, struct J9PortVmemParams *params, OMRMemCategory *category);
Expand Down
36 changes: 35 additions & 1 deletion util/omrutil/j9memclr.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2019 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 @@ -29,6 +29,14 @@
#endif /* defined(J9ZOS390) || (defined(LINUX) && defined(S390)) */
#include <string.h>

#if defined(J9ZOS39064)
#include "omrgcconsts.h"
#include "omriarv64.h"
#pragma linkage (GETTTT,OS)
#pragma map (getUserExtendedPrivateAreaMemoryType,"GETTTT")
UDATA getUserExtendedPrivateAreaMemoryType(void);
#endif /* defined(J9ZOS39064) */

#if defined(LINUX) && defined(S390)
/* _j9Z10Zero() is defined in j9memclrz10_31.s and j9memclrz10_64.s */
extern "C" void _j9Z10Zero(void *ptr, uintptr_t length);
Expand Down Expand Up @@ -163,3 +171,29 @@ j9memset(void *dest, intptr_t value, uintptr_t size)
{
memset(dest, (int) value, (size_t) size);
}

#if defined(J9ZOS39064)
U_64
zosGetMaxHeapSizeForCR(void)
{
/*
* In order to support Compressed References ZOS should support one of:
* - 2_TO_64 to support heaps allocation below 64GB
* - 2_TO_32 to support heaps allocation below 32GB
*/
U_64 maxHeapForCR = 0;
switch (getUserExtendedPrivateAreaMemoryType()) {
case ZOS64_VMEM_2_TO_32G:
maxHeapForCR = MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_3BIT_SHIFT_COMPRESSEDREFS;
break;
case ZOS64_VMEM_2_TO_64G:
maxHeapForCR = MAXIMUM_HEAP_SIZE_RECOMMENDED_FOR_COMPRESSEDREFS;
break;
case ZOS64_VMEM_ABOVE_BAR_GENERAL: /* FALLTHROUGH */
default:
break;
}

return maxHeapForCR;
}
#endif /* defined(J9ZOS39064) */

0 comments on commit bc31ba4

Please sign in to comment.