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.osr;
014
015import java.util.LinkedList;
016import org.jikesrvm.classloader.MemberReference;
017
018/**
019 * A class to hold variables for a method at one program point.
020 */
021public final class MethodVariables {
022
023  /** which method */
024  public int methId;
025
026  /** which program point */
027  public int bcIndex;
028
029  /** a list of variables */
030  public LinkedList<LocalRegPair> tupleList;
031
032  public MethodVariables(int mid, int pc, LinkedList<LocalRegPair> tupleList) {
033    this.methId = mid;
034    this.bcIndex = pc;
035    this.tupleList = tupleList;
036  }
037
038  public LinkedList<LocalRegPair> getTupleList() {
039    return tupleList;
040  }
041
042  @Override
043  public String toString() {
044    StringBuilder buf = new StringBuilder();
045
046    buf.append(" pc@").append(bcIndex).append(MemberReference.getMemberRef(methId).getName());
047    buf.append("\n");
048    for (int i = 0, n = tupleList.size(); i < n; i++) {
049      buf.append(tupleList.get(i).toString());
050      buf.append("\n");
051    }
052    return buf.toString();
053  }
054}
055
056
057