1 /* |
1 /* |
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 * |
22 * |
23 */ |
23 */ |
24 |
24 |
25 #include "precompiled.hpp" |
25 #include "precompiled.hpp" |
|
26 #include "classfile/classLoaderData.hpp" |
26 #include "memory/cardTableRS.hpp" |
27 #include "memory/cardTableRS.hpp" |
27 #include "memory/genRemSet.hpp" |
28 #include "memory/genRemSet.hpp" |
28 |
29 |
29 // This kind of "BarrierSet" allows a "CollectedHeap" to detect and |
30 // This kind of "BarrierSet" allows a "CollectedHeap" to detect and |
30 // enumerate ref fields that have been modified (since the last |
31 // enumerate ref fields that have been modified (since the last |
37 default: |
38 default: |
38 guarantee(false, "Unrecognized GenRemSet type."); |
39 guarantee(false, "Unrecognized GenRemSet type."); |
39 return (0); // Make Windows compiler happy |
40 return (0); // Make Windows compiler happy |
40 } |
41 } |
41 } |
42 } |
|
43 |
|
44 class HasAccumulatedModifiedOopsClosure : public KlassClosure { |
|
45 bool _found; |
|
46 public: |
|
47 HasAccumulatedModifiedOopsClosure() : _found(false) {} |
|
48 void do_klass(Klass* klass) { |
|
49 if (_found) { |
|
50 return; |
|
51 } |
|
52 |
|
53 if (klass->has_accumulated_modified_oops()) { |
|
54 _found = true; |
|
55 } |
|
56 } |
|
57 bool found() { |
|
58 return _found; |
|
59 } |
|
60 }; |
|
61 |
|
62 bool KlassRemSet::mod_union_is_clear() { |
|
63 HasAccumulatedModifiedOopsClosure closure; |
|
64 ClassLoaderDataGraph::classes_do(&closure); |
|
65 |
|
66 return !closure.found(); |
|
67 } |
|
68 |
|
69 |
|
70 class ClearKlassModUnionClosure : public KlassClosure { |
|
71 public: |
|
72 void do_klass(Klass* klass) { |
|
73 if (klass->has_accumulated_modified_oops()) { |
|
74 klass->clear_accumulated_modified_oops(); |
|
75 } |
|
76 } |
|
77 }; |
|
78 |
|
79 void KlassRemSet::clear_mod_union() { |
|
80 ClearKlassModUnionClosure closure; |
|
81 ClassLoaderDataGraph::classes_do(&closure); |
|
82 } |