54 size_t strings_processed() const { return _strings_processed; } |
54 size_t strings_processed() const { return _strings_processed; } |
55 size_t strings_removed() const { return _strings_removed; } |
55 size_t strings_removed() const { return _strings_removed; } |
56 }; |
56 }; |
57 |
57 |
58 class CodeCacheUnloadingTask { |
58 class CodeCacheUnloadingTask { |
59 private: |
|
60 static Monitor* _lock; |
59 static Monitor* _lock; |
61 |
60 |
62 BoolObjectClosure* const _is_alive; |
61 CodeCache::UnloadingScope _unloading_scope; |
63 const bool _unloading_occurred; |
62 const bool _unloading_occurred; |
64 const uint _num_workers; |
63 const uint _num_workers; |
65 |
64 |
66 // Variables used to claim nmethods. |
65 // Variables used to claim nmethods. |
67 CompiledMethod* _first_nmethod; |
66 CompiledMethod* _first_nmethod; |
68 CompiledMethod* volatile _claimed_nmethod; |
67 CompiledMethod* volatile _claimed_nmethod; |
69 |
|
70 // The list of nmethods that need to be processed by the second pass. |
|
71 CompiledMethod* volatile _postponed_list; |
|
72 volatile uint _num_entered_barrier; |
|
73 |
68 |
74 public: |
69 public: |
75 CodeCacheUnloadingTask(uint num_workers, BoolObjectClosure* is_alive, bool unloading_occurred); |
70 CodeCacheUnloadingTask(uint num_workers, BoolObjectClosure* is_alive, bool unloading_occurred); |
76 ~CodeCacheUnloadingTask(); |
71 ~CodeCacheUnloadingTask(); |
77 |
72 |
78 private: |
73 private: |
79 void add_to_postponed_list(CompiledMethod* nm); |
74 static const int MaxClaimNmethods = 16; |
80 void clean_nmethod(CompiledMethod* nm); |
75 void claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods); |
81 void clean_nmethod_postponed(CompiledMethod* nm); |
|
82 |
76 |
83 static const int MaxClaimNmethods = 16; |
|
84 |
|
85 void claim_nmethods(CompiledMethod** claimed_nmethods, int *num_claimed_nmethods); |
|
86 CompiledMethod* claim_postponed_nmethod(); |
|
87 public: |
77 public: |
88 // Mark that we're done with the first pass of nmethod cleaning. |
78 // Cleaning and unloading of nmethods. |
89 void barrier_mark(uint worker_id); |
79 void work(uint worker_id); |
90 |
|
91 // See if we have to wait for the other workers to |
|
92 // finish their first-pass nmethod cleaning work. |
|
93 void barrier_wait(uint worker_id); |
|
94 |
|
95 // Cleaning and unloading of nmethods. Some work has to be postponed |
|
96 // to the second pass, when we know which nmethods survive. |
|
97 void work_first_pass(uint worker_id); |
|
98 void work_second_pass(uint worker_id); |
|
99 }; |
80 }; |
100 |
81 |
101 |
82 |
102 class KlassCleaningTask : public StackObj { |
83 class KlassCleaningTask : public StackObj { |
103 volatile int _clean_klass_tree_claimed; |
84 volatile int _clean_klass_tree_claimed; |