annotate src/share/vm/classfile/metadataOnStackMark.hpp @ 20619:b12a2a9b05ca

8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse Reviewed-by: mgerdin, coleenp, bdelsart
author stefank
date Thu, 02 Oct 2014 10:55:36 +0200
parents 5daaddd917a1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
1 /*
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
4 *
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
7 * published by the Free Software Foundation.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
8 *
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
13 * accompanied this code).
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
14 *
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
18 *
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
21 * questions.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
22 *
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
23 */
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
24
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
25 #ifndef SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
26 #define SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
27
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
28 #include "memory/allocation.hpp"
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
29 #include "utilities/chunkedList.hpp"
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
30
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
31 class Metadata;
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
32
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
33 typedef ChunkedList<Metadata*, mtInternal> MetadataOnStackBuffer;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
34
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
35 // Helper class to mark and unmark metadata used on the stack as either handles
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
36 // or executing methods, so that it can't be deleted during class redefinition
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
37 // and class unloading.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
38 // This is also used for other things that can be deallocated, like class
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
39 // metadata during parsing, relocated methods, and methods in backtraces.
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
40 class MetadataOnStackMark : public StackObj {
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
41 NOT_PRODUCT(static bool _is_active;)
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
42
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
43 static volatile MetadataOnStackBuffer* _used_buffers;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
44 static volatile MetadataOnStackBuffer* _free_buffers;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
45
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
46 static MetadataOnStackBuffer* allocate_buffer();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
47 static void retire_buffer(MetadataOnStackBuffer* buffer);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
48
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
49 public:
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
50 MetadataOnStackMark(bool visit_code_cache);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
51 ~MetadataOnStackMark();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
52
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
53 static void record(Metadata* m, Thread* thread);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
54 static void retire_buffer_for_thread(Thread* thread);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 7949
diff changeset
55 static bool has_buffer_for_thread(Thread* thread);
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
56 };
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
57
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
58 #endif // SHARE_VM_CLASSFILE_METADATAONSTACKMARK_HPP