Mercurial > hg > truffle
comparison src/share/vm/oops/oop.inline.hpp @ 344:6aae2f9d0294
Merge
author | ysr |
---|---|
date | Thu, 12 Jun 2008 13:50:55 -0700 |
parents | 37f87013dfd8 feeb96a45707 |
children | 1ee8caae33af |
comparison
equal
deleted
inserted
replaced
342:37f87013dfd8 | 344:6aae2f9d0294 |
---|---|
34 } | 34 } |
35 | 35 |
36 inline klassOop oopDesc::klass() const { | 36 inline klassOop oopDesc::klass() const { |
37 if (UseCompressedOops) { | 37 if (UseCompressedOops) { |
38 return (klassOop)decode_heap_oop_not_null(_metadata._compressed_klass); | 38 return (klassOop)decode_heap_oop_not_null(_metadata._compressed_klass); |
39 // can be NULL in CMS, but isn't supported on CMS yet. | 39 } else { |
40 return _metadata._klass; | |
41 } | |
42 } | |
43 | |
44 inline klassOop oopDesc::klass_or_null() const volatile { | |
45 // can be NULL in CMS | |
46 if (UseCompressedOops) { | |
47 return (klassOop)decode_heap_oop(_metadata._compressed_klass); | |
40 } else { | 48 } else { |
41 return _metadata._klass; | 49 return _metadata._klass; |
42 } | 50 } |
43 } | 51 } |
44 | 52 |
62 inline void oopDesc::set_klass(klassOop k) { | 70 inline void oopDesc::set_klass(klassOop k) { |
63 // since klasses are promoted no store check is needed | 71 // since klasses are promoted no store check is needed |
64 assert(Universe::is_bootstrapping() || k != NULL, "must be a real klassOop"); | 72 assert(Universe::is_bootstrapping() || k != NULL, "must be a real klassOop"); |
65 assert(Universe::is_bootstrapping() || k->is_klass(), "not a klassOop"); | 73 assert(Universe::is_bootstrapping() || k->is_klass(), "not a klassOop"); |
66 if (UseCompressedOops) { | 74 if (UseCompressedOops) { |
67 // zero the gap when the klass is set, by zeroing the pointer sized | |
68 // part of the union. | |
69 _metadata._klass = NULL; | |
70 oop_store_without_check(compressed_klass_addr(), (oop)k); | 75 oop_store_without_check(compressed_klass_addr(), (oop)k); |
71 } else { | 76 } else { |
72 oop_store_without_check(klass_addr(), (oop) k); | 77 oop_store_without_check(klass_addr(), (oop) k); |
78 } | |
79 } | |
80 | |
81 inline int oopDesc::klass_gap() const { | |
82 return *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()); | |
83 } | |
84 | |
85 inline void oopDesc::set_klass_gap(int v) { | |
86 if (UseCompressedOops) { | |
87 *(int*)(((intptr_t)this) + klass_gap_offset_in_bytes()) = v; | |
73 } | 88 } |
74 } | 89 } |
75 | 90 |
76 inline void oopDesc::set_klass_to_list_ptr(oop k) { | 91 inline void oopDesc::set_klass_to_list_ptr(oop k) { |
77 // This is only to be used during GC, for from-space objects, so no | 92 // This is only to be used during GC, for from-space objects, so no |
508 if (!Universe::heap()->is_in_reserved(obj)) return false; | 523 if (!Universe::heap()->is_in_reserved(obj)) return false; |
509 // obj is aligned and accessible in heap | 524 // obj is aligned and accessible in heap |
510 // try to find metaclass cycle safely without seg faulting on bad input | 525 // try to find metaclass cycle safely without seg faulting on bad input |
511 // we should reach klassKlassObj by following klass link at most 3 times | 526 // we should reach klassKlassObj by following klass link at most 3 times |
512 for (int i = 0; i < 3; i++) { | 527 for (int i = 0; i < 3; i++) { |
513 obj = obj->klass(); | 528 obj = obj->klass_or_null(); |
514 // klass should be aligned and in permspace | 529 // klass should be aligned and in permspace |
515 if (!check_obj_alignment(obj)) return false; | 530 if (!check_obj_alignment(obj)) return false; |
516 if (!Universe::heap()->is_in_permanent(obj)) return false; | 531 if (!Universe::heap()->is_in_permanent(obj)) return false; |
517 } | 532 } |
518 if (obj != Universe::klassKlassObj()) { | 533 if (obj != Universe::klassKlassObj()) { |