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 */
013package org.jikesrvm.compilers.baseline;
014
015import org.jikesrvm.VM;
016import 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
026final 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  /**
040   * Sets the index in the stack frame of the return address for this map.
041   * @param index new index for return address
042   */
043  void setReturnAddressIndex(int index) {
044    returnAddressIndex = index;
045  }
046
047  /** @return the index in the stack frame of the return address for this map */
048  int getReturnAddressIndex() {
049    return returnAddressIndex;
050  }
051
052  /**
053   * Sets the offset of the reference map in the stackmap list of maps
054   * @param index new index for reference map
055   */
056  void setReferenceMapIndex(int index) {
057    referenceMapIndex = index;
058  }
059
060  /** @return the index in the stackmaps for the reference map */
061  int getReferenceMapIndex() {
062    return referenceMapIndex;
063  }
064
065  /**
066   * Sets the  offset of the non-reference map in the stackmap list of maps
067   * @param index new index for non-reference map
068   */
069  void setNonReferenceMapIndex(int index) {
070    nonReferenceMapIndex = index;
071  }
072
073  /** @return the index in the stackmaps for the non-reference map */
074  int getNonReferenceMapIndex() {
075    return nonReferenceMapIndex;
076  }
077
078  /**
079   * Sets the  offset of the returnAddress map in the stackmap list of maps
080   * @param index new index for returnAddress map
081   */
082  void setReturnAddressMapIndex(int index) {
083    returnAddressMapIndex = index;
084  }
085
086  /** @return the index in the stackmaps for the return Address map */
087  int getReturnAddressMapIndex() {
088    return returnAddressMapIndex;
089  }
090
091  /** @return the normal map index ie the back-pointer */
092  int getNormalMapIndex() {
093    return normalMapIndex;
094  }
095
096  /**
097   * Sets the normal map index (i.e. the back-pointer).
098   * @param index new index for normal map
099   */
100  void setNormalMapIndex(int index) {
101    normalMapIndex = index;
102  }
103
104  public void showInfo() {
105    VM.sysWrite("  UnusualMap showInfo- ");
106
107    VM.sysWrite("    return address index = ");
108    VM.sysWrite(returnAddressIndex);
109    VM.sysWrite("\n    referenceMapIndex = ");
110    VM.sysWrite(referenceMapIndex);
111    VM.sysWrite("\n    nonReferenceMapIndex = ");
112    VM.sysWrite(nonReferenceMapIndex);
113    VM.sysWrite("\n    returnAddressMapIndex = ");
114    VM.sysWrite(returnAddressMapIndex);
115    VM.sysWrite("\n");
116  }
117}