< prev index next >

test/hotspot/jtreg/gc/g1/TestFromCardCacheIndex.java

8217389: JTREG: Clean up, remove unused variable warnings

112         // Modify the last entry of the object we found.                                                                   
113         arrayWithCardMinus1[arraySize - 1] = target;                                                                       
114 
115         target = null;                                                                                                     
116         // Make sure that the dirty cards are flushed by doing a GC.                                                       
117         System.out.println("Doing a GC.");                                                                                 
118         WB.youngGC();                                                                                                      
119 
120         System.out.println("The crash didn't reproduce. Trying again.");                                                   
121     }                                                                                                                      
122 
123     /**                                                                                                                    
124      * Finds an returns an array that contains a (32 bit truncated) card with value -1.                                    
125      */                                                                                                                    
126     private static Object[] findArray(Object[][] arrays) {                                                                 
127         for (int i = 0; i < arrays.length; i++) {                                                                          
128             Object[] target = arrays[i];                                                                                   
129             if (target == null) {                                                                                          
130                 continue;                                                                                                  
131             }                                                                                                              
132             final long startAddress = WB.getObjectAddress(target);                                                         
133             final long lastAddress = getObjectLastAddress(target);                                                         
134             final int card = getCardIndex32bit(lastAddress);                                                               
135             if (card == -1) {                                                                                              
136                 Object[] foundArray = target;                                                                              
137                 return foundArray;                                                                                         
138             }                                                                                                              
139         }                                                                                                                  
140         return null;                                                                                                       
141     }                                                                                                                      
142 }                                                                                                                          
143 

112         // Modify the last entry of the object we found.
113         arrayWithCardMinus1[arraySize - 1] = target;
114 
115         target = null;
116         // Make sure that the dirty cards are flushed by doing a GC.
117         System.out.println("Doing a GC.");
118         WB.youngGC();
119 
120         System.out.println("The crash didn't reproduce. Trying again.");
121     }
122 
123     /**
124      * Finds an returns an array that contains a (32 bit truncated) card with value -1.
125      */
126     private static Object[] findArray(Object[][] arrays) {
127         for (int i = 0; i < arrays.length; i++) {
128             Object[] target = arrays[i];
129             if (target == null) {
130                 continue;
131             }
132             WB.getObjectAddress(target); // startAddress not used
133             final long lastAddress = getObjectLastAddress(target);
134             final int card = getCardIndex32bit(lastAddress);
135             if (card == -1) {
136                 Object[] foundArray = target;
137                 return foundArray;
138             }
139         }
140         return null;
141     }
142 }
143 
< prev index next >