Search in sources :

Example 96 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class MemoryPage method getWatchPoints.

/**
 ***********************************************************************
 *                      Watch-point management
 */
/**
 * Return a boolean array indicating which words in this page are being watched.
 */
private boolean[] getWatchPoints() {
    boolean[] result = null;
    for (Address addr : SimulatedMemory.watches) {
        if (SimulatedMemory.onSamePage(addr, pageAddress)) {
            if (result == null) {
                result = new boolean[data.length];
            }
            int index = getIndex(addr);
            result[index] = true;
            System.err.println("Watching address " + addr);
        }
    }
    return result;
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 97 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class Block method sweepOneBlock.

/**
 *************************************************************************
 * Sweeping
 */
/**
 * Sweeps one block.<p>
 *
 * TODO: needs better documentation.
 *
 * @param block the block's address
 * @param markHistogram the mark histogram
 * @param markState the mark value
 * @param resetMarkState whether to reset the mark state
 * @return number of marked lines
 */
static short sweepOneBlock(Address block, int[] markHistogram, final byte markState, final boolean resetMarkState) {
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(isAligned(block));
    final boolean unused = isUnused(block);
    if (unused && !SANITY_CHECK_LINE_MARKS)
        return 0;
    Address markTable = Line.getBlockMarkTable(block);
    short markCount = 0;
    short conservativeSpillCount = 0;
    byte mark, lastMark = 0;
    for (int offset = 0; offset < (LINES_IN_BLOCK << Line.LOG_BYTES_IN_LINE_STATUS); offset += Line.BYTES_IN_LINE_STATUS) {
        if (VM.VERIFY_ASSERTIONS) {
            VM.assertions._assert(markTable.plus(offset).GE(Chunk.align(block).plus(Chunk.LINE_MARK_TABLE_OFFSET)));
            VM.assertions._assert(markTable.plus(offset).LT(Chunk.align(block).plus(Chunk.LINE_MARK_TABLE_OFFSET + Line.LINE_MARK_TABLE_BYTES)));
        }
        mark = markTable.loadByte(Offset.fromIntZeroExtend(offset));
        if (resetMarkState)
            markTable.store(mark == markState ? RESET_LINE_MARK_STATE : 0, Offset.fromIntZeroExtend(offset));
        if (mark == markState)
            markCount++;
        else if (lastMark == markState)
            conservativeSpillCount++;
        else if (SANITY_CHECK_LINE_MARKS && lastMark != markState) {
            VM.memory.zero(false, block.plus(offset << (LOG_BYTES_IN_LINE - Line.LOG_BYTES_IN_LINE_STATUS)), Extent.fromIntZeroExtend(BYTES_IN_LINE));
        }
        lastMark = mark;
    }
    if (VM.VERIFY_ASSERTIONS) {
        VM.assertions._assert(markCount <= LINES_IN_BLOCK);
        VM.assertions._assert(markCount + conservativeSpillCount <= LINES_IN_BLOCK);
        VM.assertions._assert(markCount == 0 || !isUnused(block));
    }
    getDefragStateAddress(block).store(conservativeSpillCount);
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(markCount >= conservativeSpillCount);
    markHistogram[conservativeSpillCount] += markCount;
    markCount = (short) (markCount + conservativeSpillCount);
    return markCount;
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 98 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class Block method getDefragStateAddress.

static Address getDefragStateAddress(Address address) {
    Address chunk = Chunk.align(address);
    int index = getChunkIndex(address);
    Address rtn = chunk.plus(Chunk.BLOCK_DEFRAG_STATE_TABLE_OFFSET).plus(index << LOG_BYTES_IN_BLOCK_DEFRAG_STATE_ENTRY);
    if (VM.VERIFY_ASSERTIONS) {
        Address block = chunk.plus(index << LOG_BYTES_IN_BLOCK);
        VM.assertions._assert(isAligned(block));
        boolean valid = rtn.GE(chunk.plus(Chunk.BLOCK_DEFRAG_STATE_TABLE_OFFSET)) && rtn.LT(chunk.plus(Chunk.BLOCK_DEFRAG_STATE_TABLE_OFFSET + BLOCK_DEFRAG_STATE_TABLE_BYTES));
        VM.assertions._assert(valid);
    }
    return rtn;
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 99 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class Chunk method resetLineMarksAndDefragStateTable.

static void resetLineMarksAndDefragStateTable(Address chunk, short threshold) {
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(isAligned(chunk));
    Address markStateBase = Block.getBlockMarkStateAddress(chunk);
    Address defragStateBase = Block.getDefragStateAddress(chunk);
    Address lineMarkBase = Line.getChunkMarkTable(chunk);
    for (int b = FIRST_USABLE_BLOCK_INDEX; b < BLOCKS_IN_CHUNK; b++) {
        Block.resetLineMarksAndDefragStateTable(threshold, markStateBase, defragStateBase, lineMarkBase, b);
    }
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 100 with Address

use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.

the class ChunkList method addNewChunkToMap.

void addNewChunkToMap(Address chunk) {
    if (VM.VERIFY_ASSERTIONS)
        VM.assertions._assert(Chunk.isAligned(chunk));
    if (chunkMapCursor == MAX_ENTRIES_IN_CHUNK_MAP - 1)
        consolidateMap();
    chunkMapCursor++;
    int index = getChunkIndex(chunkMapCursor);
    int map = getChunkMap(chunkMapCursor);
    if (map >= CHUNK_MAP_BLOCKS) {
        Space.printUsageMB();
        VM.assertions.fail("Overflow of chunk map!");
    }
    if (chunkMap.get(map).isZero()) {
        Address tmp = Plan.metaDataSpace.acquire(1 << LOG_PAGES_IN_CHUNK_MAP_BLOCK);
        if (tmp.isZero()) {
            Space.printUsageMB();
            VM.assertions.fail("Failed to allocate space for chunk map.  Is metadata virtual memory exhausted?");
        }
        chunkMap.set(map, tmp);
    }
    Address entry = chunkMap.get(map).plus(index << LOG_BYTES_IN_ADDRESS);
    entry.store(chunk);
    Chunk.setMap(chunk, chunkMapCursor);
    if (VM.VERIFY_ASSERTIONS)
        checkMap();
}
Also used : Address(org.vmmagic.unboxed.Address)

Aggregations

Address (org.vmmagic.unboxed.Address)281 Offset (org.vmmagic.unboxed.Offset)48 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)30 NoInline (org.vmmagic.pragma.NoInline)30 Test (org.junit.Test)24 Entrypoint (org.vmmagic.pragma.Entrypoint)22 TypeReference (org.jikesrvm.classloader.TypeReference)21 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)17 RVMType (org.jikesrvm.classloader.RVMType)16 Inline (org.vmmagic.pragma.Inline)15 Uninterruptible (org.vmmagic.pragma.Uninterruptible)14 Word (org.vmmagic.unboxed.Word)14 BaseMMTkTest (org.mmtk.harness.tests.BaseMMTkTest)13 Unpreemptible (org.vmmagic.pragma.Unpreemptible)12 ObjectReference (org.vmmagic.unboxed.ObjectReference)12 Interruptible (org.vmmagic.pragma.Interruptible)11 Extent (org.vmmagic.unboxed.Extent)11 RVMClass (org.jikesrvm.classloader.RVMClass)9 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8