001    /*
002     *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003     *
004     *  This file is licensed to You under the Eclipse Public License (EPL);
005     *  You may not use this file except in compliance with the License. You
006     *  may obtain a copy of the License at
007     *
008     *      http://www.opensource.org/licenses/eclipse-1.0.php
009     *
010     *  See the COPYRIGHT.txt file distributed with this work for information
011     *  regarding copyright ownership.
012     */
013    package org.jikesrvm.objectmodel;
014    
015    import org.vmmagic.unboxed.Address;
016    import org.vmmagic.unboxed.Word;
017    
018    /**
019     * Interface of BootImage that is used to define object model classes.
020     */
021    public interface BootImageInterface {
022    
023      /**
024       * Allocate space in data portion of bootimage. Moral equivalent of
025       * memory managers allocating raw storage at runtime.
026       * @param size the number of bytes to allocate
027       * @param align the alignment requested; must be a power of 2.
028       * @param offset the offset at which the alignment is desired.
029       */
030      Address allocateDataStorage(int size, int align, int offset);
031    
032      /**
033       * Allocate space in code portion of bootimage. Moral equivalent of
034       * memory managers allocating raw storage at runtime.
035       * @param size the number of bytes to allocate
036       * @param align the alignment requested; must be a power of 2.
037       * @param offset the offset at which the alignment is desired.
038       */
039      Address allocateCodeStorage(int size, int align, int offset);
040    
041      /**
042       * Fill in 1 byte of bootimage.
043       *
044       * @param offset offset of target from start of image, in bytes
045       * @param value value to write
046       */
047      void setByte(Address offset, int value);
048    
049      /**
050       * Fill in 2 bytes of bootimage.
051       *
052       * @param offset offset of target from start of image, in bytes
053       * @param value value to write
054       */
055      void setHalfWord(Address offset, int value);
056    
057      /**
058       * Fill in 4 bytes of bootimage, as numeric.
059       *
060       * @param offset offset of target from start of image, in bytes
061       * @param value value to write
062       */
063      void setFullWord(Address offset, int value);
064    
065      /**
066       * Fill in 4/8 bytes of bootimage, as object reference.
067       *
068       * @param offset offset of target from start of image, in bytes
069       * @param value value to write
070       * @param objField true if this word is an object field (as opposed
071       * to a static, or tib, or some other metadata)
072       * @param root Does this slot contain a possible reference into the heap? (objField must also be true)
073       */
074      void setAddressWord(Address offset, Word value, boolean objField, boolean root);
075    
076      /**
077       * Fill in 4 bytes of bootimage, as null object reference.
078       *
079       * @param offset offset of target from start of image, in bytes
080       * @param objField true if this word is an object field (as opposed
081       * to a static, or tib, or some other metadata)
082       * @param root Does this slot contain a possible reference into the heap? (objField must also be true)
083       */
084      void setNullAddressWord(Address offset, boolean objField, boolean root);
085    
086      /**
087       * Fill in 8 bytes of bootimage.
088       *
089       * @param offset offset of target from start of image, in bytes
090       * @param value value to write
091       */
092      void setDoubleWord(Address offset, long value);
093    }