Package org.vmmagic.unboxed

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


            if ((offset < 0) || (offset >= size)) {
                Unsafe.debug("reference offset out of range!");
                Unsafe.debug(vmClass.getName());
                helper.die("Class internal error");
            } else {
                final Object child = ptr.loadObjectReference(Offset.fromIntZeroExtend(offset)).toObject();
                if (child != null) {
                    verifyChild(child, object, "object child");
                }
            }
        }
View Full Code Here


            if ((offset < 0) || (offset >= size)) {
                Unsafe.debug("reference offset out of range!");
                Unsafe.debug(vmClass.getName());
                helper.die("Class internal error");
            } else {
                final ObjectReference child = objAddr.loadObjectReference(Offset.fromIntZeroExtend(offset));
                if (child != null) {
                    // Enable the following in the case of heap corruption
                    if (false) {
                        verifyChild(child, object, "object child", i, offset);
                    }
View Full Code Here

            // 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 {
                    if (!inHeap(nextPtr)) {
View Full Code Here

            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;
                }
                if ((vmt == FREE) && (nextOffset.LT(size))) {
                    final Object nextVmt;
View Full Code Here

                    firstFreePtr = ptr;
                }
                if ((vmt == FREE) && (nextOffset.LT(size))) {
                    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);
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();
                }
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)) {
View Full Code Here

        if (sf.isShared()) {
            tablePtr = VmMagic.getArrayData(proc.getSharedStaticsTable());
        } else {
            tablePtr = VmMagic.getArrayData(proc.getIsolatedStaticsTable());
        }
    Object ret = tablePtr.loadObjectReference().toObject();
        if(sf.isStatic() && sf.isFinal() && f.getType().equals(String.class))
            ret = new IrregularStaticAccess(tablePtr.toLong());
        else
            ret = new StaticAccess(tablePtr.toLong());
        return ret;
View Full Code Here

    public static boolean compareAndSwapObject(Unsafe instance, Object o, long offset,
                                              Object expected, Object x) {
        //todo make sure it's atomic
        final Address address = ObjectReference.fromObject(o).toAddress().add((int) offset);
        if(address.loadObjectReference().toObject() == expected){
            address.store(ObjectReference.fromObject(x));
            return true;
        } else {
            return false;
        }
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.