8221343: x86_32 crashes on startup with "_hwm out of range"
authorredestad
Mon, 25 Mar 2019 20:57:07 +0100
changeset 54267 75445a7c2c04
parent 54266 7816d989bf21
child 54268 0cf2c87ce79a
8221343: x86_32 crashes on startup with "_hwm out of range" Reviewed-by: thartmann, kvn
src/hotspot/share/opto/matcher.cpp
--- a/src/hotspot/share/opto/matcher.cpp	Mon Mar 25 19:49:32 2019 +0300
+++ b/src/hotspot/share/opto/matcher.cpp	Mon Mar 25 20:57:07 2019 +0100
@@ -416,14 +416,20 @@
   return rms;
 }
 
-//---------------------------init_first_stack_mask-----------------------------
+#define NOF_STACK_MASKS (3*6+5)
+
 // Create the initial stack mask used by values spilling to the stack.
 // Disallow any debug info in outgoing argument areas by setting the
 // initial mask accordingly.
 void Matcher::init_first_stack_mask() {
 
   // Allocate storage for spill masks as masks for the appropriate load type.
-  RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask) * (3*6+5));
+  RegMask *rms = (RegMask*)C->comp_arena()->Amalloc_D(sizeof(RegMask) * NOF_STACK_MASKS);
+
+  // Initialize empty placeholder masks into the newly allocated arena
+  for (int i = 0; i < NOF_STACK_MASKS; i++) {
+    new (rms + i) RegMask();
+  }
 
   idealreg2spillmask  [Op_RegN] = &rms[0];
   idealreg2spillmask  [Op_RegI] = &rms[1];