equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2017, 2018, 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. |
53 } |
53 } |
54 } |
54 } |
55 } |
55 } |
56 |
56 |
57 bool UniqueMetaspaceClosure::do_ref(MetaspaceClosure::Ref* ref, bool read_only) { |
57 bool UniqueMetaspaceClosure::do_ref(MetaspaceClosure::Ref* ref, bool read_only) { |
58 bool* found = _has_been_visited.get(ref->obj()); |
58 bool* found = _has_been_visited.lookup(ref->obj()); |
59 if (found != NULL) { |
59 if (found != NULL) { |
60 assert(*found == read_only, "must be"); |
60 assert(*found == read_only, "must be"); |
61 return false; // Already visited: no need to iterate embedded pointers. |
61 return false; // Already visited: no need to iterate embedded pointers. |
62 } else { |
62 } else { |
63 bool isnew = _has_been_visited.put(ref->obj(), read_only); |
63 _has_been_visited.add(ref->obj(), read_only); |
64 assert(isnew, "sanity"); |
64 if (_has_been_visited.maybe_grow(MAX_TABLE_SIZE)) { |
|
65 log_info(cds, hashtables)("Expanded _has_been_visited table to %d", _has_been_visited.table_size()); |
|
66 } |
65 do_unique_ref(ref, read_only); |
67 do_unique_ref(ref, read_only); |
66 return true; // Saw this for the first time: iterate the embedded pointers. |
68 return true; // Saw this for the first time: iterate the embedded pointers. |
67 } |
69 } |
68 } |
70 } |