annotate src/share/vm/code/icBuffer.cpp @ 17716:cdb71841f4bc

6498581: ThreadInterruptTest3 produces wrong output on Windows Summary: There is race condition between os::interrupt and os::is_interrupted on Windows. In JVM_Sleep(Thread.sleep), check if thread gets interrupted, it may see interrupted but not really interrupted so cause spurious waking up (early return from sleep). Fix by checking if interrupt event really gets set thus prevent false return. For intrinsic of _isInterrupted, on Windows, go fastpath only on bit not set. Reviewed-by: acorn, kvn Contributed-by: david.holmes@oracle.com, yumin.qi@oracle.com
author minqi
date Wed, 26 Feb 2014 15:20:41 -0800
parents cd3d6a6b95d9
children 291ffc492eb6 78bbf4d43a14
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #include "precompiled.hpp"
7199
cd3d6a6b95d9 8003240: x86: move MacroAssembler into separate file
twisti
parents: 6725
diff changeset
26 #include "code/codeCache.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27 #include "code/compiledIC.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "code/icBuffer.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "code/nmethod.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "code/scopeDesc.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "gc_interface/collectedHeap.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "interpreter/interpreter.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "interpreter/linkResolver.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34 #include "memory/resourceArea.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
35 #include "memory/universe.inline.hpp"
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
36 #include "oops/method.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
37 #include "oops/oop.inline.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
38 #include "oops/oop.inline2.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
39 #include "runtime/mutexLocker.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
40 #include "runtime/stubRoutines.hpp"
0
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42
a61af66fc99e Initial load
duke
parents:
diff changeset
43 DEF_STUB_INTERFACE(ICStub);
a61af66fc99e Initial load
duke
parents:
diff changeset
44
a61af66fc99e Initial load
duke
parents:
diff changeset
45 StubQueue* InlineCacheBuffer::_buffer = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ICStub* InlineCacheBuffer::_next_stub = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
47
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
48 CompiledICHolder* InlineCacheBuffer::_pending_released = NULL;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
49 int InlineCacheBuffer::_pending_count = 0;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 void ICStub::finalize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
52 if (!is_empty()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
53 ResourceMark rm;
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
54 CompiledIC *ic = CompiledIC_at(CodeCache::find_nmethod(ic_site()), ic_site());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
55 assert(CodeCache::find_nmethod(ic->instruction_address()) != NULL, "inline cache in non-nmethod?");
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 assert(this == ICStub_from_destination_address(ic->stub_address()), "wrong owner of ic buffer");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
58 ic->set_ic_destination_and_value(destination(), cached_value());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
59 }
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62
a61af66fc99e Initial load
duke
parents:
diff changeset
63 address ICStub::destination() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
64 return InlineCacheBuffer::ic_buffer_entry_point(code_begin());
a61af66fc99e Initial load
duke
parents:
diff changeset
65 }
a61af66fc99e Initial load
duke
parents:
diff changeset
66
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
67 void* ICStub::cached_value() const {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
68 return InlineCacheBuffer::ic_buffer_cached_value(code_begin());
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69 }
a61af66fc99e Initial load
duke
parents:
diff changeset
70
a61af66fc99e Initial load
duke
parents:
diff changeset
71
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
72 void ICStub::set_stub(CompiledIC *ic, void* cached_val, address dest_addr) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // We cannot store a pointer to the 'ic' object, since it is resource allocated. Instead we
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // store the location of the inline cache. Then we have enough information recreate the CompiledIC
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // object when we need to remove the stub.
a61af66fc99e Initial load
duke
parents:
diff changeset
76 _ic_site = ic->instruction_address();
a61af66fc99e Initial load
duke
parents:
diff changeset
77
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // Assemble new stub
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
79 InlineCacheBuffer::assemble_ic_buffer_code(code_begin(), cached_val, dest_addr);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
80 assert(destination() == dest_addr, "can recover destination");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
81 assert(cached_value() == cached_val, "can recover destination");
0
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void ICStub::clear() {
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
86 if (CompiledIC::is_icholder_entry(destination())) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
87 InlineCacheBuffer::queue_for_release((CompiledICHolder*)cached_value());
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
88 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
89 _ic_site = NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
90 }
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92
a61af66fc99e Initial load
duke
parents:
diff changeset
93 #ifndef PRODUCT
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // anybody calling to this stub will trap
a61af66fc99e Initial load
duke
parents:
diff changeset
95
a61af66fc99e Initial load
duke
parents:
diff changeset
96 void ICStub::verify() {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void ICStub::print() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 tty->print_cr("ICStub: site: " INTPTR_FORMAT, _ic_site);
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 //-----------------------------------------------------------------------------------------------
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // Implementation of InlineCacheBuffer
a61af66fc99e Initial load
duke
parents:
diff changeset
106
a61af66fc99e Initial load
duke
parents:
diff changeset
107 void InlineCacheBuffer::init_next_stub() {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 ICStub* ic_stub = (ICStub*)buffer()->request_committed (ic_stub_code_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
109 assert (ic_stub != NULL, "no room for a single stub");
a61af66fc99e Initial load
duke
parents:
diff changeset
110 set_next_stub(ic_stub);
a61af66fc99e Initial load
duke
parents:
diff changeset
111 }
a61af66fc99e Initial load
duke
parents:
diff changeset
112
a61af66fc99e Initial load
duke
parents:
diff changeset
113 void InlineCacheBuffer::initialize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (_buffer != NULL) return; // already initialized
a61af66fc99e Initial load
duke
parents:
diff changeset
115 _buffer = new StubQueue(new ICStubInterface, 10*K, InlineCacheBuffer_lock, "InlineCacheBuffer");
a61af66fc99e Initial load
duke
parents:
diff changeset
116 assert (_buffer != NULL, "cannot allocate InlineCacheBuffer");
a61af66fc99e Initial load
duke
parents:
diff changeset
117 init_next_stub();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 }
a61af66fc99e Initial load
duke
parents:
diff changeset
119
a61af66fc99e Initial load
duke
parents:
diff changeset
120
a61af66fc99e Initial load
duke
parents:
diff changeset
121 ICStub* InlineCacheBuffer::new_ic_stub() {
a61af66fc99e Initial load
duke
parents:
diff changeset
122 while (true) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 ICStub* ic_stub = (ICStub*)buffer()->request_committed(ic_stub_code_size());
a61af66fc99e Initial load
duke
parents:
diff changeset
124 if (ic_stub != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
125 return ic_stub;
a61af66fc99e Initial load
duke
parents:
diff changeset
126 }
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // we ran out of inline cache buffer space; must enter safepoint.
a61af66fc99e Initial load
duke
parents:
diff changeset
128 // We do this by forcing a safepoint
a61af66fc99e Initial load
duke
parents:
diff changeset
129 EXCEPTION_MARK;
a61af66fc99e Initial load
duke
parents:
diff changeset
130
a61af66fc99e Initial load
duke
parents:
diff changeset
131 VM_ForceSafepoint vfs;
a61af66fc99e Initial load
duke
parents:
diff changeset
132 VMThread::execute(&vfs);
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // We could potential get an async. exception at this point.
a61af66fc99e Initial load
duke
parents:
diff changeset
134 // In that case we will rethrow it to ourselvs.
a61af66fc99e Initial load
duke
parents:
diff changeset
135 if (HAS_PENDING_EXCEPTION) {
a61af66fc99e Initial load
duke
parents:
diff changeset
136 oop exception = PENDING_EXCEPTION;
a61af66fc99e Initial load
duke
parents:
diff changeset
137 CLEAR_PENDING_EXCEPTION;
a61af66fc99e Initial load
duke
parents:
diff changeset
138 Thread::send_async_exception(JavaThread::current()->threadObj(), exception);
a61af66fc99e Initial load
duke
parents:
diff changeset
139 }
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
142 return NULL;
a61af66fc99e Initial load
duke
parents:
diff changeset
143 }
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145
a61af66fc99e Initial load
duke
parents:
diff changeset
146 void InlineCacheBuffer::update_inline_caches() {
a61af66fc99e Initial load
duke
parents:
diff changeset
147 if (buffer()->number_of_stubs() > 1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
148 if (TraceICBuffer) {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 tty->print_cr("[updating inline caches with %d stubs]", buffer()->number_of_stubs());
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 buffer()->remove_all();
a61af66fc99e Initial load
duke
parents:
diff changeset
152 init_next_stub();
a61af66fc99e Initial load
duke
parents:
diff changeset
153 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
154 release_pending_icholders();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
155 }
a61af66fc99e Initial load
duke
parents:
diff changeset
156
a61af66fc99e Initial load
duke
parents:
diff changeset
157
a61af66fc99e Initial load
duke
parents:
diff changeset
158 bool InlineCacheBuffer::contains(address instruction_address) {
a61af66fc99e Initial load
duke
parents:
diff changeset
159 return buffer()->contains(instruction_address);
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 bool InlineCacheBuffer::is_empty() {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 return buffer()->number_of_stubs() == 1; // always has sentinel
a61af66fc99e Initial load
duke
parents:
diff changeset
165 }
a61af66fc99e Initial load
duke
parents:
diff changeset
166
a61af66fc99e Initial load
duke
parents:
diff changeset
167
a61af66fc99e Initial load
duke
parents:
diff changeset
168 void InlineCacheBuffer_init() {
a61af66fc99e Initial load
duke
parents:
diff changeset
169 InlineCacheBuffer::initialize();
a61af66fc99e Initial load
duke
parents:
diff changeset
170 }
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
173 void InlineCacheBuffer::create_transition_stub(CompiledIC *ic, void* cached_value, address entry) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
174 assert(!SafepointSynchronize::is_at_safepoint(), "should not be called during a safepoint");
a61af66fc99e Initial load
duke
parents:
diff changeset
175 assert (CompiledIC_lock->is_locked(), "");
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
176 if (TraceICBuffer) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
177 tty->print_cr(" create transition stub for " INTPTR_FORMAT " destination " INTPTR_FORMAT " cached value " INTPTR_FORMAT,
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
178 ic->instruction_address(), entry, cached_value);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
179 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
180
a61af66fc99e Initial load
duke
parents:
diff changeset
181 // If an transition stub is already associate with the inline cache, then we remove the association.
a61af66fc99e Initial load
duke
parents:
diff changeset
182 if (ic->is_in_transition_state()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
183 ICStub* old_stub = ICStub_from_destination_address(ic->stub_address());
a61af66fc99e Initial load
duke
parents:
diff changeset
184 old_stub->clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
185 }
a61af66fc99e Initial load
duke
parents:
diff changeset
186
a61af66fc99e Initial load
duke
parents:
diff changeset
187 // allocate and initialize new "out-of-line" inline-cache
a61af66fc99e Initial load
duke
parents:
diff changeset
188 ICStub* ic_stub = get_next_stub();
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
189 ic_stub->set_stub(ic, cached_value, entry);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
190
a61af66fc99e Initial load
duke
parents:
diff changeset
191 // Update inline cache in nmethod to point to new "out-of-line" allocated inline cache
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
192 ic->set_ic_destination(ic_stub);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
193
a61af66fc99e Initial load
duke
parents:
diff changeset
194 set_next_stub(new_ic_stub()); // can cause safepoint synchronization
a61af66fc99e Initial load
duke
parents:
diff changeset
195 }
a61af66fc99e Initial load
duke
parents:
diff changeset
196
a61af66fc99e Initial load
duke
parents:
diff changeset
197
a61af66fc99e Initial load
duke
parents:
diff changeset
198 address InlineCacheBuffer::ic_destination_for(CompiledIC *ic) {
a61af66fc99e Initial load
duke
parents:
diff changeset
199 ICStub* stub = ICStub_from_destination_address(ic->stub_address());
a61af66fc99e Initial load
duke
parents:
diff changeset
200 return stub->destination();
a61af66fc99e Initial load
duke
parents:
diff changeset
201 }
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
204 void* InlineCacheBuffer::cached_value_for(CompiledIC *ic) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
205 ICStub* stub = ICStub_from_destination_address(ic->stub_address());
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
206 return stub->cached_value();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
207 }
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
208
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
209
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
210 // Free CompiledICHolder*s that are no longer in use
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
211 void InlineCacheBuffer::release_pending_icholders() {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
212 assert(SafepointSynchronize::is_at_safepoint(), "should only be called during a safepoint");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
213 CompiledICHolder* holder = _pending_released;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
214 _pending_released = NULL;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
215 while (holder != NULL) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
216 CompiledICHolder* next = holder->next();
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
217 delete holder;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
218 holder = next;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
219 _pending_count--;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
220 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
221 assert(_pending_count == 0, "wrong count");
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
222 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
223
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
224 // Enqueue this icholder for release during the next safepoint. It's
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
225 // not safe to free them until them since they might be visible to
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
226 // another thread.
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
227 void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
228 MutexLockerEx mex(InlineCacheBuffer_lock);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
229 icholder->set_next(_pending_released);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
230 _pending_released = icholder;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
231 _pending_count++;
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
232 if (TraceICBuffer) {
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
233 tty->print_cr("enqueueing icholder " INTPTR_FORMAT " to be freed", icholder);
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
234 }
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 2426
diff changeset
235 }