use of com.ibm.dtfj.corereaders.MemoryRange in project openj9 by eclipse.
the class CommonAddressSpace method findPattern.
public long findPattern(byte[] whatBytes, int alignment, long startFrom) {
// avoid divide-by-zero errors
int align = 0 == alignment ? 1 : alignment;
// Ensure buffer size is a multiple of the alignment
int bufferMax = BUFFER_MAX;
if (bufferMax < align)
bufferMax = align;
else if (0 != bufferMax % align)
bufferMax -= bufferMax % align;
long location = -1;
Iterator ranges = getMemoryRanges();
while ((-1 == location) && ranges.hasNext()) {
MemoryRange range = (MemoryRange) ranges.next();
// Skip over previous asids
if (range.getAsid() < lastAsid)
continue;
// Reset start location for new asid
if (range.getAsid() > lastAsid)
startFrom = 0;
location = findPatternInRange(whatBytes, align, startFrom, range, bufferMax);
}
// Reset asid as end of search
if (location == -1)
lastAsid = 0;
return location;
}
Aggregations