equal
deleted
inserted
replaced
30 package sun.jvm.hotspot.oops; |
30 package sun.jvm.hotspot.oops; |
31 |
31 |
32 import java.util.*; |
32 import java.util.*; |
33 |
33 |
34 import sun.jvm.hotspot.debugger.*; |
34 import sun.jvm.hotspot.debugger.*; |
35 import sun.jvm.hotspot.gc.cms.*; |
|
36 import sun.jvm.hotspot.gc.shared.*; |
35 import sun.jvm.hotspot.gc.shared.*; |
37 import sun.jvm.hotspot.gc.epsilon.*; |
36 import sun.jvm.hotspot.gc.epsilon.*; |
38 import sun.jvm.hotspot.gc.g1.*; |
37 import sun.jvm.hotspot.gc.g1.*; |
39 import sun.jvm.hotspot.gc.shenandoah.*; |
38 import sun.jvm.hotspot.gc.shenandoah.*; |
40 import sun.jvm.hotspot.gc.parallel.*; |
39 import sun.jvm.hotspot.gc.parallel.*; |
232 Address top = (Address) liveRegions.get(i+1); |
231 Address top = (Address) liveRegions.get(i+1); |
233 totalSize += top.minus(bottom); |
232 totalSize += top.minus(bottom); |
234 } |
233 } |
235 visitor.prologue(totalSize); |
234 visitor.prologue(totalSize); |
236 |
235 |
237 CompactibleFreeListSpace cmsSpaceOld = null; |
|
238 CollectedHeap heap = VM.getVM().getUniverse().heap(); |
236 CollectedHeap heap = VM.getVM().getUniverse().heap(); |
239 |
237 |
240 if (heap instanceof GenCollectedHeap) { |
238 if (heap instanceof GenCollectedHeap) { |
241 GenCollectedHeap genHeap = (GenCollectedHeap) heap; |
239 GenCollectedHeap genHeap = (GenCollectedHeap) heap; |
242 Generation genOld = genHeap.getGen(1); |
240 Generation genOld = genHeap.getGen(1); |
243 if (genOld instanceof ConcurrentMarkSweepGeneration) { |
|
244 ConcurrentMarkSweepGeneration concGen = (ConcurrentMarkSweepGeneration)genOld; |
|
245 cmsSpaceOld = concGen.cmsSpace(); |
|
246 } |
|
247 } |
241 } |
248 |
242 |
249 for (int i = 0; i < liveRegions.size(); i += 2) { |
243 for (int i = 0; i < liveRegions.size(); i += 2) { |
250 Address bottom = (Address) liveRegions.get(i); |
244 Address bottom = (Address) liveRegions.get(i); |
251 Address top = (Address) liveRegions.get(i+1); |
245 Address top = (Address) liveRegions.get(i+1); |
263 if (DEBUG) { |
257 if (DEBUG) { |
264 throw new RuntimeException(" UnknownOopException " + exp); |
258 throw new RuntimeException(" UnknownOopException " + exp); |
265 } |
259 } |
266 } |
260 } |
267 if (obj == null) { |
261 if (obj == null) { |
268 //Find the object size using Printezis bits and skip over |
262 throw new UnknownOopException(); |
269 long size = 0; |
|
270 |
|
271 if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle) ){ |
|
272 size = cmsSpaceOld.collector().blockSizeUsingPrintezisBits(handle); |
|
273 } |
|
274 |
|
275 if (size <= 0) { |
|
276 //Either Printezis bits not set or handle is not in cms space. |
|
277 throw new UnknownOopException(); |
|
278 } |
|
279 |
|
280 handle = handle.addOffsetToAsOopHandle(CompactibleFreeListSpace.adjustObjectSizeInBytes(size)); |
|
281 continue; |
|
282 } |
263 } |
283 if (of == null || of.canInclude(obj)) { |
264 if (of == null || of.canInclude(obj)) { |
284 if (visitor.doObj(obj)) { |
265 if (visitor.doObj(obj)) { |
285 // doObj() returns true to abort this loop. |
266 // doObj() returns true to abort this loop. |
286 break; |
267 break; |
287 } |
268 } |
288 } |
269 } |
289 if ( (cmsSpaceOld != null) && cmsSpaceOld.contains(handle)) { |
270 |
290 handle = handle.addOffsetToAsOopHandle(CompactibleFreeListSpace.adjustObjectSizeInBytes(obj.getObjectSize()) ); |
271 handle = handle.addOffsetToAsOopHandle(obj.getObjectSize()); |
291 } else { |
|
292 handle = handle.addOffsetToAsOopHandle(obj.getObjectSize()); |
|
293 } |
|
294 } |
272 } |
295 } |
273 } |
296 catch (AddressException e) { |
274 catch (AddressException e) { |
297 // This is okay at the top of these regions |
275 // This is okay at the top of these regions |
298 } |
276 } |