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_if_necessary(oop obj, markWord m);
60 inline void push_always(oop obj, markWord m);
61 // Iterate over the stack, restore all preserved marks, and
62 // reclaim the memory taken up by the stack segments.
63 void restore();
64 // Iterate over the stack, adjust all preserved marks according
65 // to their forwarding location stored in the mark.
66 void adjust_during_full_gc();
67
68 void restore_and_increment(volatile size_t* const _total_size_addr);
69
70 // Assert the stack is empty and has no cached segments.
71 void assert_empty() PRODUCT_RETURN;
72
73 inline PreservedMarks();
74 ~PreservedMarks() { assert_empty(); }
75 };
76
|
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_if_necessary(oop obj, markWord m);
63 inline void push_always(oop obj, markWord m);
64 // Iterate over the stack, restore all preserved marks, and
65 // reclaim the memory taken up by the stack segments.
66 void restore();
67 // Iterate over the stack, adjust all preserved marks according
68 // to their forwarding location stored in the mark.
69 void adjust_during_full_gc();
70
71 void restore_and_increment(volatile size_t* const _total_size_addr);
72
73 // Assert the stack is empty and has no cached segments.
74 void assert_empty() PRODUCT_RETURN;
75
76 inline PreservedMarks();
77 ~PreservedMarks() { assert_empty(); }
78 };
79
|