< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/MarkBits.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 39,50 ****
MemRegion reserved = heap.reservedRegion();
// Must cover "reserved" with one bit for each OopHandle
start = reserved.start();
end = reserved.end();
long numOopHandles = end.minus(start) / VM.getVM().getOopSize();
! // FIXME: will have trouble with larger heap sizes
! bits = new BitMap((int) numOopHandles);
}
public void clear() {
bits.clear();
}
--- 39,49 ----
MemRegion reserved = heap.reservedRegion();
// Must cover "reserved" with one bit for each OopHandle
start = reserved.start();
end = reserved.end();
long numOopHandles = end.minus(start) / VM.getVM().getOopSize();
! bits = heap.createBitMap(numOopHandles);
}
public void clear() {
bits.clear();
}
*** 58,93 ****
System.err.println("MarkBits: WARNING: null object, ignoring");
return false;
}
OopHandle handle = obj.getHandle();
- // FIXME: will have trouble with larger heap sizes
long idx = handle.minus(start) / VM.getVM().getOopSize();
! if ((idx < 0) || (idx >= bits.size())) {
! System.err.println("MarkBits: WARNING: object " + handle + " outside of heap, ignoring");
! return false;
! }
! int intIdx = (int) idx;
! if (bits.at(intIdx)) {
return false; // already marked
}
! bits.atPut(intIdx, true);
return true;
}
/** Forces clearing of a given mark bit. */
public void clear(Oop obj) {
OopHandle handle = obj.getHandle();
- // FIXME: will have trouble with larger heap sizes
long idx = handle.minus(start) / VM.getVM().getOopSize();
! if ((idx < 0) || (idx >= bits.size())) {
! System.err.println("MarkBits: WARNING: object " + handle + " outside of heap, ignoring");
! return;
! }
! int intIdx = (int) idx;
! bits.atPut(intIdx, false);
}
! private BitMap bits;
private Address start;
private Address end;
}
--- 57,80 ----
System.err.println("MarkBits: WARNING: null object, ignoring");
return false;
}
OopHandle handle = obj.getHandle();
long idx = handle.minus(start) / VM.getVM().getOopSize();
! if (bits.at(idx)) {
return false; // already marked
}
! bits.atPut(idx, true);
return true;
}
/** Forces clearing of a given mark bit. */
public void clear(Oop obj) {
OopHandle handle = obj.getHandle();
long idx = handle.minus(start) / VM.getVM().getOopSize();
! bits.atPut(idx, false);
}
! private BitMapInterface bits;
private Address start;
private Address end;
}
< prev index next >