< prev index next >

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

Print this page

244   assert(k == NULL || k->is_klass(), "type check");
245   return k;
246 }
247 
248 inline bool java_lang_Class::is_primitive(oop java_class) {
249   // should assert:
250   //assert(java_lang_Class::is_instance(java_class), "must be a Class object");
251   bool is_primitive = (java_class->metadata_field(_klass_offset) == NULL);
252 
253 #ifdef ASSERT
254   if (is_primitive) {
255     Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
256     assert(k == NULL || is_java_primitive(ArrayKlass::cast(k)->element_type()),
257         "Should be either the T_VOID primitive or a java primitive");
258   }
259 #endif
260 
261   return is_primitive;
262 }
263 


















264 inline int java_lang_Class::oop_size(oop java_class) {
265   assert(_oop_size_offset != 0, "must be set");
266   int size = java_class->int_field(_oop_size_offset);
267   assert(size > 0, "Oop size must be greater than zero, not %d", size);
268   return size;
269 }
270 
271 inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
272   return obj != NULL && is_subclass(obj->klass());
273 }
274 
275 inline bool java_lang_Module::is_instance(oop obj) {
276   return obj != NULL && obj->klass() == vmClasses::Module_klass();
277 }
278 
279 inline int Backtrace::merge_bci_and_version(int bci, int version) {
280   // only store u2 for version, checking for overflow.
281   if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
282   assert((jushort)bci == bci, "bci should be short");
283   return build_int_from_shorts(version, bci);

244   assert(k == NULL || k->is_klass(), "type check");
245   return k;
246 }
247 
248 inline bool java_lang_Class::is_primitive(oop java_class) {
249   // should assert:
250   //assert(java_lang_Class::is_instance(java_class), "must be a Class object");
251   bool is_primitive = (java_class->metadata_field(_klass_offset) == NULL);
252 
253 #ifdef ASSERT
254   if (is_primitive) {
255     Klass* k = ((Klass*)java_class->metadata_field(_array_klass_offset));
256     assert(k == NULL || is_java_primitive(ArrayKlass::cast(k)->element_type()),
257         "Should be either the T_VOID primitive or a java primitive");
258   }
259 #endif
260 
261   return is_primitive;
262 }
263 
264 inline bool java_lang_Class::is_primary_mirror(oop java_class) {
265   Klass* k = as_Klass(java_class);
266   if (k->is_inline_klass()) {
267     return java_class == primary_mirror(java_class);
268   } else {
269     return true;
270   }
271 }
272 
273 inline bool java_lang_Class::is_secondary_mirror(oop java_class) {
274   Klass* k = as_Klass(java_class);
275   if (k->is_inline_klass()) {
276     return java_class == secondary_mirror(java_class);
277   } else {
278     return false;
279   }
280 }
281 
282 inline int java_lang_Class::oop_size(oop java_class) {
283   assert(_oop_size_offset != 0, "must be set");
284   int size = java_class->int_field(_oop_size_offset);
285   assert(size > 0, "Oop size must be greater than zero, not %d", size);
286   return size;
287 }
288 
289 inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
290   return obj != NULL && is_subclass(obj->klass());
291 }
292 
293 inline bool java_lang_Module::is_instance(oop obj) {
294   return obj != NULL && obj->klass() == vmClasses::Module_klass();
295 }
296 
297 inline int Backtrace::merge_bci_and_version(int bci, int version) {
298   // only store u2 for version, checking for overflow.
299   if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
300   assert((jushort)bci == bci, "bci should be short");
301   return build_int_from_shorts(version, bci);
< prev index next >