Package org.vmmagic.unboxed

Examples of org.vmmagic.unboxed.Address


        final int refSize = VmUtils.getVm().getArch().getReferenceSize();
        allocator = checkAllocator(size, align, allocator);

        // Allocate the raw space
        size += this.headerSize;
        final Address ptr = alloc(size, align, this.headerSize, allocator);

        // Initialize the header
        final Address objPtr = ptr.add(headerSize);
        final ObjectReference tibRef = ObjectReference.fromObject(vmClass
                .getTIB());
        objPtr.store(tibRef, tibOffset);
        objPtr.store((int) 0, flagsOffset);

        // Post allocation
        final Object result = objPtr.toObjectReference().toObject();
        if (false) {
            Unsafe.debug("result=");
            Unsafe.debug(objPtr);
            Unsafe.debug('\n');
        }
View Full Code Here


        }
        initializing = true;
        final VmArchitecture arch = VmUtils.getVm().getArch();
        helper.bootArchitecture(true);

        final Address bootImgStart = helper.getBootImageStart();
        final Address bootImgEnd = helper.getBootImageEnd();
        final int bootImgSize = bootImgEnd.sub(bootImgStart.toWord()).toInt();
        LazyMmapper.boot(bootImgStart, bootImgSize);

        final Extent heapSize = helper.getHeapSize();
        HeapGrowthManager.boot(heapSize, heapSize);
        bootPlan();
View Full Code Here

        Unsafe.debug("MmtkHeapManager#start\n");

        // Claim the available heap region as resource.
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            final Address start = Memory.AVAILABLE_START();
            final Extent size = Memory.AVAILABLE_END().toWord().sub(start.toWord()).toExtent();
            heapResource = rm.claimMemoryResource(ResourceOwner.SYSTEM, start,
                    size, ResourceManager.MEMMODE_NORMAL);
        } catch (NameNotFoundException ex) {
            BootLogInstance.get().fatal("Cannot find resource manager", ex);
        } catch (ResourceNotFreeException ex) {
View Full Code Here

            "ACPI-RootSystemDescriptionTable");
        for (int index = 0; index < tablesCount; index++) {
            // log.debug("Handling RSDT index " + index + "/" + tablesCount);
            try {
                final int ptrOffset = startOfTablePointers + (index * 8);
                final Address ptr = getAddress64(ptrOffset);
                final AcpiTable table = AcpiTable.getTable(getDriver(), owner, rm, ptr);
                if (table != null) {
                    addTable(table);
                }
            } catch (Exception ex) {
View Full Code Here

    /**
     * Initialize this instance.
     */
    private PcTextScreen() throws ResourceNotFreeException {
        super(80, 25);
        Address ptr = Address.fromIntZeroExtend(0xb8000);
        try {
            final ResourceManager rm = InitialNaming.lookup(ResourceManager.NAME);
            final ResourceOwner owner = new SimpleResourceOwner("Screen");
            memory = rm.claimMemoryResource(owner, ptr, getWidth()
                    * getHeight() * 2, ResourceManager.MEMMODE_NORMAL);
View Full Code Here

     *
     * @param reader
     */
    public VmStackFrameEnumerator(VmStackReader reader) {
        this.reader = reader;
        final Address curFrame = VmMagic.getCurrentFrame();
        reset(reader.getPrevious(curFrame), reader.getReturnAddress(curFrame));
    }
View Full Code Here

                if (newIndex >= 0) {
                    codeIndex = newIndex;
                    return;
                }
            }
            final Address nextIP = reader.getReturnAddress(framePtr).add(-1);
            this.framePtr = reader.getPrevious(framePtr);
            initializeCodeIndex(nextIP);
        }
    }
View Full Code Here

    public final void lock() {
        if (this.owner == VmMagic.currentProcessor()) {
            // We already own this lock, increment the lock count.
            lockCount = lockCount.add(Word.one());
        } else {
            final Address ownerAddr = ObjectReference.fromObject(this)
                .toAddress();
            final ObjectReference procRef = ObjectReference.fromObject(VmMagic
                .currentProcessor());
            while (!ownerAddr.attempt(null, procRef)) {
                // Busy wait
            }
            // Now I'm the owner
            lockCount = lockCount.add(Word.one());
        }
View Full Code Here

        try {
            final int startOffset = cm.getCodeStart().getOffset();
            final int size = cm.getCodeEnd().getOffset() - startOffset;
            final byte[] code = new byte[size];
            System.arraycopy(os.getBytes(), startOffset, code, 0, size);
            final Address codePtr = VmMagic.getArrayData(code);

            final NativeStream.ObjectRef defExHRef = cm
                .getDefExceptionHandler();
            final Address defExHandler;
            if (defExHRef != null) {
                defExHandler = codePtr.add(cm.getDefExceptionHandler()
                    .getOffset()
                    - startOffset);
            } else {
                defExHandler = Address.zero();
            }
            final VmCompiledExceptionHandler[] eTable;
            final VmAddressMap aTable = cm.getAddressTable();

            final VmByteCode bc = method.getBytecode();
            final CompiledExceptionHandler[] ceh = cm.getExceptionHandlers();
            if (ceh != null) {
                eTable = new VmCompiledExceptionHandler[ceh.length];
                for (int i = 0; i < ceh.length; i++) {

                    final VmConstClass catchType = bc.getExceptionHandler(i)
                        .getCatchType();
                    final Address startPtr = codePtr.add(ceh[i].getStartPc()
                        .getOffset()
                        - startOffset);
                    final Address endPtr = codePtr.add(ceh[i].getEndPc()
                        .getOffset()
                        - startOffset);
                    final Address handler = codePtr.add(ceh[i].getHandler()
                        .getOffset()
                        - startOffset);

                    eTable[i] = new VmCompiledExceptionHandler(catchType,
                        startPtr.toAddress(), endPtr.toAddress(), handler
                        .toAddress());
                }
            } else {
                eTable = null;
            }
View Full Code Here

     * @return boolean
     */
    private static final boolean isInUse(Word blockNr) {
        final Word offset = blockNr.rshl(3); // we still need a byte offset
        final int mask = (1 << blockNr.and(Word.fromIntZeroExtend(7)).toInt());
        final Address ptr = bitmapPtr.add(offset);
        final int v = ptr.loadByte() & 0xFF;
        return ((v & mask) == mask);
    }
View Full Code Here

TOP

Related Classes of org.vmmagic.unboxed.Address

Copyright © 2018 www.massapicom. 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.