Mercurial > hg > graal-jvmci-8
annotate jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotReferenceMap.java @ 22773:9273bb6ba33e
Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Fri, 15 Jan 2016 16:50:19 +0100 |
parents | 1bbd4a7c274b |
children | 1d4ce2d19e52 |
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 |
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
|
30 public final class HotSpotReferenceMap extends ReferenceMap { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
31 |
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
|
32 final Location[] 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
|
33 final Location[] 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
|
34 final int[] 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
|
35 final int maxRegisterSize; |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
36 |
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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 this.maxRegisterSize = maxRegisterSize; |
21982
861108f5408e
Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
21798
diff
changeset
|
42 } |
861108f5408e
Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
21798
diff
changeset
|
43 |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
44 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
45 public int hashCode() { |
18349
7aa6180a3486
fixed NullPointerException in HotSpotReferenceMap.equals
Doug Simon <doug.simon@oracle.com>
parents:
18342
diff
changeset
|
46 throw new UnsupportedOperationException(); |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
47 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
48 |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
49 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
50 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
|
51 if (this == obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
52 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
53 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
54 if (obj instanceof HotSpotReferenceMap) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
55 HotSpotReferenceMap that = (HotSpotReferenceMap) obj; |
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
|
56 if (Arrays.equals(objects, that.objects)) { |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
57 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
58 } |
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 return false; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
61 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
62 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
63 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
64 public String toString() { |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
65 return Arrays.toString(objects); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
66 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
67 } |