annotate src/share/vm/compiler/oopMap.hpp @ 14988:82ff6c8c8f6e

Increase maximum allocatable spill area by factor of 2.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 05 Apr 2014 19:11:07 +0200
parents b8f261ba79c6
children d86b226e331a
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
14988
82ff6c8c8f6e Increase maximum allocatable spill area by factor of 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8151
diff changeset
57 enum { type_bits = 4,
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,
14988
82ff6c8c8f6e Increase maximum allocatable spill area by factor of 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8151
diff changeset
71 narrowoop_value = 2,
82ff6c8c8f6e Increase maximum allocatable spill area by factor of 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8151
diff changeset
72 callee_saved_value = 4,
82ff6c8c8f6e Increase maximum allocatable spill area by factor of 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8151
diff changeset
73 derived_oop_value= 8 };
0
a61af66fc99e Initial load
duke
parents:
diff changeset
74
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // Constructors
a61af66fc99e Initial load
duke
parents:
diff changeset
76 OopMapValue () { set_value(0); set_content_reg(VMRegImpl::Bad()); }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg,t); }
a61af66fc99e Initial load
duke
parents:
diff changeset
78 OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg,t); set_content_reg(reg2); }
a61af66fc99e Initial load
duke
parents:
diff changeset
79 OopMapValue (CompressedReadStream* stream) { read_from(stream); }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // Archiving
a61af66fc99e Initial load
duke
parents:
diff changeset
82 void write_on(CompressedWriteStream* stream) {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 stream->write_int(value());
a61af66fc99e Initial load
duke
parents:
diff changeset
84 if(is_callee_saved() || is_derived_oop()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 stream->write_int(content_reg()->value());
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87 }
a61af66fc99e Initial load
duke
parents:
diff changeset
88
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void read_from(CompressedReadStream* stream) {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 set_value(stream->read_int());
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if(is_callee_saved() || is_derived_oop()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
92 set_content_reg(VMRegImpl::as_VMReg(stream->read_int(), true));
a61af66fc99e Initial load
duke
parents:
diff changeset
93 }
a61af66fc99e Initial load
duke
parents:
diff changeset
94 }
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 // Querying
a61af66fc99e Initial load
duke
parents:
diff changeset
97 bool is_oop() { return mask_bits(value(), type_mask_in_place) == oop_value; }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
98 bool is_narrowoop() { return mask_bits(value(), type_mask_in_place) == narrowoop_value; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
99 bool is_callee_saved() { return mask_bits(value(), type_mask_in_place) == callee_saved_value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
100 bool is_derived_oop() { return mask_bits(value(), type_mask_in_place) == derived_oop_value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
101
a61af66fc99e Initial load
duke
parents:
diff changeset
102 void set_oop() { set_value((value() & register_mask_in_place) | oop_value); }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 100
diff changeset
103 void set_narrowoop() { set_value((value() & register_mask_in_place) | narrowoop_value); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
104 void set_callee_saved() { set_value((value() & register_mask_in_place) | callee_saved_value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
105 void set_derived_oop() { set_value((value() & register_mask_in_place) | derived_oop_value); }
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 VMReg reg() const { return VMRegImpl::as_VMReg(mask_bits(value(), register_mask_in_place) >> register_shift); }
a61af66fc99e Initial load
duke
parents:
diff changeset
108 oop_types type() const { return (oop_types)mask_bits(value(), type_mask_in_place); }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 static bool legal_vm_reg_name(VMReg p) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 return (p->value() == (p->value() & register_mask));
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 void set_reg_type(VMReg p, oop_types t) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 set_value((p->value() << register_shift) | t);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 assert(reg() == p, "sanity check" );
a61af66fc99e Initial load
duke
parents:
diff changeset
117 assert(type() == t, "sanity check" );
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 VMReg content_reg() const { return VMRegImpl::as_VMReg(_content_reg, true); }
a61af66fc99e Initial load
duke
parents:
diff changeset
122 void set_content_reg(VMReg r) { _content_reg = r->value(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
123
a61af66fc99e Initial load
duke
parents:
diff changeset
124 // Physical location queries
a61af66fc99e Initial load
duke
parents:
diff changeset
125 bool is_register_loc() { return reg()->is_reg(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
126 bool is_stack_loc() { return reg()->is_stack(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
127
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // Returns offset from sp.
a61af66fc99e Initial load
duke
parents:
diff changeset
129 int stack_offset() {
a61af66fc99e Initial load
duke
parents:
diff changeset
130 assert(is_stack_loc(), "must be stack location");
a61af66fc99e Initial load
duke
parents:
diff changeset
131 return reg()->reg2stack();
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 25
diff changeset
134 void print_on(outputStream* st) const;
25
c5cbd367e4d1 6621094: PrintOptoAssembly is broken for oops information in DebugInfo
kvn
parents: 0
diff changeset
135 void print() const { print_on(tty); }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
136 };
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138
a61af66fc99e Initial load
duke
parents:
diff changeset
139 class OopMap: public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
140 friend class OopMapStream;
a61af66fc99e Initial load
duke
parents:
diff changeset
141 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
142 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
143 int _pc_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 int _omv_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
145 int _omv_data_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
146 unsigned char* _omv_data;
a61af66fc99e Initial load
duke
parents:
diff changeset
147 CompressedWriteStream* _write_stream;
a61af66fc99e Initial load
duke
parents:
diff changeset
148
a61af66fc99e Initial load
duke
parents:
diff changeset
149 debug_only( OopMapValue::oop_types* _locs_used; int _locs_length;)
a61af66fc99e Initial load
duke
parents:
diff changeset
150
a61af66fc99e Initial load
duke
parents:
diff changeset
151 // Accessors
a61af66fc99e Initial load
duke
parents:
diff changeset
152 unsigned char* omv_data() const { return _omv_data; }
a61af66fc99e Initial load
duke
parents:
diff changeset
153 void set_omv_data(unsigned char* value) { _omv_data = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
154 int omv_data_size() const { return _omv_data_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
155 void set_omv_data_size(int value) { _omv_data_size = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
156 int omv_count() const { return _omv_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
157 void set_omv_count(int value) { _omv_count = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 void increment_count() { _omv_count++; }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 CompressedWriteStream* write_stream() const { return _write_stream; }
a61af66fc99e Initial load
duke
parents:
diff changeset
160 void set_write_stream(CompressedWriteStream* value) { _write_stream = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
163 enum DeepCopyToken { _deep_copy_token };
a61af66fc99e Initial load
duke
parents:
diff changeset
164 OopMap(DeepCopyToken, OopMap* source); // used only by deep_copy
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
167 OopMap(int frame_size, int arg_count);
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169 // pc-offset handling
a61af66fc99e Initial load
duke
parents:
diff changeset
170 int offset() const { return _pc_offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
171 void set_offset(int o) { _pc_offset = o; }
a61af66fc99e Initial load
duke
parents:
diff changeset
172
a61af66fc99e Initial load
duke
parents:
diff changeset
173 // Check to avoid double insertion
a61af66fc99e Initial load
duke
parents:
diff changeset
174 debug_only(OopMapValue::oop_types locs_used( int indx ) { return _locs_used[indx]; })
a61af66fc99e Initial load
duke
parents:
diff changeset
175
a61af66fc99e Initial load
duke
parents:
diff changeset
176 // Construction
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // frame_size units are stack-slots (4 bytes) NOT intptr_t; we can name odd
a61af66fc99e Initial load
duke
parents:
diff changeset
178 // slots to hold 4-byte values like ints and floats in the LP64 build.
a61af66fc99e Initial load
duke
parents:
diff changeset
179 void set_oop ( VMReg local);
a61af66fc99e Initial load
duke
parents:
diff changeset
180 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
181 void set_narrowoop(VMReg local);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
182 void set_dead ( VMReg local);
a61af66fc99e Initial load
duke
parents:
diff changeset
183 void set_callee_saved( VMReg local, VMReg caller_machine_register );
a61af66fc99e Initial load
duke
parents:
diff changeset
184 void set_derived_oop ( VMReg local, VMReg derived_from_local_register );
a61af66fc99e Initial load
duke
parents:
diff changeset
185 void set_xxx(VMReg reg, OopMapValue::oop_types x, VMReg optional);
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 int heap_size() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
188 void copy_to(address addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
189 OopMap* deep_copy();
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 bool has_derived_pointer() const PRODUCT_RETURN0;
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 bool legal_vm_reg_name(VMReg local) {
a61af66fc99e Initial load
duke
parents:
diff changeset
194 return OopMapValue::legal_vm_reg_name(local);
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197 // Printing
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 25
diff changeset
198 void print_on(outputStream* st) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
199 void print() const { print_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
200 };
a61af66fc99e Initial load
duke
parents:
diff changeset
201
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 class OopMapSet : public ResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
205 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
206 int _om_count;
a61af66fc99e Initial load
duke
parents:
diff changeset
207 int _om_size;
a61af66fc99e Initial load
duke
parents:
diff changeset
208 OopMap** _om_data;
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210 int om_count() const { return _om_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
211 void set_om_count(int value) { _om_count = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
212 void increment_count() { _om_count++; }
a61af66fc99e Initial load
duke
parents:
diff changeset
213 int om_size() const { return _om_size; }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 void set_om_size(int value) { _om_size = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
215 OopMap** om_data() const { return _om_data; }
a61af66fc99e Initial load
duke
parents:
diff changeset
216 void set_om_data(OopMap** value) { _om_data = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
217 void grow_om_data();
a61af66fc99e Initial load
duke
parents:
diff changeset
218 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
219
a61af66fc99e Initial load
duke
parents:
diff changeset
220 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
221 OopMapSet();
a61af66fc99e Initial load
duke
parents:
diff changeset
222
a61af66fc99e Initial load
duke
parents:
diff changeset
223 // returns the number of OopMaps in this OopMapSet
a61af66fc99e Initial load
duke
parents:
diff changeset
224 int size() const { return _om_count; }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 // returns the OopMap at a given index
a61af66fc99e Initial load
duke
parents:
diff changeset
226 OopMap* at(int index) const { assert((index >= 0) && (index <= om_count()),"bad index"); return _om_data[index]; }
a61af66fc99e Initial load
duke
parents:
diff changeset
227
a61af66fc99e Initial load
duke
parents:
diff changeset
228 // Collect OopMaps.
a61af66fc99e Initial load
duke
parents:
diff changeset
229 void add_gc_map(int pc, OopMap* map);
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231 // Returns the only oop map. Used for reconstructing
a61af66fc99e Initial load
duke
parents:
diff changeset
232 // Adapter frames during deoptimization
a61af66fc99e Initial load
duke
parents:
diff changeset
233 OopMap* singular_oop_map();
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 // returns OopMap in that is anchored to the pc
a61af66fc99e Initial load
duke
parents:
diff changeset
236 OopMap* find_map_at_offset(int pc_offset) const;
a61af66fc99e Initial load
duke
parents:
diff changeset
237
a61af66fc99e Initial load
duke
parents:
diff changeset
238 int heap_size() const;
a61af66fc99e Initial load
duke
parents:
diff changeset
239 void copy_to(address addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
240
858
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
241 // Methods oops_do() and all_do() filter out NULL oops and
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
242 // oop == Universe::narrow_oop_base() before passing oops
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
243 // to closures.
5314d85ffd54 6826736: CMS: core dump with -XX:+UseCompressedOops
kvn
parents: 245
diff changeset
244
0
a61af66fc99e Initial load
duke
parents:
diff changeset
245 // Iterates through frame for a compiled method
a61af66fc99e Initial load
duke
parents:
diff changeset
246 static void oops_do (const frame* fr,
a61af66fc99e Initial load
duke
parents:
diff changeset
247 const RegisterMap* reg_map, OopClosure* f);
a61af66fc99e Initial load
duke
parents:
diff changeset
248 static void update_register_map(const frame* fr, RegisterMap *reg_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
249
a61af66fc99e Initial load
duke
parents:
diff changeset
250 // Iterates through frame for a compiled method for dead ones and values, too
a61af66fc99e Initial load
duke
parents:
diff changeset
251 static void all_do(const frame* fr, const RegisterMap* reg_map,
a61af66fc99e Initial load
duke
parents:
diff changeset
252 OopClosure* oop_fn,
a61af66fc99e Initial load
duke
parents:
diff changeset
253 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
254 OopClosure* value_fn);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
255
a61af66fc99e Initial load
duke
parents:
diff changeset
256 // Printing
100
c7c777385a15 6667042: PrintAssembly option does not work without special plugin
jrose
parents: 25
diff changeset
257 void print_on(outputStream* st) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
258 void print() const { print_on(tty); }
a61af66fc99e Initial load
duke
parents:
diff changeset
259 };
a61af66fc99e Initial load
duke
parents:
diff changeset
260
a61af66fc99e Initial load
duke
parents:
diff changeset
261
a61af66fc99e Initial load
duke
parents:
diff changeset
262 class OopMapStream : public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
263 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
264 CompressedReadStream* _stream;
a61af66fc99e Initial load
duke
parents:
diff changeset
265 int _mask;
a61af66fc99e Initial load
duke
parents:
diff changeset
266 int _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
267 int _position;
a61af66fc99e Initial load
duke
parents:
diff changeset
268 bool _valid_omv;
a61af66fc99e Initial load
duke
parents:
diff changeset
269 OopMapValue _omv;
a61af66fc99e Initial load
duke
parents:
diff changeset
270 void find_next();
a61af66fc99e Initial load
duke
parents:
diff changeset
271
a61af66fc99e Initial load
duke
parents:
diff changeset
272 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
273 OopMapStream(OopMap* oop_map);
a61af66fc99e Initial load
duke
parents:
diff changeset
274 OopMapStream(OopMap* oop_map, int oop_types_mask);
a61af66fc99e Initial load
duke
parents:
diff changeset
275 bool is_done() { if(!_valid_omv) { find_next(); } return !_valid_omv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 void next() { find_next(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
277 OopMapValue current() { return _omv; }
a61af66fc99e Initial load
duke
parents:
diff changeset
278 };
a61af66fc99e Initial load
duke
parents:
diff changeset
279
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // Derived pointer support. This table keeps track of all derived points on a
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // stack. It is cleared before each scavenge/GC. During the traversal of all
a61af66fc99e Initial load
duke
parents:
diff changeset
283 // oops, it is filled in with references to all locations that contains a
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // derived oop (assumed to be very few). When the GC is complete, the derived
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // pointers are updated based on their base pointers new value and an offset.
a61af66fc99e Initial load
duke
parents:
diff changeset
286 #ifdef COMPILER2
a61af66fc99e Initial load
duke
parents:
diff changeset
287 class DerivedPointerTable : public AllStatic {
a61af66fc99e Initial load
duke
parents:
diff changeset
288 friend class VMStructs;
a61af66fc99e Initial load
duke
parents:
diff changeset
289 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
290 static GrowableArray<DerivedPointerEntry*>* _list;
a61af66fc99e Initial load
duke
parents:
diff changeset
291 static bool _active; // do not record pointers for verify pass etc.
a61af66fc99e Initial load
duke
parents:
diff changeset
292 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
293 static void clear(); // Called before scavenge/GC
a61af66fc99e Initial load
duke
parents:
diff changeset
294 static void add(oop *derived, oop *base); // Called during scavenge/GC
a61af66fc99e Initial load
duke
parents:
diff changeset
295 static void update_pointers(); // Called after scavenge/GC
a61af66fc99e Initial load
duke
parents:
diff changeset
296 static bool is_empty() { return _list == NULL || _list->is_empty(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
297 static bool is_active() { return _active; }
a61af66fc99e Initial load
duke
parents:
diff changeset
298 static void set_active(bool value) { _active = value; }
a61af66fc99e Initial load
duke
parents:
diff changeset
299 };
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // A utility class to temporarily "deactivate" the DerivedPointerTable.
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // (Note: clients are responsible for any MT-safety issues)
a61af66fc99e Initial load
duke
parents:
diff changeset
303 class DerivedPointerTableDeactivate: public StackObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
304 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
305 bool _active;
a61af66fc99e Initial load
duke
parents:
diff changeset
306 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
307 DerivedPointerTableDeactivate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
308 _active = DerivedPointerTable::is_active();
a61af66fc99e Initial load
duke
parents:
diff changeset
309 if (_active) {
a61af66fc99e Initial load
duke
parents:
diff changeset
310 DerivedPointerTable::set_active(false);
a61af66fc99e Initial load
duke
parents:
diff changeset
311 }
a61af66fc99e Initial load
duke
parents:
diff changeset
312 }
a61af66fc99e Initial load
duke
parents:
diff changeset
313
a61af66fc99e Initial load
duke
parents:
diff changeset
314 ~DerivedPointerTableDeactivate() {
a61af66fc99e Initial load
duke
parents:
diff changeset
315 assert(!DerivedPointerTable::is_active(),
a61af66fc99e Initial load
duke
parents:
diff changeset
316 "Inconsistency: not MT-safe");
a61af66fc99e Initial load
duke
parents:
diff changeset
317 if (_active) {
a61af66fc99e Initial load
duke
parents:
diff changeset
318 DerivedPointerTable::set_active(true);
a61af66fc99e Initial load
duke
parents:
diff changeset
319 }
a61af66fc99e Initial load
duke
parents:
diff changeset
320 }
a61af66fc99e Initial load
duke
parents:
diff changeset
321 };
a61af66fc99e Initial load
duke
parents:
diff changeset
322 #endif // COMPILER2
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
323
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
324 #endif // SHARE_VM_COMPILER_OOPMAP_HPP