Mercurial > hg > truffle
annotate graal/com.oracle.jvmci.hotspot/src/com/oracle/jvmci/hotspot/HotSpotReferenceMap.java @ 21599:b8416bf57508
Add BC_iadd_const* unittests.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Thu, 28 May 2015 19:49:05 +0200 |
parents | 48c1ebd24120 |
children | b9f9b8af17ff |
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 |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
25 import java.util.*; |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
26 |
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
|
27 import com.oracle.jvmci.code.CodeUtil.RefMapFormatter; |
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
|
28 import com.oracle.jvmci.code.*; |
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
|
29 import com.oracle.jvmci.common.*; |
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
|
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 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
34 static final int OOP64 = 0b1010; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
35 static final int OOP32 = 0b01; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
36 static final int NARROW_LOW = OOP32; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
37 static final int NARROW_HIGH = OOP32 << 2; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
38 static final int NARROW_BOTH = NARROW_LOW | NARROW_HIGH; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
39 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
40 private enum MapEntry { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
41 NoReference(0), |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
42 WideOop(OOP64), |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
43 NarrowOopLowerHalf(NARROW_LOW), |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
44 NarrowOopUpperHalf(NARROW_HIGH), |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
45 TwoNarrowOops(NARROW_BOTH), |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
46 Illegal(-1); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
47 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
48 MapEntry(int pattern) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
49 this.pattern = pattern; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
50 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
51 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
52 final int pattern; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
53 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
54 /** |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
55 * Create enum values from OopMap. |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
56 * <p> |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
57 * These bits can have the following values (MSB first): |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
58 * |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
59 * <pre> |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
60 * 0000 - contains no references |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
61 * 1010 - contains a wide oop |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
62 * 0001 - contains a narrow oop in the lower half |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
63 * 0101 - contains a narrow oop in the upper half |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
64 * 0101 - contains two narrow oops |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
65 * </pre> |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
66 * |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
67 * @see HotSpotReferenceMap#registerRefMap |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
68 * @see HotSpotReferenceMap#frameRefMap |
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 static MapEntry getFromBits(int idx, HotSpotOopMap set) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
71 int n = set.get(idx); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
72 switch (n) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
73 case 0: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
74 return NoReference; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
75 case OOP64: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
76 return WideOop; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
77 case NARROW_LOW: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
78 return NarrowOopLowerHalf; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
79 case NARROW_HIGH: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
80 return NarrowOopUpperHalf; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
81 case NARROW_BOTH: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
82 return TwoNarrowOops; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
83 default: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
84 return Illegal; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
85 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
86 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
87 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
88 String toBitString() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
89 int bits = toBit(this); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
90 if (bits == -1) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
91 return "---"; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
92 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
93 return String.format("%3s", Integer.toBinaryString(bits)).replace(' ', '0'); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
94 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
95 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
96 static int toBit(MapEntry type) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
97 return type.pattern; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
98 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
99 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
100 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
101 /** |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
102 * A specialized bit set that represents both wide and narrow oops in an efficient manner. The |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
103 * map consists of 4 bit entries that represent 8 bytes of memory. |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
104 * |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
105 */ |
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
|
106 class HotSpotOopMap implements Cloneable { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
107 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
108 /** |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
109 * Each entry is 4 bits long and covers 8 bytes of memory. |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
110 */ |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
111 private static final int BITS_PER_ENTRY = 4; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
112 private static final int BITS_PER_ELEMENT = 64; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
113 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
114 public HotSpotOopMap(int i) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
115 words = new long[(i * BITS_PER_ENTRY + BITS_PER_ELEMENT) / BITS_PER_ELEMENT]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
116 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
117 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
118 public HotSpotOopMap(HotSpotOopMap other) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
119 words = other.words.clone(); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
120 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
121 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
122 private long[] words; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
123 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
124 private int get(int i) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
125 return getEntry(i); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
126 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
127 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
128 public void or(HotSpotOopMap src) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
129 if (words.length < src.words.length) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
130 long[] newWords = new long[src.words.length]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
131 System.arraycopy(src.words, 0, newWords, 0, src.words.length); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
132 for (int i = 0; i < words.length; i++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
133 newWords[i] |= words[i]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
134 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
135 words = newWords; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
136 } else { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
137 for (int i = 0; i < src.words.length; i++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
138 words[i] |= src.words[i]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
139 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
140 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
141 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
142 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
143 private void setOop(int regIdx) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
144 setEntry(regIdx, OOP64); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
145 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
146 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
147 public int size() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
148 return words.length * BITS_PER_ELEMENT / BITS_PER_ENTRY; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
149 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
150 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
151 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
152 public HotSpotOopMap clone() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
153 return new HotSpotOopMap(this); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
154 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
155 |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
156 private void setNarrowOop(int offset) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
157 setNarrowEntry(offset, OOP32); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
158 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
159 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
160 private void setEntry(int regIdx, int value) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
161 assert regIdx % 2 == 0 : "must be alinged"; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
162 int bitIndex = (regIdx >> 1) * BITS_PER_ENTRY; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
163 int wordIndex = bitIndex / BITS_PER_ELEMENT; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
164 int shift = bitIndex - wordIndex * BITS_PER_ELEMENT; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
165 if (wordIndex >= words.length) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
166 if (value == 0) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
167 // Nothing to do since bits are clear |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
168 return; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
169 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
170 words = Arrays.copyOf(words, wordIndex + 1); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
171 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
172 assert verifyUpdate(this, this); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
173 long orig = words[wordIndex]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
174 words[wordIndex] = (orig & (~(0b1111L << shift))) | ((long) value << shift); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
175 assert get(regIdx / 2) == value; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
176 assert verifyUpdate(this, this); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
177 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
178 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
179 private void setNarrowEntry(int offset, int value) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
180 int regIdx = offset >> 1; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
181 boolean low = offset % 2 == 0; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
182 int bitIndex = regIdx * BITS_PER_ENTRY; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
183 int wordIndex = bitIndex / BITS_PER_ELEMENT; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
184 int shift = bitIndex - wordIndex * BITS_PER_ELEMENT; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
185 if (wordIndex >= words.length) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
186 if (value == 0) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
187 // Nothing to do since bits are clear |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
188 return; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
189 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
190 words = Arrays.copyOf(words, wordIndex + 1); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
191 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
192 long originalValue = words[wordIndex]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
193 int current = ((int) (originalValue >> shift)) & 0b1111; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
194 if (current == OOP64) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
195 current = 0; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
196 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
197 long newValue; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
198 if (value != 0) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
199 newValue = current | (low ? value : (value << 2)); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
200 } else { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
201 newValue = current & (low ? 0b1100 : 0b0011); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
202 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
203 long masked = originalValue & (~(0b1111L << shift)); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
204 words[wordIndex] = masked | (newValue << shift); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
205 assert verifyUpdate(this, this); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
206 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
207 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
208 private int getEntry(int regIdx) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
209 int bitIndex = regIdx * BITS_PER_ENTRY; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
210 int wordIndex = bitIndex / BITS_PER_ELEMENT; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
211 int shift = bitIndex - wordIndex * BITS_PER_ELEMENT; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
212 return ((int) (words[wordIndex] >>> shift)) & 0b1111; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
213 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
214 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
215 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
216 public boolean equals(Object other) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
217 if (this == other) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
218 return true; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
219 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
220 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
221 if (other instanceof HotSpotOopMap) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
222 HotSpotOopMap otherMap = (HotSpotOopMap) other; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
223 int limit = Math.min(words.length, otherMap.words.length); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
224 for (int i = 0; i < limit; i++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
225 if (words[i] != otherMap.words[i]) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
226 return false; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
227 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
228 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
229 for (int i = limit; i < words.length; i++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
230 if (words[i] != 0) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
231 return false; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
232 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
233 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
234 for (int i = limit; i < otherMap.words.length; i++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
235 if (otherMap.words[i] != 0) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
236 return false; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
237 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
238 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
239 return true; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
240 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
241 return false; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
242 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
243 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
244 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
245 public int hashCode() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
246 long h = 1234; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
247 for (int i = words.length; --i >= 0;) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
248 h ^= words[i] * (i + 1); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
249 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
250 return (int) ((h >> 32) ^ h); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
251 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
252 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
253 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
254 public String toString() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
255 int count = 0; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
256 StringBuilder sb = new StringBuilder(); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
257 sb.append("["); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
258 for (int idx = 0; idx < size(); idx++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
259 MapEntry dstType = MapEntry.getFromBits(idx, this); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
260 if (dstType == MapEntry.NoReference) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
261 continue; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
262 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
263 if (count > 0) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
264 sb.append(", "); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
265 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
266 if (dstType == MapEntry.Illegal) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
267 int value = get(idx); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
268 sb.append("0x"); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
269 sb.append(Integer.toHexString(value)); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
270 } else { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
271 sb.append(idx); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
272 sb.append(':'); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
273 sb.append(dstType); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
274 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
275 count++; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
276 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
277 sb.append("]"); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
278 return sb.toString(); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
279 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
280 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
281 |
13726
343541fb3b49
Support narrow oops in reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13725
diff
changeset
|
282 /** |
16114
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
283 * Contains 3 bits per scalar register, and n*3 bits per n-word vector register (e.g., on a |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
284 * 64-bit system, a 256-bit vector register requires 12 reference map bits). |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
285 * <p> |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
286 * These bits can have the following values (LSB first): |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
287 * |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
288 * <pre> |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
289 * 000 - contains no references |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
290 * 100 - contains a wide oop |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
291 * 110 - contains a narrow oop in the lower half |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
292 * 101 - contains a narrow oop in the upper half |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
293 * 111 - contains two narrow oops |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
294 * </pre> |
13726
343541fb3b49
Support narrow oops in reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13725
diff
changeset
|
295 */ |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
296 private final HotSpotOopMap registerRefMap; |
13726
343541fb3b49
Support narrow oops in reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13725
diff
changeset
|
297 |
343541fb3b49
Support narrow oops in reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13725
diff
changeset
|
298 /** |
16114
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
299 * Contains 3 bits per stack word. |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
300 * <p> |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
301 * These bits can have the following values (LSB first): |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
302 * |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
303 * <pre> |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
304 * 000 - contains no references |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
305 * 100 - contains a wide oop |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
306 * 110 - contains a narrow oop in the lower half |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
307 * 101 - contains a narrow oop in the upper half |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
308 * 111 - contains two narrow oops |
a0d1dfc113b8
Better documentation for HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents:
16094
diff
changeset
|
309 * </pre> |
13726
343541fb3b49
Support narrow oops in reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
13725
diff
changeset
|
310 */ |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
311 private final HotSpotOopMap frameRefMap; |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
312 |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
313 private final TargetDescription target; |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
13936
diff
changeset
|
314 |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
315 public HotSpotReferenceMap(int registerCount, int frameSlotCount, TargetDescription target) { |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
316 if (registerCount > 0) { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
317 this.registerRefMap = new HotSpotOopMap(registerCount); |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
318 } else { |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
319 this.registerRefMap = null; |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
320 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
321 this.frameRefMap = new HotSpotOopMap(frameSlotCount); |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
322 this.target = target; |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
323 } |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
324 |
18608
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
325 private HotSpotReferenceMap(HotSpotReferenceMap other) { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
326 this.registerRefMap = other.registerRefMap.clone(); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
327 this.frameRefMap = other.frameRefMap.clone(); |
18608
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
328 this.target = other.target; |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
329 } |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
330 |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
331 @Override |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
332 public ReferenceMap clone() { |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
333 return new HotSpotReferenceMap(this); |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
334 } |
66e31efead2f
Make ReferenceMap Clonable.
Josef Eisl <josef.eisl@jku.at>
parents:
18607
diff
changeset
|
335 |
18607
6383574293f9
Introduce FrameMap.clearReference().
Josef Eisl <josef.eisl@jku.at>
parents:
18349
diff
changeset
|
336 // setters |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
337 @Override |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
338 public void setRegister(int idx, LIRKind kind) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
339 set(registerRefMap, idx * 2, kind); |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
340 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
341 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
342 @Override |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
343 public void setStackSlot(int offset, LIRKind kind) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
344 assert offset % bytesPerElement(kind) == 0 : "unaligned value in ReferenceMap"; |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
345 set(frameRefMap, offset / 4, kind); |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
346 } |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
347 |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
348 private void set(HotSpotOopMap refMap, int index, LIRKind kind) { |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
349 if (kind.isDerivedReference()) { |
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
|
350 throw new JVMCIError("derived reference cannot be inserted in ReferenceMap"); |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
351 } |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
352 |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
353 int bytesPerElement = bytesPerElement(kind); |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
354 int length = kind.getPlatformKind().getVectorLength(); |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
355 if (bytesPerElement == 8) { |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
356 for (int i = 0; i < length; i++) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
357 if (kind.isReference(i)) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
358 refMap.setOop(index + i * 2); |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
359 } |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
360 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
361 } else if (bytesPerElement == 4) { |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
362 for (int i = 0; i < length; i++) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
363 if (kind.isReference(i)) { |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
364 refMap.setNarrowOop(index + i); |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
365 } |
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
366 } |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
367 } else { |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
368 assert kind.isValue() : "unknown reference kind " + kind; |
16094
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
369 } |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
370 } |
c0b8d395368b
Introduce LIRKind to accurately track oop references in backend.
Roland Schatz <roland.schatz@oracle.com>
parents:
16093
diff
changeset
|
371 |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
372 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
|
373 PlatformKind platformKind = kind.getPlatformKind(); |
21002
95931055060f
fix handling of uncompressed vector oopmaps
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
20981
diff
changeset
|
374 return target.getSizeInBytes(platformKind) / platformKind.getVectorLength(); |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
375 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
376 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
377 public HotSpotOopMap getFrameMap() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
378 return frameRefMap == null ? null : (HotSpotOopMap) frameRefMap.clone(); |
18663 | 379 } |
380 | |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
381 public HotSpotOopMap getRegisterMap() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
382 return registerRefMap == null ? null : (HotSpotOopMap) registerRefMap.clone(); |
18663 | 383 } |
384 | |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
385 static MapEntry[] entries(HotSpotOopMap fixedMap) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
386 MapEntry[] result = new MapEntry[fixedMap.size()]; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
387 for (int idx = 0; idx < fixedMap.size(); idx++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
388 MapEntry dstType = MapEntry.getFromBits(idx, fixedMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
389 result[idx] = dstType; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
390 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
391 return result; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
392 } |
18609
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
393 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
394 private static boolean verifyUpdate(HotSpotOopMap dst, HotSpotOopMap src) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
395 return verifyUpdate(dst, src, true); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
396 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
397 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
398 private static boolean verifyUpdate(HotSpotOopMap dst, HotSpotOopMap src, boolean doAssert) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
399 for (int idx = 0; idx < Math.min(src.size(), dst.size()); idx++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
400 if (!verifyUpdateEntry(idx, dst, src, doAssert)) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
401 return false; |
18609
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
402 } |
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
403 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
404 return true; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
405 } |
18609
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
406 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
407 private static boolean verifyUpdateEntry(int idx, HotSpotOopMap dst, HotSpotOopMap src, boolean doAssert) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
408 MapEntry dstType = MapEntry.getFromBits(idx, dst); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
409 MapEntry srcType = MapEntry.getFromBits(idx, src); |
18609
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
410 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
411 if (dstType == MapEntry.Illegal || srcType == MapEntry.Illegal) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
412 assert !doAssert : String.format("Illegal RefMap bit pattern: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString()); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
413 return false; |
18609
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
414 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
415 switch (dstType) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
416 case NoReference: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
417 return true; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
418 case WideOop: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
419 switch (srcType) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
420 case NoReference: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
421 case WideOop: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
422 return true; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
423 default: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
424 assert false : String.format("Illegal RefMap combination: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString()); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
425 return false; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
426 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
427 case TwoNarrowOops: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
428 case NarrowOopLowerHalf: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
429 case NarrowOopUpperHalf: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
430 switch (srcType) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
431 case TwoNarrowOops: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
432 case NarrowOopLowerHalf: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
433 case NarrowOopUpperHalf: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
434 case NoReference: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
435 return true; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
436 default: |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
437 assert false : String.format("Illegal RefMap combination: %s (0b%s), %s (0b%s)", dstType, dstType.toBitString(), srcType, srcType.toBitString()); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
438 return false; |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
439 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
440 default: |
18609
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
441 return false; |
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
442 } |
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
443 } |
c7fe48cd8087
Add ReferenceMap.mergeMaps().
Josef Eisl <josef.eisl@jku.at>
parents:
18608
diff
changeset
|
444 |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
445 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
446 public int hashCode() { |
18349
7aa6180a3486
fixed NullPointerException in HotSpotReferenceMap.equals
Doug Simon <doug.simon@oracle.com>
parents:
18342
diff
changeset
|
447 throw new UnsupportedOperationException(); |
18342
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
448 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
449 |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
450 @Override |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
451 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
|
452 if (this == obj) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
453 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
454 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
455 if (obj instanceof HotSpotReferenceMap) { |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
456 HotSpotReferenceMap that = (HotSpotReferenceMap) obj; |
18349
7aa6180a3486
fixed NullPointerException in HotSpotReferenceMap.equals
Doug Simon <doug.simon@oracle.com>
parents:
18342
diff
changeset
|
457 if (this.frameRefMap.equals(that.frameRefMap) && Objects.equals(this.registerRefMap, that.registerRefMap) && 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
|
458 return true; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
459 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
460 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
461 return false; |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
462 } |
d60dd21329f2
implemented .equals() for CompilationResult and the objects it encapsulates
Doug Simon <doug.simon@oracle.com>
parents:
16114
diff
changeset
|
463 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
464 @Override |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
465 public boolean hasRegisterRefMap() { |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
466 return registerRefMap != null && registerRefMap.size() > 0; |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
467 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
468 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
469 @Override |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
470 public boolean hasFrameRefMap() { |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
471 return frameRefMap != null && frameRefMap.size() > 0; |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
472 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
473 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
474 @Override |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
13936
diff
changeset
|
475 public void appendRegisterMap(StringBuilder sb, RefMapFormatter formatter) { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
476 for (int idx = 0; idx < registerRefMap.size(); idx++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
477 MapEntry dstType = MapEntry.getFromBits(idx, registerRefMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
478 if (dstType != MapEntry.NoReference) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
479 sb.append(' ').append(formatter.formatRegister(idx)).append(':').append(dstType); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
480 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
481 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
482 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
483 |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
484 @Override |
14562
45812e05cdb3
Move narrow oop handling in reference maps to hotspot specific code.
Roland Schatz <roland.schatz@oracle.com>
parents:
13936
diff
changeset
|
485 public void appendFrameMap(StringBuilder sb, RefMapFormatter formatter) { |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
486 for (int idx = 0; idx < frameRefMap.size(); idx++) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
487 MapEntry dstType = MapEntry.getFromBits(idx, frameRefMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
488 if (dstType != MapEntry.NoReference) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
489 sb.append(' ').append(formatter.formatStackSlot(idx)).append(':').append(dstType); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
490 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
491 } |
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
492 } |
20981
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
493 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
494 @Override |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
495 public String toString() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
496 StringBuilder sb = new StringBuilder(); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
497 if (registerRefMap != null) { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
498 sb.append("Registers = "); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
499 sb.append(registerRefMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
500 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
501 sb.append("Stack = "); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
502 sb.append(frameRefMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
503 return sb.toString(); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
504 } |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
505 |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
506 public void verify() { |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
507 assert verifyUpdate(frameRefMap, frameRefMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
508 assert registerRefMap == null || verifyUpdate(registerRefMap, registerRefMap); |
92fc95e8667d
Add more efficient implementation of HotSpotReferenceMap
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
18706
diff
changeset
|
509 } |
13725
8d8732e14447
Refactor reference maps.
Roland Schatz <roland.schatz@oracle.com>
parents:
diff
changeset
|
510 } |