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.compilers.baseline;
014    
015    import org.jikesrvm.VM;
016    import org.vmmagic.pragma.Uninterruptible;
017    
018    /**
019     * Unusual maps are maps to track references that don't take the usual format.<p>
020     * Currently unusual maps include:
021     *    maps of locations within JSR subroutines (includes return address map).
022     * In the future the return address maps may be expanded to include other
023     * internal pointers or internal/external pointers may be handled separately.
024     */
025    @Uninterruptible
026    final class UnusualMaps {
027    
028      /** For maps of JSR subroutine locations index into the normal reference map of where the return address can be located */
029      int returnAddressIndex;
030      /** index into the map table of the references set map */
031      int referenceMapIndex;
032      /** index into the map table of the non-reference set map */
033      int nonReferenceMapIndex;
034      /** index into the map table of the return address map */
035      int returnAddressMapIndex;
036      /** index into the array of normal maps ie the back-pointer */
037      int normalMapIndex;
038    
039      /** set the index in the stack frame of the return address for this map */
040      void setReturnAddressIndex(int index) {
041        returnAddressIndex = index;
042      }
043    
044      /** provide the index in the stack frame of the return address for this map */
045      int getReturnAddressIndex() {
046        return returnAddressIndex;
047      }
048    
049      /** set the  offset of the reference map in the stackmap list of maps */
050      void setReferenceMapIndex(int index) {
051        referenceMapIndex = index;
052      }
053    
054      /** provide the index in the stackmaps for the reference map */
055      int getReferenceMapIndex() {
056        return referenceMapIndex;
057      }
058    
059      /** set the  offset of the non-reference map in the stackmap list of maps */
060      void setNonReferenceMapIndex(int index) {
061        nonReferenceMapIndex = index;
062      }
063    
064      /** provide the index in the stackmaps for the non-reference map */
065      int getNonReferenceMapIndex() {
066        return nonReferenceMapIndex;
067      }
068    
069      /** set the  offset of the returnAddress map in the stackmap list of maps */
070      void setReturnAddressMapIndex(int index) {
071        returnAddressMapIndex = index;
072      }
073    
074      /** provide the index in the stackmaps for the return Address map */
075      int getReturnAddressMapIndex() {
076        return returnAddressMapIndex;
077      }
078    
079      /** provide the normal map index ie the back-pointer */
080      int getNormalMapIndex() {
081        return normalMapIndex;
082      }
083    
084      /** set the normal map index ie the back-pointer */
085      void setNormalMapIndex(int index) {
086        normalMapIndex = index;
087      }
088    
089      public void showInfo() {
090        VM.sysWrite("  UnusualMap showInfo- ");
091    
092        VM.sysWrite("    return address index = ");
093        VM.sysWrite(returnAddressIndex);
094        VM.sysWrite("\n    referenceMapIndex = ");
095        VM.sysWrite(referenceMapIndex);
096        VM.sysWrite("\n    nonReferenceMapIndex = ");
097        VM.sysWrite(nonReferenceMapIndex);
098        VM.sysWrite("\n    returnAddressMapIndex = ");
099        VM.sysWrite(returnAddressMapIndex);
100        VM.sysWrite("\n");
101      }
102    }