author | david |
Tue, 29 Sep 2015 11:02:08 +0200 | |
changeset 33105 | 294e48b4f704 |
parent 32189 | 5264b560ab1b |
child 33198 | b37ad9fbf681 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
28731
f7339cba0a6a
8067480: Crash in klassItable::initialize_itable_for_interface when running vm.runtime.defmeth.StaticMethodsTest.
lfoltan
parents:
27020
diff
changeset
|
2 |
* Copyright (c) 1997, 2015, 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:
5421
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5421
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:
5421
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
14385 | 26 |
#include "classfile/defaultMethods.hpp" |
7397 | 27 |
#include "classfile/systemDictionary.hpp" |
28 |
#include "classfile/vmSymbols.hpp" |
|
29 |
#include "compiler/compileBroker.hpp" |
|
30764 | 30 |
#include "gc/shared/collectedHeap.inline.hpp" |
7397 | 31 |
#include "interpreter/bytecode.hpp" |
32 |
#include "interpreter/interpreterRuntime.hpp" |
|
33 |
#include "interpreter/linkResolver.hpp" |
|
34 |
#include "memory/resourceArea.hpp" |
|
35 |
#include "memory/universe.inline.hpp" |
|
36 |
#include "oops/instanceKlass.hpp" |
|
37 |
#include "oops/objArrayOop.hpp" |
|
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28738
diff
changeset
|
38 |
#include "oops/oop.inline.hpp" |
7397 | 39 |
#include "prims/methodHandles.hpp" |
40 |
#include "prims/nativeLookup.hpp" |
|
41 |
#include "runtime/compilationPolicy.hpp" |
|
42 |
#include "runtime/fieldDescriptor.hpp" |
|
43 |
#include "runtime/frame.inline.hpp" |
|
44 |
#include "runtime/handles.inline.hpp" |
|
45 |
#include "runtime/reflection.hpp" |
|
46 |
#include "runtime/signature.hpp" |
|
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
14488
diff
changeset
|
47 |
#include "runtime/thread.inline.hpp" |
7397 | 48 |
#include "runtime/vmThread.hpp" |
1 | 49 |
|
50 |
||
51 |
//------------------------------------------------------------------------------------------------------------------------ |
|
52 |
// Implementation of CallInfo |
|
53 |
||
54 |
||
31019 | 55 |
void CallInfo::set_static(KlassHandle resolved_klass, const methodHandle& resolved_method, TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
56 |
int vtable_index = Method::nonvirtual_vtable_index; |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
57 |
set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK); |
1 | 58 |
} |
59 |
||
60 |
||
31019 | 61 |
void CallInfo::set_interface(KlassHandle resolved_klass, |
62 |
KlassHandle selected_klass, |
|
63 |
const methodHandle& resolved_method, |
|
64 |
const methodHandle& selected_method, |
|
65 |
int itable_index, TRAPS) { |
|
1 | 66 |
// This is only called for interface methods. If the resolved_method |
67 |
// comes from java/lang/Object, it can be the subject of a virtual call, so |
|
68 |
// we should pick the vtable index from the resolved method. |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
69 |
// In that case, the caller must call set_virtual instead of set_interface. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
70 |
assert(resolved_method->method_holder()->is_interface(), ""); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
71 |
assert(itable_index == resolved_method()->itable_index(), ""); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
72 |
set_common(resolved_klass, selected_klass, resolved_method, selected_method, CallInfo::itable_call, itable_index, CHECK); |
1 | 73 |
} |
74 |
||
31019 | 75 |
void CallInfo::set_virtual(KlassHandle resolved_klass, |
76 |
KlassHandle selected_klass, |
|
77 |
const methodHandle& resolved_method, |
|
78 |
const methodHandle& selected_method, |
|
79 |
int vtable_index, TRAPS) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
80 |
assert(vtable_index >= 0 || vtable_index == Method::nonvirtual_vtable_index, "valid index"); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
81 |
assert(vtable_index < 0 || !resolved_method->has_vtable_index() || vtable_index == resolved_method->vtable_index(), ""); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
82 |
CallKind kind = (vtable_index >= 0 && !resolved_method->can_be_statically_bound() ? CallInfo::vtable_call : CallInfo::direct_call); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
83 |
set_common(resolved_klass, selected_klass, resolved_method, selected_method, kind, vtable_index, CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
84 |
assert(!resolved_method->is_compiled_lambda_form(), "these must be handled via an invokehandle call"); |
1 | 85 |
} |
86 |
||
31019 | 87 |
void CallInfo::set_handle(const methodHandle& resolved_method, |
88 |
Handle resolved_appendix, |
|
89 |
Handle resolved_method_type, TRAPS) { |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
90 |
if (resolved_method.is_null()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
91 |
THROW_MSG(vmSymbols::java_lang_InternalError(), "resolved method is null"); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
92 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
93 |
KlassHandle resolved_klass = SystemDictionary::MethodHandle_klass(); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
94 |
assert(resolved_method->intrinsic_id() == vmIntrinsics::_invokeBasic || |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
95 |
resolved_method->is_compiled_lambda_form(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
96 |
"linkMethod must return one of these"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
97 |
int vtable_index = Method::nonvirtual_vtable_index; |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
98 |
assert(!resolved_method->has_vtable_index(), ""); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
99 |
set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK); |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
100 |
_resolved_appendix = resolved_appendix; |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
101 |
_resolved_method_type = resolved_method_type; |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5547
diff
changeset
|
102 |
} |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5547
diff
changeset
|
103 |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
104 |
void CallInfo::set_common(KlassHandle resolved_klass, |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
105 |
KlassHandle selected_klass, |
31019 | 106 |
const methodHandle& resolved_method, |
107 |
const methodHandle& selected_method, |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
108 |
CallKind kind, |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
109 |
int index, |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
110 |
TRAPS) { |
1 | 111 |
assert(resolved_method->signature() == selected_method->signature(), "signatures must correspond"); |
112 |
_resolved_klass = resolved_klass; |
|
113 |
_selected_klass = selected_klass; |
|
114 |
_resolved_method = resolved_method; |
|
115 |
_selected_method = selected_method; |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
116 |
_call_kind = kind; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
117 |
_call_index = index; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
118 |
_resolved_appendix = Handle(); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
119 |
DEBUG_ONLY(verify()); // verify before making side effects |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
120 |
|
6453 | 121 |
if (CompilationPolicy::must_be_compiled(selected_method)) { |
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
122 |
// This path is unusual, mostly used by the '-Xcomp' stress test mode. |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
123 |
|
6453 | 124 |
// Note: with several active threads, the must_be_compiled may be true |
125 |
// while can_be_compiled is false; remove assert |
|
126 |
// assert(CompilationPolicy::can_be_compiled(selected_method), "cannot compile"); |
|
1 | 127 |
if (THREAD->is_Compiler_thread()) { |
128 |
// don't force compilation, resolve was on behalf of compiler |
|
129 |
return; |
|
130 |
} |
|
14391
df0a1573d5bd
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
14385
diff
changeset
|
131 |
if (selected_method->method_holder()->is_not_initialized()) { |
4564
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
132 |
// 'is_not_initialized' means not only '!is_initialized', but also that |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
133 |
// initialization has not been started yet ('!being_initialized') |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
134 |
// Do not force compilation of methods in uninitialized classes. |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
135 |
// Note that doing this would throw an assert later, |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
136 |
// in CompileBroker::compile_method. |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
137 |
// We sometimes use the link resolver to do reflective lookups |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
138 |
// even before classes are initialized. |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
139 |
return; |
55dfb20908d0
6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164)
twisti
parents:
4429
diff
changeset
|
140 |
} |
1 | 141 |
CompileBroker::compile_method(selected_method, InvocationEntryBci, |
10250
0794cd144834
7066339: Tiered: policy should make consistent decisions about osr levels
iveresov
parents:
10008
diff
changeset
|
142 |
CompilationPolicy::policy()->initial_compile_level(), |
6453 | 143 |
methodHandle(), 0, "must_be_compiled", CHECK); |
1 | 144 |
} |
145 |
} |
|
146 |
||
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
147 |
// utility query for unreflecting a method |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
148 |
CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass) { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
149 |
Klass* resolved_method_holder = resolved_method->method_holder(); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
150 |
if (resolved_klass == NULL) { // 2nd argument defaults to holder of 1st |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
151 |
resolved_klass = resolved_method_holder; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
152 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
153 |
_resolved_klass = resolved_klass; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
154 |
_selected_klass = resolved_klass; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
155 |
_resolved_method = resolved_method; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
156 |
_selected_method = resolved_method; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
157 |
// classify: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
158 |
CallKind kind = CallInfo::unknown_kind; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
159 |
int index = resolved_method->vtable_index(); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
160 |
if (resolved_method->can_be_statically_bound()) { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
161 |
kind = CallInfo::direct_call; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
162 |
} else if (!resolved_method_holder->is_interface()) { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
163 |
// Could be an Object method inherited into an interface, but still a vtable call. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
164 |
kind = CallInfo::vtable_call; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
165 |
} else if (!resolved_klass->is_interface()) { |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
166 |
// A default or miranda method. Compute the vtable index. |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
167 |
ResourceMark rm; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
168 |
klassVtable* vt = InstanceKlass::cast(resolved_klass)->vtable(); |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
169 |
index = LinkResolver::vtable_index_of_interface_method(resolved_klass, |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
170 |
resolved_method); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
171 |
assert(index >= 0 , "we should have valid vtable index at this point"); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
172 |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
173 |
kind = CallInfo::vtable_call; |
20712
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
174 |
} else if (resolved_method->has_vtable_index()) { |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
175 |
// Can occur if an interface redeclares a method of Object. |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
176 |
|
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
177 |
#ifdef ASSERT |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
178 |
// Ensure that this is really the case. |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
179 |
KlassHandle object_klass = SystemDictionary::Object_klass(); |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
180 |
Method * object_resolved_method = object_klass()->vtable()->method_at(index); |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
181 |
assert(object_resolved_method->name() == resolved_method->name(), |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
182 |
"Object and interface method names should match at vtable index %d, %s != %s", |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
183 |
index, object_resolved_method->name()->as_C_string(), resolved_method->name()->as_C_string()); |
20712
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
184 |
assert(object_resolved_method->signature() == resolved_method->signature(), |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
185 |
"Object and interface method signatures should match at vtable index %d, %s != %s", |
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
186 |
index, object_resolved_method->signature()->as_C_string(), resolved_method->signature()->as_C_string()); |
20712
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
187 |
#endif // ASSERT |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
188 |
|
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
189 |
kind = CallInfo::vtable_call; |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
190 |
} else { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
191 |
// A regular interface call. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
192 |
kind = CallInfo::itable_call; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
193 |
index = resolved_method->itable_index(); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
194 |
} |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
195 |
assert(index == Method::nonvirtual_vtable_index || index >= 0, "bad index %d", index); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
196 |
_call_kind = kind; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
197 |
_call_index = index; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
198 |
_resolved_appendix = Handle(); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
199 |
DEBUG_ONLY(verify()); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
200 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
201 |
|
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
202 |
#ifdef ASSERT |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
203 |
void CallInfo::verify() { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
204 |
switch (call_kind()) { // the meaning and allowed value of index depends on kind |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
205 |
case CallInfo::direct_call: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
206 |
if (_call_index == Method::nonvirtual_vtable_index) break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
207 |
// else fall through to check vtable index: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
208 |
case CallInfo::vtable_call: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
209 |
assert(resolved_klass()->verify_vtable_index(_call_index), ""); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
210 |
break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
211 |
case CallInfo::itable_call: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
212 |
assert(resolved_method()->method_holder()->verify_itable_index(_call_index), ""); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
213 |
break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
214 |
case CallInfo::unknown_kind: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
215 |
assert(call_kind() != CallInfo::unknown_kind, "CallInfo must be set"); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
216 |
break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
217 |
default: |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
218 |
fatal("Unexpected call kind %d", call_kind()); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
219 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
220 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
221 |
#endif //ASSERT |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
222 |
|
31019 | 223 |
#ifndef PRODUCT |
224 |
void CallInfo::print() { |
|
225 |
ResourceMark rm; |
|
226 |
const char* kindstr = "unknown"; |
|
227 |
switch (_call_kind) { |
|
228 |
case direct_call: kindstr = "direct"; break; |
|
229 |
case vtable_call: kindstr = "vtable"; break; |
|
230 |
case itable_call: kindstr = "itable"; break; |
|
231 |
} |
|
232 |
tty->print_cr("Call %s@%d %s", kindstr, _call_index, |
|
233 |
_resolved_method.is_null() ? "(none)" : _resolved_method->name_and_sig_as_C_string()); |
|
234 |
} |
|
235 |
#endif |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
236 |
|
31019 | 237 |
//------------------------------------------------------------------------------------------------------------------------ |
238 |
// Implementation of LinkInfo |
|
1 | 239 |
|
31019 | 240 |
LinkInfo::LinkInfo(constantPoolHandle pool, int index, TRAPS) { |
241 |
// resolve klass |
|
242 |
Klass* result = pool->klass_ref_at(index, CHECK); |
|
243 |
_resolved_klass = KlassHandle(THREAD, result); |
|
244 |
||
245 |
// Get name, signature, and static klass |
|
246 |
_name = pool->name_ref_at(index); |
|
247 |
_signature = pool->signature_ref_at(index); |
|
248 |
_current_klass = KlassHandle(THREAD, pool->pool_holder()); |
|
249 |
||
250 |
// Coming from the constant pool always checks access |
|
251 |
_check_access = true; |
|
252 |
} |
|
253 |
||
254 |
char* LinkInfo::method_string() const { |
|
255 |
return Method::name_and_sig_as_C_string(_resolved_klass(), _name, _signature); |
|
256 |
} |
|
257 |
||
258 |
#ifndef PRODUCT |
|
259 |
void LinkInfo::print() { |
|
260 |
ResourceMark rm; |
|
261 |
tty->print_cr("Link resolved_klass=%s name=%s signature=%s current_klass=%s check_access=%s", |
|
262 |
_resolved_klass->name()->as_C_string(), |
|
263 |
_name->as_C_string(), |
|
264 |
_signature->as_C_string(), |
|
265 |
_current_klass.is_null() ? "(none)" : _current_klass->name()->as_C_string(), |
|
266 |
_check_access ? "true" : "false"); |
|
267 |
} |
|
268 |
#endif // PRODUCT |
|
1 | 269 |
//------------------------------------------------------------------------------------------------------------------------ |
270 |
// Klass resolution |
|
271 |
||
272 |
void LinkResolver::check_klass_accessability(KlassHandle ref_klass, KlassHandle sel_klass, TRAPS) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
273 |
if (!Reflection::verify_class_access(ref_klass(), |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
274 |
sel_klass(), |
1 | 275 |
true)) { |
276 |
ResourceMark rm(THREAD); |
|
277 |
Exceptions::fthrow( |
|
278 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
279 |
vmSymbols::java_lang_IllegalAccessError(), |
1 | 280 |
"tried to access class %s from class %s", |
281 |
sel_klass->external_name(), |
|
282 |
ref_klass->external_name() |
|
283 |
); |
|
284 |
return; |
|
285 |
} |
|
286 |
} |
|
287 |
||
288 |
//------------------------------------------------------------------------------------------------------------------------ |
|
289 |
// Method resolution |
|
290 |
// |
|
291 |
// According to JVM spec. $5.4.3c & $5.4.3d |
|
292 |
||
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
293 |
// Look up method in klasses, including static methods |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
294 |
// Then look up local default methods |
31019 | 295 |
methodHandle LinkResolver::lookup_method_in_klasses(const LinkInfo& link_info, |
296 |
bool checkpolymorphism, |
|
297 |
bool in_imethod_resolve, TRAPS) { |
|
298 |
KlassHandle klass = link_info.resolved_klass(); |
|
299 |
Symbol* name = link_info.name(); |
|
300 |
Symbol* signature = link_info.signature(); |
|
301 |
||
23999
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
302 |
// Ignore overpasses so statics can be found during resolution |
31019 | 303 |
Method* result = klass->uncached_lookup_method(name, signature, Klass::skip_overpass); |
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
304 |
|
27020 | 305 |
if (klass->oop_is_array()) { |
306 |
// Only consider klass and super klass for arrays |
|
31019 | 307 |
return methodHandle(THREAD, result); |
27020 | 308 |
} |
309 |
||
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
310 |
// JDK 8, JVMS 5.4.3.4: Interface method resolution should |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
311 |
// ignore static and non-public methods of java.lang.Object, |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
312 |
// like clone, finalize, registerNatives. |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
313 |
if (in_imethod_resolve && |
31019 | 314 |
result != NULL && |
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
315 |
klass->is_interface() && |
31019 | 316 |
(result->is_static() || !result->is_public()) && |
317 |
result->method_holder() == SystemDictionary::Object_klass()) { |
|
318 |
result = NULL; |
|
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
319 |
} |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
320 |
|
23999
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
321 |
// Before considering default methods, check for an overpass in the |
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
322 |
// current class if a method has not been found. |
31019 | 323 |
if (result == NULL) { |
324 |
result = InstanceKlass::cast(klass())->find_method(name, signature); |
|
23999
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
325 |
} |
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
326 |
|
31019 | 327 |
if (result == NULL) { |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
328 |
Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
329 |
if (default_methods != NULL) { |
31019 | 330 |
result = InstanceKlass::find_method(default_methods, name, signature); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
331 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
332 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
333 |
|
31019 | 334 |
if (checkpolymorphism && result != NULL) { |
335 |
vmIntrinsics::ID iid = result->intrinsic_id(); |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
336 |
if (MethodHandles::is_signature_polymorphic(iid)) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
337 |
// Do not link directly to these. The VM must produce a synthetic one using lookup_polymorphic_method. |
31019 | 338 |
return NULL; |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
4571
diff
changeset
|
339 |
} |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
4571
diff
changeset
|
340 |
} |
31019 | 341 |
return methodHandle(THREAD, result); |
1 | 342 |
} |
343 |
||
344 |
// returns first instance method |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
345 |
// Looks up method in classes, then looks up local default methods |
31019 | 346 |
methodHandle LinkResolver::lookup_instance_method_in_klasses(KlassHandle klass, |
347 |
Symbol* name, |
|
348 |
Symbol* signature, TRAPS) { |
|
349 |
Method* result = klass->uncached_lookup_method(name, signature, Klass::find_overpass); |
|
350 |
||
351 |
while (result != NULL && result->is_static() && result->method_holder()->super() != NULL) { |
|
352 |
Klass* super_klass = result->method_holder()->super(); |
|
353 |
result = super_klass->uncached_lookup_method(name, signature, Klass::find_overpass); |
|
1 | 354 |
} |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
355 |
|
27020 | 356 |
if (klass->oop_is_array()) { |
357 |
// Only consider klass and super klass for arrays |
|
31019 | 358 |
return methodHandle(THREAD, result); |
27020 | 359 |
} |
360 |
||
31019 | 361 |
if (result == NULL) { |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
362 |
Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
363 |
if (default_methods != NULL) { |
31019 | 364 |
result = InstanceKlass::find_method(default_methods, name, signature); |
365 |
assert(result == NULL || !result->is_static(), "static defaults not allowed"); |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
366 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
367 |
} |
31019 | 368 |
return methodHandle(THREAD, result); |
1 | 369 |
} |
370 |
||
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
371 |
int LinkResolver::vtable_index_of_interface_method(KlassHandle klass, |
31019 | 372 |
const methodHandle& resolved_method) { |
1 | 373 |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
374 |
int vtable_index = Method::invalid_vtable_index; |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
375 |
Symbol* name = resolved_method->name(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
376 |
Symbol* signature = resolved_method->signature(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
377 |
|
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
378 |
// First check in default method array |
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
379 |
if (!resolved_method->is_abstract() && |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
380 |
(InstanceKlass::cast(klass())->default_methods() != NULL)) { |
28731
f7339cba0a6a
8067480: Crash in klassItable::initialize_itable_for_interface when running vm.runtime.defmeth.StaticMethodsTest.
lfoltan
parents:
27020
diff
changeset
|
381 |
int index = InstanceKlass::find_method_index(InstanceKlass::cast(klass())->default_methods(), |
32189
5264b560ab1b
8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
31019
diff
changeset
|
382 |
name, signature, Klass::find_overpass, |
5264b560ab1b
8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
31019
diff
changeset
|
383 |
Klass::find_static, Klass::find_private); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
384 |
if (index >= 0 ) { |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
385 |
vtable_index = InstanceKlass::cast(klass())->default_vtable_indices()->at(index); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
386 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
387 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
388 |
if (vtable_index == Method::invalid_vtable_index) { |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
389 |
// get vtable_index for miranda methods |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
390 |
ResourceMark rm; |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
391 |
klassVtable *vt = InstanceKlass::cast(klass())->vtable(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
392 |
vtable_index = vt->index_of_miranda(name, signature); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
393 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
394 |
return vtable_index; |
1 | 395 |
} |
396 |
||
31019 | 397 |
methodHandle LinkResolver::lookup_method_in_interfaces(const LinkInfo& cp_info, TRAPS) { |
398 |
InstanceKlass *ik = InstanceKlass::cast(cp_info.resolved_klass()()); |
|
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
399 |
|
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
400 |
// Specify 'true' in order to skip default methods when searching the |
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
401 |
// interfaces. Function lookup_method_in_klasses() already looked for |
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
402 |
// the method in the default methods table. |
31019 | 403 |
return methodHandle(THREAD, |
404 |
ik->lookup_method_in_all_interfaces(cp_info.name(), cp_info.signature(), |
|
405 |
Klass::skip_defaults)); |
|
1 | 406 |
} |
407 |
||
31019 | 408 |
methodHandle LinkResolver::lookup_polymorphic_method( |
409 |
const LinkInfo& link_info, |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
410 |
Handle *appendix_result_or_null, |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
411 |
Handle *method_type_result, |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
412 |
TRAPS) { |
31019 | 413 |
KlassHandle klass = link_info.resolved_klass(); |
414 |
Symbol* name = link_info.name(); |
|
415 |
Symbol* full_signature = link_info.signature(); |
|
416 |
||
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
417 |
vmIntrinsics::ID iid = MethodHandles::signature_polymorphic_name_id(name); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
418 |
if (TraceMethodHandles) { |
16691 | 419 |
ResourceMark rm(THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
420 |
tty->print_cr("lookup_polymorphic_method iid=%s %s.%s%s", |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
421 |
vmIntrinsics::name_at(iid), klass->external_name(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
422 |
name->as_C_string(), full_signature->as_C_string()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
423 |
} |
24322 | 424 |
if (klass() == SystemDictionary::MethodHandle_klass() && |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
425 |
iid != vmIntrinsics::_none) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
426 |
if (MethodHandles::is_signature_polymorphic_intrinsic(iid)) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
427 |
// Most of these do not need an up-call to Java to resolve, so can be done anywhere. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
428 |
// Do not erase last argument type (MemberName) if it is a static linkTo method. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
429 |
bool keep_last_arg = MethodHandles::is_signature_polymorphic_static(iid); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
430 |
TempNewSymbol basic_signature = |
31019 | 431 |
MethodHandles::lookup_basic_type_signature(full_signature, keep_last_arg, CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
432 |
if (TraceMethodHandles) { |
16691 | 433 |
ResourceMark rm(THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
434 |
tty->print_cr("lookup_polymorphic_method %s %s => basic %s", |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
435 |
name->as_C_string(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
436 |
full_signature->as_C_string(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
437 |
basic_signature->as_C_string()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
438 |
} |
31019 | 439 |
methodHandle result = SystemDictionary::find_method_handle_intrinsic(iid, |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
440 |
basic_signature, |
31019 | 441 |
CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
442 |
if (result.not_null()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
443 |
assert(result->is_method_handle_intrinsic(), "MH.invokeBasic or MH.linkTo* intrinsic"); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
444 |
assert(result->intrinsic_id() != vmIntrinsics::_invokeGeneric, "wrong place to find this"); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
445 |
assert(basic_signature == result->signature(), "predict the result signature"); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
446 |
if (TraceMethodHandles) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
447 |
tty->print("lookup_polymorphic_method => intrinsic "); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
448 |
result->print_on(tty); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
449 |
} |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5547
diff
changeset
|
450 |
} |
31019 | 451 |
return result; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
452 |
} else if (iid == vmIntrinsics::_invokeGeneric |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
453 |
&& !THREAD->is_Compiler_thread() |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
454 |
&& appendix_result_or_null != NULL) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
455 |
// This is a method with type-checking semantics. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
456 |
// We will ask Java code to spin an adapter method for it. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
457 |
if (!MethodHandles::enabled()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
458 |
// Make sure the Java part of the runtime has been booted up. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
459 |
Klass* natives = SystemDictionary::MethodHandleNatives_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
460 |
if (natives == NULL || InstanceKlass::cast(natives)->is_not_initialized()) { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
461 |
SystemDictionary::resolve_or_fail(vmSymbols::java_lang_invoke_MethodHandleNatives(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
462 |
Handle(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
463 |
Handle(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
464 |
true, |
31019 | 465 |
CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
466 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
467 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
468 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
469 |
Handle appendix; |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
470 |
Handle method_type; |
31019 | 471 |
methodHandle result = SystemDictionary::find_method_handle_invoker( |
472 |
name, |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
473 |
full_signature, |
31019 | 474 |
link_info.current_klass(), |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
475 |
&appendix, |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
476 |
&method_type, |
31019 | 477 |
CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
478 |
if (TraceMethodHandles) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
479 |
tty->print("lookup_polymorphic_method => (via Java) "); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
480 |
result->print_on(tty); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
481 |
tty->print(" lookup_polymorphic_method => appendix = "); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
482 |
if (appendix.is_null()) tty->print_cr("(none)"); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
483 |
else appendix->print_on(tty); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
484 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
485 |
if (result.not_null()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
486 |
#ifdef ASSERT |
16691 | 487 |
ResourceMark rm(THREAD); |
488 |
||
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
489 |
TempNewSymbol basic_signature = |
31019 | 490 |
MethodHandles::lookup_basic_type_signature(full_signature, CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
491 |
int actual_size_of_params = result->size_of_parameters(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
492 |
int expected_size_of_params = ArgumentSizeComputer(basic_signature).size(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
493 |
// +1 for MethodHandle.this, +1 for trailing MethodType |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
494 |
if (!MethodHandles::is_signature_polymorphic_static(iid)) expected_size_of_params += 1; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
495 |
if (appendix.not_null()) expected_size_of_params += 1; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
496 |
if (actual_size_of_params != expected_size_of_params) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
497 |
tty->print_cr("*** basic_signature=%s", basic_signature->as_C_string()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
498 |
tty->print_cr("*** result for %s: ", vmIntrinsics::name_at(iid)); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
499 |
result->print(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
500 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
501 |
assert(actual_size_of_params == expected_size_of_params, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
502 |
"%d != %d", actual_size_of_params, expected_size_of_params); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
503 |
#endif //ASSERT |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
504 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
505 |
assert(appendix_result_or_null != NULL, ""); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
506 |
(*appendix_result_or_null) = appendix; |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
507 |
(*method_type_result) = method_type; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
508 |
} |
31019 | 509 |
return result; |
2534 | 510 |
} |
511 |
} |
|
31019 | 512 |
return NULL; |
2534 | 513 |
} |
514 |
||
1 | 515 |
void LinkResolver::check_method_accessability(KlassHandle ref_klass, |
516 |
KlassHandle resolved_klass, |
|
517 |
KlassHandle sel_klass, |
|
31019 | 518 |
const methodHandle& sel_method, |
1 | 519 |
TRAPS) { |
520 |
||
521 |
AccessFlags flags = sel_method->access_flags(); |
|
522 |
||
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
523 |
// Special case: arrays always override "clone". JVMS 2.15. |
1 | 524 |
// If the resolved klass is an array class, and the declaring class |
525 |
// is java.lang.Object and the method is "clone", set the flags |
|
526 |
// to public. |
|
527 |
// |
|
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
528 |
// We'll check for the method name first, as that's most likely |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
529 |
// to be false (so we'll short-circuit out of these tests). |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
530 |
if (sel_method->name() == vmSymbols::clone_name() && |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
531 |
sel_klass() == SystemDictionary::Object_klass() && |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
532 |
resolved_klass->oop_is_array()) { |
1 | 533 |
// We need to change "protected" to "public". |
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
534 |
assert(flags.is_protected(), "clone not protected?"); |
1 | 535 |
jint new_flags = flags.as_int(); |
536 |
new_flags = new_flags & (~JVM_ACC_PROTECTED); |
|
537 |
new_flags = new_flags | JVM_ACC_PUBLIC; |
|
538 |
flags.set_flags(new_flags); |
|
539 |
} |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
540 |
// assert(extra_arg_result_or_null != NULL, "must be able to return extra argument"); |
1 | 541 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
542 |
if (!Reflection::verify_field_access(ref_klass(), |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
543 |
resolved_klass(), |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
544 |
sel_klass(), |
1 | 545 |
flags, |
546 |
true)) { |
|
547 |
ResourceMark rm(THREAD); |
|
548 |
Exceptions::fthrow( |
|
549 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
550 |
vmSymbols::java_lang_IllegalAccessError(), |
1 | 551 |
"tried to access method %s.%s%s from class %s", |
552 |
sel_klass->external_name(), |
|
553 |
sel_method->name()->as_C_string(), |
|
554 |
sel_method->signature()->as_C_string(), |
|
555 |
ref_klass->external_name() |
|
556 |
); |
|
557 |
return; |
|
558 |
} |
|
559 |
} |
|
560 |
||
31019 | 561 |
methodHandle LinkResolver::resolve_method_statically(Bytecodes::Code code, |
562 |
constantPoolHandle pool, int index, TRAPS) { |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
563 |
// This method is used only |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
564 |
// (1) in C2 from InlineTree::ok_to_inline (via ciMethod::check_call), |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
565 |
// and |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
566 |
// (2) in Bytecode_invoke::static_target |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
567 |
// It appears to fail when applied to an invokeinterface call site. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
568 |
// FIXME: Remove this method and ciMethod::check_call; refactor to use the other LinkResolver entry points. |
1 | 569 |
// resolve klass |
31019 | 570 |
KlassHandle resolved_klass; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
571 |
if (code == Bytecodes::_invokedynamic) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
572 |
resolved_klass = SystemDictionary::MethodHandle_klass(); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
573 |
Symbol* method_name = vmSymbols::invoke_name(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
574 |
Symbol* method_signature = pool->signature_ref_at(index); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
575 |
KlassHandle current_klass(THREAD, pool->pool_holder()); |
31019 | 576 |
LinkInfo link_info(resolved_klass, method_name, method_signature, current_klass); |
577 |
return resolve_method(link_info, /*require_methodref*/false, THREAD); |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
578 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
579 |
|
31019 | 580 |
LinkInfo link_info(pool, index, CHECK_NULL); |
581 |
resolved_klass = link_info.resolved_klass(); |
|
1 | 582 |
|
10008
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
583 |
if (pool->has_preresolution() |
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
584 |
|| (resolved_klass() == SystemDictionary::MethodHandle_klass() && |
31019 | 585 |
MethodHandles::is_signature_polymorphic_name(resolved_klass(), link_info.name()))) { |
586 |
Method* result = ConstantPool::method_at_if_loaded(pool, index); |
|
587 |
if (result != NULL) { |
|
588 |
return methodHandle(THREAD, result); |
|
10008
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
589 |
} |
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
590 |
} |
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
591 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
592 |
if (code == Bytecodes::_invokeinterface) { |
31019 | 593 |
return resolve_interface_method(link_info, true, THREAD); |
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
594 |
} else if (code == Bytecodes::_invokevirtual) { |
31019 | 595 |
return resolve_method(link_info, /*require_methodref*/true, THREAD); |
21912 | 596 |
} else if (!resolved_klass->is_interface()) { |
31019 | 597 |
return resolve_method(link_info, /*require_methodref*/false, THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
598 |
} else { |
21912 | 599 |
bool nostatics = (code == Bytecodes::_invokestatic) ? false : true; |
31019 | 600 |
return resolve_interface_method(link_info, nostatics, THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
601 |
} |
1 | 602 |
} |
603 |
||
31019 | 604 |
// Check and print a loader constraint violation message for method or interface method |
605 |
void LinkResolver::check_method_loader_constraints(const LinkInfo& link_info, |
|
606 |
const methodHandle& resolved_method, |
|
607 |
const char* method_type, TRAPS) { |
|
608 |
Handle current_loader(THREAD, link_info.current_klass()->class_loader()); |
|
609 |
Handle resolved_loader(THREAD, resolved_method->method_holder()->class_loader()); |
|
610 |
||
611 |
ResourceMark rm(THREAD); |
|
612 |
Symbol* failed_type_symbol = |
|
613 |
SystemDictionary::check_signature_loaders(link_info.signature(), current_loader, |
|
614 |
resolved_loader, true, CHECK); |
|
615 |
if (failed_type_symbol != NULL) { |
|
616 |
const char* msg = "loader constraint violation: when resolving %s" |
|
617 |
" \"%s\" the class loader (instance of %s) of the current class, %s," |
|
618 |
" and the class loader (instance of %s) for the method's defining class, %s, have" |
|
619 |
" different Class objects for the type %s used in the signature"; |
|
620 |
char* sig = link_info.method_string(); |
|
621 |
const char* loader1_name = SystemDictionary::loader_name(current_loader()); |
|
622 |
char* current = link_info.current_klass()->name()->as_C_string(); |
|
623 |
const char* loader2_name = SystemDictionary::loader_name(resolved_loader()); |
|
624 |
char* target = resolved_method->method_holder()->name()->as_C_string(); |
|
625 |
char* failed_type_name = failed_type_symbol->as_C_string(); |
|
626 |
size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1_name) + |
|
627 |
strlen(current) + strlen(loader2_name) + strlen(target) + |
|
628 |
strlen(failed_type_name) + strlen(method_type) + 1; |
|
629 |
char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); |
|
630 |
jio_snprintf(buf, buflen, msg, method_type, sig, loader1_name, current, loader2_name, |
|
631 |
target, failed_type_name); |
|
632 |
THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); |
|
633 |
} |
|
634 |
} |
|
635 |
||
636 |
void LinkResolver::check_field_loader_constraints(Symbol* field, Symbol* sig, |
|
637 |
KlassHandle current_klass, |
|
638 |
KlassHandle sel_klass, TRAPS) { |
|
639 |
Handle ref_loader(THREAD, current_klass->class_loader()); |
|
640 |
Handle sel_loader(THREAD, sel_klass->class_loader()); |
|
641 |
||
642 |
ResourceMark rm(THREAD); // needed for check_signature_loaders |
|
643 |
Symbol* failed_type_symbol = |
|
644 |
SystemDictionary::check_signature_loaders(sig, |
|
645 |
ref_loader, sel_loader, |
|
646 |
false, |
|
647 |
CHECK); |
|
648 |
if (failed_type_symbol != NULL) { |
|
649 |
const char* msg = "loader constraint violation: when resolving field" |
|
650 |
" \"%s\" the class loader (instance of %s) of the referring class, " |
|
651 |
"%s, and the class loader (instance of %s) for the field's resolved " |
|
652 |
"type, %s, have different Class objects for that type"; |
|
653 |
char* field_name = field->as_C_string(); |
|
654 |
const char* loader1_name = SystemDictionary::loader_name(ref_loader()); |
|
655 |
char* sel = sel_klass->name()->as_C_string(); |
|
656 |
const char* loader2_name = SystemDictionary::loader_name(sel_loader()); |
|
657 |
char* failed_type_name = failed_type_symbol->as_C_string(); |
|
658 |
size_t buflen = strlen(msg) + strlen(field_name) + strlen(loader1_name) + |
|
659 |
strlen(sel) + strlen(loader2_name) + strlen(failed_type_name) + 1; |
|
660 |
char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); |
|
661 |
jio_snprintf(buf, buflen, msg, field_name, loader1_name, sel, loader2_name, |
|
662 |
failed_type_name); |
|
663 |
THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); |
|
664 |
} |
|
665 |
} |
|
666 |
||
667 |
methodHandle LinkResolver::resolve_method(const LinkInfo& link_info, |
|
668 |
bool require_methodref, TRAPS) { |
|
1 | 669 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
670 |
Handle nested_exception; |
31019 | 671 |
KlassHandle resolved_klass = link_info.resolved_klass(); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
672 |
|
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
673 |
// 1. check if methodref required, that resolved_klass is not interfacemethodref |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
674 |
if (require_methodref && resolved_klass->is_interface()) { |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
675 |
ResourceMark rm(THREAD); |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
676 |
char buf[200]; |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
677 |
jio_snprintf(buf, sizeof(buf), "Found interface %s, but class was expected", |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
678 |
resolved_klass()->external_name()); |
31019 | 679 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
680 |
} |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
681 |
|
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
682 |
// 2. lookup method in resolved klass and its super klasses |
31019 | 683 |
methodHandle resolved_method = lookup_method_in_klasses(link_info, true, false, CHECK_NULL); |
1 | 684 |
|
27020 | 685 |
if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { // not found in the class hierarchy |
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
686 |
// 3. lookup method in all the interfaces implemented by the resolved klass |
31019 | 687 |
resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL); |
1 | 688 |
|
689 |
if (resolved_method.is_null()) { |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
690 |
// JSR 292: see if this is an implicitly generated method MethodHandle.linkToVirtual(*...), etc |
31019 | 691 |
resolved_method = lookup_polymorphic_method(link_info, (Handle*)NULL, (Handle*)NULL, THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
692 |
if (HAS_PENDING_EXCEPTION) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
693 |
nested_exception = Handle(THREAD, PENDING_EXCEPTION); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
694 |
CLEAR_PENDING_EXCEPTION; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
695 |
} |
2534 | 696 |
} |
27020 | 697 |
} |
2534 | 698 |
|
27020 | 699 |
if (resolved_method.is_null()) { |
700 |
// 4. method lookup failed |
|
701 |
ResourceMark rm(THREAD); |
|
31019 | 702 |
THROW_MSG_CAUSE_(vmSymbols::java_lang_NoSuchMethodError(), |
27020 | 703 |
Method::name_and_sig_as_C_string(resolved_klass(), |
31019 | 704 |
link_info.name(), |
705 |
link_info.signature()), |
|
706 |
nested_exception, NULL); |
|
1 | 707 |
} |
708 |
||
22739
74105c330330
8032010: Attempt to resolve abstract method in concrete class fails with AbstractMethodError
ccheung
parents:
22521
diff
changeset
|
709 |
// 5. access checks, access checking may be turned off when calling from within the VM. |
31019 | 710 |
KlassHandle current_klass = link_info.current_klass(); |
711 |
if (link_info.check_access()) { |
|
1 | 712 |
assert(current_klass.not_null() , "current_klass should not be null"); |
713 |
||
714 |
// check if method can be accessed by the referring class |
|
715 |
check_method_accessability(current_klass, |
|
716 |
resolved_klass, |
|
717 |
KlassHandle(THREAD, resolved_method->method_holder()), |
|
718 |
resolved_method, |
|
31019 | 719 |
CHECK_NULL); |
1 | 720 |
|
721 |
// check loader constraints |
|
31019 | 722 |
check_method_loader_constraints(link_info, resolved_method, "method", CHECK_NULL); |
1 | 723 |
} |
31019 | 724 |
|
725 |
return resolved_method; |
|
1 | 726 |
} |
727 |
||
31019 | 728 |
methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, |
729 |
bool nostatics, TRAPS) { |
|
730 |
||
731 |
KlassHandle resolved_klass = link_info.resolved_klass(); |
|
1 | 732 |
|
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
733 |
// check if klass is interface |
1 | 734 |
if (!resolved_klass->is_interface()) { |
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
735 |
ResourceMark rm(THREAD); |
1 | 736 |
char buf[200]; |
14488 | 737 |
jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass()->external_name()); |
31019 | 738 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1 | 739 |
} |
740 |
||
741 |
// lookup method in this interface or its super, java.lang.Object |
|
21912 | 742 |
// JDK8: also look for static methods |
31019 | 743 |
methodHandle resolved_method = lookup_method_in_klasses(link_info, false, true, CHECK_NULL); |
1 | 744 |
|
27020 | 745 |
if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { |
1 | 746 |
// lookup method in all the super-interfaces |
31019 | 747 |
resolved_method = lookup_method_in_interfaces(link_info, CHECK_NULL); |
27020 | 748 |
} |
749 |
||
750 |
if (resolved_method.is_null()) { |
|
751 |
// no method found |
|
752 |
ResourceMark rm(THREAD); |
|
31019 | 753 |
THROW_MSG_NULL(vmSymbols::java_lang_NoSuchMethodError(), |
754 |
Method::name_and_sig_as_C_string(resolved_klass(), |
|
755 |
link_info.name(), |
|
756 |
link_info.signature())); |
|
1 | 757 |
} |
758 |
||
31019 | 759 |
if (link_info.check_access()) { |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
760 |
// JDK8 adds non-public interface methods, and accessability check requirement |
31019 | 761 |
KlassHandle current_klass = link_info.current_klass(); |
762 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
763 |
assert(current_klass.not_null() , "current_klass should not be null"); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
764 |
|
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
765 |
// check if method can be accessed by the referring class |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
766 |
check_method_accessability(current_klass, |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
767 |
resolved_klass, |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
768 |
KlassHandle(THREAD, resolved_method->method_holder()), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
769 |
resolved_method, |
31019 | 770 |
CHECK_NULL); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
771 |
|
31019 | 772 |
check_method_loader_constraints(link_info, resolved_method, "interface method", CHECK_NULL); |
1 | 773 |
} |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
774 |
|
22521
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
775 |
if (nostatics && resolved_method->is_static()) { |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
776 |
ResourceMark rm(THREAD); |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
777 |
char buf[200]; |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
778 |
jio_snprintf(buf, sizeof(buf), "Expected instance not static method %s", |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
779 |
Method::name_and_sig_as_C_string(resolved_klass(), |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
780 |
resolved_method->name(), resolved_method->signature())); |
31019 | 781 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
22521
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
782 |
} |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
783 |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
784 |
if (TraceItables && Verbose) { |
31019 | 785 |
trace_method_resolution("invokeinterface resolved method: caller-class", |
786 |
link_info.current_klass(), resolved_klass, resolved_method); |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
787 |
tty->cr(); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
788 |
} |
31019 | 789 |
|
790 |
return resolved_method; |
|
1 | 791 |
} |
792 |
||
793 |
//------------------------------------------------------------------------------------------------------------------------ |
|
794 |
// Field resolution |
|
795 |
||
796 |
void LinkResolver::check_field_accessability(KlassHandle ref_klass, |
|
797 |
KlassHandle resolved_klass, |
|
798 |
KlassHandle sel_klass, |
|
31019 | 799 |
const fieldDescriptor& fd, |
1 | 800 |
TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
801 |
if (!Reflection::verify_field_access(ref_klass(), |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
802 |
resolved_klass(), |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
803 |
sel_klass(), |
1 | 804 |
fd.access_flags(), |
805 |
true)) { |
|
806 |
ResourceMark rm(THREAD); |
|
807 |
Exceptions::fthrow( |
|
808 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
809 |
vmSymbols::java_lang_IllegalAccessError(), |
1 | 810 |
"tried to access field %s.%s from class %s", |
811 |
sel_klass->external_name(), |
|
812 |
fd.name()->as_C_string(), |
|
813 |
ref_klass->external_name() |
|
814 |
); |
|
815 |
return; |
|
816 |
} |
|
817 |
} |
|
818 |
||
31019 | 819 |
void LinkResolver::resolve_field_access(fieldDescriptor& fd, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS) { |
820 |
LinkInfo link_info(pool, index, CHECK); |
|
821 |
resolve_field(fd, link_info, byte, true, CHECK); |
|
1 | 822 |
} |
823 |
||
31019 | 824 |
void LinkResolver::resolve_field(fieldDescriptor& fd, |
825 |
const LinkInfo& link_info, |
|
826 |
Bytecodes::Code byte, bool initialize_class, |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
827 |
TRAPS) { |
1 | 828 |
assert(byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic || |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
829 |
byte == Bytecodes::_getfield || byte == Bytecodes::_putfield || |
30117
cce2cdac56dc
8074345: Enable RewriteBytecodes when VM runs with CDS
minqi
parents:
29081
diff
changeset
|
830 |
byte == Bytecodes::_nofast_getfield || byte == Bytecodes::_nofast_putfield || |
31019 | 831 |
(byte == Bytecodes::_nop && !link_info.check_access()), "bad field access bytecode"); |
1 | 832 |
|
833 |
bool is_static = (byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic); |
|
30117
cce2cdac56dc
8074345: Enable RewriteBytecodes when VM runs with CDS
minqi
parents:
29081
diff
changeset
|
834 |
bool is_put = (byte == Bytecodes::_putfield || byte == Bytecodes::_putstatic || byte == Bytecodes::_nofast_putfield); |
1 | 835 |
// Check if there's a resolved klass containing the field |
31019 | 836 |
KlassHandle resolved_klass = link_info.resolved_klass(); |
837 |
Symbol* field = link_info.name(); |
|
838 |
Symbol* sig = link_info.signature(); |
|
839 |
||
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
840 |
if (resolved_klass.is_null()) { |
1 | 841 |
ResourceMark rm(THREAD); |
842 |
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); |
|
843 |
} |
|
844 |
||
845 |
// Resolve instance field |
|
27020 | 846 |
KlassHandle sel_klass(THREAD, resolved_klass->find_field(field, sig, &fd)); |
1 | 847 |
// check if field exists; i.e., if a klass containing the field def has been selected |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
848 |
if (sel_klass.is_null()) { |
1 | 849 |
ResourceMark rm(THREAD); |
850 |
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); |
|
851 |
} |
|
852 |
||
31019 | 853 |
if (!link_info.check_access()) |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
854 |
// Access checking may be turned off when calling from within the VM. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
855 |
return; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
856 |
|
1 | 857 |
// check access |
31019 | 858 |
KlassHandle current_klass = link_info.current_klass(); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
859 |
check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); |
1 | 860 |
|
861 |
// check for errors |
|
862 |
if (is_static != fd.is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
863 |
ResourceMark rm(THREAD); |
1 | 864 |
char msg[200]; |
14488 | 865 |
jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass()->external_name(), fd.name()->as_C_string()); |
1 | 866 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg); |
867 |
} |
|
868 |
||
869 |
// Final fields can only be accessed from its own class. |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
870 |
if (is_put && fd.access_flags().is_final() && sel_klass() != current_klass()) { |
1 | 871 |
THROW(vmSymbols::java_lang_IllegalAccessError()); |
872 |
} |
|
873 |
||
874 |
// initialize resolved_klass if necessary |
|
875 |
// note 1: the klass which declared the field must be initialized (i.e, sel_klass) |
|
876 |
// according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99) |
|
877 |
// |
|
878 |
// note 2: we don't want to force initialization if we are just checking |
|
879 |
// if the field access is legal; e.g., during compilation |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
880 |
if (is_static && initialize_class) { |
1 | 881 |
sel_klass->initialize(CHECK); |
882 |
} |
|
883 |
||
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
884 |
if (sel_klass() != current_klass()) { |
31019 | 885 |
check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK); |
1 | 886 |
} |
887 |
||
888 |
// return information. note that the klass is set to the actual klass containing the |
|
889 |
// field, otherwise access of static fields in superclasses will not work. |
|
890 |
} |
|
891 |
||
892 |
||
893 |
//------------------------------------------------------------------------------------------------------------------------ |
|
894 |
// Invoke resolution |
|
895 |
// |
|
896 |
// Naming conventions: |
|
897 |
// |
|
898 |
// resolved_method the specified method (i.e., static receiver specified via constant pool index) |
|
899 |
// sel_method the selected method (selected via run-time lookup; e.g., based on dynamic receiver class) |
|
900 |
// resolved_klass the specified klass (i.e., specified via constant pool index) |
|
901 |
// recv_klass the receiver klass |
|
902 |
||
903 |
||
31019 | 904 |
void LinkResolver::resolve_static_call(CallInfo& result, |
905 |
const LinkInfo& link_info, |
|
906 |
bool initialize_class, TRAPS) { |
|
907 |
methodHandle resolved_method = linktime_resolve_static_method(link_info, CHECK); |
|
1 | 908 |
|
31019 | 909 |
// The resolved class can change as a result of this resolution. |
910 |
KlassHandle resolved_klass = KlassHandle(THREAD, resolved_method->method_holder()); |
|
911 |
||
912 |
Method* save_resolved_method = resolved_method(); |
|
1 | 913 |
// Initialize klass (this should only happen if everything is ok) |
914 |
if (initialize_class && resolved_klass->should_be_initialized()) { |
|
915 |
resolved_klass->initialize(CHECK); |
|
31019 | 916 |
// Use updated LinkInfo (to reresolve with resolved_klass as method_holder?) |
917 |
LinkInfo new_info(resolved_klass, link_info.name(), link_info.signature(), |
|
918 |
link_info.current_klass(), link_info.check_access()); |
|
919 |
resolved_method = linktime_resolve_static_method(new_info, CHECK); |
|
1 | 920 |
} |
921 |
||
31019 | 922 |
assert(save_resolved_method == resolved_method(), "does this change?"); |
1 | 923 |
// setup result |
924 |
result.set_static(resolved_klass, resolved_method, CHECK); |
|
925 |
} |
|
926 |
||
927 |
// throws linktime exceptions |
|
31019 | 928 |
methodHandle LinkResolver::linktime_resolve_static_method(const LinkInfo& link_info, TRAPS) { |
1 | 929 |
|
31019 | 930 |
KlassHandle resolved_klass = link_info.resolved_klass(); |
931 |
methodHandle resolved_method; |
|
21912 | 932 |
if (!resolved_klass->is_interface()) { |
31019 | 933 |
resolved_method = resolve_method(link_info, /*require_methodref*/false, CHECK_NULL); |
21912 | 934 |
} else { |
31019 | 935 |
resolved_method = resolve_interface_method(link_info, /*nostatics*/false, CHECK_NULL); |
21912 | 936 |
} |
1 | 937 |
assert(resolved_method->name() != vmSymbols::class_initializer_name(), "should have been checked in verifier"); |
938 |
||
939 |
// check if static |
|
940 |
if (!resolved_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
941 |
ResourceMark rm(THREAD); |
1 | 942 |
char buf[200]; |
14488 | 943 |
jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(resolved_klass(), |
1 | 944 |
resolved_method->name(), |
945 |
resolved_method->signature())); |
|
31019 | 946 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1 | 947 |
} |
31019 | 948 |
return resolved_method; |
1 | 949 |
} |
950 |
||
951 |
||
31019 | 952 |
void LinkResolver::resolve_special_call(CallInfo& result, |
953 |
const LinkInfo& link_info, |
|
954 |
TRAPS) { |
|
955 |
methodHandle resolved_method = linktime_resolve_special_method(link_info, CHECK); |
|
956 |
runtime_resolve_special_method(result, resolved_method, |
|
957 |
link_info.resolved_klass(), |
|
958 |
link_info.current_klass(), |
|
959 |
link_info.check_access(), CHECK); |
|
1 | 960 |
} |
961 |
||
962 |
// throws linktime exceptions |
|
31019 | 963 |
methodHandle LinkResolver::linktime_resolve_special_method(const LinkInfo& link_info, |
964 |
TRAPS) { |
|
1 | 965 |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
966 |
// Invokespecial is called for multiple special reasons: |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
967 |
// <init> |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
968 |
// local private method invocation, for classes and interfaces |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
969 |
// superclass.method, which can also resolve to a default method |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
970 |
// and the selected method is recalculated relative to the direct superclass |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
971 |
// superinterface.method, which explicitly does not check shadowing |
31019 | 972 |
KlassHandle resolved_klass = link_info.resolved_klass(); |
973 |
methodHandle resolved_method; |
|
14385 | 974 |
|
21912 | 975 |
if (!resolved_klass->is_interface()) { |
31019 | 976 |
resolved_method = resolve_method(link_info, /*require_methodref*/false, CHECK_NULL); |
21912 | 977 |
} else { |
31019 | 978 |
resolved_method = resolve_interface_method(link_info, /*nostatics*/true, CHECK_NULL); |
21912 | 979 |
} |
1 | 980 |
|
981 |
// check if method name is <init>, that it is found in same klass as static type |
|
982 |
if (resolved_method->name() == vmSymbols::object_initializer_name() && |
|
983 |
resolved_method->method_holder() != resolved_klass()) { |
|
984 |
ResourceMark rm(THREAD); |
|
985 |
Exceptions::fthrow( |
|
986 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
987 |
vmSymbols::java_lang_NoSuchMethodError(), |
1 | 988 |
"%s: method %s%s not found", |
989 |
resolved_klass->external_name(), |
|
990 |
resolved_method->name()->as_C_string(), |
|
991 |
resolved_method->signature()->as_C_string() |
|
992 |
); |
|
31019 | 993 |
return NULL; |
1 | 994 |
} |
995 |
||
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
996 |
// check if invokespecial's interface method reference is in an indirect superinterface |
31019 | 997 |
KlassHandle current_klass = link_info.current_klass(); |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
998 |
if (!current_klass.is_null() && resolved_klass->is_interface()) { |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
999 |
Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ? |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1000 |
current_klass() : |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1001 |
InstanceKlass::cast(current_klass())->host_klass(); |
25057 | 1002 |
// Disable verification for the dynamically-generated reflection bytecodes. |
1003 |
bool is_reflect = klass_to_check->is_subclass_of( |
|
22218
71cff6a30ec1
8029415: java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java fails on all platforms with hs25-b61
hseigel
parents:
21913
diff
changeset
|
1004 |
SystemDictionary::reflect_MagicAccessorImpl_klass()); |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1005 |
|
22218
71cff6a30ec1
8029415: java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java fails on all platforms with hs25-b61
hseigel
parents:
21913
diff
changeset
|
1006 |
if (!is_reflect && |
71cff6a30ec1
8029415: java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java fails on all platforms with hs25-b61
hseigel
parents:
21913
diff
changeset
|
1007 |
!InstanceKlass::cast(klass_to_check)->is_same_or_direct_interface(resolved_klass())) { |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1008 |
ResourceMark rm(THREAD); |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1009 |
char buf[200]; |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1010 |
jio_snprintf(buf, sizeof(buf), |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1011 |
"Interface method reference: %s, is in an indirect superinterface of %s", |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1012 |
Method::name_and_sig_as_C_string(resolved_klass(), |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1013 |
resolved_method->name(), |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1014 |
resolved_method->signature()), |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1015 |
current_klass->external_name()); |
31019 | 1016 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1017 |
} |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1018 |
} |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1019 |
|
1 | 1020 |
// check if not static |
1021 |
if (resolved_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1022 |
ResourceMark rm(THREAD); |
1 | 1023 |
char buf[200]; |
1024 |
jio_snprintf(buf, sizeof(buf), |
|
1025 |
"Expecting non-static method %s", |
|
14488 | 1026 |
Method::name_and_sig_as_C_string(resolved_klass(), |
31019 | 1027 |
resolved_method->name(), |
1028 |
resolved_method->signature())); |
|
1029 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
|
1 | 1030 |
} |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1031 |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1032 |
if (TraceItables && Verbose) { |
31019 | 1033 |
trace_method_resolution("invokespecial resolved method: caller-class:", |
1034 |
current_klass, resolved_klass, resolved_method); |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1035 |
tty->cr(); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1036 |
} |
31019 | 1037 |
|
1038 |
return resolved_method; |
|
1 | 1039 |
} |
1040 |
||
1041 |
// throws runtime exceptions |
|
31019 | 1042 |
void LinkResolver::runtime_resolve_special_method(CallInfo& result, |
1043 |
const methodHandle& resolved_method, |
|
1044 |
KlassHandle resolved_klass, |
|
1045 |
KlassHandle current_klass, |
|
1046 |
bool check_access, TRAPS) { |
|
1 | 1047 |
|
1048 |
// resolved method is selected method unless we have an old-style lookup |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1049 |
// for a superclass method |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1050 |
// Invokespecial for a superinterface, resolved method is selected method, |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1051 |
// no checks for shadowing |
1 | 1052 |
methodHandle sel_method(THREAD, resolved_method()); |
1053 |
||
1054 |
// check if this is an old-style super call and do a new lookup if so |
|
1055 |
{ KlassHandle method_klass = KlassHandle(THREAD, |
|
1056 |
resolved_method->method_holder()); |
|
1057 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1058 |
if (check_access && |
1 | 1059 |
// a) check if ACC_SUPER flag is set for the current class |
15918 | 1060 |
(current_klass->is_super() || !AllowNonVirtualCalls) && |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1061 |
// b) check if the class of the resolved_klass is a superclass |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1062 |
// (not supertype in order to exclude interface classes) of the current class. |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1063 |
// This check is not performed for super.invoke for interface methods |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1064 |
// in super interfaces. |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1065 |
current_klass->is_subclass_of(resolved_klass()) && |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1066 |
current_klass() != resolved_klass() && |
1 | 1067 |
// c) check if the method is not <init> |
1068 |
resolved_method->name() != vmSymbols::object_initializer_name()) { |
|
1069 |
// Lookup super method |
|
1070 |
KlassHandle super_klass(THREAD, current_klass->super()); |
|
31019 | 1071 |
sel_method = lookup_instance_method_in_klasses(super_klass, |
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
1072 |
resolved_method->name(), |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
1073 |
resolved_method->signature(), CHECK); |
1 | 1074 |
// check if found |
1075 |
if (sel_method.is_null()) { |
|
1076 |
ResourceMark rm(THREAD); |
|
1077 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
14488 | 1078 |
Method::name_and_sig_as_C_string(resolved_klass(), |
1 | 1079 |
resolved_method->name(), |
1080 |
resolved_method->signature())); |
|
1081 |
} |
|
1082 |
} |
|
1083 |
} |
|
1084 |
||
1085 |
// check if not static |
|
1086 |
if (sel_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1087 |
ResourceMark rm(THREAD); |
1 | 1088 |
char buf[200]; |
14488 | 1089 |
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass(), |
1 | 1090 |
resolved_method->name(), |
1091 |
resolved_method->signature())); |
|
1092 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
|
1093 |
} |
|
1094 |
||
1095 |
// check if abstract |
|
1096 |
if (sel_method->is_abstract()) { |
|
1097 |
ResourceMark rm(THREAD); |
|
1098 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
14488 | 1099 |
Method::name_and_sig_as_C_string(resolved_klass(), |
31019 | 1100 |
sel_method->name(), |
1101 |
sel_method->signature())); |
|
1 | 1102 |
} |
1103 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1104 |
if (TraceItables && Verbose) { |
31019 | 1105 |
trace_method_resolution("invokespecial selected method: resolved-class:", |
1106 |
resolved_klass, resolved_klass, sel_method); |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1107 |
tty->cr(); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1108 |
} |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1109 |
|
1 | 1110 |
// setup result |
1111 |
result.set_static(resolved_klass, sel_method, CHECK); |
|
1112 |
} |
|
1113 |
||
31019 | 1114 |
void LinkResolver::resolve_virtual_call(CallInfo& result, Handle recv, KlassHandle receiver_klass, |
1115 |
const LinkInfo& link_info, |
|
1116 |
bool check_null_and_abstract, TRAPS) { |
|
1117 |
methodHandle resolved_method = linktime_resolve_virtual_method(link_info, CHECK); |
|
1118 |
runtime_resolve_virtual_method(result, resolved_method, |
|
1119 |
link_info.resolved_klass(), |
|
1120 |
recv, receiver_klass, |
|
1121 |
check_null_and_abstract, CHECK); |
|
1 | 1122 |
} |
1123 |
||
1124 |
// throws linktime exceptions |
|
31019 | 1125 |
methodHandle LinkResolver::linktime_resolve_virtual_method(const LinkInfo& link_info, |
1126 |
TRAPS) { |
|
1 | 1127 |
// normal method resolution |
31019 | 1128 |
methodHandle resolved_method = resolve_method(link_info, /*require_methodref*/true, CHECK_NULL); |
1 | 1129 |
|
1130 |
assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier"); |
|
1131 |
assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier"); |
|
1132 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1133 |
// check if private interface method |
31019 | 1134 |
KlassHandle resolved_klass = link_info.resolved_klass(); |
1135 |
KlassHandle current_klass = link_info.current_klass(); |
|
1136 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1137 |
if (resolved_klass->is_interface() && resolved_method->is_private()) { |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1138 |
ResourceMark rm(THREAD); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1139 |
char buf[200]; |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1140 |
jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokevirtual: method %s, caller-class:%s", |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1141 |
Method::name_and_sig_as_C_string(resolved_klass(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1142 |
resolved_method->name(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1143 |
resolved_method->signature()), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1144 |
(current_klass.is_null() ? "<NULL>" : current_klass->internal_name())); |
31019 | 1145 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1146 |
} |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1147 |
|
1 | 1148 |
// check if not static |
1149 |
if (resolved_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1150 |
ResourceMark rm(THREAD); |
1 | 1151 |
char buf[200]; |
14488 | 1152 |
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass(), |
1 | 1153 |
resolved_method->name(), |
1154 |
resolved_method->signature())); |
|
31019 | 1155 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1 | 1156 |
} |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1157 |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1158 |
if (PrintVtables && Verbose) { |
31019 | 1159 |
trace_method_resolution("invokevirtual resolved method: caller-class:", |
1160 |
current_klass, resolved_klass, resolved_method); |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1161 |
tty->cr(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1162 |
} |
31019 | 1163 |
|
1164 |
return resolved_method; |
|
1 | 1165 |
} |
1166 |
||
1167 |
// throws runtime exceptions |
|
1168 |
void LinkResolver::runtime_resolve_virtual_method(CallInfo& result, |
|
31019 | 1169 |
const methodHandle& resolved_method, |
1 | 1170 |
KlassHandle resolved_klass, |
1171 |
Handle recv, |
|
1172 |
KlassHandle recv_klass, |
|
1173 |
bool check_null_and_abstract, |
|
1174 |
TRAPS) { |
|
1175 |
||
1176 |
// setup default return values |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1177 |
int vtable_index = Method::invalid_vtable_index; |
1 | 1178 |
methodHandle selected_method; |
1179 |
||
1180 |
assert(recv.is_null() || recv->is_oop(), "receiver is not an oop"); |
|
1181 |
||
1182 |
// runtime method resolution |
|
1183 |
if (check_null_and_abstract && recv.is_null()) { // check if receiver exists |
|
1184 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1185 |
} |
|
1186 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1187 |
// Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s |
1 | 1188 |
// has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since |
1189 |
// a missing receiver might result in a bogus lookup. |
|
14391
df0a1573d5bd
8000725: NPG: method_holder() and pool_holder() and pool_holder field should be InstanceKlass
coleenp
parents:
14385
diff
changeset
|
1190 |
assert(resolved_method->method_holder()->is_linked(), "must be linked"); |
1 | 1191 |
|
1192 |
// do lookup based on receiver klass using the vtable index |
|
32189
5264b560ab1b
8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
31019
diff
changeset
|
1193 |
if (resolved_method->method_holder()->is_interface()) { // default or miranda method |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1194 |
vtable_index = vtable_index_of_interface_method(resolved_klass, |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1195 |
resolved_method); |
1 | 1196 |
assert(vtable_index >= 0 , "we should have valid vtable index at this point"); |
1197 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1198 |
InstanceKlass* inst = InstanceKlass::cast(recv_klass()); |
1 | 1199 |
selected_method = methodHandle(THREAD, inst->method_at_vtable(vtable_index)); |
1200 |
} else { |
|
1201 |
// at this point we are sure that resolved_method is virtual and not |
|
32189
5264b560ab1b
8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
31019
diff
changeset
|
1202 |
// a default or miranda method; therefore, it must have a valid vtable index. |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1203 |
assert(!resolved_method->has_itable_index(), ""); |
1 | 1204 |
vtable_index = resolved_method->vtable_index(); |
1205 |
// We could get a negative vtable_index for final methods, |
|
1206 |
// because as an optimization they are they are never put in the vtable, |
|
1207 |
// unless they override an existing method. |
|
1208 |
// If we do get a negative, it means the resolved method is the the selected |
|
1209 |
// method, and it can never be changed by an override. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1210 |
if (vtable_index == Method::nonvirtual_vtable_index) { |
1 | 1211 |
assert(resolved_method->can_be_statically_bound(), "cannot override this method"); |
1212 |
selected_method = resolved_method; |
|
1213 |
} else { |
|
1214 |
// recv_klass might be an arrayKlassOop but all vtables start at |
|
1215 |
// the same place. The cast is to avoid virtual call and assertion. |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1216 |
InstanceKlass* inst = (InstanceKlass*)recv_klass(); |
1 | 1217 |
selected_method = methodHandle(THREAD, inst->method_at_vtable(vtable_index)); |
1218 |
} |
|
1219 |
} |
|
1220 |
||
1221 |
// check if method exists |
|
1222 |
if (selected_method.is_null()) { |
|
1223 |
ResourceMark rm(THREAD); |
|
1224 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
14488 | 1225 |
Method::name_and_sig_as_C_string(resolved_klass(), |
1 | 1226 |
resolved_method->name(), |
1227 |
resolved_method->signature())); |
|
1228 |
} |
|
1229 |
||
1230 |
// check if abstract |
|
1231 |
if (check_null_and_abstract && selected_method->is_abstract()) { |
|
1232 |
ResourceMark rm(THREAD); |
|
1233 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
14488 | 1234 |
Method::name_and_sig_as_C_string(resolved_klass(), |
1 | 1235 |
selected_method->name(), |
1236 |
selected_method->signature())); |
|
1237 |
} |
|
1238 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1239 |
if (PrintVtables && Verbose) { |
31019 | 1240 |
trace_method_resolution("invokevirtual selected method: receiver-class:", |
1241 |
recv_klass, resolved_klass, selected_method); |
|
1242 |
tty->print_cr("vtable_index:%d", vtable_index); |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1243 |
} |
1 | 1244 |
// setup result |
1245 |
result.set_virtual(resolved_klass, recv_klass, resolved_method, selected_method, vtable_index, CHECK); |
|
1246 |
} |
|
1247 |
||
31019 | 1248 |
void LinkResolver::resolve_interface_call(CallInfo& result, Handle recv, KlassHandle recv_klass, |
1249 |
const LinkInfo& link_info, |
|
1250 |
bool check_null_and_abstract, TRAPS) { |
|
1251 |
// throws linktime exceptions |
|
1252 |
methodHandle resolved_method = linktime_resolve_interface_method(link_info, CHECK); |
|
1253 |
runtime_resolve_interface_method(result, resolved_method,link_info.resolved_klass(), |
|
1254 |
recv, recv_klass, check_null_and_abstract, CHECK); |
|
1 | 1255 |
} |
1256 |
||
31019 | 1257 |
methodHandle LinkResolver::linktime_resolve_interface_method(const LinkInfo& link_info, |
1258 |
TRAPS) { |
|
1 | 1259 |
// normal interface method resolution |
31019 | 1260 |
methodHandle resolved_method = resolve_interface_method(link_info, true, CHECK_NULL); |
1 | 1261 |
assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier"); |
1262 |
assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier"); |
|
31019 | 1263 |
|
1264 |
return resolved_method; |
|
1 | 1265 |
} |
1266 |
||
1267 |
// throws runtime exceptions |
|
31019 | 1268 |
void LinkResolver::runtime_resolve_interface_method(CallInfo& result, |
1269 |
const methodHandle& resolved_method, |
|
1270 |
KlassHandle resolved_klass, |
|
1271 |
Handle recv, |
|
1272 |
KlassHandle recv_klass, |
|
1273 |
bool check_null_and_abstract, TRAPS) { |
|
1 | 1274 |
// check if receiver exists |
1275 |
if (check_null_and_abstract && recv.is_null()) { |
|
1276 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1277 |
} |
|
1278 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1279 |
// check if private interface method |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1280 |
if (resolved_klass->is_interface() && resolved_method->is_private()) { |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1281 |
ResourceMark rm(THREAD); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1282 |
char buf[200]; |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1283 |
jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokeinterface: method %s", |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1284 |
Method::name_and_sig_as_C_string(resolved_klass(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1285 |
resolved_method->name(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1286 |
resolved_method->signature())); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1287 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1288 |
} |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1289 |
|
1 | 1290 |
// check if receiver klass implements the resolved interface |
1291 |
if (!recv_klass->is_subtype_of(resolved_klass())) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1292 |
ResourceMark rm(THREAD); |
1 | 1293 |
char buf[200]; |
1294 |
jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s", |
|
14488 | 1295 |
recv_klass()->external_name(), |
1296 |
resolved_klass()->external_name()); |
|
1 | 1297 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1298 |
} |
|
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
1299 |
|
1 | 1300 |
// do lookup based on receiver klass |
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
1301 |
// This search must match the linktime preparation search for itable initialization |
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
1302 |
// to correctly enforce loader constraints for interface method inheritance |
31019 | 1303 |
methodHandle sel_method = lookup_instance_method_in_klasses(recv_klass, |
1304 |
resolved_method->name(), |
|
1305 |
resolved_method->signature(), CHECK); |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1306 |
if (sel_method.is_null() && !check_null_and_abstract) { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1307 |
// In theory this is a harmless placeholder value, but |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1308 |
// in practice leaving in null affects the nsk default method tests. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1309 |
// This needs further study. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1310 |
sel_method = resolved_method; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1311 |
} |
1 | 1312 |
// check if method exists |
1313 |
if (sel_method.is_null()) { |
|
1314 |
ResourceMark rm(THREAD); |
|
1315 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
31019 | 1316 |
Method::name_and_sig_as_C_string(recv_klass(), |
1317 |
resolved_method->name(), |
|
1318 |
resolved_method->signature())); |
|
1 | 1319 |
} |
17024
49cbeca23983
8006267: InterfaceMethod_ref should allow invokestatic and invokespecial
bharadwaj
parents:
16691
diff
changeset
|
1320 |
// check access |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1321 |
// Throw Illegal Access Error if sel_method is not public. |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1322 |
if (!sel_method->is_public()) { |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1323 |
ResourceMark rm(THREAD); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1324 |
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1325 |
Method::name_and_sig_as_C_string(recv_klass(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1326 |
sel_method->name(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1327 |
sel_method->signature())); |
17024
49cbeca23983
8006267: InterfaceMethod_ref should allow invokestatic and invokespecial
bharadwaj
parents:
16691
diff
changeset
|
1328 |
} |
1 | 1329 |
// check if abstract |
1330 |
if (check_null_and_abstract && sel_method->is_abstract()) { |
|
1331 |
ResourceMark rm(THREAD); |
|
1332 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
14488 | 1333 |
Method::name_and_sig_as_C_string(recv_klass(), |
1 | 1334 |
sel_method->name(), |
1335 |
sel_method->signature())); |
|
1336 |
} |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1337 |
|
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1338 |
if (TraceItables && Verbose) { |
31019 | 1339 |
trace_method_resolution("invokeinterface selected method: receiver-class", |
1340 |
recv_klass, resolved_klass, sel_method); |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1341 |
tty->cr(); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1342 |
} |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1343 |
// setup result |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1344 |
if (!resolved_method->has_itable_index()) { |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1345 |
int vtable_index = resolved_method->vtable_index(); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1346 |
assert(vtable_index == sel_method->vtable_index(), "sanity check"); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1347 |
result.set_virtual(resolved_klass, recv_klass, resolved_method, sel_method, vtable_index, CHECK); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1348 |
} else { |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1349 |
int itable_index = resolved_method()->itable_index(); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1350 |
result.set_interface(resolved_klass, recv_klass, resolved_method, sel_method, itable_index, CHECK); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1351 |
} |
1 | 1352 |
} |
1353 |
||
1354 |
||
1355 |
methodHandle LinkResolver::linktime_resolve_interface_method_or_null( |
|
31019 | 1356 |
const LinkInfo& link_info) { |
1 | 1357 |
EXCEPTION_MARK; |
31019 | 1358 |
methodHandle method_result = linktime_resolve_interface_method(link_info, THREAD); |
1 | 1359 |
if (HAS_PENDING_EXCEPTION) { |
1360 |
CLEAR_PENDING_EXCEPTION; |
|
1361 |
return methodHandle(); |
|
1362 |
} else { |
|
1363 |
return method_result; |
|
1364 |
} |
|
1365 |
} |
|
1366 |
||
1367 |
methodHandle LinkResolver::linktime_resolve_virtual_method_or_null( |
|
31019 | 1368 |
const LinkInfo& link_info) { |
1 | 1369 |
EXCEPTION_MARK; |
31019 | 1370 |
methodHandle method_result = linktime_resolve_virtual_method(link_info, THREAD); |
1 | 1371 |
if (HAS_PENDING_EXCEPTION) { |
1372 |
CLEAR_PENDING_EXCEPTION; |
|
1373 |
return methodHandle(); |
|
1374 |
} else { |
|
1375 |
return method_result; |
|
1376 |
} |
|
1377 |
} |
|
1378 |
||
1379 |
methodHandle LinkResolver::resolve_virtual_call_or_null( |
|
1380 |
KlassHandle receiver_klass, |
|
31019 | 1381 |
const LinkInfo& link_info) { |
1 | 1382 |
EXCEPTION_MARK; |
1383 |
CallInfo info; |
|
31019 | 1384 |
resolve_virtual_call(info, Handle(), receiver_klass, link_info, false, THREAD); |
1 | 1385 |
if (HAS_PENDING_EXCEPTION) { |
1386 |
CLEAR_PENDING_EXCEPTION; |
|
1387 |
return methodHandle(); |
|
1388 |
} |
|
1389 |
return info.selected_method(); |
|
1390 |
} |
|
1391 |
||
1392 |
methodHandle LinkResolver::resolve_interface_call_or_null( |
|
1393 |
KlassHandle receiver_klass, |
|
31019 | 1394 |
const LinkInfo& link_info) { |
1 | 1395 |
EXCEPTION_MARK; |
1396 |
CallInfo info; |
|
31019 | 1397 |
resolve_interface_call(info, Handle(), receiver_klass, link_info, false, THREAD); |
1 | 1398 |
if (HAS_PENDING_EXCEPTION) { |
1399 |
CLEAR_PENDING_EXCEPTION; |
|
1400 |
return methodHandle(); |
|
1401 |
} |
|
1402 |
return info.selected_method(); |
|
1403 |
} |
|
1404 |
||
31019 | 1405 |
int LinkResolver::resolve_virtual_vtable_index(KlassHandle receiver_klass, |
1406 |
const LinkInfo& link_info) { |
|
1 | 1407 |
EXCEPTION_MARK; |
1408 |
CallInfo info; |
|
31019 | 1409 |
resolve_virtual_call(info, Handle(), receiver_klass, link_info, |
1410 |
/*check_null_or_abstract*/false, THREAD); |
|
1 | 1411 |
if (HAS_PENDING_EXCEPTION) { |
1412 |
CLEAR_PENDING_EXCEPTION; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1413 |
return Method::invalid_vtable_index; |
1 | 1414 |
} |
1415 |
return info.vtable_index(); |
|
1416 |
} |
|
1417 |
||
31019 | 1418 |
methodHandle LinkResolver::resolve_static_call_or_null(const LinkInfo& link_info) { |
1 | 1419 |
EXCEPTION_MARK; |
1420 |
CallInfo info; |
|
31019 | 1421 |
resolve_static_call(info, link_info, /*initialize_class*/false, THREAD); |
1 | 1422 |
if (HAS_PENDING_EXCEPTION) { |
1423 |
CLEAR_PENDING_EXCEPTION; |
|
1424 |
return methodHandle(); |
|
1425 |
} |
|
1426 |
return info.selected_method(); |
|
1427 |
} |
|
1428 |
||
31019 | 1429 |
methodHandle LinkResolver::resolve_special_call_or_null(const LinkInfo& link_info) { |
1 | 1430 |
EXCEPTION_MARK; |
1431 |
CallInfo info; |
|
31019 | 1432 |
resolve_special_call(info, link_info, THREAD); |
1 | 1433 |
if (HAS_PENDING_EXCEPTION) { |
1434 |
CLEAR_PENDING_EXCEPTION; |
|
1435 |
return methodHandle(); |
|
1436 |
} |
|
1437 |
return info.selected_method(); |
|
1438 |
} |
|
1439 |
||
1440 |
||
1441 |
||
1442 |
//------------------------------------------------------------------------------------------------------------------------ |
|
1443 |
// ConstantPool entries |
|
1444 |
||
1445 |
void LinkResolver::resolve_invoke(CallInfo& result, Handle recv, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS) { |
|
1446 |
switch (byte) { |
|
1447 |
case Bytecodes::_invokestatic : resolve_invokestatic (result, pool, index, CHECK); break; |
|
1448 |
case Bytecodes::_invokespecial : resolve_invokespecial (result, pool, index, CHECK); break; |
|
1449 |
case Bytecodes::_invokevirtual : resolve_invokevirtual (result, recv, pool, index, CHECK); break; |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1450 |
case Bytecodes::_invokehandle : resolve_invokehandle (result, pool, index, CHECK); break; |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1451 |
case Bytecodes::_invokedynamic : resolve_invokedynamic (result, pool, index, CHECK); break; |
1 | 1452 |
case Bytecodes::_invokeinterface: resolve_invokeinterface(result, recv, pool, index, CHECK); break; |
1453 |
} |
|
1454 |
return; |
|
1455 |
} |
|
1456 |
||
1457 |
void LinkResolver::resolve_invokestatic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) { |
|
31019 | 1458 |
LinkInfo link_info(pool, index, CHECK); |
1459 |
resolve_static_call(result, link_info, /*initialize_class*/true, CHECK); |
|
1 | 1460 |
} |
1461 |
||
1462 |
||
1463 |
void LinkResolver::resolve_invokespecial(CallInfo& result, constantPoolHandle pool, int index, TRAPS) { |
|
31019 | 1464 |
LinkInfo link_info(pool, index, CHECK); |
1465 |
resolve_special_call(result, link_info, CHECK); |
|
1 | 1466 |
} |
1467 |
||
1468 |
||
1469 |
void LinkResolver::resolve_invokevirtual(CallInfo& result, Handle recv, |
|
1470 |
constantPoolHandle pool, int index, |
|
1471 |
TRAPS) { |
|
1472 |
||
31019 | 1473 |
LinkInfo link_info(pool, index, CHECK); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1474 |
KlassHandle recvrKlass (THREAD, recv.is_null() ? (Klass*)NULL : recv->klass()); |
31019 | 1475 |
resolve_virtual_call(result, recv, recvrKlass, link_info, /*check_null_or_abstract*/true, CHECK); |
1 | 1476 |
} |
1477 |
||
1478 |
||
1479 |
void LinkResolver::resolve_invokeinterface(CallInfo& result, Handle recv, constantPoolHandle pool, int index, TRAPS) { |
|
31019 | 1480 |
LinkInfo link_info(pool, index, CHECK); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1481 |
KlassHandle recvrKlass (THREAD, recv.is_null() ? (Klass*)NULL : recv->klass()); |
31019 | 1482 |
resolve_interface_call(result, recv, recvrKlass, link_info, true, CHECK); |
1 | 1483 |
} |
1484 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1485 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1486 |
void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle pool, int index, TRAPS) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1487 |
// This guy is reached from InterpreterRuntime::resolve_invokehandle. |
31019 | 1488 |
LinkInfo link_info(pool, index, CHECK); |
16691 | 1489 |
if (TraceMethodHandles) { |
1490 |
ResourceMark rm(THREAD); |
|
31019 | 1491 |
tty->print_cr("resolve_invokehandle %s %s", link_info.name()->as_C_string(), |
1492 |
link_info.signature()->as_C_string()); |
|
16691 | 1493 |
} |
31019 | 1494 |
resolve_handle_call(result, link_info, CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1495 |
} |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1496 |
|
31019 | 1497 |
void LinkResolver::resolve_handle_call(CallInfo& result, |
1498 |
const LinkInfo& link_info, |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1499 |
TRAPS) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1500 |
// JSR 292: this must be an implicitly generated method MethodHandle.invokeExact(*...) or similar |
31019 | 1501 |
assert(link_info.resolved_klass()() == SystemDictionary::MethodHandle_klass(), ""); |
1502 |
assert(MethodHandles::is_signature_polymorphic_name(link_info.name()), ""); |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1503 |
Handle resolved_appendix; |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1504 |
Handle resolved_method_type; |
31019 | 1505 |
methodHandle resolved_method = lookup_polymorphic_method(link_info, |
1506 |
&resolved_appendix, &resolved_method_type, CHECK); |
|
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1507 |
result.set_handle(resolved_method, resolved_appendix, resolved_method_type, CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1508 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1509 |
|
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1510 |
static void wrap_invokedynamic_exception(TRAPS) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1511 |
if (HAS_PENDING_EXCEPTION) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1512 |
if (TraceMethodHandles) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1513 |
tty->print_cr("invokedynamic throws BSME for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1514 |
PENDING_EXCEPTION->print(); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1515 |
} |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1516 |
if (PENDING_EXCEPTION->is_a(SystemDictionary::BootstrapMethodError_klass())) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1517 |
// throw these guys, since they are already wrapped |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1518 |
return; |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1519 |
} |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1520 |
if (!PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1521 |
// intercept only LinkageErrors which might have failed to wrap |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1522 |
return; |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1523 |
} |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1524 |
// See the "Linking Exceptions" section for the invokedynamic instruction in the JVMS. |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1525 |
Handle nested_exception(THREAD, PENDING_EXCEPTION); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1526 |
CLEAR_PENDING_EXCEPTION; |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1527 |
THROW_CAUSE(vmSymbols::java_lang_BootstrapMethodError(), nested_exception) |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1528 |
} |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1529 |
} |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1530 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1531 |
void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1532 |
Symbol* method_name = pool->name_ref_at(index); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1533 |
Symbol* method_signature = pool->signature_ref_at(index); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1534 |
KlassHandle current_klass = KlassHandle(THREAD, pool->pool_holder()); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1535 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1536 |
// Resolve the bootstrap specifier (BSM + optional arguments). |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1537 |
Handle bootstrap_specifier; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1538 |
// Check if CallSite has been bound already: |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1539 |
ConstantPoolCacheEntry* cpce = pool->invokedynamic_cp_cache_entry_at(index); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1540 |
if (cpce->is_f1_null()) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1541 |
int pool_index = cpce->constant_pool_index(); |
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1542 |
oop bsm_info = pool->resolve_bootstrap_specifier_at(pool_index, THREAD); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1543 |
wrap_invokedynamic_exception(CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1544 |
assert(bsm_info != NULL, ""); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1545 |
// FIXME: Cache this once per BootstrapMethods entry, not once per CONSTANT_InvokeDynamic. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1546 |
bootstrap_specifier = Handle(THREAD, bsm_info); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1547 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1548 |
if (!cpce->is_f1_null()) { |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1549 |
methodHandle method( THREAD, cpce->f1_as_method()); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1550 |
Handle appendix( THREAD, cpce->appendix_if_resolved(pool)); |
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1551 |
Handle method_type(THREAD, cpce->method_type_if_resolved(pool)); |
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1552 |
result.set_handle(method, appendix, method_type, THREAD); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1553 |
wrap_invokedynamic_exception(CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1554 |
return; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1555 |
} |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1556 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1557 |
if (TraceMethodHandles) { |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1558 |
ResourceMark rm(THREAD); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1559 |
tty->print_cr("resolve_invokedynamic #%d %s %s", |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1560 |
ConstantPool::decode_invokedynamic_index(index), |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1561 |
method_name->as_C_string(), method_signature->as_C_string()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1562 |
tty->print(" BSM info: "); bootstrap_specifier->print(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1563 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1564 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1565 |
resolve_dynamic_call(result, bootstrap_specifier, method_name, method_signature, current_klass, CHECK); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1566 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1567 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1568 |
void LinkResolver::resolve_dynamic_call(CallInfo& result, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1569 |
Handle bootstrap_specifier, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1570 |
Symbol* method_name, Symbol* method_signature, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1571 |
KlassHandle current_klass, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1572 |
TRAPS) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1573 |
// JSR 292: this must resolve to an implicitly generated method MH.linkToCallSite(*...) |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1574 |
// The appendix argument is likely to be a freshly-created CallSite. |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1575 |
Handle resolved_appendix; |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1576 |
Handle resolved_method_type; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1577 |
methodHandle resolved_method = |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1578 |
SystemDictionary::find_dynamic_call_site_invoker(current_klass, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1579 |
bootstrap_specifier, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1580 |
method_name, method_signature, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1581 |
&resolved_appendix, |
13929
8da0dc50a6e4
7200949: JSR 292: rubybench/bench/time/bench_base64.rb fails with jruby.jar not on boot class path
twisti
parents:
13732
diff
changeset
|
1582 |
&resolved_method_type, |
13732
a9865f5514fc
7196120: NPG: JSR 2292 test fails because missing fix for 7188911
twisti
parents:
13728
diff
changeset
|
1583 |
THREAD); |
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1584 |
wrap_invokedynamic_exception(CHECK); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1585 |
result.set_handle(resolved_method, resolved_appendix, resolved_method_type, THREAD); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1586 |
wrap_invokedynamic_exception(CHECK); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1587 |
} |
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1588 |
|
1 | 1589 |
#ifndef PRODUCT |
31019 | 1590 |
void LinkResolver::trace_method_resolution(const char* prefix, |
1591 |
KlassHandle klass, |
|
1592 |
KlassHandle resolved_klass, |
|
1593 |
const methodHandle& method) { |
|
1 | 1594 |
ResourceMark rm; |
31019 | 1595 |
tty->print("%s%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ", |
1596 |
prefix, |
|
1597 |
(klass.is_null() ? "<NULL>" : klass->internal_name()), |
|
1598 |
(resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()), |
|
1599 |
Method::name_and_sig_as_C_string(resolved_klass(), |
|
1600 |
method->name(), |
|
1601 |
method->signature()), |
|
1602 |
method->method_holder()->internal_name() |
|
1603 |
); |
|
1604 |
method->access_flags().print_on(tty); |
|
1605 |
if (method->is_default_method()) { |
|
1606 |
tty->print("default "); |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1607 |
} |
31019 | 1608 |
if (method->is_overpass()) { |
1609 |
tty->print("overpass "); |
|
1610 |
} |
|
1 | 1611 |
} |
31019 | 1612 |
#endif // PRODUCT |