use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.
the class ConstantPoolHelpers method J9_CP_TYPE.
/**
* This method is Java implementation of the define J9_CP_TYPE in j9cp.h in VM.
* It basically find out the type of the constant pool entry at the given index.
*
* #define J9_CP_TYPE(cpShapeDescription, index) \
* (((cpShapeDescription)[(index) / J9_CP_DESCRIPTIONS_PER_U32] >> \
* (((index) % J9_CP_DESCRIPTIONS_PER_U32) * J9_CP_BITS_PER_DESCRIPTION)) & J9_CP_DESCRIPTION_MASK)
*
* @param cpShapeDescription Description of the constantPool
* @param index Type index
* @return Type
* @throws CorruptDataException
*/
public static long J9_CP_TYPE(U32Pointer cpShapeDescription, int index) throws CorruptDataException {
U32 cpDescription = cpShapeDescription.at(index / J9_CP_DESCRIPTIONS_PER_U32);
long shapeDesc = cpDescription.rightShift((int) ((index % J9_CP_DESCRIPTIONS_PER_U32) * J9_CP_BITS_PER_DESCRIPTION)).bitAnd(J9_CP_DESCRIPTION_MASK).longValue();
return shapeDesc;
}
use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.
the class Pool_29_V0 method pool_nextDo.
// re-uses the existing state
private VoidPointer pool_nextDo() throws CorruptDataException {
slot = 1 + state.lastSlot;
UDATAPointer currAddr = null;
if (state.leftToDo == 0) {
if ((state.currentPuddle != null) && (state.currentPuddle.notNull())) {
return poolPuddle_startDo(state.currentPuddle, true);
} else {
return null;
}
}
while (isPuddleSlotFree(state.currentPuddle)) {
slot++;
}
currAddr = UDATAPointer.cast(state.currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
state.lastSlot = slot;
state.leftToDo--;
if (state.leftToDo == 0) {
if ((state.flags & POOLSTATE_FOLLOW_NEXT_POINTERS) == POOLSTATE_FOLLOW_NEXT_POINTERS) {
state.currentPuddle = state.currentPuddle.nextPuddle();
state.lastSlot = -1;
} else {
state.currentPuddle = null;
}
}
logger.fine(String.format("Next pool item 0x%016x", currAddr.getAddress()));
if (logger.isLoggable(Level.FINER)) {
logger.finer(state.toString());
}
return VoidPointer.cast(currAddr);
}
use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.
the class Pool_29_V0 method hasNext.
@SuppressWarnings("unchecked")
public boolean hasNext() {
// prevents multiple calls to hasNext() walking the pool further.
if (nextStruct != null) {
return true;
}
try {
// any handlers are likely to have been installed.
if (!inited) {
// start the pool walk
nextItem = pool_startDo();
} else {
// continue the pool walk
nextItem = pool_nextDo();
}
} catch (CorruptDataException e) {
// cannot try to recover from this
raiseCorruptDataEvent("Error creating iterator", e, true);
// make the pool look empty
nextItem = null;
} finally {
// make sure we don't do this again
inited = true;
}
while ((nextItem != null) && nextItem.notNull()) {
try {
if (!isInline) {
PointerPointer ptr = PointerPointer.cast(nextItem);
nextItem = ptr.at(0);
}
nextStruct = (StructType) DataType.getStructure(structType, nextItem.getAddress());
} catch (CorruptDataException e) {
// may be able to recover from this
raiseCorruptDataEvent("Error getting next pool item", e, false);
}
if (nextStruct != null) {
// Found an item, move on.
break;
} else {
// the next item in the pool.
try {
// continue the pool walk
nextItem = pool_nextDo();
} catch (CorruptDataException e) {
// cannot try to recover from this
raiseCorruptDataEvent("Error creating iterator", e, true);
// make the pool look empty
nextItem = null;
}
}
}
return nextStruct != null;
}
use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.
the class GCStandardMemoryPoolIterator method advancePool.
/* Analog to the HeapMemoryPoolIterator.cpp:nextPool() */
private void advancePool() {
try {
boolean poolFound = false;
MM_MemoryPoolPointer memoryPool = null;
while (!poolFound && _regionIterator.hasNext()) {
switch(_state) {
case mm_heapmp_iterator_next_region:
_region = _regionIterator.next();
/* Based on current Modron architecture, the leafs of the sub spaces in standard collectors
* are of type SubSpaceGeneric. This might change in the future */
MM_MemorySubSpaceGenericPointer subSpaceGeneric = MM_MemorySubSpaceGenericPointer.cast(_region.getSubSpace());
if (subSpaceGeneric.notNull()) {
memoryPool = subSpaceGeneric._memoryPool();
if (memoryPool.notNull()) {
/* Does this Memory pool have children ? */
if (memoryPool._children().notNull()) {
/* Yes ..So we only return details of its children */
memoryPool = memoryPool._children();
}
_state = IteratorState.mm_heapmp_iterator_next_memory_pool;
poolFound = true;
}
}
break;
case mm_heapmp_iterator_next_memory_pool:
/* Any more children ? */
memoryPool = _currentMemoryPool._next();
if (memoryPool.isNull()) {
_state = IteratorState.mm_heapmp_iterator_next_region;
} else {
poolFound = true;
}
break;
}
}
if (poolFound) {
/* Set currentMemoryPool to null to indicate we can't find any more pools */
_currentMemoryPool = memoryPool;
} else {
_currentMemoryPool = null;
}
} catch (CorruptDataException e) {
raiseCorruptDataEvent("Memory Pool corruption detected", e, false);
_currentMemoryPool = null;
}
}
use of com.ibm.j9ddr.vm29.j9.Pool in project openj9 by eclipse.
the class MonitorIterator method threadPoolHasNext.
private boolean threadPoolHasNext() throws CorruptDataException {
while ((current == null) && pool.notNull()) {
while (index < poolSize) {
J9ThreadMonitorPointer monitor = J9ThreadMonitorPointer.cast(poolEntries.add(index));
index++;
if (freeTag != monitor.count().longValue()) {
J9ThreadAbstractMonitorPointer lock = J9ThreadAbstractMonitorPointer.cast(monitor);
if (lock.flags().allBitsIn(J9ThreadAbstractMonitor.J9THREAD_MONITOR_OBJECT)) {
if (!lock.userData().eq(0)) {
// this is an object monitor in the system monitor table
J9ObjectPointer obj = J9ObjectPointer.cast(lock.userData());
ObjectMonitor objmon = ObjectAccessBarrier.getMonitor(obj);
// This check is to exclude flat object monitors. Flat object monitors are accounted for during the heap walk
if ((objmon == null) || !objmon.isInflated()) {
continue;
}
// return an object monitor
current = objmon;
}
} else {
// return a system monitor
current = monitor;
}
if (log.isLoggable(Level.FINE)) {
log.fine(String.format("Found monitor @ 0x%016x : %s", monitor.getAddress(), monitor.name().getCStringAtOffset(0)));
}
return true;
}
}
pool = pool.next();
if (pool.notNull()) {
index = 0;
poolEntries = pool.entriesEA();
}
}
return pool.notNull();
}
Aggregations