Package org.vmmagic.unboxed

Examples of org.vmmagic.unboxed.Address.loadWord()


     */
    private final void mapPage(Address vmAddress, Address physAddr, Extent pageSize, boolean debug) {
        // Setup the pdir structures
        final Word pdirIdx = vmAddress.toWord().rshl(22);
        final Address pdirEntryPtr = UnsafeX86.getCR3().add(pdirIdx.lsh(2));
        Word entry = pdirEntryPtr.loadWord();
        if (entry.and(Word.fromIntZeroExtend(PF_PRESENT)).isZero()) {
            final Word pagePtr;
            if (physAddr.isMax()) {
                // Get a free page
                pagePtr = pageCursor;
View Full Code Here


        this.sizeOffset = Offset.fromIntSignExtend(-((ObjectLayout.HEADER_SLOTS + 1) * slotSize));
        this.headerSize = ObjectLayout.objectAlign(this.headerSize + slotSize);
        final int size = getSize();

        final Address myAddr = ObjectReference.fromObject(this).toAddress();
        final Word mySize = myAddr.loadWord(sizeOffset);
        Address firstObject;
        if (inHeap(myAddr)) {
            firstObject = myAddr.add(mySize).add(headerSize);
        } else {
            firstObject = start.add(headerSize);
View Full Code Here

        try {
            // Search for the first free block that is large enough
            //Screen.debug("a");
            while (objectPtr == null) {
                final Address ptr = nextFreePtr;
                final Word objSize = ptr.loadWord(sizeOffset);
                final Object objVmt = ptr.loadObjectReference(tibOffset);
                final Address nextPtr = ptr.add(objSize.add(headerSize));
                if ((objVmt == FREE) && alignedSizeW.LE(objSize)) {
                    objectPtr = ptr;
                } else {
View Full Code Here

     * @param object
     */
    @Inline
    final void free(Object object) {
        final Address ptr = ObjectReference.fromObject(object).toAddress();
        final Word objSize = ptr.loadWord(sizeOffset);
        ptr.store(ObjectReference.fromObject(FREE), tibOffset);
        setAllocationBit(object, false);
        freeSize = freeSize.add(objSize);
    }

View Full Code Here

        lock();
        try {
            Address firstFreePtr = Address.zero();
            while (offset.LT(size)) {
                final Address ptr = start.add(offset);
                final Word objSize = ptr.loadWord(sizeOffset);
                final Word nextOffset = offset.add(objSize).add(headerSize);
                final Object vmt = ptr.loadObjectReference(tibOffset);
                if ((firstFreePtr == null) && (vmt == FREE)) {
                    firstFreePtr = ptr;
                }
View Full Code Here

                    final Object nextVmt;
                    final Address nextObjectPtr = start.add(nextOffset);
                    nextVmt = nextObjectPtr.loadObjectReference(tibOffset);
                    if (nextVmt == FREE) {
                        // Combine two free spaces
                        Word nextObjSize = nextObjectPtr.loadWord(sizeOffset);
                        Word newObjSize = objSize.add(headerSize).add(nextObjSize);
                        ptr.store(newObjSize, sizeOffset);
                        // Do not increment offset here, because there may be
                        // another next free object, which we will combine
                        // in the next loop.
View Full Code Here

                lock();
                try {
                    final Address ptr = start.add(offset);
                    object = ptr.toObjectReference().toObject();
                    tib = ptr.loadObjectReference(tibOffset);
                    objSize = ptr.loadWord(sizeOffset);
                    flags = (flagsMask.isZero()) ? Word.zero() : VmMagic.getObjectFlags(object).and(flagsMask);
                } finally {
                    unlock();
                }
                if (tib != FREE) {
View Full Code Here

        } else {
            while (offset.LT(size)) {
                final Address ptr = start.add(offset);
                final Object object = ptr.toObjectReference().toObject();
                final Object tib = ptr.loadObjectReference(tibOffset);
                final Word objSize = ptr.loadWord(sizeOffset);
                final Word flags = flagsMask.isZero() ? Word.zero() : VmMagic.getObjectFlags(object).and(flagsMask);
                if (tib != FREE) {
                    if (flags.EQ(flagsValue)) {
                        if (!visitor.visit(object)) {
                            // Stop
View Full Code Here

        final Word headerSize = Word.fromIntZeroExtend(this.headerSize);
        Word offset = headerSize;
        while (offset.LT(heapSizeW)) {
            final Address ptr = start.add(offset);
            setAllocationBit(ptr, true);
            final Word objSize = ptr.loadWord(sizeOffset);
            offset = offset.add(objSize).add(headerSize);
        }
        //Unsafe.debug("end of bootheap.initialize");
    }
View Full Code Here

            final Address ptr = start.add(offset);
            final Object object = ptr.toObjectReference().toObject();
            final Word flags = VmMagic.getObjectFlags(object).and(flagsMask);
            if (!flags.EQ(flagsValue) || visitor.visit(object)) {
                // Continue
                final Word objSize = ptr.loadWord(sizeOffset);
                offset = offset.add(objSize).add(headerSize);
            } else {
                // Stop
                offset = size;
            }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.