< prev index next >

src/hotspot/share/classfile/javaClasses.inline.hpp

Print this page

 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  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP
 26 #define SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP
 27 
 28 #include "classfile/javaClasses.hpp"
 29 
 30 #include "oops/access.inline.hpp"

 31 #include "oops/method.hpp"
 32 #include "oops/oop.inline.hpp"
 33 #include "oops/oopsHierarchy.hpp"

 34 
 35 void java_lang_String::set_coder(oop string, jbyte coder) {
 36   string->byte_field_put(_coder_offset, coder);
 37 }
 38 
 39 void java_lang_String::set_value_raw(oop string, typeArrayOop buffer) {
 40   string->obj_field_put_raw(_value_offset, buffer);
 41 }
 42 
 43 void java_lang_String::set_value(oop string, typeArrayOop buffer) {
 44   string->obj_field_put(_value_offset, buffer);
 45 }
 46 
 47 bool java_lang_String::hash_is_set(oop java_string) {
 48   return java_string->int_field(_hash_offset) != 0 || java_string->bool_field(_hashIsZero_offset) != 0;
 49 }
 50 
 51 // Accessors
 52 bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_value2) {
 53   return ((str_value1 == str_value2) ||

124 }
125 
126 bool java_lang_String::is_instance(oop obj) {
127   return obj != NULL && obj->klass() == vmClasses::String_klass();
128 }
129 
130 // Accessors
131 
132 oop java_lang_ref_Reference::weak_referent_no_keepalive(oop ref) {
133   return ref->obj_field_access<ON_WEAK_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
134 }
135 
136 oop java_lang_ref_Reference::phantom_referent_no_keepalive(oop ref) {
137   return ref->obj_field_access<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
138 }
139 
140 oop java_lang_ref_Reference::unknown_referent_no_keepalive(oop ref) {
141   return ref->obj_field_access<ON_UNKNOWN_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
142 }
143 




144 void java_lang_ref_Reference::clear_referent(oop ref) {
145   ref->obj_field_put_raw(_referent_offset, nullptr);
146 }
147 
148 HeapWord* java_lang_ref_Reference::referent_addr_raw(oop ref) {
149   return ref->field_addr<HeapWord>(_referent_offset);
150 }
151 
152 oop java_lang_ref_Reference::next(oop ref) {
153   return ref->obj_field(_next_offset);
154 }
155 
156 void java_lang_ref_Reference::set_next(oop ref, oop value) {
157   ref->obj_field_put(_next_offset, value);
158 }
159 
160 void java_lang_ref_Reference::set_next_raw(oop ref, oop value) {
161   ref->obj_field_put_raw(_next_offset, value);
162 }
163 

172 void java_lang_ref_Reference::set_discovered(oop ref, oop value) {
173   ref->obj_field_put(_discovered_offset, value);
174 }
175 
176 void java_lang_ref_Reference::set_discovered_raw(oop ref, oop value) {
177   ref->obj_field_put_raw(_discovered_offset, value);
178 }
179 
180 HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) {
181   return ref->field_addr<HeapWord>(_discovered_offset);
182 }
183 
184 bool java_lang_ref_Reference::is_final(oop ref) {
185   return InstanceKlass::cast(ref->klass())->reference_type() == REF_FINAL;
186 }
187 
188 bool java_lang_ref_Reference::is_phantom(oop ref) {
189   return InstanceKlass::cast(ref->klass())->reference_type() == REF_PHANTOM;
190 }
191 




























































































































































