annotate src/share/vm/compiler/oopMap.hpp @ 13364:5a4293f24642

added -G:PrintCompRate option for periodically printing out the current compilation rate
author Doug Simon <doug.simon@oracle.com>
date Tue, 17 Dec 2013 16:45:02 +0100
parents b8f261ba79c6
children 82ff6c8c8f6e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 948
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 948
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 948
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_COMPILER_OOPMAP_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_COMPILER_OOPMAP_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "code/compressedStream.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "code/vmreg.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "memory/allocation.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "utilities/growableArray.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // Interface for generating the frame map for compiled code. A frame map
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // describes for a specific pc whether each register and frame stack slot is:
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // Oop - A GC root for current frame
a61af66fc99e Initial load
duke
parents:
diff changeset
36 // Value - Live non-oop, non-float value: int, either half of double
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // Dead - Dead; can be Zapped for debugging
a61af66fc99e Initial load
duke
parents:
diff changeset
38 // CalleeXX - Callee saved; also describes which caller register is saved
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // DerivedXX - A derived oop; original oop is described.
a61af66fc99e Initial load
duke
parents:
diff changeset
40 //
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // OopMapValue describes a single OopMap entry
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 class frame;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 class RegisterMap;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 class DerivedPointerEntry;
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class OopMapValue: public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 private:
8151
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2044
diff changeset
50 short _value;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
51 int value() const { return _value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
52 void set_value(int value) { _value = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
53 short _content_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // Constants
244
524eca34ea76 6684714: Optimize EA Connection Graph build performance
kvn
parents: 113
diff changeset
57 enum { type_bits = 5,
8151
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2044
diff changeset
58 register_bits = BitsPerShort - type_bits };
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59
a61af66fc99e Initial load
duke
parents:
diff changeset
60 enum { type_shift = 0,
a61af66fc99e Initial load
duke
parents:
diff changeset
61 register_shift = type_bits };
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 enum { type_mask = right_n_bits(type_bits),
a61af66fc99e Initial load
duke
parents:
diff changeset
64 type_mask_in_place = type_mask << type_shift,
a61af66fc99e Initial load
duke
parents:
diff changeset
65 register_mask = right_n_bits(register_bits),
a61af66fc99e Initial load
duke
parents:
diff changeset
66 register_mask_in_place = register_mask << register_shift };
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 enum oop_types { // must fit in type_bits
a61af66fc99e Initial load
duke
parents:
diff changeset
69 unused_value =0, // powers of 2, for masking OopMapStream
a61af66fc99e Initial load
duke
parents:
diff changeset
70 oop_value = 1,
a61af66fc99e Initial load
duke
parents:
diff changeset
71 value_value = 2,
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
72 narrowoop_value = 4,
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73 callee_saved_value = 8,
244
524eca34ea76 6684714: Optimize EA Connection Graph build performance
kvn
parents: 113
diff changeset
74 derived_oop_value= 16 };
0
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // Constructors
a61af66fc99e Initial load
duke
parents:
diff changeset
77 OopMapValue () { set_value(0); set_content_reg(VMRegImpl::Bad()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg,t); }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg,t); set_content_reg(reg2); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 OopMapValue (CompressedReadStream* stream) { read_from(stream); }
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Archiving
a61af66fc99e Initial load
duke
parents:
diff changeset
83 void write_on(CompressedWriteStream* stream) {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 stream->write_int(value());
a61af66fc99e Initial load
duke
parents:
diff changeset
85 if(is_callee_saved() || is_derived_oop()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
86 stream->write_int(content_reg()->value());
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 void read_from(CompressedReadStream* stream) {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 set_value(stream->read_int());
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if(is_callee_saved() || is_derived_oop()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
93 set_content_reg(VMRegImpl::as_VMReg(stream->read_int(), true));
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Querying
a61af66fc99e Initial load
duke
parents:
diff changeset
98 bool is_oop() { return mask_bits(value(), type_mask_in_place) == oop_value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool is_value() { return mask_bits(value(), type_mask_in_place) == value_value; }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
100 bool is_narrowoop() { return mask_bits(value(), type_mask_in_place) == narrowoop_value; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
101 bool is_callee_saved() { return mask_bits(value(), type_mask_in_place) == callee_saved_value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 bool is_derived_oop() { return mask_bits(value(), type_mask_in_place) == derived_oop_value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 void set_oop() { set_value((value() & register_mask_in_place) | oop_value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void set_value() { set_value((value() & register_mask_in_place) | value_value); }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
106 void set_narrowoop() { set_value((value() & register_mask_in_place) | narrowoop_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void set_callee_saved() { set_value((value() & register_mask_in_place) | callee_saved_value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 void set_derived_oop() { set_value((value() & register_mask_in_place) | derived_oop_value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 VMReg reg() const { return VMRegImpl::as_VMReg(mask_bits(value(), register_mask_in_place) >> register_shift); }
a61af66fc99e Initial load
duke
parents:
diff changeset
111 oop_types type() const { return (oop_types)mask_bits(value(), type_mask_in_place); }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 static bool legal_vm_reg_name(VMReg p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 return (p->value() == (p->value() & register_mask));
a61af66fc99e Initial load
duke
parents:
diff changeset
115 }
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 void set_reg_type(VMReg p, oop_types t) {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 set_value((p->value() << register_shift) | t);
a61af66fc99e Initial load
duke
parents:
diff changeset
119 assert(reg() == p, "sanity check" );
a61af66fc99e Initial load
duke
parents:
diff changeset
120 assert(type() == t, "sanity check" );
a61af66fc99e Initial load
duke
parents:
diff changeset
121 }
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 VMReg content_reg() const { return VMRegImpl::as_VMReg(_content_reg, true); }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 void set_content_reg(VMReg r) { _content_reg = r->value(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
126
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Physical location queries
a61af66fc99e Initial load
duke
parents:
diff changeset
128 bool is_register_loc() { return reg()->is_reg(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
129 bool is_stack_loc() { return reg()->is_stack(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 // Returns offset from sp.
a61af66fc99e Initial load
duke
parents:
diff changeset
132 int stack_offset() {
a61af66fc99e Initial load
duke
parents:
diff changeset
133 assert(is_stack_loc(), "must be stack location");
a61af66fc99e Initial load
duke
parents:
diff changeset
134 return reg()->reg2stack();
a61af66fc99e Initial load
duke
parents:
diff changeset
135 }
a61af66fc99e Initial load
duke
parents:
diff changeset
136
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 25
diff changeset
137 void print_on(outputStream* st) const;
25
c5cbd367e4d1 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 0
diff changeset
138 void print() const { print_on(tty); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
139 };
a61af66fc99e Initial load
duke
parents:
diff changeset
140
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 class OopMap: public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 friend class OopMapStream;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
146 int _pc_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
147 int _omv_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
148 int _omv_data_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
149 unsigned char* _omv_data;
a61af66fc99e Initial load
duke
parents:
diff changeset
150 CompressedWriteStream* _write_stream;
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 debug_only( OopMapValue::oop_types* _locs_used; int _locs_length;)
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 // Accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
155 unsigned char* omv_data() const { return _omv_data; }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 void set_omv_data(unsigned char* value) { _omv_data = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 int omv_data_size() const { return _omv_data_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 void set_omv_data_size(int value) { _omv_data_size = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 int omv_count() const { return _omv_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
160 void set_omv_count(int value) { _omv_count = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
161 void increment_count() { _omv_count++; }
a61af66fc99e Initial load
duke
parents:
diff changeset
162 CompressedWriteStream* write_stream() const { return _write_stream; }
a61af66fc99e Initial load
duke
parents:
diff changeset
163 void set_write_stream(CompressedWriteStream* value) { _write_stream = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
164
a61af66fc99e Initial load
duke
parents:
diff changeset
165 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
166 enum DeepCopyToken { _deep_copy_token };
a61af66fc99e Initial load
duke
parents:
diff changeset
167 OopMap(DeepCopyToken, OopMap* source); // used only by deep_copy
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
170 OopMap(int frame_size, int arg_count);
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172 // pc-offset handling
a61af66fc99e Initial load
duke
parents:
diff changeset
173 int offset() const { return _pc_offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
174 void set_offset(int o) { _pc_offset = o; }
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // Check to avoid double insertion
a61af66fc99e Initial load
duke
parents:
diff changeset
177 debug_only(OopMapValue::oop_types locs_used( int indx ) { return _locs_used[indx]; })
a61af66fc99e Initial load
duke
parents:
diff changeset
178
a61af66fc99e Initial load
duke
parents:
diff changeset
179 // Construction
a61af66fc99e Initial load
duke
parents:
diff changeset
180 // frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // slots to hold 4-byte values like ints and floats in the LP64 build.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 void set_oop ( VMReg local);
a61af66fc99e Initial load
duke
parents:
diff changeset
183 void set_value( VMReg local);
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
184 void set_narrowoop(VMReg local);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
185 void set_dead ( VMReg local);
a61af66fc99e Initial load
duke
parents:
diff changeset
186 void set_callee_saved( VMReg local, VMReg caller_machine_register );
a61af66fc99e Initial load
duke
parents:
diff changeset
187 void set_derived_oop ( VMReg local, VMReg derived_from_local_register );
a61af66fc99e Initial load
duke
parents:
diff changeset
188 void set_xxx(VMReg reg, OopMapValue::oop_types x, VMReg optional);
a61af66fc99e Initial load
duke
parents:
diff changeset
189
a61af66fc99e Initial load
duke
parents:
diff changeset
190 int heap_size() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
191 void copy_to(address addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
192 OopMap* deep_copy();
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 bool has_derived_pointer() const PRODUCT_RETURN0;
a61af66fc99e Initial load
duke
parents:
diff changeset
195
a61af66fc99e Initial load
duke
parents:
diff changeset
196 bool legal_vm_reg_name(VMReg local) {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 return OopMapValue::legal_vm_reg_name(local);
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 // Printing
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 25
diff changeset
201 void print_on(outputStream* st) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
202 void print() const { print_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 };
a61af66fc99e Initial load
duke
parents:
diff changeset
204
a61af66fc99e Initial load
duke
parents:
diff changeset
205
a61af66fc99e Initial load
duke
parents:
diff changeset
206 class OopMapSet : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
207 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
208 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
209 int _om_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
210 int _om_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
211 OopMap** _om_data;
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 int om_count() const { return _om_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 void set_om_count(int value) { _om_count = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
215 void increment_count() { _om_count++; }
a61af66fc99e Initial load
duke
parents:
diff changeset
216 int om_size() const { return _om_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
217 void set_om_size(int value) { _om_size = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
218 OopMap** om_data() const { return _om_data; }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 void set_om_data(OopMap** value) { _om_data = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
220 void grow_om_data();
a61af66fc99e Initial load
duke
parents:
diff changeset
221 void set(int index,OopMap* value) { assert((index == 0) || ((index > 0) && (index < om_size())),"bad index"); _om_data[index] = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
224 OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
225
a61af66fc99e Initial load
duke
parents:
diff changeset
226 // returns the number of OopMaps in this OopMapSet
a61af66fc99e Initial load
duke
parents:
diff changeset
227 int size() const { return _om_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
228 // returns the OopMap at a given index
a61af66fc99e Initial load
duke
parents:
diff changeset
229 OopMap* at(int index) const { assert((index >= 0) && (index <= om_count()),"bad index"); return _om_data[index]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // Collect OopMaps.
a61af66fc99e Initial load
duke
parents:
diff changeset
232 void add_gc_map(int pc, OopMap* map);
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 // Returns the only oop map. Used for reconstructing
a61af66fc99e Initial load
duke
parents:
diff changeset
235 // Adapter frames during deoptimization
a61af66fc99e Initial load
duke
parents:
diff changeset
236 OopMap* singular_oop_map();
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 // returns OopMap in that is anchored to the pc
a61af66fc99e Initial load
duke
parents:
diff changeset
239 OopMap* find_map_at_offset(int pc_offset) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
240
a61af66fc99e Initial load
duke
parents:
diff changeset
241 int heap_size() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
242 void copy_to(address addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
243
858
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
244 // Methods oops_do() and all_do() filter out NULL oops and
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
245 // oop == Universe::narrow_oop_base() before passing oops
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
246 // to closures.
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
247
0
a61af66fc99e Initial load
duke
parents:
diff changeset
248 // Iterates through frame for a compiled method
a61af66fc99e Initial load
duke
parents:
diff changeset
249 static void oops_do (const frame* fr,
a61af66fc99e Initial load
duke
parents:
diff changeset
250 const RegisterMap* reg_map, OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
251 static void update_register_map(const frame* fr, RegisterMap *reg_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
252
a61af66fc99e Initial load
duke
parents:
diff changeset
253 // Iterates through frame for a compiled method for dead ones and values, too
a61af66fc99e Initial load
duke
parents:
diff changeset
254 static void all_do(const frame* fr, const RegisterMap* reg_map,
a61af66fc99e Initial load
duke
parents:
diff changeset
255 OopClosure* oop_fn,
a61af66fc99e Initial load
duke
parents:
diff changeset
256 void derived_oop_fn(oop* base, oop* derived),
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
257 OopClosure* value_fn);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
258
a61af66fc99e Initial load
duke
parents:
diff changeset
259 // Printing
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 25
diff changeset
260 void print_on(outputStream* st) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
261 void print() const { print_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
262 };
a61af66fc99e Initial load
duke
parents:
diff changeset
263
a61af66fc99e Initial load
duke
parents:
diff changeset
264
a61af66fc99e Initial load
duke
parents:
diff changeset
265 class OopMapStream : public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
267 CompressedReadStream* _stream;
a61af66fc99e Initial load
duke
parents:
diff changeset
268 int _mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
269 int _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
270 int _position;
a61af66fc99e Initial load
duke
parents:
diff changeset
271 bool _valid_omv;
a61af66fc99e Initial load
duke
parents:
diff changeset
272 OopMapValue _omv;
a61af66fc99e Initial load
duke
parents:
diff changeset
273 void find_next();
a61af66fc99e Initial load
duke
parents:
diff changeset
274
a61af66fc99e Initial load
duke
parents:
diff changeset
275 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
276 OopMapStream(OopMap* oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
277 OopMapStream(OopMap* oop_map, int oop_types_mask);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 bool is_done() { if(!_valid_omv) { find_next(); } return !_valid_omv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
279 void next() { find_next(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
280 OopMapValue current() { return _omv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
281 };
a61af66fc99e Initial load
duke
parents:
diff changeset
282
a61af66fc99e Initial load
duke
parents:
diff changeset
283
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // Derived pointer support. This table keeps track of all derived points on a
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // stack. It is cleared before each scavenge/GC. During the traversal of all
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // oops, it is filled in with references to all locations that contains a
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // derived oop (assumed to be very few). When the GC is complete, the derived
a61af66fc99e Initial load
duke
parents:
diff changeset
288 // pointers are updated based on their base pointers new value and an offset.
a61af66fc99e Initial load
duke
parents:
diff changeset
289 #ifdef COMPILER2
a61af66fc99e Initial load
duke
parents:
diff changeset
290 class DerivedPointerTable : public AllStatic {
a61af66fc99e Initial load
duke
parents:
diff changeset
291 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
292 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
293 static GrowableArray<DerivedPointerEntry*>* _list;
a61af66fc99e Initial load
duke
parents:
diff changeset
294 static bool _active; // do not record pointers for verify pass etc.
a61af66fc99e Initial load
duke
parents:
diff changeset
295 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
296 static void clear(); // Called before scavenge/GC
a61af66fc99e Initial load
duke
parents:
diff changeset
297 static void add(oop *derived, oop *base); // Called during scavenge/GC
a61af66fc99e Initial load
duke
parents:
diff changeset
298 static void update_pointers(); // Called after scavenge/GC
a61af66fc99e Initial load
duke
parents:
diff changeset
299 static bool is_empty() { return _list == NULL || _list->is_empty(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
300 static bool is_active() { return _active; }
a61af66fc99e Initial load
duke
parents:
diff changeset
301 static void set_active(bool value) { _active = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
302 };
a61af66fc99e Initial load
duke
parents:
diff changeset
303
a61af66fc99e Initial load
duke
parents:
diff changeset
304 // A utility class to temporarily "deactivate" the DerivedPointerTable.
a61af66fc99e Initial load
duke
parents:
diff changeset
305 // (Note: clients are responsible for any MT-safety issues)
a61af66fc99e Initial load
duke
parents:
diff changeset
306 class DerivedPointerTableDeactivate: public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
308 bool _active;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
310 DerivedPointerTableDeactivate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
311 _active = DerivedPointerTable::is_active();
a61af66fc99e Initial load
duke
parents:
diff changeset
312 if (_active) {
a61af66fc99e Initial load
duke
parents:
diff changeset
313 DerivedPointerTable::set_active(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
314 }
a61af66fc99e Initial load
duke
parents:
diff changeset
315 }
a61af66fc99e Initial load
duke
parents:
diff changeset
316
a61af66fc99e Initial load
duke
parents:
diff changeset
317 ~DerivedPointerTableDeactivate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
318 assert(!DerivedPointerTable::is_active(),
a61af66fc99e Initial load
duke
parents:
diff changeset
319 "Inconsistency: not MT-safe");
a61af66fc99e Initial load
duke
parents:
diff changeset
320 if (_active) {
a61af66fc99e Initial load
duke
parents:
diff changeset
321 DerivedPointerTable::set_active(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
322 }
a61af66fc99e Initial load
duke
parents:
diff changeset
323 }
a61af66fc99e Initial load
duke
parents:
diff changeset
324 };
a61af66fc99e Initial load
duke
parents:
diff changeset
325 #endif // COMPILER2
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
326
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
327 #endif // SHARE_VM_COMPILER_OOPMAP_HPP