annotate src/share/vm/classfile/metadataOnStackMark.cpp @ 23286:dd9cc155639c

Merge with jdk8u66-b17
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Thu, 07 Jan 2016 17:28:46 +0100
parents 76af33d4d504
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 #include "precompiled.hpp"
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
26 #include "classfile/metadataOnStackMark.hpp"
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
27 #include "code/codeCache.hpp"
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
28 #include "compiler/compileBroker.hpp"
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
29 #include "oops/metadata.hpp"
13038
910026b800b8 8026946: JvmtiEnv::SetBreakpoint and JvmtiEnv::ClearBreakpoint should use MethodHandle
coleenp
parents: 7949
diff changeset
30 #include "prims/jvmtiImpl.hpp"
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
31 #include "runtime/synchronizer.hpp"
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
32 #include "runtime/thread.hpp"
13391
0b9ea9a72436 8027630: SIGSEGV in const char*Klass::external_name()
sla
parents: 13038
diff changeset
33 #include "services/threadService.hpp"
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
34 #include "utilities/chunkedList.hpp"
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20619
diff changeset
35 #if INCLUDE_JVMCI
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20619
diff changeset
36 #include "jvmci/jvmciRuntime.hpp"
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20619
diff changeset
37 #endif
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
38
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
39 volatile MetadataOnStackBuffer* MetadataOnStackMark::_used_buffers = NULL;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
40 volatile MetadataOnStackBuffer* MetadataOnStackMark::_free_buffers = NULL;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
41
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
42 NOT_PRODUCT(bool MetadataOnStackMark::_is_active = false;)
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
43
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
44 // Walk metadata on the stack and mark it so that redefinition doesn't delete
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
45 // it. Class unloading also walks the previous versions and might try to
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
46 // delete it, so this class is used by class unloading also.
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
47 MetadataOnStackMark::MetadataOnStackMark(bool visit_code_cache) {
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
48 assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
49 assert(_used_buffers == NULL, "sanity check");
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
50 NOT_PRODUCT(_is_active = true;)
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 13391
diff changeset
51
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
52 Threads::metadata_do(Metadata::mark_on_stack);
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
53 if (visit_code_cache) {
20278
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 13391
diff changeset
54 CodeCache::alive_nmethods_do(nmethod::mark_on_stack);
2c6ef90f030a 8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents: 13391
diff changeset
55 }
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
56 CompileBroker::mark_on_stack();
13038
910026b800b8 8026946: JvmtiEnv::SetBreakpoint and JvmtiEnv::ClearBreakpoint should use MethodHandle
coleenp
parents: 7949
diff changeset
57 JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
13391
0b9ea9a72436 8027630: SIGSEGV in const char*Klass::external_name()
sla
parents: 13038
diff changeset
58 ThreadService::metadata_do(Metadata::mark_on_stack);
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20619
diff changeset
59 #if INCLUDE_JVMCI
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20619
diff changeset
60 JVMCIRuntime::metadata_do(Metadata::mark_on_stack);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 20619
diff changeset
61 #endif
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
62 }
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
63
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
64 MetadataOnStackMark::~MetadataOnStackMark() {
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
65 assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
66 // Unmark everything that was marked. Can't do the same walk because
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
67 // redefine classes messes up the code cache so the set of methods
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
68 // might not be the same.
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
69
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
70 retire_buffer_for_thread(Thread::current());
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
71
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
72 MetadataOnStackBuffer* buffer = const_cast<MetadataOnStackBuffer* >(_used_buffers);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
73 while (buffer != NULL) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
74 // Clear on stack state for all metadata.
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
75 size_t size = buffer->size();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
76 for (size_t i = 0; i < size; i++) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
77 Metadata* md = buffer->at(i);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
78 md->set_on_stack(false);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
79 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
80
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
81 MetadataOnStackBuffer* next = buffer->next_used();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
82
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
83 // Move the buffer to the free list.
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
84 buffer->clear();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
85 buffer->set_next_used(NULL);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
86 buffer->set_next_free(const_cast<MetadataOnStackBuffer*>(_free_buffers));
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
87 _free_buffers = buffer;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
88
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
89 // Step to next used buffer.
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
90 buffer = next;
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
91 }
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
92
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
93 _used_buffers = NULL;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
94
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
95 NOT_PRODUCT(_is_active = false;)
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
96 }
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
97
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
98 void MetadataOnStackMark::retire_buffer(MetadataOnStackBuffer* buffer) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
99 if (buffer == NULL) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
100 return;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
101 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
102
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
103 MetadataOnStackBuffer* old_head;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
104
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
105 do {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
106 old_head = const_cast<MetadataOnStackBuffer*>(_used_buffers);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
107 buffer->set_next_used(old_head);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
108 } while (Atomic::cmpxchg_ptr(buffer, &_used_buffers, old_head) != old_head);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
109 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
110
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
111 void MetadataOnStackMark::retire_buffer_for_thread(Thread* thread) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
112 retire_buffer(thread->metadata_on_stack_buffer());
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
113 thread->set_metadata_on_stack_buffer(NULL);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
114 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
115
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
116 bool MetadataOnStackMark::has_buffer_for_thread(Thread* thread) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
117 return thread->metadata_on_stack_buffer() != NULL;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
118 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
119
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
120 MetadataOnStackBuffer* MetadataOnStackMark::allocate_buffer() {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
121 MetadataOnStackBuffer* allocated;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
122 MetadataOnStackBuffer* new_head;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
123
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
124 do {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
125 allocated = const_cast<MetadataOnStackBuffer*>(_free_buffers);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
126 if (allocated == NULL) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
127 break;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
128 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
129 new_head = allocated->next_free();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
130 } while (Atomic::cmpxchg_ptr(new_head, &_free_buffers, allocated) != allocated);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
131
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
132 if (allocated == NULL) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
133 allocated = new MetadataOnStackBuffer();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
134 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
135
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
136 assert(!allocated->is_full(), err_msg("Should not be full: " PTR_FORMAT, p2i(allocated)));
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
137
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
138 return allocated;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
139 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
140
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
141 // Record which objects are marked so we can unmark the same objects.
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
142 void MetadataOnStackMark::record(Metadata* m, Thread* thread) {
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
143 assert(_is_active, "metadata on stack marking is active");
20619
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
144
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
145 MetadataOnStackBuffer* buffer = thread->metadata_on_stack_buffer();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
146
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
147 if (buffer != NULL && buffer->is_full()) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
148 retire_buffer(buffer);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
149 buffer = NULL;
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
150 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
151
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
152 if (buffer == NULL) {
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
153 buffer = allocate_buffer();
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
154 thread->set_metadata_on_stack_buffer(buffer);
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
155 }
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
156
b12a2a9b05ca 8056240: Investigate increased GC remark time after class unloading changes in CRM Fuse
stefank
parents: 20278
diff changeset
157 buffer->push(m);
7949
5daaddd917a1 8006040: NPG: on_stack processing wastes space in ConstantPool
coleenp
parents:
diff changeset
158 }