Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotReferenceMap.java @ 21789:5b9adb645217
fixed remnants of "graal" names in JVMCI code
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 08 Jun 2015 20:24:51 +0200 |
parents | df9d2375512a |
children |
rev | line source |
---|---|
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
1 /* |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
13936
diff
changeset
|
2 * Copyright (c) 2009, 2014, 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 */ |
21552
9579a3c62a9e
use skeleton findbugs jar containing only SuppresFBWarnings to avoid external dependency for JVMCI classes (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21413
diff
changeset
|
23 package com.oracle.jvmci.hotspot; |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
24 |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
25 import static com.oracle.jvmci.code.ValueUtil.*; |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
26 |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
27 import java.util.*; |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
28 |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
29 import com.oracle.jvmci.code.*; |
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21552
diff
changeset
|
30 import com.oracle.jvmci.meta.*; |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
31 |
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
|
32 public final class HotSpotReferenceMap extends ReferenceMap { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
33 |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
34 private Value[] objects; |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
35 private int[] bytesPerElement; |
21731
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
36 private int maxRegisterSize; |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
37 private ArrayList<Value> objectValues; |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
38 |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
39 private final TargetDescription target; |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
40 |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
41 public HotSpotReferenceMap(TargetDescription target) { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
42 this.target = target; |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
43 this.objects = Value.NO_VALUES; |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
44 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
45 |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
46 @Override |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
47 public void reset() { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
48 objectValues = new ArrayList<>(); |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
49 objects = Value.NO_VALUES; |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
50 bytesPerElement = null; |
21731
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
51 maxRegisterSize = 0; |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
52 } |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
53 |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
54 @Override |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
55 public void addLiveValue(Value v) { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
56 if (isConstant(v)) { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
57 return; |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
58 } |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
59 LIRKind lirKind = v.getLIRKind(); |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
60 if (!lirKind.isValue()) { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
61 objectValues.add(v); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
62 } |
21731
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
63 if (isRegister(v)) { |
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
64 int size = target.getSizeInBytes(lirKind.getPlatformKind()); |
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
65 if (size > maxRegisterSize) { |
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
66 maxRegisterSize = size; |
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
67 } |
df9d2375512a
Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21730
diff
changeset
|
68 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
69 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
70 |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
71 @Override |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
72 public void finish() { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
73 objects = objectValues.toArray(new Value[objectValues.size()]); |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
74 this.bytesPerElement = new int[objects.length]; |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
75 for (int i = 0; i < objects.length; i++) { |
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
76 bytesPerElement[i] = bytesPerElement(objects[i].getLIRKind()); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
77 } |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
78 objectValues = null; |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
79 } |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
80 |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
81 private int bytesPerElement(LIRKind kind) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
82 PlatformKind platformKind = kind.getPlatformKind(); |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
83 return target.getSizeInBytes(platformKind) / platformKind.getVectorLength(); |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
84 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
85 |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
86 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
87 public int hashCode() { |
18349
7aa6180a3486
fixed NullPointerException in HotSpotReferenceMap.equals
Doug Simon <doug.simon@oracle.com>
parents:
18342
diff
changeset
|
88 throw new UnsupportedOperationException(); |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
89 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
90 |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
91 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
92 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
|
93 if (this == obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
94 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
95 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
96 if (obj instanceof HotSpotReferenceMap) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
97 HotSpotReferenceMap that = (HotSpotReferenceMap) obj; |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
98 if (Arrays.equals(objects, that.objects) && this.target.equals(that.target)) { |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
99 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
100 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
101 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
102 return false; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
103 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
104 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
105 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
106 public String toString() { |
21730
b9f9b8af17ff
Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
21556
diff
changeset
|
107 return Arrays.toString(objects); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
108 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
109 } |