use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class ObjectMonitor_V1 method getBlockedThreads.
private static List<J9VMThreadPointer> getBlockedThreads(J9ObjectPointer blockingObject) throws CorruptDataException {
// Do a single walk and cache all the results.
if (blockedThreadsCache == null) {
blockedThreadsCache = new HashMap<J9ObjectPointer, List<J9VMThreadPointer>>();
GCVMThreadListIterator iterator = GCVMThreadListIterator.from();
while (iterator.hasNext()) {
J9VMThreadPointer vmThread = iterator.next();
if (vmThread.publicFlags().allBitsIn(J9Consts.J9_PUBLIC_FLAGS_THREAD_BLOCKED)) {
J9ObjectPointer object = vmThread.blockingEnterObject();
if (object.notNull()) {
List<J9VMThreadPointer> list = blockedThreadsCache.get(object);
if (list == null) {
list = new ArrayList<J9VMThreadPointer>();
blockedThreadsCache.put(object, list);
}
list.add(vmThread);
}
}
}
}
return blockedThreadsCache.get(blockingObject);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class GCConstantPoolSlotIterator method initializeSlots_V1.
protected void initializeSlots_V1(J9ClassPointer clazz, boolean returnClassSlots, boolean returnObjectSlots) throws CorruptDataException {
U32Pointer cpDescriptionSlots = clazz.romClass().cpShapeDescription();
PointerPointer cpEntry = PointerPointer.cast(clazz.ramConstantPool());
long cpDescription = 0;
long cpEntryCount = clazz.romClass().ramConstantPoolCount().longValue();
long cpDescriptionIndex = 0;
ArrayList<AbstractPointer> slots = new ArrayList<AbstractPointer>();
ArrayList<VoidPointer> addresses = new ArrayList<VoidPointer>();
while (cpEntryCount > 0) {
if (0 == cpDescriptionIndex) {
// Load a new description word
cpDescription = cpDescriptionSlots.at(0).longValue();
cpDescriptionSlots = cpDescriptionSlots.add(1);
cpDescriptionIndex = J9_CP_DESCRIPTIONS_PER_U32;
}
long slotType = cpDescription & J9_CP_DESCRIPTION_MASK;
if ((slotType == J9CPTYPE_STRING) || (slotType == J9CPTYPE_ANNOTATION_UTF8)) {
if (returnObjectSlots) {
J9RAMStringRefPointer ref = J9RAMStringRefPointer.cast(cpEntry);
J9ObjectPointer slot = ref.stringObject();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.stringObjectEA()));
}
}
} else if (slotType == J9CPTYPE_METHOD_TYPE) {
if (returnObjectSlots) {
J9RAMMethodTypeRefPointer ref = J9RAMMethodTypeRefPointer.cast(cpEntry);
J9ObjectPointer slot = ref.type();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.typeEA()));
}
}
} else if (slotType == J9CPTYPE_METHODHANDLE) {
if (returnObjectSlots) {
J9RAMMethodHandleRefPointer ref = J9RAMMethodHandleRefPointer.cast(cpEntry);
J9ObjectPointer slot = ref.methodHandle();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.methodHandleEA()));
}
}
} else if (slotType == J9CPTYPE_CLASS) {
if (returnClassSlots) {
J9RAMClassRefPointer ref = J9RAMClassRefPointer.cast(cpEntry);
J9ClassPointer slot = ref.value();
if (slot.notNull()) {
slots.add(slot);
addresses.add(VoidPointer.cast(ref.valueEA()));
}
}
}
cpEntry = cpEntry.addOffset(J9RAMConstantPoolItem.SIZEOF);
cpEntryCount -= 1;
cpDescription >>= J9_CP_BITS_PER_DESCRIPTION;
cpDescriptionIndex -= 1;
}
slotIterator = slots.iterator();
addressIterator = addresses.iterator();
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class GCFinalizableObjectIterator method next.
public J9ObjectPointer next() {
try {
if (hasNext()) {
J9ObjectPointer result = J9ObjectPointer.NULL;
switch(_state) {
case state_system:
result = _currentSystemObject;
advanceToNextSystemFinalizableObject();
break;
case state_default:
result = _currentDefaultObject;
advanceToNextDefaultFinalizableObject();
break;
case state_reference:
result = _currentReferenceObject;
_currentReferenceObject = ObjectAccessBarrier.getReferenceLink(_currentReferenceObject);
break;
}
return result;
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
} catch (CorruptDataException cde) {
// can try to recover from this
raiseCorruptDataEvent("Error getting next item", cde, false);
if (_state < state_end) {
/* The current list appears damaged. Move to the next one. */
_state++;
}
return null;
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class GCMixedObjectIterator_V1 method next.
@Override
public J9ObjectPointer next() {
try {
if (hasNext()) {
if (object != null && includeClassSlot) {
includeClassSlot = false;
return J9ObjectHelper.clazz(object).classObject();
}
J9ObjectPointer next = J9ObjectPointer.cast(data.at(scanIndex));
scanIndex++;
return next;
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
} catch (CorruptDataException e) {
// can try to recover from this
raiseCorruptDataEvent("Error getting next item", e, false);
return null;
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.
the class GCHeapMap method queryRange.
/**
* Query the mark map to see what objects are marked within the specified range.
* Return an array of MarkedObject records describing each entry found.
* @param base Bottom of the range to query (inclusive)
* @param top Top of the range to query (exclusive)
* @return A MarkedObject[] containing the results
* @throws CorruptDataException
*/
public MarkedObject[] queryRange(J9ObjectPointer base, J9ObjectPointer top) throws CorruptDataException {
/* Naive implementation; should work but slow */
ArrayList<MarkedObject> results = new ArrayList<MarkedObject>();
if (base.lt(_heapBase)) {
base = J9ObjectPointer.cast(_heapBase);
}
if (top.gt(_heapTop)) {
top = J9ObjectPointer.cast(_heapTop);
}
if (base.gt(top)) {
base = top;
}
J9ObjectPointer cursor = base;
while (cursor.lt(top)) {
UDATA[] indexAndMask = getSlotIndexAndMask(cursor);
UDATAPointer slot = _heapMapBits.add(indexAndMask[0]);
if (slot.at(0).bitAnd(indexAndMask[1]).gt(0)) {
results.add(new MarkedObject(cursor, slot));
}
cursor = cursor.addOffset(getObjectGrain());
}
return results.toArray(new MarkedObject[results.size()]);
}
Aggregations