JDK-8203030 : Zero s390 31 bit size_t type conflicts in shared code
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8u172,9.0.4,10.0.1,11
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: other
  • Submitted: 2018-05-13
  • Updated: 2023-12-07
  • Resolved: 2018-06-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b19Fixed
Related Reports
Relates :  
Relates :  
Description
There are still places where s390 31 bit (ilp32) size_t conflicts occur.
[ See 
http://mail.openjdk.java.net/pipermail/hotspot-dev/2014-June/014254.html
https://bugs.openjdk.java.net/browse/JDK-8046938
https://bugs.openjdk.java.net/browse/JDK-8074459
for previous history ]

The following are the patches as they have been made to
the local (Red Hat)  s390 31bit Zero build to present, along with a
search on the variable that forces the need for the
cast to size_t. I think many of the variables should be defined
as size_t rather than cast, but it some places its hazy
and any input regarding the best way to fix is appreciated.

> patching file src/hotspot/share/code/codeCache.cpp
--- a/src/hotspot/share/code/codeCache.cpp
+++ b/src/hotspot/share/code/codeCache.cpp
@@ -409,7 +409,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)",

Possible alternatives:
*** src/hotspot/cpu/s390/c1_globals_s390.hpp:
<global>[62]                   define_pd_global(uintx, InitialCodeCacheSize, 160*K);

*** src/hotspot/cpu/s390/c2_globals_s390.hpp:
<global>[74]                   define_pd_global(uintx, InitialCodeCacheSize, 2048*K);

*** src/hotspot/share/runtime/globals.hpp:
<global>[88]                   define_pd_global(uintx, InitialCodeCacheSize, 160*K);

> patching file src/hotspot/share/gc/cms/parNewGeneration.cpp
--- a/src/hotspot/share/gc/cms/parNewGeneration.cpp
+++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp
@@ -201,7 +201,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.

Finding symbol: ParGCDesiredObjsFromOverflowList

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------
*** src/hotspot/share/gc/cms/cms_globals.hpp:
GC_CMS_FLAGS[413]              product(uintx, ParGCDesiredObjsFromOverflowList, 20, \

*** src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp:
get_work_from_overflow_stack[3198] (size_t)ParGCDesiredObjsFromOverflowList);
do_work_steal[4628]            (size_t)ParGCDesiredObjsFromOverflowList);
do_work_steal[5088]            (size_t)ParGCDesiredObjsFromOverflowList);
take_from_overflow_list[8051]  (size_t)ParGCDesiredObjsFromOverflowList);

*** src/hotspot/share/gc/cms/parNewGeneration.cpp:
take_from_overflow_stack[204]  ParGCDesiredObjsFromOverflowList,
take_from_overflow_list_work[1312] (size_t)ParGCDesiredObjsFromOverflowList);
-------------------------------------------------------------------------------


> patching file src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
@@ -2306,7 +2306,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;
   }


Finding symbol: GCDrainStackTargetSize

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------
*** src/hotspot/share/gc/g1/g1Arguments.cpp:
initialize[128]                if (FLAG_IS_DEFAULT(GCDrainStackTargetSize)) {
initialize[129]                FLAG_SET_ERGO(uintx, GCDrainStackTargetSize, MIN2(GCDrainStackTargetSize, (uintx)TASKQUEUE_SIZE / 4));

*** src/hotspot/share/gc/g1/g1ConcurrentMark.cpp:
drain_local_queue[2347]        target_size = MIN2((size_t)_task_queue->max_elems()/3, GCDrainStackTargetSize);

*** src/hotspot/share/gc/shared/gc_globals.hpp:
GC_FLAGS[772]                  product(uintx, GCDrainStackTargetSize, 64, \
-------------------------------------------------------------------------------

> patching file 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);

Finding symbol: ObjArrayMarkingStride

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------

*** src/hotspot/share/gc/shared/gc_globals.hpp:
GC_FLAGS[314]                  develop(uintx, ObjArrayMarkingStride, 2048, \
-------------------------------------------------------------------------------

> patching file 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;
 }
 
Finding symbol: addr_to_page_index

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------
*** src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.cpp:
addr_to_page_index[103]        size_t G1PageBasedVirtualSpace::addr_to_page_index(char * addr) const {

*** src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.hpp:
addr_to_page_index[94]         uintptr_t addr_to_page_index(char * addr) const;
-------------------------------------------------------------------------------


> patching file src/hotspot/share/gc/g1/g1StringDedupTable.cpp--- a/src/hotspot/share/gc/g1/g1StringDedupTable.cpp
+++ b/src/hotspot/share/gc/g1/g1StringDedupTable.cpp
@@ -617,7 +617,7 @@
             G1_STRDEDUP_BYTES_PARAM(_table->_size * sizeof(G1StringDedupEntry*) + (_table->_entries + _entry_cache->size()) * sizeof(G1StringDedupEntry)));
   log.debug("    Size: " SIZE_FORMAT ", Min: " SIZE_FORMAT ", Max: " SIZE_FORMAT, _table->_size, _min_size, _max_size);
   log.debug("    Entries: " UINTX_FORMAT ", Load: " G1_STRDEDUP_PERCENT_FORMAT_NS ", Cached: " UINTX_FORMAT ", Added: " UINTX_FORMAT ", Removed: " UINTX_FORMAT,
-            _table->_entries, percent_of(_table->_entries, _table->_size), _entry_cache->size(), _entries_added, _entries_removed);
+            _table->_entries, percent_of( (size_t)(_table->_entries), _table->_size), _entry_cache->size(), _entries_added, _entries_removed);
   log.debug("    Resize Count: " UINTX_FORMAT ", Shrink Threshold: " UINTX_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT_NS "), Grow Threshold: " UINTX_FORMAT "(" G1_STRDEDUP_PERCENT_FORMAT_NS ")",
             _resize_count, _table->_shrink_threshold, _shrink_load_factor * 100.0, _table->_grow_threshold, _grow_load_factor * 100.0);
   log.debug("    Rehash Count: " UINTX_FORMAT ", Rehash Threshold: " UINTX_FORMAT ", Hash Seed: 0x%x", _rehash_count, _rehash_threshold, _table->_hash_seed);


