Clean up patches.

- Remove unneeded ones.
- Rename patches for clarity. Update JDK-8201788
  from upstream.
- Add patches needed to build on more arches (Zero).
This commit is contained in:
Severin Gehwolf 2018-04-20 14:02:54 +02:00
parent 7c201d1c3f
commit 903fd83316
13 changed files with 248 additions and 226 deletions

View File

@ -0,0 +1,21 @@
# HG changeset patch
# User sgehwolf
# Date 1523874036 -7200
# Mon Apr 16 12:20:36 2018 +0200
# Node ID fc3a72e286e0d5bf9b994d1b778b39f3b080c686
# Parent 69bae761600bdbc97953500ac51a396d31f54ee9
8201495: [Zero] Reduce limits of max heap size for boot JDK on s390
Reviewed-by: ihse, aph, simonis
diff --git a/make/autoconf/boot-jdk.m4 b/make/autoconf/boot-jdk.m4
--- a/make/autoconf/boot-jdk.m4
+++ b/make/autoconf/boot-jdk.m4
@@ -405,7 +405,7 @@
BOOTCYCLE_JVM_ARGS_BIG=-Xms64M
# Maximum amount of heap memory and stack size.
- JVM_HEAP_LIMIT_32="1024"
+ JVM_HEAP_LIMIT_32="768"
# Running a 64 bit JVM allows for and requires a bigger heap
JVM_HEAP_LIMIT_64="1600"
STACK_SIZE_32=768

View File

@ -0,0 +1,18 @@
diff --git a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp
@@ -50,10 +50,10 @@
: "Q"(*(volatile long*)src));
#elif defined(S390) && !defined(_LP64)
double tmp;
- asm volatile ("ld %0, 0(%1)\n"
- "std %0, 0(%2)\n"
- : "=r"(tmp)
- : "a"(src), "a"(dst));
+ asm volatile ("ld %0, %2\n"
+ "std %0, %1\n"
+ : "=&f"(tmp), "=Q"(*(volatile double*)dst)
+ : "Q"(*(volatile double*)src));
#else
*(jlong *) dst = *(const jlong *) src;
#endif

View File

