src/share/vm/memory/genRemSet.cpp

changeset 4037
da91efe96a93
parent 2314
f95d63e2154a
child 5818
ab68fc0101ce
     1.1 --- a/src/share/vm/memory/genRemSet.cpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/memory/genRemSet.cpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -23,6 +23,7 @@
    1.11   */
    1.12  
    1.13  #include "precompiled.hpp"
    1.14 +#include "classfile/classLoaderData.hpp"
    1.15  #include "memory/cardTableRS.hpp"
    1.16  #include "memory/genRemSet.hpp"
    1.17  
    1.18 @@ -39,3 +40,43 @@
    1.19      return (0); // Make Windows compiler happy
    1.20    }
    1.21  }
    1.22 +
    1.23 +class HasAccumulatedModifiedOopsClosure : public KlassClosure {
    1.24 +  bool _found;
    1.25 + public:
    1.26 +  HasAccumulatedModifiedOopsClosure() : _found(false) {}
    1.27 +  void do_klass(Klass* klass) {
    1.28 +    if (_found) {
    1.29 +      return;
    1.30 +    }
    1.31 +
    1.32 +    if (klass->has_accumulated_modified_oops()) {
    1.33 +      _found = true;
    1.34 +    }
    1.35 +  }
    1.36 +  bool found() {
    1.37 +    return _found;
    1.38 +  }
    1.39 +};
    1.40 +
    1.41 +bool KlassRemSet::mod_union_is_clear() {
    1.42 +  HasAccumulatedModifiedOopsClosure closure;
    1.43 +  ClassLoaderDataGraph::classes_do(&closure);
    1.44 +
    1.45 +  return !closure.found();
    1.46 +}
    1.47 +
    1.48 +
    1.49 +class ClearKlassModUnionClosure : public KlassClosure {
    1.50 + public:
    1.51 +  void do_klass(Klass* klass) {
    1.52 +    if (klass->has_accumulated_modified_oops()) {
    1.53 +      klass->clear_accumulated_modified_oops();
    1.54 +    }
    1.55 +  }
    1.56 +};
    1.57 +
    1.58 +void KlassRemSet::clear_mod_union() {
    1.59 +  ClearKlassModUnionClosure closure;
    1.60 +  ClassLoaderDataGraph::classes_do(&closure);
    1.61 +}

mercurial