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
017 /**
018 * This class is used during the processing of reference maps for a method.
019 *
020 * When a JSR has been processed the processing of a RET is pending.
021 * Need to track which JSR was processed, and where the "return address" value
022 * is being held (ie is it on the operand stack, or in a local variable).
023 * The value starts on the top of the stack, but is usually quickly moved to
024 * a local variable.
025 */
026 final class PendingRETInfo {
027
028 // --------------------- Instance Data -------------------
029
030 public final int JSRSubStartByteIndex;
031 public final int JSRBBNum;
032 /**
033 * index into map - represents either a local variable or a stack
034 * position
035 */
036 public int returnAddressLocation;
037 /** Sanity check the return address location is only updated once */
038 private boolean updatedOnce;
039 /** Block number of block after JSR */
040 public final short JSRNextBBNum;
041
042 // --------------------- Constructors ----------------------------
043
044 public PendingRETInfo(int JSRSubStartByteIndex, int JSRBBNum, int returnAddressLocation, short JSRNextBBNum) {
045 this.JSRSubStartByteIndex = JSRSubStartByteIndex;
046 this.JSRBBNum = JSRBBNum;
047 this.returnAddressLocation = returnAddressLocation;
048 this.JSRNextBBNum = JSRNextBBNum;
049 updatedOnce = false;
050 }
051
052 public PendingRETInfo(PendingRETInfo copyfrom) {
053 this.JSRSubStartByteIndex = copyfrom.JSRSubStartByteIndex;
054 this.JSRBBNum = copyfrom.JSRBBNum;
055 this.returnAddressLocation = copyfrom.returnAddressLocation;
056 this.JSRNextBBNum = copyfrom.JSRNextBBNum;
057 this.updatedOnce = copyfrom.updatedOnce;
058 }
059
060 // ------------------ Instance Method ---------------------------
061
062 public void updateReturnAddressLocation(int newLocation) {
063 if (VM.VerifyAssertions) VM._assert(!updatedOnce);
064 updatedOnce = true;
065 returnAddressLocation = newLocation;
066 }
067
068 }