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.VM;
017import org.jikesrvm.compilers.opt.ir.Instruction;
018import org.jikesrvm.compilers.opt.ir.OsrPoint;
019
020/**
021 * Variable map element (osr instruction, LinkedList MethodVariables)
022 */
023public final class VariableMapElement {
024  public final Instruction osr;
025  public final LinkedList<MethodVariables> mvars;
026
027  public VariableMapElement(Instruction inst, LinkedList<MethodVariables> methVars) {
028    if (VM.VerifyAssertions) {
029      VM._assert(OsrPoint.conforms(inst));
030    }
031
032    this.osr = inst;
033    this.mvars = methVars;
034  }
035
036  @Override
037  public String toString() {
038    StringBuilder buf = new StringBuilder("  ");
039    buf.append(this.osr.toString()).append("\n");
040    for (int i = 0, n = this.mvars.size(); i < n; i++) {
041      buf.append(i);
042      buf.append("  ");
043      buf.append(this.mvars.get(i).toString());
044      buf.append("\n");
045    }
046    return buf.toString();
047  }
048}