< prev index next >

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

Print this page

286   assert(k == NULL || k->is_klass(), "type check");
287   return k;
288 }
289 
290 inline bool java_lang_Class::is_primitive(oop java_class) {
291   // should assert:
292   //assert(java_lang_Class::is_instance(java_class), "must be a Class object");
293   bool is_primitive = (java_class->metadata_field(_klass_offset) == NULL);
294 
295 #ifdef ASSERT
296   if (is_primitive) {
297     Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
298     assert(k == NULL || is_java_primitive(ArrayKlass::cast(k)->element_type()),
299         "Should be either the T_VOID primitive or a java primitive");
300   }
301 #endif
302 
303   return is_primitive;
304 }
305 


















306 inline size_t java_lang_Class::oop_size(oop java_class) {
307   assert(_oop_size_offset != 0, "must be set");
308   int size = java_class->int_field(_oop_size_offset);
309   assert(size > 0, "Oop size must be greater than zero, not %d", size);
310   return size;
311 }
312 
313 inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
314   return obj != NULL && is_subclass(obj->klass());
315 }
316 
317 inline bool java_lang_Module::is_instance(oop obj) {
318   return obj != NULL && obj->klass() == vmClasses::Module_klass();
319 }
320 
321 inline int Backtrace::merge_bci_and_version(int bci, int version) {
322   // only store u2 for version, checking for overflow.
323   if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
324   assert((jushort)bci == bci, "bci should be short");
325   return build_int_from_shorts(version, bci);

286   assert(k == NULL || k->is_klass(), "type check");
287   return k;
288 }
289 
290 inline bool java_lang_Class::is_primitive(oop java_class) {
291   // should assert:
292   //assert(java_lang_Class::is_instance(java_class), "must be a Class object");
293   bool is_primitive = (java_class->metadata_field(_klass_offset) == NULL);
294 
295 #ifdef ASSERT
296   if (is_primitive) {
297     Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
298     assert(k == NULL || is_java_primitive(ArrayKlass::cast(k)->element_type()),
299         "Should be either the T_VOID primitive or a java primitive");
300   }
301 #endif
302 
303   return is_primitive;
304 }
305 
306 inline bool java_lang_Class::is_primary_mirror(oop java_class) {
307   Klass* k = as_Klass(java_class);
308   if (k->is_inline_klass()) {
309     return java_class == primary_mirror(java_class);
310   } else {
311     return true;
312   }
313 }
314 
315 inline bool java_lang_Class::is_secondary_mirror(oop java_class) {
316   Klass* k = as_Klass(java_class);
317   if (k->is_inline_klass()) {
318     return java_class == secondary_mirror(java_class);
319   } else {
320     return false;
321   }
322 }
323 
324 inline size_t java_lang_Class::oop_size(oop java_class) {
325   assert(_oop_size_offset != 0, "must be set");
326   int size = java_class->int_field(_oop_size_offset);
327   assert(size > 0, "Oop size must be greater than zero, not %d", size);
328   return size;
329 }
330 
331 inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
332   return obj != NULL && is_subclass(obj->klass());
333 }
334 
335 inline bool java_lang_Module::is_instance(oop obj) {
336   return obj != NULL && obj->klass() == vmClasses::Module_klass();
337 }
338 
339 inline int Backtrace::merge_bci_and_version(int bci, int version) {
340   // only store u2 for version, checking for overflow.
341   if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
342   assert((jushort)bci == bci, "bci should be short");
343   return build_int_from_shorts(version, bci);
< prev index next >