43972
|
1 |
/*
|
|
2 |
* Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
|
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
4 |
*
|
|
5 |
* This code is free software; you can redistribute it and/or modify it
|
|
6 |
* under the terms of the GNU General Public License version 2 only, as
|
|
7 |
* published by the Free Software Foundation.
|
|
8 |
*
|
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT
|
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that
|
|
13 |
* accompanied this code).
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License version
|
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation,
|
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
18 |
*
|
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
20 |
* or visit www.oracle.com if you need additional information or have any
|
|
21 |
* questions.
|
|
22 |
*/
|
|
23 |
package jdk.vm.ci.hotspot;
|
|
24 |
|
|
25 |
import java.util.Arrays;
|
|
26 |
|
|
27 |
import jdk.vm.ci.code.Location;
|
|
28 |
import jdk.vm.ci.code.ReferenceMap;
|
|
29 |
|
|
30 |
/**
|
|
31 |
* Describes where the object references are in machine state, compliant with what HotSpot expects.
|
|
32 |
*/
|
|
33 |
public final class HotSpotReferenceMap extends ReferenceMap {
|
|
34 |
|
|
35 |
private final Location[] objects;
|
|
36 |
private final Location[] derivedBase;
|
|
37 |
private final int[] sizeInBytes;
|
|
38 |
private final int maxRegisterSize;
|
|
39 |
|
|
40 |
/**
|
|
41 |
*
|
|
42 |
* @param objects This array is now owned by this object and must not be mutated by the caller.
|
|
43 |
* @param derivedBase This array is now owned by this object and must not be mutated by the
|
|
44 |
* caller.
|
|
45 |
* @param sizeInBytes This array is now owned by this object and must not be mutated by the
|
|
46 |
* caller.
|
|
47 |
*/
|
|
48 |
@SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `objects`, `derivedBase` and `sizeInBytes`")
|
|
49 |
public HotSpotReferenceMap(Location[] objects, Location[] derivedBase, int[] sizeInBytes, int maxRegisterSize) {
|
|
50 |
this.objects = objects;
|
|
51 |
this.derivedBase = derivedBase;
|
|
52 |
this.sizeInBytes = sizeInBytes;
|
|
53 |
this.maxRegisterSize = maxRegisterSize;
|
|
54 |
}
|
|
55 |
|
|
56 |
@Override
|
|
57 |
public int hashCode() {
|
|
58 |
throw new UnsupportedOperationException();
|
|
59 |
}
|
|
60 |
|
|
61 |
@Override
|
|
62 |
public boolean equals(Object obj) {
|
|
63 |
if (this == obj) {
|
|
64 |
return true;
|
|
65 |
}
|
|
66 |
if (obj instanceof HotSpotReferenceMap) {
|
|
67 |
HotSpotReferenceMap that = (HotSpotReferenceMap) obj;
|
|
68 |
if (sizeInBytes == that.sizeInBytes && maxRegisterSize == that.maxRegisterSize && Arrays.equals(objects, that.objects) && Arrays.equals(derivedBase, that.derivedBase)) {
|
|
69 |
return true;
|
|
70 |
}
|
|
71 |
}
|
|
72 |
return false;
|
|
73 |
}
|
|
74 |
|
|
75 |
@Override
|
|
76 |
public String toString() {
|
|
77 |
return Arrays.toString(objects);
|
|
78 |
}
|
|
79 |
}
|