@ -0,0 +1,27 @@
# HG changeset patch
# User sgehwolf
# Date 1524152606 -7200
# Thu Apr 19 17:43:26 2018 +0200
# Node ID f7a3ca673e9cc831848fc890a2df3ae9acb447e4
# Parent dd26184768b0a1c4103a2e9eaa8b4d852a9eca1b
8201788: Number of make jobs wrong for bootcycle-images target
Reviewed-by: erikj, ihse
diff --git a/make/Init.gmk b/make/Init.gmk
--- a/make/Init.gmk
+++ b/make/Init.gmk
@@ -310,9 +310,13 @@
ifneq ($(PARALLEL_TARGETS), )
$(call StartGlobalTimer)
$(call PrepareSmartJavac)
+ # JOBS will only be empty for a bootcycle-images recursive call
+ # or if specified via a make argument directly. In those cases
+ # treat it as NOT using jobs at all.
( cd $(TOPDIR) && \
$(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
- -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
+ $(if $(JOBS), -j $(JOBS)) \
+ -f make/Main.gmk $(USER_MAKE_VARS) \
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
( exitcode=$$? && \
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \

View File

@ -1,33 +0,0 @@
--- openjdk/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java 2012-04-06 02:26:33.322164601 +0200
+++ openjdk/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/PStack.java 2012-04-06 02:26:57.958514071 +0200
@@ -84,7 +85,8 @@
if (jthread != null) {
jthread.printThreadInfoOn(out);
}
- while (f != null) {
+ int maxStack = 256;
+ while (f != null && maxStack-- > 0) {
ClosestSymbol sym = f.closestSymbolToPC();
Address pc = f.pc();
out.print(pc + "\t");
@@ -158,10 +160,19 @@
}
}
}
+ Address oldPC = f.pc();
+ Address oldFP = f.localVariableBase();
f = f.sender(th);
+ if (f != null
+ && oldPC.equals(f.pc())
+ && oldFP.equals(f.localVariableBase())) {
+ // We didn't make any progress
+ f = null;
+ }
}
} catch (Exception exp) {
- exp.printStackTrace();
+ // exp.printStackTrace();
+ out.println("bad stack: " + exp);
// continue, may be we can do a better job for other threads
}
if (concurrentLocks) {

View File

@ -1,25 +0,0 @@
diff -r 21b063d75b3e make/Init.gmk
--- openjdk/make/Init.gmk Thu Mar 16 16:34:33 2017 +0000
+++ oepnjdk/make/Init.gmk Tue Apr 04 13:49:37 2017 +0100
@@ -303,7 +303,8 @@
$(call PrepareSmartJavac)
( cd $(TOPDIR) && \
$(NICE) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
- -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
+ $(if $(DISABLE_JOBS),, -j $(JOBS)) \
+ -f make/Main.gmk $(USER_MAKE_VARS) \
$(PARALLEL_TARGETS) $(COMPARE_BUILD_MAKE) $(BUILD_LOG_PIPE) || \
( exitcode=$$? && \
$(PRINTF) "\nERROR: Build failed for $(TARGET_DESCRIPTION) (exit code $$exitcode) \n" \
diff -r 21b063d75b3e make/Main.gmk
--- jdk9/make/Main.gmk Thu Mar 16 16:34:33 2017 +0000
+++ jdk9/make/Main.gmk Tue Apr 04 13:49:37 2017 +0100
@@ -320,7 +320,7 @@
ifneq ($(COMPILE_TYPE), cross)
$(call LogWarn, Boot cycle build step 2: Building a new JDK image using previously built image)
+$(MAKE) $(MAKE_ARGS) -f $(TOPDIR)/make/Init.gmk PARALLEL_TARGETS=$(BOOTCYCLE_TARGET) \
- JOBS= SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
+ DISABLE_JOBS=true SPEC=$(dir $(SPEC))bootcycle-spec.gmk main
else
$(call LogWarn, Boot cycle build disabled when cross compiling)
endif

View File

@ -1,14 +0,0 @@
diff -r b515beb3b4ad openjdk/srchotspot/src/share/vm/utilities/globalDefinitions.hpp
--- openjdk/srchotspot/src/share/vm/utilities/globalDefinitions.hpp Thu Jul 07 18:40:53 2016 +0100
+++ openjdk/srchotspot/src/share/vm/utilities/globalDefinitions.hpp Tue Jul 12 19:13:51 2016 +0100
@@ -1163,8 +1163,10 @@
#undef min
#endif
+#ifndef _GLIBCXX_STDLIB_H
#define max(a,b) Do_not_use_max_use_MAX2_instead
#define min(a,b) Do_not_use_min_use_MIN2_instead
+#endif
// It is necessary to use templates here. Having normal overloaded
// functions does not work because it is necessary to provide both 32-

View File

@ -0,0 +1,134 @@
diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp
--- a/src/hotspot/share/code/codeCache.cpp
+++ b/src/hotspot/share/code/codeCache.cpp
@@ -405,7 +405,7 @@
add_heap(heap);
// Reserve Space
- size_t size_initial = MIN2(InitialCodeCacheSize, rs.size());
+ size_t size_initial = MIN2((size_t)InitialCodeCacheSize, rs.size());
size_initial = align_up(size_initial, os::vm_page_size());
if (!heap->reserve(rs, size_initial, CodeCacheSegmentSize)) {
vm_exit_during_initialization(err_msg("Could not reserve enough space in %s (" SIZE_FORMAT "K)",
diff --git a/src/hotspot/share/gc/cms/parNewGeneration.cpp b/src/hotspot/share/gc/cms/parNewGeneration.cpp
--- a/src/hotspot/share/gc/cms/parNewGeneration.cpp
+++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp
@@ -200,7 +200,7 @@
const size_t num_overflow_elems = of_stack->size();
const size_t space_available = queue->max_elems() - queue->size();
const size_t num_take_elems = MIN3(space_available / 4,
- ParGCDesiredObjsFromOverflowList,
+ (size_t)ParGCDesiredObjsFromOverflowList,
num_overflow_elems);
// Transfer the most recent num_take_elems from the overflow
// stack to our work queue.
diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
@@ -2296,7 +2296,7 @@
// of things to do) or totally (at the very end).
size_t target_size;
if (partially) {
- target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);
+ target_size = MIN2((size_t)_task_queue->max_elems()/3, (size_t)GCDrainStackTargetSize);
} else {
target_size = 0;
}
diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp
--- a/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkObjArrayProcessor.cpp
@@ -31,7 +31,7 @@
}
size_t G1CMObjArrayProcessor::process_array_slice(objArrayOop obj, HeapWord* start_from, size_t remaining) {
- size_t words_to_scan = MIN2(remaining, ObjArrayMarkingStride);
+ size_t words_to_scan = MIN2(remaining, (size_t)ObjArrayMarkingStride);
if (remaining > ObjArrayMarkingStride) {
push_array_slice(start_from + ObjArrayMarkingStride);
diff --git a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp
--- a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp
+++ b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp
@@ -100,7 +100,7 @@
return reserved_size() - committed_size();
}
-size_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const {
+uintptr_t G1PageBasedVirtualSpace::addr_to_page_index(char* addr) const {
return (addr - _low_boundary) / _page_size;
}
diff --git a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp
--- a/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp
+++ b/src/hotspot/share/gc/parallel/psCompactionManager.inline.hpp
@@ -115,7 +115,7 @@
const size_t beg_index = size_t(index);
assert(beg_index < len || len == 0, "index too large");
- const size_t stride = MIN2(len - beg_index, ObjArrayMarkingStride);
+ const size_t stride = MIN2(len - beg_index, (size_t)ObjArrayMarkingStride);
const size_t end_index = beg_index + stride;
T* const base = (T*)obj->base();
T* const beg = base + beg_index;
diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
@@ -905,8 +905,8 @@
void PSParallelCompact::initialize_dead_wood_limiter()
{
const size_t max = 100;
- _dwl_mean = double(MIN2(ParallelOldDeadWoodLimiterMean, max)) / 100.0;
- _dwl_std_dev = double(MIN2(ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
+ _dwl_mean = double(MIN2((size_t)ParallelOldDeadWoodLimiterMean, max)) / 100.0;
+ _dwl_std_dev = double(MIN2((size_t)ParallelOldDeadWoodLimiterStdDev, max)) / 100.0;
_dwl_first_term = 1.0 / (sqrt(2.0 * M_PI) * _dwl_std_dev);
DEBUG_ONLY(_dwl_initialized = true;)
_dwl_adjustment = normal_distribution(1.0);
diff --git a/src/hotspot/share/gc/shared/plab.cpp b/src/hotspot/share/gc/shared/plab.cpp
--- a/src/hotspot/share/gc/shared/plab.cpp
+++ b/src/hotspot/share/gc/shared/plab.cpp
@@ -32,7 +32,7 @@
size_t PLAB::min_size() {
// Make sure that we return something that is larger than AlignmentReserve
- return align_object_size(MAX2(MinTLABSize / HeapWordSize, (uintx)oopDesc::header_size())) + AlignmentReserve;
+ return align_object_size(MAX2(MinTLABSize / HeapWordSize, (size_t)oopDesc::header_size())) + AlignmentReserve;
}
size_t PLAB::max_size() {
diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp
--- a/src/hotspot/share/prims/whitebox.cpp
+++ b/src/hotspot/share/prims/whitebox.cpp
@@ -1096,7 +1096,7 @@
WB_END
WB_ENTRY(jobject, WB_GetSizeTVMFlag(JNIEnv* env, jobject o, jstring name))
- uintx result;
+ size_t result;
if (GetVMFlag <size_t> (thread, env, name, &result, &CommandLineFlags::size_tAt)) {
ThreadToNativeFromVM ttnfv(thread); // can't be in VM when we call JNI
return longBox(thread, env, result);
diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp
--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -1586,7 +1586,7 @@
// Increase the code cache size - tiered compiles a lot more.
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
FLAG_SET_ERGO(uintx, ReservedCodeCacheSize,
- MIN2(CODE_CACHE_DEFAULT_LIMIT, ReservedCodeCacheSize * 5));
+ MIN2(CODE_CACHE_DEFAULT_LIMIT, (size_t)(ReservedCodeCacheSize * 5)));
}
// Enable SegmentedCodeCache if TieredCompilation is enabled and ReservedCodeCacheSize >= 240M
if (FLAG_IS_DEFAULT(SegmentedCodeCache) && ReservedCodeCacheSize >= 240*M) {
diff --git a/src/hotspot/share/runtime/arguments.hpp b/src/hotspot/share/runtime/arguments.hpp
--- a/src/hotspot/share/runtime/arguments.hpp
+++ b/src/hotspot/share/runtime/arguments.hpp
@@ -328,7 +328,7 @@
// Value of the conservative maximum heap alignment needed
static size_t _conservative_max_heap_alignment;
- static uintx _min_heap_size;
+ static size_t _min_heap_size;
// -Xrun arguments
static AgentLibraryList _libraryList;

View File

@ -825,7 +825,7 @@ Provides: java-%{javaver}-%{origin}-src%{?1} = %{epoch}:%{version}-%{release}
Name: java-%{origin}
Version: %{newjavaver}.%{buildver}
Release: 1%{?dist}
Release: 2%{?dist}
# java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons
# and this change was brought into RHEL-4. java-1.5.0-ibm packages
# also included the epoch in their virtual provides. This created a
@ -866,38 +866,48 @@ Source13: TestCryptoLevel.java
# Ensure ECDSA is working
Source14: TestECDSA.java
############################################
#
# RPM/distribution specific patches
#
############################################
# NSS via SunPKCS11 Provider (disabled comment
# due to memory leak).
Patch1000: enableCommentedOutSystemNss.patch
# Ignore AWTError when assistive technologies are loaded
Patch1: accessible-toolkit.patch
Patch1: accessible-toolkit.patch
# Restrict access to java-atk-wrapper classes
Patch3: java-atk-wrapper-security.patch
# RHBZ 808293
Patch4: PStack-808293.patch
# Allow multiple initialization of PKCS11 libraries
Patch5: multiple-pkcs11-library-init.patch
Patch12: system-nss-ec-rh1565658.patch
Patch13: libjpeg-turbo-1.4-compat.patch
# follow system wide crypto policy RHBZ#1249083
Patch14: systemCryptoPolicyPR3183.patch
Patch2: java-atk-wrapper-security.patch
Patch3: libjpeg-turbo-1.4-compat.patch
# Follow system wide crypto policy RHBZ#1249083
Patch4: RHBZ-1249083-system-crypto-policy-PR3183.patch
# System NSS via SunEC Provider
Patch5: RHBZ-1565658-system-nss-SunEC.patch
#############################################
#
# OpenJDK specific patches
#
#############################################
# JVM heap size changes for s390 (thanks to aph)
Patch101: sorted-diff.patch
Patch104: bootcycle_jobs.patch
# s390 (Zero) build does not bootcycle without this patch
# Already in JDK-11. Missing backports.
Patch100: JDK-8201495-s390-java-opts.patch
# See JDK-8198844. This won't be needed any more in
# JDK 11+
Patch101: sorted-diff.patch
# Type fixing for s390 (Zero). Not upstream.
Patch102: java-openjdk-s390-size_t.patch
# bootcycle-images target may run out of ressources
# due to bad jobs config. Missing backports.
Patch103: JDK-8201788-bootcycle-images-jobs.patch
# s390 (Zero) build fix. Pending upstream.
Patch104: JDK-8201509-s390-atomic_store.patch
Patch400: ppc_stack_overflow_fix.patch
Patch401: aarch64BuildFailure.patch
# Non-OpenJDK fixes
Patch1000: enableCommentedOutSystemNss.patch
# aarch64 slowdebug build fix. Pending upstream
Patch400: JDK-8200556-aarch64-slowdebug-crash.patch
BuildRequires: autoconf
BuildRequires: automake
@ -1154,26 +1164,18 @@ fi
sh %{SOURCE12}
pushd %{top_level_dir_name}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
# s390 build fixes
%ifarch s390
%endif
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch104 -p1
# Zero PPC fixes
# TODO: propose them upstream
%patch400 -p1
%patch401 -p1
popd # openjdk
%patch1000
@ -1728,6 +1730,20 @@ require "copy_jdk_configs.lua"
%changelog
* Fri Apr 20 2018 Severin Gehwolf <sgehwolf@redhat.com> - 1:10.0.1.10-2
- Removed unneeded patches:
PStack-808293.patch
multiple-pkcs11-library-init.patch
ppc_stack_overflow_fix.patch
- Added patches for s390 Zero builds:
JDK-8201495-s390-java-opts.patch
JDK-8201509-s390-atomic_store.patch
- Renamed patches for clarity:
aarch64BuildFailure.patch => JDK-8200556-aarch64-slowdebug-crash.patch
systemCryptoPolicyPR3183.patch => RHBZ-1249083-system-crypto-policy-PR3183.patch
bootcycle_jobs.patch => JDK-8201788-bootcycle-images-jobs.patch
system-nss-ec-rh1565658.patch => RHBZ-1565658-system-nss-SunEC.patch
* Fri Apr 20 2018 Jiri Vanek <jvanek@redhat.com> - 1:10.0.1.10-1
- updated to security update 1
- jexec unlinked from path

View File

@ -1,74 +0,0 @@
# HG changeset patch
# User andrew
# Date 1352129932 0
# Node ID e9c857dcb964dbfa5eef3a3590244cb4d999cf7a
# Parent 1406789608b76d0906881979335d685855f44190
Allow multiple PKCS11 library initialisation to be a non-critical error.
diff -r 1406789608b7 -r e9c857dcb964 src/share/classes/sun/security/pkcs11/Config.java
--- openjdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java Tue Oct 30 13:05:14 2012 +0000
+++ openjdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/Config.java Mon Nov 05 15:38:52 2012 +0000
@@ -52,6 +52,7 @@
static final int ERR_HALT = 1;
static final int ERR_IGNORE_ALL = 2;
static final int ERR_IGNORE_LIB = 3;
+ static final int ERR_IGNORE_MULTI_INIT = 4;
// same as allowSingleThreadedModules but controlled via a system property
// and applied to all providers. if set to false, no SunPKCS11 instances
@@ -980,6 +981,8 @@
handleStartupErrors = ERR_IGNORE_LIB;
} else if (val.equals("halt")) {
handleStartupErrors = ERR_HALT;
+ } else if (val.equals("ignoreMultipleInitialisation")) {
+ handleStartupErrors = ERR_IGNORE_MULTI_INIT;
} else {
throw excToken("Invalid value for handleStartupErrors:");
}
diff -r 1406789608b7 -r e9c857dcb964 src/share/classes/sun/security/pkcs11/SunPKCS11.java
--- openjdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java Tue Oct 30 13:05:14 2012 +0000
+++ openjdk/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java Mon Nov 05 15:38:52 2012 +0000
@@ -168,26 +168,37 @@
String nssLibraryDirectory = config.getNssLibraryDirectory();
String nssSecmodDirectory = config.getNssSecmodDirectory();
boolean nssOptimizeSpace = config.getNssOptimizeSpace();
+ int errorHandling = config.getHandleStartupErrors();
if (secmod.isInitialized()) {
if (nssSecmodDirectory != null) {
String s = secmod.getConfigDir();
if ((s != null) &&
(s.equals(nssSecmodDirectory) == false)) {
- throw new ProviderException("Secmod directory "
- + nssSecmodDirectory
- + " invalid, NSS already initialized with "
- + s);
+ String msg = "Secmod directory " + nssSecmodDirectory
+ + " invalid, NSS already initialized with " + s;
+ if (errorHandling == Config.ERR_IGNORE_MULTI_INIT ||
+ errorHandling == Config.ERR_IGNORE_ALL) {
+ throw new UnsupportedOperationException(msg);
+ } else {
+ throw new ProviderException(msg);
+ }
}
}
if (nssLibraryDirectory != null) {
String s = secmod.getLibDir();
if ((s != null) &&
(s.equals(nssLibraryDirectory) == false)) {
- throw new ProviderException("NSS library directory "
+ String msg = "NSS library directory "
+ nssLibraryDirectory
+ " invalid, NSS already initialized with "
- + s);
+ + s;
+ if (errorHandling == Config.ERR_IGNORE_MULTI_INIT ||
+ errorHandling == Config.ERR_IGNORE_ALL) {
+ throw new UnsupportedOperationException(msg);
+ } else {
+ throw new ProviderException(msg);
+ }
}
}
} else {

View File

@ -1,48 +0,0 @@
diff --git a/src/cpu/zero/vm/stack_zero.hpp b/src/cpu/zero/vm/stack_zero.hpp
--- openjdk/src/hotspot/cpu/zero/stack_zero.hpp
+++ openjdk/src/hotspot/cpu/zero/stack_zero.hpp
@@ -99,7 +99,7 @@
int shadow_pages_size() const {
return _shadow_pages_size;
}
- int abi_stack_available(Thread *thread) const;
+ ssize_t abi_stack_available(Thread *thread) const;
public:
void overflow_check(int required_words, TRAPS);
diff --git a/src/cpu/zero/vm/stack_zero.inline.hpp b/src/cpu/zero/vm/stack_zero.inline.hpp
--- openjdk/src/hotspot/cpu/zero/stack_zero.inline.hpp
+++ openjdk/src/hotspot/cpu/zero/stack_zero.inline.hpp
@@ -47,12 +47,12 @@
// This method returns the amount of ABI stack available for us
// to use under normal circumstances. Note that the returned
// value can be negative.
-inline int ZeroStack::abi_stack_available(Thread *thread) const {
+inline ssize_t ZeroStack::abi_stack_available(Thread *thread) const {
guarantee(Thread::current() == thread, "should run in the same thread");
- int stack_used = thread->stack_base() - (address) &stack_used
+ ssize_t stack_used = thread->stack_base() - (address) &stack_used
+ (JavaThread::stack_guard_zone_size() + JavaThread::stack_shadow_zone_size());
- int stack_free = thread->stack_size() - stack_used;
+ ssize_t stack_free = thread->stack_size() - stack_used;
return stack_free;
}
#endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP
diff --git a/src/os/linux/vm/os_linux.cpp b/src/os/linux/vm/os_linux.cpp
--- openjdk/src/hotspot/os/posix/os_posix.cpp
+++ openjdk/src/hotspot/os/posix/os_posix.cpp
@@ -4791,6 +4791,13 @@
_java_thread_min_stack_allowed = align_up(_java_thread_min_stack_allowed, vm_page_size());
_java_thread_min_stack_allowed = MAX2(_java_thread_min_stack_allowed, os_min_stack_allowed);
+#ifdef ZERO
+ // If this is Zero, allow at the very minimum one page each for the
+ // Zero stack and the native stack. This won't make any difference
+ // for 4k pages, but is significant for large pages.
+ _java_thread_min_stack_allowed = MAX2(_java_thread_min_stack_allowed,
+ align_size_up((size_t)(JavaThread::stack_guard_zone_size()+JavaThread::stack_shadow_zone_size()+2) * vm_page_size(), vm_page_size());
+#endif
size_t stack_size_in_bytes = ThreadStackSize * K;
if (stack_size_in_bytes != 0 &&