HotSpotReferenceMap.java revision 12651:6ef01bd40ce2
1207753Smm/* 2207753Smm * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. 3207753Smm * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4207753Smm * 5207753Smm * This code is free software; you can redistribute it and/or modify it 6207753Smm * under the terms of the GNU General Public License version 2 only, as 7207753Smm * published by the Free Software Foundation. 8207753Smm * 9207753Smm * This code is distributed in the hope that it will be useful, but WITHOUT 10207753Smm * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11207753Smm * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12207753Smm * version 2 for more details (a copy is included in the LICENSE file that 13207753Smm * accompanied this code). 14207753Smm * 15207753Smm * You should have received a copy of the GNU General Public License version 16207753Smm * 2 along with this work; if not, write to the Free Software Foundation, 17207753Smm * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18278433Srpaulo * 19207753Smm * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20207753Smm * or visit www.oracle.com if you need additional information or have any 21207753Smm * questions. 22207753Smm */ 23207753Smmpackage jdk.vm.ci.hotspot; 24207753Smm 25207753Smmimport java.util.Arrays; 26207753Smm 27207753Smmimport jdk.vm.ci.code.Location; 28207753Smmimport jdk.vm.ci.code.ReferenceMap; 29207753Smm 30207753Smm/** 31207753Smm * Describes where the object references are in machine state, compliant with what HotSpot expects. 32207753Smm */ 33207753Smmpublic final class HotSpotReferenceMap extends ReferenceMap { 34207753Smm 35278433Srpaulo private final Location[] objects; 36207753Smm private final Location[] derivedBase; 37207753Smm private final int[] sizeInBytes; 38207753Smm private final int maxRegisterSize; 39207753Smm 40207753Smm /** 41207753Smm * 42207753Smm * @param objects This array is now owned by this object and must not be mutated by the caller. 43207753Smm * @param derivedBase This array is now owned by this object and must not be mutated by the 44207753Smm * caller. 45207753Smm * @param sizeInBytes This array is now owned by this object and must not be mutated by the 46207753Smm * caller. 47207753Smm */ 48207753Smm @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `objects`, `derivedBase` and `sizeInBytes`") 49278433Srpaulo public HotSpotReferenceMap(Location[] objects, Location[] derivedBase, int[] sizeInBytes, int maxRegisterSize) { 50278433Srpaulo this.objects = objects; 51278433Srpaulo this.derivedBase = derivedBase; 52278433Srpaulo this.sizeInBytes = sizeInBytes; 53207753Smm this.maxRegisterSize = maxRegisterSize; 54278433Srpaulo } 55278433Srpaulo 56278433Srpaulo @Override 57278433Srpaulo public int hashCode() { 58278433Srpaulo throw new UnsupportedOperationException(); 59278433Srpaulo } 60207753Smm 61207753Smm @Override 62207753Smm public boolean equals(Object obj) { 63207753Smm if (this == obj) { 64207753Smm return true; 65207753Smm } 66207753Smm if (obj instanceof HotSpotReferenceMap) { 67207753Smm HotSpotReferenceMap that = (HotSpotReferenceMap) obj; 68207753Smm if (sizeInBytes == that.sizeInBytes && maxRegisterSize == that.maxRegisterSize && Arrays.equals(objects, that.objects) && Arrays.equals(derivedBase, that.derivedBase)) { 69207753Smm return true; 70207753Smm } 71207753Smm } 72207753Smm return false; 73207753Smm } 74207753Smm 75207753Smm @Override 76207753Smm public String toString() { 77207753Smm return Arrays.toString(objects); 78207753Smm } 79207753Smm} 80207753Smm