Mercurial > hg > truffle
comparison src/share/vm/oops/oop.inline.hpp @ 14521:29ccc4cbabca
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 12 Mar 2014 13:30:08 +0100 |
parents | d8041d695d19 |
children | 4ca6dc0799b6 |
comparison
equal
deleted
inserted
replaced
14520:f84115370178 | 14521:29ccc4cbabca |
---|---|
145 | 145 |
146 inline void oopDesc::init_mark() { set_mark(markOopDesc::prototype_for_object(this)); } | 146 inline void oopDesc::init_mark() { set_mark(markOopDesc::prototype_for_object(this)); } |
147 | 147 |
148 inline bool oopDesc::is_a(Klass* k) const { return klass()->is_subtype_of(k); } | 148 inline bool oopDesc::is_a(Klass* k) const { return klass()->is_subtype_of(k); } |
149 | 149 |
150 inline bool oopDesc::is_instance() const { return klass()->oop_is_instance(); } | 150 inline bool oopDesc::is_instance() const { return klass()->oop_is_instance(); } |
151 inline bool oopDesc::is_instanceMirror() const { return klass()->oop_is_instanceMirror(); } | 151 inline bool oopDesc::is_instanceClassLoader() const { return klass()->oop_is_instanceClassLoader(); } |
152 inline bool oopDesc::is_instanceRef() const { return klass()->oop_is_instanceRef(); } | 152 inline bool oopDesc::is_instanceMirror() const { return klass()->oop_is_instanceMirror(); } |
153 inline bool oopDesc::is_array() const { return klass()->oop_is_array(); } | 153 inline bool oopDesc::is_instanceRef() const { return klass()->oop_is_instanceRef(); } |
154 inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); } | 154 inline bool oopDesc::is_array() const { return klass()->oop_is_array(); } |
155 inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); } | 155 inline bool oopDesc::is_objArray() const { return klass()->oop_is_objArray(); } |
156 inline bool oopDesc::is_typeArray() const { return klass()->oop_is_typeArray(); } | |
156 | 157 |
157 inline void* oopDesc::field_base(int offset) const { return (void*)&((char*)this)[offset]; } | 158 inline void* oopDesc::field_base(int offset) const { return (void*)&((char*)this)[offset]; } |
158 | 159 |
159 template <class T> inline T* oopDesc::obj_field_addr(int offset) const { return (T*)field_base(offset); } | 160 template <class T> inline T* oopDesc::obj_field_addr(int offset) const { return (T*)field_base(offset); } |
160 inline Metadata** oopDesc::metadata_field_addr(int offset) const { return (Metadata**)field_base(offset); } | 161 inline Metadata** oopDesc::metadata_field_addr(int offset) const { return (Metadata**)field_base(offset); } |
488 | 489 |
489 inline int oopDesc::size() { | 490 inline int oopDesc::size() { |
490 return size_given_klass(klass()); | 491 return size_given_klass(klass()); |
491 } | 492 } |
492 | 493 |
493 inline void update_barrier_set(void* p, oop v) { | 494 inline void update_barrier_set(void* p, oop v, bool release = false) { |
494 assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!"); | 495 assert(oopDesc::bs() != NULL, "Uninitialized bs in oop!"); |
495 oopDesc::bs()->write_ref_field(p, v); | 496 oopDesc::bs()->write_ref_field(p, v, release); |
496 } | 497 } |
497 | 498 |
498 template <class T> inline void update_barrier_set_pre(T* p, oop v) { | 499 template <class T> inline void update_barrier_set_pre(T* p, oop v) { |
499 oopDesc::bs()->write_ref_field_pre(p, v); | 500 oopDesc::bs()->write_ref_field_pre(p, v); |
500 } | 501 } |
503 if (always_do_update_barrier) { | 504 if (always_do_update_barrier) { |
504 oop_store((volatile T*)p, v); | 505 oop_store((volatile T*)p, v); |
505 } else { | 506 } else { |
506 update_barrier_set_pre(p, v); | 507 update_barrier_set_pre(p, v); |
507 oopDesc::encode_store_heap_oop(p, v); | 508 oopDesc::encode_store_heap_oop(p, v); |
508 update_barrier_set((void*)p, v); // cast away type | 509 // always_do_update_barrier == false => |
510 // Either we are at a safepoint (in GC) or CMS is not used. In both | |
511 // cases it's unnecessary to mark the card as dirty with release sematics. | |
512 update_barrier_set((void*)p, v, false /* release */); // cast away type | |
509 } | 513 } |
510 } | 514 } |
511 | 515 |
512 template <class T> inline void oop_store(volatile T* p, oop v) { | 516 template <class T> inline void oop_store(volatile T* p, oop v) { |
513 update_barrier_set_pre((T*)p, v); // cast away volatile | 517 update_barrier_set_pre((T*)p, v); // cast away volatile |
514 // Used by release_obj_field_put, so use release_store_ptr. | 518 // Used by release_obj_field_put, so use release_store_ptr. |
515 oopDesc::release_encode_store_heap_oop(p, v); | 519 oopDesc::release_encode_store_heap_oop(p, v); |
516 update_barrier_set((void*)p, v); // cast away type | 520 // When using CMS we must mark the card corresponding to p as dirty |
521 // with release sematics to prevent that CMS sees the dirty card but | |
522 // not the new value v at p due to reordering of the two | |
523 // stores. Note that CMS has a concurrent precleaning phase, where | |
524 // it reads the card table while the Java threads are running. | |
525 update_barrier_set((void*)p, v, true /* release */); // cast away type | |
517 } | 526 } |
518 | 527 |
519 // Should replace *addr = oop assignments where addr type depends on UseCompressedOops | 528 // Should replace *addr = oop assignments where addr type depends on UseCompressedOops |
520 // (without having to remember the function name this calls). | 529 // (without having to remember the function name this calls). |
521 inline void oop_store_raw(HeapWord* addr, oop value) { | 530 inline void oop_store_raw(HeapWord* addr, oop value) { |