192 inline void java_lang_invoke_CallSite::set_target_volatile(oop site, oop target) {
193   site->obj_field_put_volatile(_target_offset, target);
194 }
195 
196 inline oop  java_lang_invoke_CallSite::target(oop site) {
197   return site->obj_field(_target_offset);
198 }
199 
200 inline void java_lang_invoke_CallSite::set_target(oop site, oop target) {
201   site->obj_field_put(_target_offset, target);
202 }
203 
204 inline bool java_lang_invoke_CallSite::is_instance(oop obj) {
205   return obj != NULL && is_subclass(obj->klass());
206 }
207 
208 inline jboolean java_lang_invoke_ConstantCallSite::is_frozen(oop site) {
209   return site->bool_field(_is_frozen_offset);
210 }
211 

 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  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 #ifndef SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP
 26 #define SHARE_CLASSFILE_JAVACLASSES_INLINE_HPP
 27 
 28 #include "classfile/javaClasses.hpp"
 29 
 30 #include "oops/access.inline.hpp"
 31 #include "oops/instanceKlass.inline.hpp"
 32 #include "oops/method.hpp"
 33 #include "oops/oop.inline.hpp"
 34 #include "oops/oopsHierarchy.hpp"
 35 #include "oops/typeArrayOop.inline.hpp"
 36 
 37 void java_lang_String::set_coder(oop string, jbyte coder) {
 38   string->byte_field_put(_coder_offset, coder);
 39 }
 40 
 41 void java_lang_String::set_value_raw(oop string, typeArrayOop buffer) {
 42   string->obj_field_put_raw(_value_offset, buffer);
 43 }
 44 
 45 void java_lang_String::set_value(oop string, typeArrayOop buffer) {
 46   string->obj_field_put(_value_offset, buffer);
 47 }
 48 
 49 bool java_lang_String::hash_is_set(oop java_string) {
 50   return java_string->int_field(_hash_offset) != 0 || java_string->bool_field(_hashIsZero_offset) != 0;
 51 }
 52 
 53 // Accessors
 54 bool java_lang_String::value_equals(typeArrayOop str_value1, typeArrayOop str_value2) {
 55   return ((str_value1 == str_value2) ||

126 }
127 
128 bool java_lang_String::is_instance(oop obj) {
129   return obj != NULL && obj->klass() == vmClasses::String_klass();
130 }
131 
132 // Accessors
133 
134 oop java_lang_ref_Reference::weak_referent_no_keepalive(oop ref) {
135   return ref->obj_field_access<ON_WEAK_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
136 }
137 
138 oop java_lang_ref_Reference::phantom_referent_no_keepalive(oop ref) {
139   return ref->obj_field_access<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
140 }
141 
142 oop java_lang_ref_Reference::unknown_referent_no_keepalive(oop ref) {
143   return ref->obj_field_access<ON_UNKNOWN_OOP_REF | AS_NO_KEEPALIVE>(_referent_offset);
144 }
145 
146 oop java_lang_ref_Reference::unknown_referent(oop ref) {
147   return ref->obj_field_access<ON_UNKNOWN_OOP_REF>(_referent_offset);
148 }
149 
150 void java_lang_ref_Reference::clear_referent(oop ref) {
151   ref->obj_field_put_raw(_referent_offset, nullptr);
152 }
153 
154 HeapWord* java_lang_ref_Reference::referent_addr_raw(oop ref) {
155   return ref->field_addr<HeapWord>(_referent_offset);
156 }
157 
158 oop java_lang_ref_Reference::next(oop ref) {
159   return ref->obj_field(_next_offset);
160 }
161 
162 void java_lang_ref_Reference::set_next(oop ref, oop value) {
163   ref->obj_field_put(_next_offset, value);
164 }
165 
166 void java_lang_ref_Reference::set_next_raw(oop ref, oop value) {
167   ref->obj_field_put_raw(_next_offset, value);
168 }
169 

178 void java_lang_ref_Reference::set_discovered(oop ref, oop value) {
179   ref->obj_field_put(_discovered_offset, value);
180 }
181 
182 void java_lang_ref_Reference::set_discovered_raw(oop ref, oop value) {
183   ref->obj_field_put_raw(_discovered_offset, value);
184 }
185 
186 HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) {
187   return ref->field_addr<HeapWord>(_discovered_offset);
188 }
189 
190 bool java_lang_ref_Reference::is_final(oop ref) {
191   return InstanceKlass::cast(ref->klass())->reference_type() == REF_FINAL;
192 }
193 
194 bool java_lang_ref_Reference::is_phantom(oop ref) {
195   return InstanceKlass::cast(ref->klass())->reference_type() == REF_PHANTOM;
196 }
197 
198 inline oop java_lang_Thread::continuation(oop java_thread) {
199   return java_thread->obj_field(_continuation_offset);
200 }
201 
202 inline oop jdk_internal_vm_ContinuationScope::name(oop ref) {
203   return ref->obj_field(_name_offset);
204 }
205 
206 inline oop jdk_internal_vm_Continuation::scope(oop ref) {
207   return ref->obj_field(_scope_offset);
208 }
209 inline oop jdk_internal_vm_Continuation::target(oop ref) {
210   return ref->obj_field(_target_offset);
211 }
212 inline oop jdk_internal_vm_Continuation::parent(oop ref) {
213   return ref->obj_field(_parent_offset);
214 }
215 inline oop jdk_internal_vm_Continuation::yieldInfo(oop ref) {
216   return ref->obj_field(_yieldInfo_offset);
217 }
218 inline void jdk_internal_vm_Continuation::set_yieldInfo(oop ref, oop value) {
219   ref->obj_field_put(_yieldInfo_offset, value);
220 }
221 inline stackChunkOop jdk_internal_vm_Continuation::tail(oop ref) {
222   return (stackChunkOop)ref->obj_field(_tail_offset);
223 }
224 inline void jdk_internal_vm_Continuation::set_tail(oop ref, stackChunkOop value) {
225   ref->obj_field_put(_tail_offset, value);
226 }
227 inline jshort jdk_internal_vm_Continuation::critical_section(oop ref) {
228   return ref->short_field(_cs_offset);
229 }
230 inline void jdk_internal_vm_Continuation::set_critical_section(oop ref, jshort value) {
231   ref->short_field_put(_cs_offset, value);
232 }
233 inline bool jdk_internal_vm_Continuation::is_reset(oop ref) {
234   return ref->bool_field(_reset_offset);
235 }
236 
237 inline bool jdk_internal_vm_Continuation::done(oop ref) {
238   return ref->bool_field(_done_offset);
239 }
240 inline bool jdk_internal_vm_Continuation::is_mounted(oop ref) {
241   return ref->bool_field(_mounted_offset) != 0;
242 }
243 inline bool jdk_internal_vm_Continuation::is_preempted(oop ref) {
244   return ref->bool_field(_preempted_offset);
245 }
246 inline void jdk_internal_vm_Continuation::set_preempted(oop ref, bool value) {
247   ref->bool_field_put(_preempted_offset, (jboolean)value);
248 }
249 
250 inline oop java_lang_VirtualThread::vthread_scope() {
251   oop base = vmClasses::VirtualThread_klass()->static_field_base_raw();
252   return base->obj_field(static_vthread_scope_offset);
253 }
254 
255 inline jlong java_lang_VirtualThread::set_jfrTraceId(oop ref, jlong id) {
256   ref->long_field_put(java_lang_Thread::_tid_offset, id);
257   return id;
258 }
259 
260 inline oop jdk_internal_vm_StackChunk::parent(oop ref) {
261   return ref->obj_field(_parent_offset);
262 }
263 inline void jdk_internal_vm_StackChunk::set_parent(oop ref, oop value) {
264   ref->obj_field_put(_parent_offset, value);
265 }
266 
267 template<typename P>
268 inline bool jdk_internal_vm_StackChunk::is_parent_null(oop ref) {
269   return (oop)RawAccess<>::oop_load(ref->field_addr<P>(_parent_offset)) == NULL;
270 }
271 
272 template<typename P>
273 inline void jdk_internal_vm_StackChunk::set_parent_raw(oop ref, oop value) {
274   RawAccess<IS_DEST_UNINITIALIZED>::oop_store(ref->field_addr<P>(_parent_offset), value);
275 }
276 inline oop jdk_internal_vm_StackChunk::cont(oop ref) {
277   return ref->obj_field(_cont_offset);
278 }
279 inline void jdk_internal_vm_StackChunk::set_cont(oop ref, oop value) {
280   ref->obj_field_put(_cont_offset, value);
281 }
282 
283 template<typename P>
284 inline oop jdk_internal_vm_StackChunk::cont_raw(oop ref) {
285   return (oop)RawAccess<>::oop_load(ref->field_addr<P>(_cont_offset));
286 }
287 
288 template<typename P>
289 inline void jdk_internal_vm_StackChunk::set_cont_raw(oop ref, oop value) {
290   RawAccess<IS_DEST_UNINITIALIZED>::oop_store(ref->field_addr<P>(_cont_offset), value);
291 }
292 
293 inline jint jdk_internal_vm_StackChunk::size(oop ref) {
294   return ref->int_field(_size_offset);
295 }
296 inline void jdk_internal_vm_StackChunk::set_size(HeapWord* ref, jint value) {
297   *(cast_to_oop(ref))->field_addr<jint>(_size_offset) = value; // ref->int_field_put(_size_offset, value);
298 }
299 inline jint jdk_internal_vm_StackChunk::sp(oop ref) {
300   return ref->int_field(_sp_offset);
301 }
302 inline void jdk_internal_vm_StackChunk::set_sp(oop ref, jint value) {
303   ref->int_field_put(_sp_offset, value);
304 }
305 inline jlong jdk_internal_vm_StackChunk::pc(oop ref) {
306   return ref->long_field(_pc_offset);
307 }
308 inline void jdk_internal_vm_StackChunk::set_pc(oop ref, jlong value) {
309   ref->long_field_put(_pc_offset, value);
310 }
311 inline jint jdk_internal_vm_StackChunk::argsize(oop ref) {
312   return ref->int_field(_argsize_offset);
313 }
314 inline void jdk_internal_vm_StackChunk::set_argsize(oop ref, jint value) {
315   ref->int_field_put(_argsize_offset, value);
316 }
317 inline jbyte jdk_internal_vm_StackChunk::flags(oop ref) {
318   return ref->byte_field(_flags_offset);
319 }
320 inline void jdk_internal_vm_StackChunk::set_flags(oop ref, jbyte value) {
321   ref->byte_field_put(_flags_offset, value);
322 }
323 inline jint jdk_internal_vm_StackChunk::gc_sp(oop ref) {
324   return ref->int_field(_gcSP_offset);
325 }
326 inline void jdk_internal_vm_StackChunk::set_gc_sp(oop ref, jint value) {
327   ref->int_field_put(_gcSP_offset, value);
328 }
329 inline jlong jdk_internal_vm_StackChunk::mark_cycle(oop ref) {
330   return ref->long_field(_markCycle_offset);
331 }
332 inline void jdk_internal_vm_StackChunk::set_mark_cycle(oop ref, jlong value) {
333   ref->long_field_put(_markCycle_offset, value);
334 }
335 inline jint jdk_internal_vm_StackChunk::maxSize(oop ref) {
336   return ref->int_field(_maxSize_offset);
337 }
338 inline void jdk_internal_vm_StackChunk::set_maxSize(oop ref, jint value) {
339   ref->int_field_put(_maxSize_offset, value);
340 }
341 inline jint jdk_internal_vm_StackChunk::numFrames(oop ref) {
342   return ref->int_field(_numFrames_offset);
343 }
344 inline void jdk_internal_vm_StackChunk::set_numFrames(oop ref, jint value) {
345   ref->int_field_put(_numFrames_offset, value);
346 }
347 inline jint jdk_internal_vm_StackChunk::numOops(oop ref) {
348   return ref->int_field(_numOops_offset);
349 }
350 inline void jdk_internal_vm_StackChunk::set_numOops(oop ref, jint value) {
351   ref->int_field_put(_numOops_offset, value);
352 }
353 
354 inline void java_lang_invoke_CallSite::set_target_volatile(oop site, oop target) {
355   site->obj_field_put_volatile(_target_offset, target);
356 }
357 
358 inline oop  java_lang_invoke_CallSite::target(oop site) {
359   return site->obj_field(_target_offset);
360 }
361 
362 inline void java_lang_invoke_CallSite::set_target(oop site, oop target) {
363   site->obj_field_put(_target_offset, target);
364 }
365 
366 inline bool java_lang_invoke_CallSite::is_instance(oop obj) {
367   return obj != NULL && is_subclass(obj->klass());
368 }
369 
370 inline jboolean java_lang_invoke_ConstantCallSite::is_frozen(oop site) {
371   return site->bool_field(_is_frozen_offset);
372 }
373 
< prev index next >