Mercurial > hg > truffle
annotate src/share/vm/code/compiledIC.hpp @ 8071:bbc7936779f9
8006398: Add regression tests for deprectated GCs
Reviewed-by: ehelin, jwilhelm, jmasa
author | brutisso |
---|---|
date | Thu, 14 Feb 2013 09:11:43 +0100 |
parents | da91efe96a93 |
children | a6e09d6dd8e5 |
rev | line source |
---|---|
0 | 1 /* |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
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:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_CODE_COMPILEDIC_HPP |
26 #define SHARE_VM_CODE_COMPILEDIC_HPP | |
27 | |
28 #include "interpreter/linkResolver.hpp" | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
29 #include "oops/compiledICHolder.hpp" |
1972 | 30 #ifdef TARGET_ARCH_x86 |
31 # include "nativeInst_x86.hpp" | |
32 #endif | |
33 #ifdef TARGET_ARCH_sparc | |
34 # include "nativeInst_sparc.hpp" | |
35 #endif | |
36 #ifdef TARGET_ARCH_zero | |
37 # include "nativeInst_zero.hpp" | |
38 #endif | |
2192
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
39 #ifdef TARGET_ARCH_arm |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
40 # include "nativeInst_arm.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
41 #endif |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
42 #ifdef TARGET_ARCH_ppc |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
43 # include "nativeInst_ppc.hpp" |
b92c45f2bc75
7016023: Enable building ARM and PPC from src/closed repository
bobv
parents:
1972
diff
changeset
|
44 #endif |
1972 | 45 |
0 | 46 //----------------------------------------------------------------------------- |
47 // The CompiledIC represents a compiled inline cache. | |
48 // | |
49 // In order to make patching of the inline cache MT-safe, we only allow the following | |
50 // transitions (when not at a safepoint): | |
51 // | |
52 // | |
53 // [1] --<-- Clean -->--- [1] | |
54 // / (null) \ | |
55 // / \ /-<-\ | |
56 // / [2] \ / \ | |
57 // Interpreted ---------> Monomorphic | [3] | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
58 // (CompiledICHolder*) (Klass*) | |
0 | 59 // \ / \ / |
60 // [4] \ / [4] \->-/ | |
61 // \->- Megamorphic -<-/ | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
62 // (Method*) |
0 | 63 // |
64 // The text in paranteses () refere to the value of the inline cache receiver (mov instruction) | |
65 // | |
66 // The numbers in square brackets refere to the kind of transition: | |
67 // [1]: Initial fixup. Receiver it found from debug information | |
68 // [2]: Compilation of a method | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
69 // [3]: Recompilation of a method (note: only entry is changed. The Klass* must stay the same) |
0 | 70 // [4]: Inline cache miss. We go directly to megamorphic call. |
71 // | |
72 // The class automatically inserts transition stubs (using the InlineCacheBuffer) when an MT-unsafe | |
73 // transition is made to a stub. | |
74 // | |
75 class CompiledIC; | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
76 class ICStub; |
0 | 77 |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
78 class CompiledICInfo : public StackObj { |
0 | 79 private: |
80 address _entry; // entry point for call | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
81 void* _cached_value; // Value of cached_value (either in stub or inline cache) |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
82 bool _is_icholder; // Is the cached value a CompiledICHolder* |
0 | 83 bool _is_optimized; // it is an optimized virtual call (i.e., can be statically bound) |
84 bool _to_interpreter; // Call it to interpreter | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
85 bool _release_icholder; |
0 | 86 public: |
87 address entry() const { return _entry; } | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
88 Metadata* cached_metadata() const { assert(!_is_icholder, ""); return (Metadata*)_cached_value; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
89 CompiledICHolder* claim_cached_icholder() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
90 assert(_is_icholder, ""); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
91 assert(_cached_value != NULL, "must be non-NULL"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
92 _release_icholder = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
93 CompiledICHolder* icholder = (CompiledICHolder*)_cached_value; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
94 icholder->claim(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
95 return icholder; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
96 } |
0 | 97 bool is_optimized() const { return _is_optimized; } |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
98 bool to_interpreter() const { return _to_interpreter; } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
99 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
100 void set_compiled_entry(address entry, Klass* klass, bool is_optimized) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
101 _entry = entry; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
102 _cached_value = (void*)klass; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
103 _to_interpreter = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
104 _is_icholder = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
105 _is_optimized = is_optimized; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
106 _release_icholder = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
107 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
108 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
109 void set_interpreter_entry(address entry, Method* method) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
110 _entry = entry; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
111 _cached_value = (void*)method; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
112 _to_interpreter = true; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
113 _is_icholder = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
114 _is_optimized = true; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
115 _release_icholder = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
116 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
117 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
118 void set_icholder_entry(address entry, CompiledICHolder* icholder) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
119 _entry = entry; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
120 _cached_value = (void*)icholder; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
121 _to_interpreter = true; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
122 _is_icholder = true; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
123 _is_optimized = false; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
124 _release_icholder = true; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
125 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
126 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
127 CompiledICInfo(): _entry(NULL), _cached_value(NULL), _is_icholder(false), |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
128 _to_interpreter(false), _is_optimized(false), _release_icholder(false) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
129 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
130 ~CompiledICInfo() { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
131 // In rare cases the info is computed but not used, so release any |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
132 // CompiledICHolder* that was created |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
133 if (_release_icholder) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
134 assert(_is_icholder, "must be"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
135 CompiledICHolder* icholder = (CompiledICHolder*)_cached_value; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
136 icholder->claim(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
137 delete icholder; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
138 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
139 } |
0 | 140 }; |
141 | |
142 class CompiledIC: public ResourceObj { | |
143 friend class InlineCacheBuffer; | |
144 friend class ICStub; | |
145 | |
146 | |
147 private: | |
148 NativeCall* _ic_call; // the call instruction | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
149 NativeMovConstReg* _value; // patchable value cell for this IC |
0 | 150 bool _is_optimized; // an optimized virtual call (i.e., no compiled IC) |
151 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
152 CompiledIC(nmethod* nm, NativeCall* ic_call); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
153 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
154 static bool is_icholder_entry(address entry); |
0 | 155 |
156 // low-level inline-cache manipulation. Cannot be accessed directly, since it might not be MT-safe | |
157 // to change an inline-cache. These changes the underlying inline-cache directly. They *newer* make | |
158 // changes to a transition stub. | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
159 void internal_set_ic_destination(address entry_point, bool is_icstub, void* cache, bool is_icholder); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
160 void set_ic_destination(ICStub* stub); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
161 void set_ic_destination(address entry_point) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
162 assert(_is_optimized, "use set_ic_destination_and_value instead"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
163 internal_set_ic_destination(entry_point, false, NULL, false); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
164 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
165 // This only for use by ICStubs where the type of the value isn't known |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
166 void set_ic_destination_and_value(address entry_point, void* value) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
167 internal_set_ic_destination(entry_point, false, value, is_icholder_entry(entry_point)); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
168 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
169 void set_ic_destination_and_value(address entry_point, Metadata* value) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
170 internal_set_ic_destination(entry_point, false, value, false); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
171 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
172 void set_ic_destination_and_value(address entry_point, CompiledICHolder* value) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
173 internal_set_ic_destination(entry_point, false, value, true); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
174 } |
0 | 175 |
176 // Reads the location of the transition stub. This will fail with an assertion, if no transition stub is | |
177 // associated with the inline cache. | |
178 address stub_address() const; | |
179 bool is_in_transition_state() const; // Use InlineCacheBuffer | |
180 | |
181 public: | |
182 // conversion (machine PC to CompiledIC*) | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
183 friend CompiledIC* CompiledIC_before(nmethod* nm, address return_addr); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
184 friend CompiledIC* CompiledIC_at(nmethod* nm, address call_site); |
0 | 185 friend CompiledIC* CompiledIC_at(Relocation* call_site); |
186 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
187 // This is used to release CompiledICHolder*s from nmethods that |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
188 // are about to be freed. The callsite might contain other stale |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
189 // values of other kinds so it must be careful. |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
190 static void cleanup_call_site(virtual_call_Relocation* call_site); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
191 static bool is_icholder_call_site(virtual_call_Relocation* call_site); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
192 |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
193 // Return the cached_metadata/destination associated with this inline cache. If the cache currently points |
0 | 194 // to a transition stub, it will read the values from the transition stub. |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
195 void* cached_value() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
196 CompiledICHolder* cached_icholder() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
197 assert(is_icholder_call(), "must be"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
198 return (CompiledICHolder*) cached_value(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
199 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
200 Metadata* cached_metadata() const { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
201 assert(!is_icholder_call(), "must be"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
202 return (Metadata*) cached_value(); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
203 } |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
204 |
0 | 205 address ic_destination() const; |
206 | |
207 bool is_optimized() const { return _is_optimized; } | |
208 | |
209 // State | |
210 bool is_clean() const; | |
211 bool is_megamorphic() const; | |
212 bool is_call_to_compiled() const; | |
213 bool is_call_to_interpreted() const; | |
214 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
215 bool is_icholder_call() const; |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
216 |
0 | 217 address end_of_call() { return _ic_call->return_address(); } |
218 | |
219 // MT-safe patching of inline caches. Note: Only safe to call is_xxx when holding the CompiledIC_ock | |
220 // so you are guaranteed that no patching takes place. The same goes for verify. | |
221 // | |
222 // Note: We do not provide any direct access to the stub code, to prevent parts of the code | |
223 // to manipulate the inline cache in MT-unsafe ways. | |
224 // | |
225 // They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full. | |
226 // | |
227 void set_to_clean(); // Can only be called during a safepoint operation | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
228 void set_to_monomorphic(CompiledICInfo& info); |
0 | 229 void set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS); |
230 | |
231 static void compute_monomorphic_entry(methodHandle method, KlassHandle receiver_klass, | |
232 bool is_optimized, bool static_bound, CompiledICInfo& info, TRAPS); | |
233 | |
234 // Location | |
235 address instruction_address() const { return _ic_call->instruction_address(); } | |
236 | |
237 // Misc | |
238 void print() PRODUCT_RETURN; | |
239 void print_compiled_ic() PRODUCT_RETURN; | |
240 void verify() PRODUCT_RETURN; | |
241 }; | |
242 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
243 inline CompiledIC* CompiledIC_before(nmethod* nm, address return_addr) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
244 CompiledIC* c_ic = new CompiledIC(nm, nativeCall_before(return_addr)); |
0 | 245 c_ic->verify(); |
246 return c_ic; | |
247 } | |
248 | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
249 inline CompiledIC* CompiledIC_at(nmethod* nm, address call_site) { |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
250 CompiledIC* c_ic = new CompiledIC(nm, nativeCall_at(call_site)); |
0 | 251 c_ic->verify(); |
252 return c_ic; | |
253 } | |
254 | |
255 inline CompiledIC* CompiledIC_at(Relocation* call_site) { | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
256 assert(call_site->type() == relocInfo::virtual_call_type || |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
257 call_site->type() == relocInfo::opt_virtual_call_type, "wrong reloc. info"); |
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
258 CompiledIC* c_ic = new CompiledIC(call_site->code(), nativeCall_at(call_site->addr())); |
0 | 259 c_ic->verify(); |
260 return c_ic; | |
261 } | |
262 | |
263 | |
264 //----------------------------------------------------------------------------- | |
265 // The CompiledStaticCall represents a call to a static method in the compiled | |
266 // | |
267 // Transition diagram of a static call site is somewhat simpler than for an inlined cache: | |
268 // | |
269 // | |
270 // -----<----- Clean ----->----- | |
271 // / \ | |
272 // / \ | |
273 // compilled code <------------> interpreted code | |
274 // | |
275 // Clean: Calls directly to runtime method for fixup | |
276 // Compiled code: Calls directly to compiled code | |
6725
da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
2426
diff
changeset
|
277 // Interpreted code: Calls to stub that set Method* reference |
0 | 278 // |
279 // | |
280 class CompiledStaticCall; | |
281 | |
282 class StaticCallInfo { | |
283 private: | |
284 address _entry; // Entrypoint | |
285 methodHandle _callee; // Callee (used when calling interpreter) | |
286 bool _to_interpreter; // call to interpreted method (otherwise compiled) | |
287 | |
288 friend class CompiledStaticCall; | |
289 public: | |
290 address entry() const { return _entry; } | |
291 methodHandle callee() const { return _callee; } | |
292 }; | |
293 | |
294 | |
295 class CompiledStaticCall: public NativeCall { | |
296 friend class CompiledIC; | |
297 | |
298 // Also used by CompiledIC | |
299 void set_to_interpreted(methodHandle callee, address entry); | |
300 bool is_optimized_virtual(); | |
301 | |
302 public: | |
303 friend CompiledStaticCall* compiledStaticCall_before(address return_addr); | |
304 friend CompiledStaticCall* compiledStaticCall_at(address native_call); | |
305 friend CompiledStaticCall* compiledStaticCall_at(Relocation* call_site); | |
306 | |
307 // State | |
308 bool is_clean() const; | |
309 bool is_call_to_compiled() const; | |
310 bool is_call_to_interpreted() const; | |
311 | |
312 // Clean static call (will force resolving on next use) | |
313 void set_to_clean(); | |
314 | |
315 // Set state. The entry must be the same, as computed by compute_entry. | |
316 // Computation and setting is split up, since the actions are separate during | |
317 // a OptoRuntime::resolve_xxx. | |
318 void set(const StaticCallInfo& info); | |
319 | |
320 // Compute entry point given a method | |
321 static void compute_entry(methodHandle m, StaticCallInfo& info); | |
322 | |
323 // Stub support | |
324 address find_stub(); | |
325 static void set_stub_to_clean(static_stub_Relocation* static_stub); | |
326 | |
327 // Misc. | |
328 void print() PRODUCT_RETURN; | |
329 void verify() PRODUCT_RETURN; | |
330 }; | |
331 | |
332 | |
333 inline CompiledStaticCall* compiledStaticCall_before(address return_addr) { | |
334 CompiledStaticCall* st = (CompiledStaticCall*)nativeCall_before(return_addr); | |
335 st->verify(); | |
336 return st; | |
337 } | |
338 | |
339 inline CompiledStaticCall* compiledStaticCall_at(address native_call) { | |
340 CompiledStaticCall* st = (CompiledStaticCall*)native_call; | |
341 st->verify(); | |
342 return st; | |
343 } | |
344 | |
345 inline CompiledStaticCall* compiledStaticCall_at(Relocation* call_site) { | |
346 return compiledStaticCall_at(call_site->addr()); | |
347 } | |
1972 | 348 |
349 #endif // SHARE_VM_CODE_COMPILEDIC_HPP |