Finding symbol: _entries

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------
*** src/hotspot/share/gc/g1/g1StringDedupTable.hpp:
<global>[125]                  uintx _entries;

-------------------------------------------------

> patching file 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
@@ -118,7 +118,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_raw();
   T* const beg = base + beg_index;

Finding symbol: ObjArrayMarkingStride

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------

*** src/hotspot/share/gc/shared/gc_globals.hpp:
GC_FLAGS[314]                  develop(uintx, ObjArrayMarkingStride, 2048, \
-------------------------------------------------------------------------------

> patching file src/hotspot/share/gc/parallel/psParallelCompact.cpp
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp
@@ -907,8 +907,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);

Finding symbol: ParallelOldDeadWoodLimiterStdDev

Database directory: /local/openjdk/JDK-8203030/
-------------------------------------------------------------------------------
*** src/hotspot/share/gc/parallel/parallel_globals.hpp:
GC_PARALLEL_FLAGS[60]          product(uintx, ParallelOldDeadWoodLimiterStdDev, 80, \
-------------------------------------------------------------------------------

> patching file 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() {

This is probably best done as above.

> patching file src/hotspot/share/prims/whitebox.cpp--- a/src/hotspot/share/prims/whitebox.cpp
+++ b/src/hotspot/share/prims/whitebox.cpp
@@ -1109,7 +1109,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, &JVMFlag::size_tAt)) {
     ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
     return longBox(thread, env, result);

This is probably best done as above.

> patching file src/hotspot/share/runtime/arguments.cpp--- a/src/hotspot/share/runtime/arguments.cpp
+++ b/src/hotspot/share/runtime/arguments.cpp
@@ -1615,7 +1615,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) {

Finding symbol: ReservedCodeCacheSize

Database directory: /local/openjdk/JDK-8203030/

*** src/hotspot/cpu/s390/c1_globals_s390.hpp:
<global>[51]                   define_pd_global(uintx, ReservedCodeCacheSize, 32*M);

*** src/hotspot/cpu/s390/c2_globals_s390.hpp:
<global>[75]                   define_pd_global(uintx, ReservedCodeCacheSize, 48*M);

*** src/hotspot/share/runtime/globals.hpp:
<global>[89]                   define_pd_global(uintx, ReservedCodeCacheSize, 32*M);



> patching file src/hotspot/share/runtime/arguments.hpp--- a/src/hotspot/share/runtime/arguments.hpp
+++ b/src/hotspot/share/runtime/arguments.hpp
@@ -332,7 +332,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;



Comments
URL: http://hg.openjdk.java.net/jdk/jdk/rev/8c0a5b51559b User: sgehwolf Date: 2018-06-20 12:33:11 +0000
20-06-2018

After review by Per Liden http://cr.openjdk.java.net/~chrisphi/JDK-8203030/webrev.4/ Ready for push. Build Details: 2018-06-19-1559053.chrisphi.source 0 Failed Tests Mach5 Tasks Results Summary FAILED: 0 KILLED: 0 UNABLE_TO_RUN: 0 NA: 0 PASSED: 75 EXECUTED_WITH_FAILURE: 0
19-06-2018

Subject: [Mach5] mach5-one-chrisphi-JDK-8203030-2-20180614-1350-26514: Build tasks PASSED. Test tasks SUCCESSFUL. From: do-not-reply@oracle.com Date: 14/06/18 10:49 AM To: chrisphi@lgonqn.org Build Details: 2018-06-14-1347454.chrisphi.source 0 Failed Tests Mach5 Tasks Results Summary PASSED: 75 KILLED: 0 FAILED: 0 UNABLE_TO_RUN: 0 EXECUTED_WITH_FAILURE: 0 NA: 0
14-06-2018

Webrev: http://cr.openjdk.java.net/~chrisphi/JDK-8203030/webrev.2
14-06-2018

Webrev: http://cr.openjdk.java.net/~chrisphi/JDK-8203030/webrev.0
06-06-2018