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.opt.regalloc; 014 015 016/** 017 * The following represents the intervals assigned to a particular spill 018 * location 019 */ 020class SpillLocationInterval extends CompoundInterval { 021 /** Support for Set serialization */ 022 static final long serialVersionUID = 2854333172650538517L; 023 /** 024 * The spill location, an offset from the frame pointer 025 */ 026 private final int frameOffset; 027 /* type of the register that is being spilled */ 028 private final int type; 029 030 int getOffset() { 031 return frameOffset; 032 } 033 034 /** 035 * The size of the spill location, in bytes. 036 */ 037 private final int size; 038 039 int getSize() { 040 return size; 041 } 042 043 SpillLocationInterval(int frameOffset, int size, int type) { 044 super(null); 045 this.frameOffset = frameOffset; 046 this.size = size; 047 this.type = type; 048 } 049 050 public int getType() { 051 return type; 052 } 053 054 @Override 055 public String toString() { 056 return super.toString() + "<Offset: " + frameOffset + ", size: " + 057 size + ", type: " + type + ">"; 058 } 059 060 /** 061 * Redefine hash code for reproducibility. 062 */ 063 @Override 064 public int hashCode() { 065 BasicInterval first = first(); 066 BasicInterval last = last(); 067 return frameOffset + (first.getBegin() << 4) + (last.getEnd() << 12); 068 } 069}