author | naoto |
Tue, 09 Jul 2019 08:05:38 -0700 | |
changeset 55627 | 9c1885fb2a42 |
parent 54786 | ebf733a324d4 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
53084
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
1
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14626
0cf4eccf130f
8003240: x86: move MacroAssembler into separate file
twisti
parents:
13728
diff
changeset
|
26 |
#include "code/codeCache.hpp" |
7397 | 27 |
#include "code/compiledIC.hpp" |
28 |
#include "code/icBuffer.hpp" |
|
29 |
#include "code/nmethod.hpp" |
|
30 |
#include "code/scopeDesc.hpp" |
|
30764 | 31 |
#include "gc/shared/collectedHeap.inline.hpp" |
7397 | 32 |
#include "interpreter/interpreter.hpp" |
33 |
#include "interpreter/linkResolver.hpp" |
|
34 |
#include "memory/resourceArea.hpp" |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
35 |
#include "oops/method.hpp" |
7397 | 36 |
#include "oops/oop.inline.hpp" |
49393 | 37 |
#include "runtime/handles.inline.hpp" |
7397 | 38 |
#include "runtime/mutexLocker.hpp" |
39 |
#include "runtime/stubRoutines.hpp" |
|
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
40 |
#include "runtime/thread.hpp" |
1 | 41 |
|
42 |
DEF_STUB_INTERFACE(ICStub); |
|
43 |
||
44 |
StubQueue* InlineCacheBuffer::_buffer = NULL; |
|
45 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
46 |
CompiledICHolder* InlineCacheBuffer::_pending_released = NULL; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
47 |
int InlineCacheBuffer::_pending_count = 0; |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
48 |
|
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
49 |
#ifdef ASSERT |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
50 |
ICRefillVerifier::ICRefillVerifier() |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
51 |
: _refill_requested(false), |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
52 |
_refill_remembered(false) |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
53 |
{ |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
54 |
Thread* thread = Thread::current(); |
53084
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
55 |
assert(thread->missed_ic_stub_refill_verifier() == NULL, "nesting not supported"); |
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
56 |
thread->set_missed_ic_stub_refill_verifier(this); |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
57 |
} |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
58 |
|
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
59 |
ICRefillVerifier::~ICRefillVerifier() { |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
60 |
assert(!_refill_requested || _refill_remembered, |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
61 |
"Forgot to refill IC stubs after failed IC transition"); |
53084
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
62 |
Thread::current()->set_missed_ic_stub_refill_verifier(NULL); |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
63 |
} |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
64 |
|
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
65 |
ICRefillVerifierMark::ICRefillVerifierMark(ICRefillVerifier* verifier) { |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
66 |
Thread* thread = Thread::current(); |
53084
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
67 |
assert(thread->missed_ic_stub_refill_verifier() == NULL, "nesting not supported"); |
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
68 |
thread->set_missed_ic_stub_refill_verifier(verifier); |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
69 |
} |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
70 |
|
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
71 |
ICRefillVerifierMark::~ICRefillVerifierMark() { |
53084
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
72 |
Thread::current()->set_missed_ic_stub_refill_verifier(NULL); |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
73 |
} |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
74 |
|
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
75 |
static ICRefillVerifier* current_ic_refill_verifier() { |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
76 |
Thread* current = Thread::current(); |
53084
293cec2f7670
8215500: ICRefillVerifierMark does not set the provided verfier as current
eosterlund
parents:
52896
diff
changeset
|
77 |
ICRefillVerifier* verifier = current->missed_ic_stub_refill_verifier(); |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
78 |
assert(verifier != NULL, "need a verifier for safety"); |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
79 |
return verifier; |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
80 |
} |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
81 |
#endif |
1 | 82 |
|
83 |
void ICStub::finalize() { |
|
84 |
if (!is_empty()) { |
|
85 |
ResourceMark rm; |
|
38133
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
33148
diff
changeset
|
86 |
CompiledIC *ic = CompiledIC_at(CodeCache::find_compiled(ic_site()), ic_site()); |
78b95467b9f1
8151956: Support non-continuous CodeBlobs in HotSpot
rbackman
parents:
33148
diff
changeset
|
87 |
assert(CodeCache::find_compiled(ic->instruction_address()) != NULL, "inline cache in non-compiled?"); |
1 | 88 |
|
89 |
assert(this == ICStub_from_destination_address(ic->stub_address()), "wrong owner of ic buffer"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
90 |
ic->set_ic_destination_and_value(destination(), cached_value()); |
1 | 91 |
} |
92 |
} |
|
93 |
||
94 |
||
95 |
address ICStub::destination() const { |
|
96 |
return InlineCacheBuffer::ic_buffer_entry_point(code_begin()); |
|
97 |
} |
|
98 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
99 |
void* ICStub::cached_value() const { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
100 |
return InlineCacheBuffer::ic_buffer_cached_value(code_begin()); |
1 | 101 |
} |
102 |
||
103 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
104 |
void ICStub::set_stub(CompiledIC *ic, void* cached_val, address dest_addr) { |
1 | 105 |
// We cannot store a pointer to the 'ic' object, since it is resource allocated. Instead we |
106 |
// store the location of the inline cache. Then we have enough information recreate the CompiledIC |
|
107 |
// object when we need to remove the stub. |
|
108 |
_ic_site = ic->instruction_address(); |
|
109 |
||
110 |
// Assemble new stub |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
111 |
InlineCacheBuffer::assemble_ic_buffer_code(code_begin(), cached_val, dest_addr); |
1 | 112 |
assert(destination() == dest_addr, "can recover destination"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
113 |
assert(cached_value() == cached_val, "can recover destination"); |
1 | 114 |
} |
115 |
||
116 |
||
117 |
void ICStub::clear() { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
118 |
if (CompiledIC::is_icholder_entry(destination())) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
119 |
InlineCacheBuffer::queue_for_release((CompiledICHolder*)cached_value()); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
120 |
} |
1 | 121 |
_ic_site = NULL; |
122 |
} |
|
123 |
||
124 |
||
125 |
#ifndef PRODUCT |
|
126 |
// anybody calling to this stub will trap |
|
127 |
||
128 |
void ICStub::verify() { |
|
129 |
} |
|
130 |
||
131 |
void ICStub::print() { |
|
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
30764
diff
changeset
|
132 |
tty->print_cr("ICStub: site: " INTPTR_FORMAT, p2i(_ic_site)); |
1 | 133 |
} |
134 |
#endif |
|
135 |
||
136 |
//----------------------------------------------------------------------------------------------- |
|
137 |
// Implementation of InlineCacheBuffer |
|
138 |
||
139 |
||
140 |
void InlineCacheBuffer::initialize() { |
|
141 |
if (_buffer != NULL) return; // already initialized |
|
142 |
_buffer = new StubQueue(new ICStubInterface, 10*K, InlineCacheBuffer_lock, "InlineCacheBuffer"); |
|
143 |
assert (_buffer != NULL, "cannot allocate InlineCacheBuffer"); |
|
144 |
} |
|
145 |
||
146 |
||
147 |
ICStub* InlineCacheBuffer::new_ic_stub() { |
|
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
148 |
return (ICStub*)buffer()->request_committed(ic_stub_code_size()); |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
149 |
} |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
150 |
|
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
151 |
|
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
152 |
void InlineCacheBuffer::refill_ic_stubs() { |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
153 |
#ifdef ASSERT |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
154 |
ICRefillVerifier* verifier = current_ic_refill_verifier(); |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
155 |
verifier->request_remembered(); |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
156 |
#endif |
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
157 |
// we ran out of inline cache buffer space; must enter safepoint. |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
158 |
// We do this by forcing a safepoint |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
159 |
EXCEPTION_MARK; |
1 | 160 |
|
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
161 |
VM_ICBufferFull ibf; |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
162 |
VMThread::execute(&ibf); |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
163 |
// We could potential get an async. exception at this point. |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
164 |
// In that case we will rethrow it to ourselvs. |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
165 |
if (HAS_PENDING_EXCEPTION) { |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
166 |
oop exception = PENDING_EXCEPTION; |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
167 |
CLEAR_PENDING_EXCEPTION; |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
168 |
Thread::send_async_exception(JavaThread::current()->threadObj(), exception); |
1 | 169 |
} |
170 |
} |
|
171 |
||
172 |
||
173 |
void InlineCacheBuffer::update_inline_caches() { |
|
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
174 |
if (buffer()->number_of_stubs() > 0) { |
1 | 175 |
if (TraceICBuffer) { |
176 |
tty->print_cr("[updating inline caches with %d stubs]", buffer()->number_of_stubs()); |
|
177 |
} |
|
178 |
buffer()->remove_all(); |
|
179 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
180 |
release_pending_icholders(); |
1 | 181 |
} |
182 |
||
183 |
||
184 |
bool InlineCacheBuffer::contains(address instruction_address) { |
|
185 |
return buffer()->contains(instruction_address); |
|
186 |
} |
|
187 |
||
188 |
||
189 |
bool InlineCacheBuffer::is_empty() { |
|
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
190 |
return buffer()->number_of_stubs() == 0; |
1 | 191 |
} |
192 |
||
193 |
||
194 |
void InlineCacheBuffer_init() { |
|
195 |
InlineCacheBuffer::initialize(); |
|
196 |
} |
|
197 |
||
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
198 |
bool InlineCacheBuffer::create_transition_stub(CompiledIC *ic, void* cached_value, address entry) { |
1 | 199 |
assert(!SafepointSynchronize::is_at_safepoint(), "should not be called during a safepoint"); |
52384
d6dc479bcdd3
8212681: Refactor IC locking to use a fine grained CompiledICLocker
eosterlund
parents:
49393
diff
changeset
|
200 |
assert(CompiledICLocker::is_safe(ic->instruction_address()), "mt unsafe call"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
201 |
if (TraceICBuffer) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
202 |
tty->print_cr(" create transition stub for " INTPTR_FORMAT " destination " INTPTR_FORMAT " cached value " INTPTR_FORMAT, |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
30764
diff
changeset
|
203 |
p2i(ic->instruction_address()), p2i(entry), p2i(cached_value)); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
204 |
} |
1 | 205 |
|
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
206 |
// allocate and initialize new "out-of-line" inline-cache |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
207 |
ICStub* ic_stub = new_ic_stub(); |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
208 |
if (ic_stub == NULL) { |
52896
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
209 |
#ifdef ASSERT |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
210 |
ICRefillVerifier* verifier = current_ic_refill_verifier(); |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
211 |
verifier->request_refill(); |
98408c7c0b73
8214936: assert(_needs_refill == 0) failed: Forgot to handle a failed IC transition requiring IC stubs
eosterlund
parents:
52857
diff
changeset
|
212 |
#endif |
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
213 |
return false; |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
214 |
} |
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
215 |
|
1 | 216 |
// If an transition stub is already associate with the inline cache, then we remove the association. |
217 |
if (ic->is_in_transition_state()) { |
|
218 |
ICStub* old_stub = ICStub_from_destination_address(ic->stub_address()); |
|
219 |
old_stub->clear(); |
|
220 |
} |
|
221 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
222 |
ic_stub->set_stub(ic, cached_value, entry); |
1 | 223 |
|
224 |
// Update inline cache in nmethod to point to new "out-of-line" allocated inline cache |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
225 |
ic->set_ic_destination(ic_stub); |
52857
7e268f863ff0
8214338: Move IC stub refilling out of IC cache transitions
eosterlund
parents:
52384
diff
changeset
|
226 |
return true; |
1 | 227 |
} |
228 |
||
229 |
||
230 |
address InlineCacheBuffer::ic_destination_for(CompiledIC *ic) { |
|
231 |
ICStub* stub = ICStub_from_destination_address(ic->stub_address()); |
|
232 |
return stub->destination(); |
|
233 |
} |
|
234 |
||
235 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
236 |
void* InlineCacheBuffer::cached_value_for(CompiledIC *ic) { |
1 | 237 |
ICStub* stub = ICStub_from_destination_address(ic->stub_address()); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
238 |
return stub->cached_value(); |
1 | 239 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
240 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
241 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
242 |
// Free CompiledICHolder*s that are no longer in use |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
243 |
void InlineCacheBuffer::release_pending_icholders() { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
244 |
assert(SafepointSynchronize::is_at_safepoint(), "should only be called during a safepoint"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
245 |
CompiledICHolder* holder = _pending_released; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
246 |
_pending_released = NULL; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
247 |
while (holder != NULL) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
248 |
CompiledICHolder* next = holder->next(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
249 |
delete holder; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
250 |
holder = next; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
251 |
_pending_count--; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
252 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
253 |
assert(_pending_count == 0, "wrong count"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
254 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
255 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
256 |
// Enqueue this icholder for release during the next safepoint. It's |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
257 |
// not safe to free them until them since they might be visible to |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
258 |
// another thread. |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
259 |
void InlineCacheBuffer::queue_for_release(CompiledICHolder* icholder) { |
54623
1126f0607c70
8222811: Consolidate MutexLockerEx and MutexLocker
coleenp
parents:
53084
diff
changeset
|
260 |
MutexLocker mex(InlineCacheBuffer_lock, Mutex::_no_safepoint_check_flag); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
261 |
icholder->set_next(_pending_released); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
262 |
_pending_released = icholder; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
263 |
_pending_count++; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
264 |
if (TraceICBuffer) { |
33148
68fa8b6c4340
8042893: compiler: PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC needs to be removed from source files
david
parents:
30764
diff
changeset
|
265 |
tty->print_cr("enqueueing icholder " INTPTR_FORMAT " to be freed", p2i(icholder)); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
266 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
8921
diff
changeset
|
267 |
} |