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.ArchitectureSpecific.BaselineConstants;
016 import org.jikesrvm.VM;
017 import org.vmmagic.pragma.Uninterruptible;
018
019 /**
020 * Scratch space for JSR processing. Used from ReferenceMaps
021 */
022 @Uninterruptible
023 final class JSRInfo implements BaselineConstants {
024
025 int numberUnusualMaps;
026 UnusualMaps[] unusualMaps;
027 byte[] unusualReferenceMaps;
028 int freeMapSlot = 0;
029 /** Merged jsr ret and callers maps */
030 UnusualMaps extraUnusualMap = new UnusualMaps();
031 int tempIndex = 0;
032 int mergedReferenceMap = 0; // result of jsrmerged maps - stored in referenceMaps
033 int mergedReturnAddressMap = 0; // result of jsrmerged maps - stored return addresses
034
035 JSRInfo(int initialMaps) {
036 unusualMaps = new UnusualMaps[initialMaps];
037 }
038
039 /**
040 * show the basic information for each of the unusual maps this is for testing
041 * use
042 */
043 public void showUnusualMapInfo(int bytesPerMap) {
044 VM.sysWrite("-------------------------------------------------\n");
045 VM.sysWriteln(" numberUnusualMaps = ", numberUnusualMaps);
046
047 for (int i = 0; i < numberUnusualMaps; i++) {
048 VM.sysWrite("-----------------\n");
049 VM.sysWrite("Unusual map #", i);
050 VM.sysWrite(":\n");
051 unusualMaps[i].showInfo();
052 VM.sysWrite(" -- reference Map: ");
053 showAnUnusualMap(unusualMaps[i].getReferenceMapIndex(), bytesPerMap);
054 VM.sysWrite("\n");
055 VM.sysWrite(" -- non-reference Map: ");
056 showAnUnusualMap(unusualMaps[i].getNonReferenceMapIndex(), bytesPerMap);
057 VM.sysWrite("\n");
058 VM.sysWrite(" -- returnAddress Map: ");
059 showAnUnusualMap(unusualMaps[i].getReturnAddressMapIndex(), bytesPerMap);
060 VM.sysWrite("\n");
061 }
062 VM.sysWrite("------ extraUnusualMap: ");
063 extraUnusualMap.showInfo();
064 showAnUnusualMap(extraUnusualMap.getReferenceMapIndex(), bytesPerMap);
065 showAnUnusualMap(extraUnusualMap.getNonReferenceMapIndex(), bytesPerMap);
066 showAnUnusualMap(extraUnusualMap.getReturnAddressMapIndex(), bytesPerMap);
067 VM.sysWrite("\n");
068 }
069
070 /**
071 * show the basic information for a single unusualmap this is for testing use
072 */
073 public void showAnUnusualMap(int mapIndex, int bytesPerMap) {
074 VM.sysWrite("unusualMap with index = ", mapIndex);
075 VM.sysWrite(" Map bytes = ");
076 for (int i = 0; i < bytesPerMap; i++) {
077 VM.sysWrite(unusualReferenceMaps[mapIndex + i]);
078 VM.sysWrite(" ");
079 }
080 VM.sysWrite(" ");
081 }
082
083 }