annotate src/share/vm/c1/c1_CodeStubs.hpp @ 20543:e7d0505c8a30

8059758: Footprint regressions with JDK-8038423 Summary: Changes in JDK-8038423 always initialize (zero out) virtual memory used for auxiliary data structures. This causes a footprint regression for G1 in startup benchmarks. This is because they do not touch that memory at all, so the operating system does not actually commit these pages. The fix is to, if the initialization value of the data structures matches the default value of just committed memory (=0), do not do anything. Reviewed-by: jwilhelm, brutisso
author tschatzl
date Fri, 10 Oct 2014 15:51:58 +0200
parents 55fb97c4c58d
children 4ca6dc0799b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
17467
55fb97c4c58d 8029233: Update copyright year to match last edit in jdk8 hotspot repository for 2013
mikael
parents: 12160
diff changeset
2 * Copyright (c) 1999, 2013, 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: 1295
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1295
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: 1295
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: 1783
diff changeset
25 #ifndef SHARE_VM_C1_C1_CODESTUBS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
26 #define SHARE_VM_C1_C1_CODESTUBS_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
28 #include "c1/c1_FrameMap.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
29 #include "c1/c1_IR.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
30 #include "c1/c1_Instruction.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
31 #include "c1/c1_LIR.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
32 #include "c1/c1_Runtime1.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
33 #include "utilities/array.hpp"
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
34 #include "utilities/macros.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
35
0
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class CodeEmitInfo;
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class LIR_Assembler;
a61af66fc99e Initial load
duke
parents:
diff changeset
38 class LIR_OpVisitState;
a61af66fc99e Initial load
duke
parents:
diff changeset
39
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // CodeStubs are little 'out-of-line' pieces of code that
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // usually handle slow cases of operations. All code stubs
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // are collected and code is emitted at the end of the
a61af66fc99e Initial load
duke
parents:
diff changeset
43 // nmethod.
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 class CodeStub: public CompilationResourceObj {
a61af66fc99e Initial load
duke
parents:
diff changeset
46 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
47 Label _entry; // label at the stub entry point
a61af66fc99e Initial load
duke
parents:
diff changeset
48 Label _continuation; // label where stub continues, if any
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
51 CodeStub() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
52
a61af66fc99e Initial load
duke
parents:
diff changeset
53 // code generation
a61af66fc99e Initial load
duke
parents:
diff changeset
54 void assert_no_unbound_labels() { assert(!_entry.is_unbound() && !_continuation.is_unbound(), "unbound label"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
55 virtual void emit_code(LIR_Assembler* e) = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
56 virtual CodeEmitInfo* info() const { return NULL; }
a61af66fc99e Initial load
duke
parents:
diff changeset
57 virtual bool is_exception_throw_stub() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
58 virtual bool is_range_check_stub() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
59 virtual bool is_divbyzero_stub() const { return false; }
a61af66fc99e Initial load
duke
parents:
diff changeset
60 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
61 virtual void print_name(outputStream* out) const = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
62 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // label access
a61af66fc99e Initial load
duke
parents:
diff changeset
65 Label* entry() { return &_entry; }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 Label* continuation() { return &_continuation; }
a61af66fc99e Initial load
duke
parents:
diff changeset
67 // for LIR
a61af66fc99e Initial load
duke
parents:
diff changeset
68 virtual void visit(LIR_OpVisitState* visit) {
a61af66fc99e Initial load
duke
parents:
diff changeset
69 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
70 if (LIRTracePeephole && Verbose) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 tty->print("no visitor for ");
a61af66fc99e Initial load
duke
parents:
diff changeset
72 print_name(tty);
a61af66fc99e Initial load
duke
parents:
diff changeset
73 tty->cr();
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
76 }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 };
a61af66fc99e Initial load
duke
parents:
diff changeset
78
a61af66fc99e Initial load
duke
parents:
diff changeset
79
a61af66fc99e Initial load
duke
parents:
diff changeset
80 define_array(CodeStubArray, CodeStub*)
a61af66fc99e Initial load
duke
parents:
diff changeset
81 define_stack(_CodeStubList, CodeStubArray)
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 class CodeStubList: public _CodeStubList {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
85 CodeStubList(): _CodeStubList() {}
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 void append(CodeStub* stub) {
a61af66fc99e Initial load
duke
parents:
diff changeset
88 if (!contains(stub)) {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 _CodeStubList::append(stub);
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 };
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 class CounterOverflowStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
95 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
96 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
97 int _bci;
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1681
diff changeset
98 LIR_Opr _method;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 public:
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1681
diff changeset
101 CounterOverflowStub(CodeEmitInfo* info, int bci, LIR_Opr method) : _info(info), _bci(bci), _method(method) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 visitor->do_slow_case(_info);
1783
d5d065957597 6953144: Tiered compilation
iveresov
parents: 1681
diff changeset
108 visitor->do_input(_method);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
112 virtual void print_name(outputStream* out) const { out->print("CounterOverflowStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
113 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
114
a61af66fc99e Initial load
duke
parents:
diff changeset
115 };
a61af66fc99e Initial load
duke
parents:
diff changeset
116
a61af66fc99e Initial load
duke
parents:
diff changeset
117 class ConversionStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
118 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
119 Bytecodes::Code _bytecode;
a61af66fc99e Initial load
duke
parents:
diff changeset
120 LIR_Opr _input;
a61af66fc99e Initial load
duke
parents:
diff changeset
121 LIR_Opr _result;
a61af66fc99e Initial load
duke
parents:
diff changeset
122
a61af66fc99e Initial load
duke
parents:
diff changeset
123 static float float_zero;
a61af66fc99e Initial load
duke
parents:
diff changeset
124 static double double_zero;
a61af66fc99e Initial load
duke
parents:
diff changeset
125 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
126 ConversionStub(Bytecodes::Code bytecode, LIR_Opr input, LIR_Opr result)
a61af66fc99e Initial load
duke
parents:
diff changeset
127 : _bytecode(bytecode), _input(input), _result(result) {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 Bytecodes::Code bytecode() { return _bytecode; }
a61af66fc99e Initial load
duke
parents:
diff changeset
131 LIR_Opr input() { return _input; }
a61af66fc99e Initial load
duke
parents:
diff changeset
132 LIR_Opr result() { return _result; }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
135 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 visitor->do_slow_case();
a61af66fc99e Initial load
duke
parents:
diff changeset
137 visitor->do_input(_input);
a61af66fc99e Initial load
duke
parents:
diff changeset
138 visitor->do_output(_result);
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
141 virtual void print_name(outputStream* out) const { out->print("ConversionStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
142 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
143 };
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // Throws ArrayIndexOutOfBoundsException by default but can be
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // configured to throw IndexOutOfBoundsException in constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
148 class RangeCheckStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
150 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
151 LIR_Opr _index;
a61af66fc99e Initial load
duke
parents:
diff changeset
152 bool _throw_index_out_of_bounds_exception;
a61af66fc99e Initial load
duke
parents:
diff changeset
153
a61af66fc99e Initial load
duke
parents:
diff changeset
154 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
155 RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, bool throw_index_out_of_bounds_exception = false);
a61af66fc99e Initial load
duke
parents:
diff changeset
156 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
157 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 virtual bool is_exception_throw_stub() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
159 virtual bool is_range_check_stub() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
160 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
161 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
162 visitor->do_input(_index);
a61af66fc99e Initial load
duke
parents:
diff changeset
163 }
a61af66fc99e Initial load
duke
parents:
diff changeset
164 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
165 virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
166 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
167 };
a61af66fc99e Initial load
duke
parents:
diff changeset
168
8860
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
169 // stub used when predicate fails and deoptimization is needed
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
170 class PredicateFailedStub: public CodeStub {
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
171 private:
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
172 CodeEmitInfo* _info;
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
173
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
174 public:
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
175 PredicateFailedStub(CodeEmitInfo* info);
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
176 virtual void emit_code(LIR_Assembler* e);
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
177 virtual CodeEmitInfo* info() const { return _info; }
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
178 virtual void visit(LIR_OpVisitState* visitor) {
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
179 visitor->do_slow_case(_info);
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
180 }
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
181 #ifndef PRODUCT
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
182 virtual void print_name(outputStream* out) const { out->print("PredicateFailedStub"); }
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
183 #endif // PRODUCT
46f6f063b272 7153771: array bound check elimination for c1
roland
parents: 8001
diff changeset
184 };
0
a61af66fc99e Initial load
duke
parents:
diff changeset
185
a61af66fc99e Initial load
duke
parents:
diff changeset
186 class DivByZeroStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
187 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
188 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
189 int _offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
192 DivByZeroStub(CodeEmitInfo* info)
a61af66fc99e Initial load
duke
parents:
diff changeset
193 : _info(info), _offset(-1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195 DivByZeroStub(int offset, CodeEmitInfo* info)
a61af66fc99e Initial load
duke
parents:
diff changeset
196 : _info(info), _offset(offset) {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 }
a61af66fc99e Initial load
duke
parents:
diff changeset
198 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
199 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
200 virtual bool is_exception_throw_stub() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
201 virtual bool is_divbyzero_stub() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
202 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
204 }
a61af66fc99e Initial load
duke
parents:
diff changeset
205 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
206 virtual void print_name(outputStream* out) const { out->print("DivByZeroStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
208 };
a61af66fc99e Initial load
duke
parents:
diff changeset
209
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 class ImplicitNullCheckStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
212 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
213 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
214 int _offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
215
a61af66fc99e Initial load
duke
parents:
diff changeset
216 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
217 ImplicitNullCheckStub(int offset, CodeEmitInfo* info)
a61af66fc99e Initial load
duke
parents:
diff changeset
218 : _offset(offset), _info(info) {
a61af66fc99e Initial load
duke
parents:
diff changeset
219 }
a61af66fc99e Initial load
duke
parents:
diff changeset
220 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
221 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
222 virtual bool is_exception_throw_stub() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
223 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
227 virtual void print_name(outputStream* out) const { out->print("ImplicitNullCheckStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
228 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
229 };
a61af66fc99e Initial load
duke
parents:
diff changeset
230
a61af66fc99e Initial load
duke
parents:
diff changeset
231
a61af66fc99e Initial load
duke
parents:
diff changeset
232 class NewInstanceStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
233 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
234 ciInstanceKlass* _klass;
a61af66fc99e Initial load
duke
parents:
diff changeset
235 LIR_Opr _klass_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
236 LIR_Opr _result;
a61af66fc99e Initial load
duke
parents:
diff changeset
237 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
238 Runtime1::StubID _stub_id;
a61af66fc99e Initial load
duke
parents:
diff changeset
239
a61af66fc99e Initial load
duke
parents:
diff changeset
240 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
241 NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id);
a61af66fc99e Initial load
duke
parents:
diff changeset
242 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
243 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
244 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
246 visitor->do_input(_klass_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
247 visitor->do_output(_result);
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
250 virtual void print_name(outputStream* out) const { out->print("NewInstanceStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
251 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
252 };
a61af66fc99e Initial load
duke
parents:
diff changeset
253
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 class NewTypeArrayStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
257 LIR_Opr _klass_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
258 LIR_Opr _length;
a61af66fc99e Initial load
duke
parents:
diff changeset
259 LIR_Opr _result;
a61af66fc99e Initial load
duke
parents:
diff changeset
260 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
261
a61af66fc99e Initial load
duke
parents:
diff changeset
262 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
263 NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
a61af66fc99e Initial load
duke
parents:
diff changeset
264 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
265 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
266 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
267 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 visitor->do_input(_klass_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
269 visitor->do_input(_length);
a61af66fc99e Initial load
duke
parents:
diff changeset
270 assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
273 virtual void print_name(outputStream* out) const { out->print("NewTypeArrayStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
274 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
275 };
a61af66fc99e Initial load
duke
parents:
diff changeset
276
a61af66fc99e Initial load
duke
parents:
diff changeset
277
a61af66fc99e Initial load
duke
parents:
diff changeset
278 class NewObjectArrayStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
279 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
280 LIR_Opr _klass_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
281 LIR_Opr _length;
a61af66fc99e Initial load
duke
parents:
diff changeset
282 LIR_Opr _result;
a61af66fc99e Initial load
duke
parents:
diff changeset
283 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
284
a61af66fc99e Initial load
duke
parents:
diff changeset
285 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
286 NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
a61af66fc99e Initial load
duke
parents:
diff changeset
287 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
288 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
289 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
290 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
291 visitor->do_input(_klass_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
292 visitor->do_input(_length);
a61af66fc99e Initial load
duke
parents:
diff changeset
293 assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
a61af66fc99e Initial load
duke
parents:
diff changeset
294 }
a61af66fc99e Initial load
duke
parents:
diff changeset
295 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
296 virtual void print_name(outputStream* out) const { out->print("NewObjectArrayStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
297 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
298 };
a61af66fc99e Initial load
duke
parents:
diff changeset
299
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 class MonitorAccessStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
302 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
303 LIR_Opr _obj_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
304 LIR_Opr _lock_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
305
a61af66fc99e Initial load
duke
parents:
diff changeset
306 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
307 MonitorAccessStub(LIR_Opr obj_reg, LIR_Opr lock_reg) {
a61af66fc99e Initial load
duke
parents:
diff changeset
308 _obj_reg = obj_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
309 _lock_reg = lock_reg;
a61af66fc99e Initial load
duke
parents:
diff changeset
310 }
a61af66fc99e Initial load
duke
parents:
diff changeset
311
a61af66fc99e Initial load
duke
parents:
diff changeset
312 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
313 virtual void print_name(outputStream* out) const { out->print("MonitorAccessStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
314 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
315 };
a61af66fc99e Initial load
duke
parents:
diff changeset
316
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 class MonitorEnterStub: public MonitorAccessStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
320 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
321
a61af66fc99e Initial load
duke
parents:
diff changeset
322 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
323 MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info);
a61af66fc99e Initial load
duke
parents:
diff changeset
324
a61af66fc99e Initial load
duke
parents:
diff changeset
325 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
326 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
327 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 visitor->do_input(_obj_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
329 visitor->do_input(_lock_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
330 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
331 }
a61af66fc99e Initial load
duke
parents:
diff changeset
332 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
333 virtual void print_name(outputStream* out) const { out->print("MonitorEnterStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
334 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
335 };
a61af66fc99e Initial load
duke
parents:
diff changeset
336
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 class MonitorExitStub: public MonitorAccessStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
339 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
340 bool _compute_lock;
a61af66fc99e Initial load
duke
parents:
diff changeset
341 int _monitor_ix;
a61af66fc99e Initial load
duke
parents:
diff changeset
342
a61af66fc99e Initial load
duke
parents:
diff changeset
343 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
344 MonitorExitStub(LIR_Opr lock_reg, bool compute_lock, int monitor_ix)
a61af66fc99e Initial load
duke
parents:
diff changeset
345 : MonitorAccessStub(LIR_OprFact::illegalOpr, lock_reg),
a61af66fc99e Initial load
duke
parents:
diff changeset
346 _compute_lock(compute_lock), _monitor_ix(monitor_ix) { }
a61af66fc99e Initial load
duke
parents:
diff changeset
347 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
348 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
349 assert(_obj_reg->is_illegal(), "unused");
a61af66fc99e Initial load
duke
parents:
diff changeset
350 if (_compute_lock) {
a61af66fc99e Initial load
duke
parents:
diff changeset
351 visitor->do_temp(_lock_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
352 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
353 visitor->do_input(_lock_reg);
a61af66fc99e Initial load
duke
parents:
diff changeset
354 }
a61af66fc99e Initial load
duke
parents:
diff changeset
355 }
a61af66fc99e Initial load
duke
parents:
diff changeset
356 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
357 virtual void print_name(outputStream* out) const { out->print("MonitorExitStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
358 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
359 };
a61af66fc99e Initial load
duke
parents:
diff changeset
360
a61af66fc99e Initial load
duke
parents:
diff changeset
361
a61af66fc99e Initial load
duke
parents:
diff changeset
362 class PatchingStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
363 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
364 enum PatchID {
a61af66fc99e Initial load
duke
parents:
diff changeset
365 access_field_id,
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6615
diff changeset
366 load_klass_id,
12160
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 8860
diff changeset
367 load_mirror_id,
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 8860
diff changeset
368 load_appendix_id
0
a61af66fc99e Initial load
duke
parents:
diff changeset
369 };
a61af66fc99e Initial load
duke
parents:
diff changeset
370 enum constants {
a61af66fc99e Initial load
duke
parents:
diff changeset
371 patch_info_size = 3
a61af66fc99e Initial load
duke
parents:
diff changeset
372 };
a61af66fc99e Initial load
duke
parents:
diff changeset
373 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
374 PatchID _id;
a61af66fc99e Initial load
duke
parents:
diff changeset
375 address _pc_start;
a61af66fc99e Initial load
duke
parents:
diff changeset
376 int _bytes_to_copy;
a61af66fc99e Initial load
duke
parents:
diff changeset
377 Label _patched_code_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
378 Label _patch_site_entry;
a61af66fc99e Initial load
duke
parents:
diff changeset
379 Label _patch_site_continuation;
a61af66fc99e Initial load
duke
parents:
diff changeset
380 Register _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
381 CodeEmitInfo* _info;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6615
diff changeset
382 int _index; // index of the patchable oop or Klass* in nmethod oop or metadata table if needed
0
a61af66fc99e Initial load
duke
parents:
diff changeset
383 static int _patch_info_offset;
a61af66fc99e Initial load
duke
parents:
diff changeset
384
a61af66fc99e Initial load
duke
parents:
diff changeset
385 void align_patch_site(MacroAssembler* masm);
a61af66fc99e Initial load
duke
parents:
diff changeset
386
a61af66fc99e Initial load
duke
parents:
diff changeset
387 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
388 static int patch_info_offset() { return _patch_info_offset; }
a61af66fc99e Initial load
duke
parents:
diff changeset
389
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6615
diff changeset
390 PatchingStub(MacroAssembler* masm, PatchID id, int index = -1):
0
a61af66fc99e Initial load
duke
parents:
diff changeset
391 _id(id)
a61af66fc99e Initial load
duke
parents:
diff changeset
392 , _info(NULL)
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6615
diff changeset
393 , _index(index) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
394 if (os::is_MP()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
395 // force alignment of patch sites on MP hardware so we
a61af66fc99e Initial load
duke
parents:
diff changeset
396 // can guarantee atomic writes to the patch site.
a61af66fc99e Initial load
duke
parents:
diff changeset
397 align_patch_site(masm);
a61af66fc99e Initial load
duke
parents:
diff changeset
398 }
a61af66fc99e Initial load
duke
parents:
diff changeset
399 _pc_start = masm->pc();
a61af66fc99e Initial load
duke
parents:
diff changeset
400 masm->bind(_patch_site_entry);
a61af66fc99e Initial load
duke
parents:
diff changeset
401 }
a61af66fc99e Initial load
duke
parents:
diff changeset
402
a61af66fc99e Initial load
duke
parents:
diff changeset
403 void install(MacroAssembler* masm, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
a61af66fc99e Initial load
duke
parents:
diff changeset
404 _info = info;
a61af66fc99e Initial load
duke
parents:
diff changeset
405 _obj = obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
406 masm->bind(_patch_site_continuation);
a61af66fc99e Initial load
duke
parents:
diff changeset
407 _bytes_to_copy = masm->pc() - pc_start();
a61af66fc99e Initial load
duke
parents:
diff changeset
408 if (_id == PatchingStub::access_field_id) {
a61af66fc99e Initial load
duke
parents:
diff changeset
409 // embed a fixed offset to handle long patches which need to be offset by a word.
a61af66fc99e Initial load
duke
parents:
diff changeset
410 // the patching code will just add the field offset field to this offset so
a61af66fc99e Initial load
duke
parents:
diff changeset
411 // that we can refernce either the high or low word of a double word field.
a61af66fc99e Initial load
duke
parents:
diff changeset
412 int field_offset = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
413 switch (patch_code) {
a61af66fc99e Initial load
duke
parents:
diff changeset
414 case lir_patch_low: field_offset = lo_word_offset_in_bytes; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
415 case lir_patch_high: field_offset = hi_word_offset_in_bytes; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
416 case lir_patch_normal: field_offset = 0; break;
a61af66fc99e Initial load
duke
parents:
diff changeset
417 default: ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419 NativeMovRegMem* n_move = nativeMovRegMem_at(pc_start());
a61af66fc99e Initial load
duke
parents:
diff changeset
420 n_move->set_offset(field_offset);
12160
f98f5d48f511 7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents: 8860
diff changeset
421 } else if (_id == load_klass_id || _id == load_mirror_id || _id == load_appendix_id) {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6615
diff changeset
422 assert(_obj != noreg, "must have register object for load_klass/load_mirror");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
423 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
424 // verify that we're pointing at a NativeMovConstReg
a61af66fc99e Initial load
duke
parents:
diff changeset
425 nativeMovConstReg_at(pc_start());
a61af66fc99e Initial load
duke
parents:
diff changeset
426 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
427 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
428 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
429 }
a61af66fc99e Initial load
duke
parents:
diff changeset
430 assert(_bytes_to_copy <= (masm->pc() - pc_start()), "not enough bytes");
a61af66fc99e Initial load
duke
parents:
diff changeset
431 }
a61af66fc99e Initial load
duke
parents:
diff changeset
432
a61af66fc99e Initial load
duke
parents:
diff changeset
433 address pc_start() const { return _pc_start; }
a61af66fc99e Initial load
duke
parents:
diff changeset
434 PatchID id() const { return _id; }
a61af66fc99e Initial load
duke
parents:
diff changeset
435
a61af66fc99e Initial load
duke
parents:
diff changeset
436 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
437 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
438 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
439 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
440 }
a61af66fc99e Initial load
duke
parents:
diff changeset
441 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
442 virtual void print_name(outputStream* out) const { out->print("PatchingStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
443 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
444 };
a61af66fc99e Initial load
duke
parents:
diff changeset
445
a61af66fc99e Initial load
duke
parents:
diff changeset
446
1295
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
447 //------------------------------------------------------------------------------
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
448 // DeoptimizeStub
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
449 //
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
450 class DeoptimizeStub : public CodeStub {
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
451 private:
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
452 CodeEmitInfo* _info;
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
453
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
454 public:
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
455 DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
456
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
457 virtual void emit_code(LIR_Assembler* e);
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
458 virtual CodeEmitInfo* info() const { return _info; }
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
459 virtual bool is_exception_throw_stub() const { return true; }
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
460 virtual void visit(LIR_OpVisitState* visitor) {
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
461 visitor->do_slow_case(_info);
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
462 }
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
463 #ifndef PRODUCT
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
464 virtual void print_name(outputStream* out) const { out->print("DeoptimizeStub"); }
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
465 #endif // PRODUCT
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
466 };
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
467
3cf667df43ef 6919934: JSR 292 needs to support x86 C1
twisti
parents: 342
diff changeset
468
0
a61af66fc99e Initial load
duke
parents:
diff changeset
469 class SimpleExceptionStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
470 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
471 LIR_Opr _obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
472 Runtime1::StubID _stub;
a61af66fc99e Initial load
duke
parents:
diff changeset
473 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
474
a61af66fc99e Initial load
duke
parents:
diff changeset
475 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
476 SimpleExceptionStub(Runtime1::StubID stub, LIR_Opr obj, CodeEmitInfo* info):
a61af66fc99e Initial load
duke
parents:
diff changeset
477 _obj(obj), _info(info), _stub(stub) {
a61af66fc99e Initial load
duke
parents:
diff changeset
478 }
a61af66fc99e Initial load
duke
parents:
diff changeset
479
1681
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
480 void set_obj(LIR_Opr obj) {
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
481 _obj = obj;
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
482 }
126ea7725993 6953477: Increase portability and flexibility of building Hotspot
bobv
parents: 1552
diff changeset
483
0
a61af66fc99e Initial load
duke
parents:
diff changeset
484 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
485 virtual CodeEmitInfo* info() const { return _info; }
a61af66fc99e Initial load
duke
parents:
diff changeset
486 virtual bool is_exception_throw_stub() const { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
487 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
488 if (_obj->is_valid()) visitor->do_input(_obj);
a61af66fc99e Initial load
duke
parents:
diff changeset
489 visitor->do_slow_case(_info);
a61af66fc99e Initial load
duke
parents:
diff changeset
490 }
a61af66fc99e Initial load
duke
parents:
diff changeset
491 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
492 virtual void print_name(outputStream* out) const { out->print("SimpleExceptionStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
493 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
494 };
a61af66fc99e Initial load
duke
parents:
diff changeset
495
a61af66fc99e Initial load
duke
parents:
diff changeset
496
a61af66fc99e Initial load
duke
parents:
diff changeset
497
2168
e4fee0bdaa85 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 1972
diff changeset
498 class ArrayStoreExceptionStub: public SimpleExceptionStub {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
499 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
500 CodeEmitInfo* _info;
a61af66fc99e Initial load
duke
parents:
diff changeset
501
a61af66fc99e Initial load
duke
parents:
diff changeset
502 public:
2168
e4fee0bdaa85 7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents: 1972
diff changeset
503 ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
504 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
505 virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
506 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
507 };
a61af66fc99e Initial load
duke
parents:
diff changeset
508
a61af66fc99e Initial load
duke
parents:
diff changeset
509
a61af66fc99e Initial load
duke
parents:
diff changeset
510 class ArrayCopyStub: public CodeStub {
a61af66fc99e Initial load
duke
parents:
diff changeset
511 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
512 LIR_OpArrayCopy* _op;
a61af66fc99e Initial load
duke
parents:
diff changeset
513
a61af66fc99e Initial load
duke
parents:
diff changeset
514 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
515 ArrayCopyStub(LIR_OpArrayCopy* op): _op(op) { }
a61af66fc99e Initial load
duke
parents:
diff changeset
516
a61af66fc99e Initial load
duke
parents:
diff changeset
517 LIR_Opr src() const { return _op->src(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
518 LIR_Opr src_pos() const { return _op->src_pos(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
519 LIR_Opr dst() const { return _op->dst(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
520 LIR_Opr dst_pos() const { return _op->dst_pos(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
521 LIR_Opr length() const { return _op->length(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
522 LIR_Opr tmp() const { return _op->tmp(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
523
a61af66fc99e Initial load
duke
parents:
diff changeset
524 virtual void emit_code(LIR_Assembler* e);
a61af66fc99e Initial load
duke
parents:
diff changeset
525 virtual CodeEmitInfo* info() const { return _op->info(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
526 virtual void visit(LIR_OpVisitState* visitor) {
a61af66fc99e Initial load
duke
parents:
diff changeset
527 // don't pass in the code emit info since it's processed in the fast path
a61af66fc99e Initial load
duke
parents:
diff changeset
528 visitor->do_slow_case();
a61af66fc99e Initial load
duke
parents:
diff changeset
529 }
a61af66fc99e Initial load
duke
parents:
diff changeset
530 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
531 virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); }
a61af66fc99e Initial load
duke
parents:
diff changeset
532 #endif // PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
533 };
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
534
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
535 //////////////////////////////////////////////////////////////////////////////////////////
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
536 #if INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
537
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
538 // Code stubs for Garbage-First barriers.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
539 class G1PreBarrierStub: public CodeStub {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
540 private:
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
541 bool _do_load;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
542 LIR_Opr _addr;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
543 LIR_Opr _pre_val;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
544 LIR_PatchCode _patch_code;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
545 CodeEmitInfo* _info;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
546
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
547 public:
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
548 // Version that _does_ generate a load of the previous value from addr.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
549 // addr (the address of the field to be read) must be a LIR_Address
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
550 // pre_val (a temporary register) must be a register;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
551 G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) :
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
552 _addr(addr), _pre_val(pre_val), _do_load(true),
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
553 _patch_code(patch_code), _info(info)
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
554 {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
555 assert(_pre_val->is_register(), "should be temporary register");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
556 assert(_addr->is_address(), "should be the address of the field");
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
557 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
558
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
559 // Version that _does not_ generate load of the previous value; the
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
560 // previous value is assumed to have already been loaded into pre_val.
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
561 G1PreBarrierStub(LIR_Opr pre_val) :
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
562 _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false),
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
563 _patch_code(lir_patch_none), _info(NULL)
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
564 {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
565 assert(_pre_val->is_register(), "should be a register");
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
566 }
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
567
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
568 LIR_Opr addr() const { return _addr; }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
569 LIR_Opr pre_val() const { return _pre_val; }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
570 LIR_PatchCode patch_code() const { return _patch_code; }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
571 CodeEmitInfo* info() const { return _info; }
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
572 bool do_load() const { return _do_load; }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
573
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
574 virtual void emit_code(LIR_Assembler* e);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
575 virtual void visit(LIR_OpVisitState* visitor) {
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
576 if (_do_load) {
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
577 // don't pass in the code emit info since it's processed in the fast
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
578 // path
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
579 if (_info != NULL)
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
580 visitor->do_slow_case(_info);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
581 else
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
582 visitor->do_slow_case();
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
583
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
584 visitor->do_input(_addr);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
585 visitor->do_temp(_pre_val);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
586 } else {
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
587 visitor->do_slow_case();
3249
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
588 visitor->do_input(_pre_val);
e1162778c1c8 7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents: 2168
diff changeset
589 }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
590 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
591 #ifndef PRODUCT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
592 virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
593 #endif // PRODUCT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
594 };
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
595
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
596 class G1PostBarrierStub: public CodeStub {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
597 private:
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
598 LIR_Opr _addr;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
599 LIR_Opr _new_val;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
600
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
601 static jbyte* _byte_map_base;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
602 static jbyte* byte_map_base_slow();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
603 static jbyte* byte_map_base() {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
604 if (_byte_map_base == NULL) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
605 _byte_map_base = byte_map_base_slow();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
606 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
607 return _byte_map_base;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
608 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
609
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
610 public:
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
611 // addr (the address of the object head) and new_val must be registers.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
612 G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
613
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
614 LIR_Opr addr() const { return _addr; }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
615 LIR_Opr new_val() const { return _new_val; }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
616
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
617 virtual void emit_code(LIR_Assembler* e);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
618 virtual void visit(LIR_OpVisitState* visitor) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
619 // don't pass in the code emit info since it's processed in the fast path
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
620 visitor->do_slow_case();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
621 visitor->do_input(_addr);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
622 visitor->do_input(_new_val);
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
623 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
624 #ifndef PRODUCT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
625 virtual void print_name(outputStream* out) const { out->print("G1PostBarrierStub"); }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
626 #endif // PRODUCT
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
627 };
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
628
8001
db9981fd3124 8005915: Unify SERIALGC and INCLUDE_ALTERNATE_GCS
jprovino
parents: 6725
diff changeset
629 #endif // INCLUDE_ALL_GCS
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents: 0
diff changeset
630 //////////////////////////////////////////////////////////////////////////////////////////
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
631
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1783
diff changeset
632 #endif // SHARE_VM_C1_C1_CODESTUBS_HPP