47 |
47 |
48 inline void PreservedMarks::init_forwarded_mark(oop obj) { |
48 inline void PreservedMarks::init_forwarded_mark(oop obj) { |
49 obj->init_mark(); |
49 obj->init_mark(); |
50 } |
50 } |
51 |
51 |
52 template <class E> |
52 inline void PreservedMarksSet::restore(RestorePreservedMarksTaskExecutor* executor) { |
53 inline void PreservedMarksSet::restore(E* executor) { |
|
54 volatile size_t total_size = 0; |
53 volatile size_t total_size = 0; |
55 |
54 |
56 #ifdef ASSERT |
55 #ifdef ASSERT |
57 // This is to make sure the total_size we'll calculate below is correct. |
56 // This is to make sure the total_size we'll calculate below is correct. |
58 size_t total_size_before = 0; |
57 size_t total_size_before = 0; |
59 for (uint i = 0; i < _num; i += 1) { |
58 for (uint i = 0; i < _num; i += 1) { |
60 total_size_before += get(i)->size(); |
59 total_size_before += get(i)->size(); |
61 } |
60 } |
62 #endif // def ASSERT |
61 #endif // def ASSERT |
63 |
62 |
64 if (executor == NULL) { |
63 executor->restore(this, &total_size); |
65 for (uint i = 0; i < _num; i += 1) { |
|
66 total_size += get(i)->size(); |
|
67 get(i)->restore(); |
|
68 } |
|
69 } else { |
|
70 // Right now, if the executor is not NULL we do the work in |
|
71 // parallel. In the future we might want to do the restoration |
|
72 // serially, if there's only a small number of marks per stack. |
|
73 restore_internal(executor, &total_size); |
|
74 } |
|
75 assert_empty(); |
64 assert_empty(); |
76 |
65 |
77 assert(total_size == total_size_before, |
66 assert(total_size == total_size_before, |
78 "total_size = " SIZE_FORMAT " before = " SIZE_FORMAT, |
67 "total_size = " SIZE_FORMAT " before = " SIZE_FORMAT, |
79 total_size, total_size_before); |
68 total_size, total_size_before); |