< prev index next >

src/hotspot/share/gc/shared/preservedMarks.hpp

Print this page

 37 class PreservedMarks {
 38 private:
 39   class OopAndMarkWord {
 40   private:
 41     oop _o;
 42     markWord _m;
 43 
 44   public:
 45     OopAndMarkWord(oop obj, markWord m) : _o(obj), _m(m) { }
 46 
 47     oop get_oop() { return _o; }
 48     inline void set_mark() const;
 49     void set_oop(oop obj) { _o = obj; }
 50   };
 51   typedef Stack<OopAndMarkWord, mtGC> OopAndMarkWordStack;
 52 
 53   OopAndMarkWordStack _stack;
 54 
 55   inline bool should_preserve_mark(oop obj, markWord m) const;
 56 



 57 public:
 58   size_t size() const { return _stack.size(); }
 59   inline void push(oop obj, markWord m);
 60   inline void push_if_necessary(oop obj, markWord m);
 61   inline void push_always(oop obj, markWord m);
 62   // Iterate over the stack, restore all preserved marks, and
 63   // reclaim the memory taken up by the stack segments.
 64   void restore();
 65   // Iterate over the stack, adjust all preserved marks according
 66   // to their forwarding location stored in the mark.
 67   void adjust_during_full_gc();
 68 
 69   void restore_and_increment(volatile size_t* const _total_size_addr);
 70   inline static void init_forwarded_mark(oop obj);
 71 
 72   // Assert the stack is empty and has no cached segments.
 73   void assert_empty() PRODUCT_RETURN;
 74 
 75   inline PreservedMarks();
 76   ~PreservedMarks() { assert_empty(); }

 37 class PreservedMarks {
 38 private:
 39   class OopAndMarkWord {
 40   private:
 41     oop _o;
 42     markWord _m;
 43 
 44   public:
 45     OopAndMarkWord(oop obj, markWord m) : _o(obj), _m(m) { }
 46 
 47     oop get_oop() { return _o; }
 48     inline void set_mark() const;
 49     void set_oop(oop obj) { _o = obj; }
 50   };
 51   typedef Stack<OopAndMarkWord, mtGC> OopAndMarkWordStack;
 52 
 53   OopAndMarkWordStack _stack;
 54 
 55   inline bool should_preserve_mark(oop obj, markWord m) const;
 56 
 57   template <bool ALT_FWD>
 58   void adjust_during_full_gc_impl();
 59 
 60 public:
 61   size_t size() const { return _stack.size(); }
 62   inline void push(oop obj, markWord m);
 63   inline void push_if_necessary(oop obj, markWord m);
 64   inline void push_always(oop obj, markWord m);
 65   // Iterate over the stack, restore all preserved marks, and
 66   // reclaim the memory taken up by the stack segments.
 67   void restore();
 68   // Iterate over the stack, adjust all preserved marks according
 69   // to their forwarding location stored in the mark.
 70   void adjust_during_full_gc();
 71 
 72   void restore_and_increment(volatile size_t* const _total_size_addr);
 73   inline static void init_forwarded_mark(oop obj);
 74 
 75   // Assert the stack is empty and has no cached segments.
 76   void assert_empty() PRODUCT_RETURN;
 77 
 78   inline PreservedMarks();
 79   ~PreservedMarks() { assert_empty(); }
< prev index next >