Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotReferenceMap.java @ 23785:5cf445d2acf6 jvmci-0.22
Exported elements referring to inaccessible types in jdk.vm.ci (JDK-8167180)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 11 Oct 2016 22:13:23 +0200 |
parents | 9e1235406b59 |
children |
rev | line source |
---|---|
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
1 /* |
21982
861108f5408e
Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
21798
diff
changeset
|
2 * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
4 * |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
8 * |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
14 * |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
18 * |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
21 * questions. |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
22 */ |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
23 package jdk.vm.ci.hotspot; |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
24 |
22569
ec96f33a101d
updated imports to be explicit and added checkstyle rule to forbid * imports
Doug Simon <doug.simon@oracle.com>
parents:
22236
diff
changeset
|
25 import java.util.Arrays; |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
26 |
22672
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
27 import jdk.vm.ci.code.Location; |
1bbd4a7c274b
Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22569
diff
changeset
|
28 import jdk.vm.ci.code.ReferenceMap; |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
29 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
30 /** |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
31 * Describes where the object references are in machine state, compliant with what HotSpot expects. |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
32 */ |
21411
082417ac43e4
removed com.oracle.graal.hotspot.server and uses of Serializable it depended upon (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21005
diff
changeset
|
33 public final class HotSpotReferenceMap extends ReferenceMap { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
34 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
35 private final Location[] objects; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
36 private final Location[] derivedBase; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
37 private final int[] sizeInBytes; |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
38 private final int maxRegisterSize; |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
39 |
23700
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
40 /** |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
41 * |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
42 * @param objects This array is now owned by this object and must not be mutated by the caller. |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
43 * @param derivedBase This array is now owned by this object and must not be mutated by the |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
44 * caller. |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
45 * @param sizeInBytes This array is now owned by this object and must not be mutated by the |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
46 * caller. |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
47 */ |
9e1235406b59
[Findbugs] various warnings reported for JVMCI sources (JDK-8159613)
Doug Simon <doug.simon@oracle.com>
parents:
23393
diff
changeset
|
48 @SuppressFBWarnings(value = "EI_EXPOSE_REP2", justification = "caller transfers ownership of `objects`, `derivedBase` and `sizeInBytes`") |
22236
9c811a5e6a62
Split HotSpotReferenceMap into separate builder and result class, and move the builder class from jvmci to graal.
Roland Schatz <roland.schatz@oracle.com>
parents:
22190
diff
changeset
|
49 public HotSpotReferenceMap(Location[] objects, Location[] derivedBase, int[] sizeInBytes, int maxRegisterSize) { |
9c811a5e6a62
Split HotSpotReferenceMap into separate builder and result class, and move the builder class from jvmci to graal.
Roland Schatz <roland.schatz@oracle.com>
parents:
22190
diff
changeset
|
50 this.objects = objects; |
9c811a5e6a62
Split HotSpotReferenceMap into separate builder and result class, and move the builder class from jvmci to graal.
Roland Schatz <roland.schatz@oracle.com>
parents:
22190
diff
changeset
|
51 this.derivedBase = derivedBase; |
9c811a5e6a62
Split HotSpotReferenceMap into separate builder and result class, and move the builder class from jvmci to graal.
Roland Schatz <roland.schatz@oracle.com>
parents:
22190
diff
changeset
|
52 this.sizeInBytes = sizeInBytes; |
9c811a5e6a62
Split HotSpotReferenceMap into separate builder and result class, and move the builder class from jvmci to graal.
Roland Schatz <roland.schatz@oracle.com>
parents:
22190
diff
changeset
|
53 this.maxRegisterSize = maxRegisterSize; |
21982
861108f5408e
Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
21798
diff
changeset
|
54 } |
861108f5408e
Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
21798
diff
changeset
|
55 |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
56 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
57 public int hashCode() { |
18349
7aa6180a3486
fixed NullPointerException in HotSpotReferenceMap.equals
Doug Simon <doug.simon@oracle.com>
parents:
18342
diff
changeset
|
58 throw new UnsupportedOperationException(); |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
59 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
60 |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
61 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
62 public boolean equals(Object obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
63 if (this == obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
64 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
65 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
66 if (obj instanceof HotSpotReferenceMap) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
67 HotSpotReferenceMap that = (HotSpotReferenceMap) obj; |
23393
1d4ce2d19e52
clean up and minimize JVMCI (JDK-8156835)
Doug Simon <doug.simon@oracle.com>
parents:
22672
diff
changeset
|
68 if (sizeInBytes == that.sizeInBytes && maxRegisterSize == that.maxRegisterSize && Arrays.equals(objects, that.objects) && Arrays.equals(derivedBase, that.derivedBase)) { |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
69 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
70 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
71 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
72 return false; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
73 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
74 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
75 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
76 public String toString() { |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
77 return Arrays.toString(objects); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
78 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
79 } |