author | jwilhelm |
Mon, 30 Oct 2017 21:23:10 +0100 | |
changeset 47771 | 8024fff2e247 |
parent 47765 | b7c7428eaab9 |
parent 47401 | 98e960939ef2 |
child 47824 | cf127be65014 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
46262
83280d968b96
8174092: Remove array-related access checks from Reflection::verify_class_access()
hseigel
parents:
42074
diff
changeset
|
2 |
* Copyright (c) 1997, 2017, 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" |
47765
b7c7428eaab9
8189610: Reconcile jvm.h and all jvm_md.h between java.base and hotspot
coleenp
parents:
47684
diff
changeset
|
26 |
#include "jvm.h" |
14385 | 27 |
#include "classfile/defaultMethods.hpp" |
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
28 |
#include "classfile/javaClasses.hpp" |
47684
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
29 |
#include "classfile/resolutionErrors.hpp" |
34666 | 30 |
#include "classfile/symbolTable.hpp" |
7397 | 31 |
#include "classfile/systemDictionary.hpp" |
32 |
#include "classfile/vmSymbols.hpp" |
|
33 |
#include "compiler/compileBroker.hpp" |
|
30764 | 34 |
#include "gc/shared/collectedHeap.inline.hpp" |
7397 | 35 |
#include "interpreter/bytecode.hpp" |
36 |
#include "interpreter/interpreterRuntime.hpp" |
|
37 |
#include "interpreter/linkResolver.hpp" |
|
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
38 |
#include "logging/log.hpp" |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
39 |
#include "logging/logStream.hpp" |
7397 | 40 |
#include "memory/resourceArea.hpp" |
41 |
#include "memory/universe.inline.hpp" |
|
42 |
#include "oops/instanceKlass.hpp" |
|
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
43 |
#include "oops/method.hpp" |
7397 | 44 |
#include "oops/objArrayOop.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28738
diff
changeset
|
45 |
#include "oops/oop.inline.hpp" |
7397 | 46 |
#include "prims/methodHandles.hpp" |
47 |
#include "prims/nativeLookup.hpp" |
|
48 |
#include "runtime/compilationPolicy.hpp" |
|
49 |
#include "runtime/fieldDescriptor.hpp" |
|
50 |
#include "runtime/frame.inline.hpp" |
|
51 |
#include "runtime/handles.inline.hpp" |
|
52 |
#include "runtime/reflection.hpp" |
|
53 |
#include "runtime/signature.hpp" |
|
14583
d70ee55535f4
8003935: Simplify the needed includes for using Thread::current()
stefank
parents:
14488
diff
changeset
|
54 |
#include "runtime/thread.inline.hpp" |
7397 | 55 |
#include "runtime/vmThread.hpp" |
1 | 56 |
|
57 |
||
58 |
//------------------------------------------------------------------------------------------------------------------------ |
|
59 |
// Implementation of CallInfo |
|
60 |
||
61 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
62 |
void CallInfo::set_static(Klass* resolved_klass, const methodHandle& resolved_method, TRAPS) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
63 |
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
|
64 |
set_common(resolved_klass, resolved_klass, resolved_method, resolved_method, CallInfo::direct_call, vtable_index, CHECK); |
1 | 65 |
} |
66 |
||
67 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
68 |
void CallInfo::set_interface(Klass* resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
69 |
Klass* selected_klass, |
31019 | 70 |
const methodHandle& resolved_method, |
71 |
const methodHandle& selected_method, |
|
72 |
int itable_index, TRAPS) { |
|
1 | 73 |
// This is only called for interface methods. If the resolved_method |
74 |
// comes from java/lang/Object, it can be the subject of a virtual call, so |
|
75 |
// 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
|
76 |
// 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
|
77 |
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
|
78 |
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
|
79 |
set_common(resolved_klass, selected_klass, resolved_method, selected_method, CallInfo::itable_call, itable_index, CHECK); |
1 | 80 |
} |
81 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
82 |
void CallInfo::set_virtual(Klass* resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
83 |
Klass* selected_klass, |
31019 | 84 |
const methodHandle& resolved_method, |
85 |
const methodHandle& selected_method, |
|
86 |
int vtable_index, TRAPS) { |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
87 |
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
|
88 |
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
|
89 |
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
|
90 |
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
|
91 |
assert(!resolved_method->is_compiled_lambda_form(), "these must be handled via an invokehandle call"); |
1 | 92 |
} |
93 |
||
31019 | 94 |
void CallInfo::set_handle(const methodHandle& resolved_method, |
95 |
Handle resolved_appendix, |
|
96 |
Handle resolved_method_type, TRAPS) { |
|
36819 | 97 |
set_handle(SystemDictionary::MethodHandle_klass(), resolved_method, resolved_appendix, resolved_method_type, CHECK); |
98 |
} |
|
99 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
100 |
void CallInfo::set_handle(Klass* resolved_klass, |
36819 | 101 |
const methodHandle& resolved_method, |
102 |
Handle resolved_appendix, |
|
103 |
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
|
104 |
if (resolved_method.is_null()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
105 |
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
|
106 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
107 |
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
|
108 |
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
|
109 |
"linkMethod must return one of these"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
110 |
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
|
111 |
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
|
112 |
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
|
113 |
_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
|
114 |
_resolved_method_type = resolved_method_type; |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5547
diff
changeset
|
115 |
} |
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5547
diff
changeset
|
116 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
117 |
void CallInfo::set_common(Klass* resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
118 |
Klass* selected_klass, |
31019 | 119 |
const methodHandle& resolved_method, |
120 |
const methodHandle& selected_method, |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
121 |
CallKind kind, |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
122 |
int index, |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
123 |
TRAPS) { |
1 | 124 |
assert(resolved_method->signature() == selected_method->signature(), "signatures must correspond"); |
125 |
_resolved_klass = resolved_klass; |
|
126 |
_selected_klass = selected_klass; |
|
127 |
_resolved_method = resolved_method; |
|
128 |
_selected_method = selected_method; |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
129 |
_call_kind = kind; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
130 |
_call_index = index; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
131 |
_resolved_appendix = Handle(); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
132 |
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
|
133 |
|
38139
cf6f5c1b7205
8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
never
parents:
38034
diff
changeset
|
134 |
CompilationPolicy::compile_if_required(selected_method, THREAD); |
1 | 135 |
} |
136 |
||
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
137 |
// utility query for unreflecting a method |
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
138 |
CallInfo::CallInfo(Method* resolved_method, Klass* resolved_klass, TRAPS) { |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
139 |
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
|
140 |
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
|
141 |
resolved_klass = resolved_method_holder; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
142 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
143 |
_resolved_klass = resolved_klass; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
144 |
_selected_klass = resolved_klass; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
145 |
_resolved_method = resolved_method; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
146 |
_selected_method = resolved_method; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
147 |
// classify: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
148 |
CallKind kind = CallInfo::unknown_kind; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
149 |
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
|
150 |
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
|
151 |
kind = CallInfo::direct_call; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
152 |
} 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
|
153 |
// 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
|
154 |
kind = CallInfo::vtable_call; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
155 |
} else if (!resolved_klass->is_interface()) { |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
156 |
// A default or miranda method. Compute the vtable index. |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
157 |
index = LinkResolver::vtable_index_of_interface_method(resolved_klass, |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
158 |
resolved_method); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
159 |
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
|
160 |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
161 |
kind = CallInfo::vtable_call; |
20712
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
162 |
} else if (resolved_method->has_vtable_index()) { |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
163 |
// 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
|
164 |
|
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
165 |
#ifdef ASSERT |
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
166 |
// Ensure that this is really the case. |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
167 |
Klass* object_klass = SystemDictionary::Object_klass(); |
46408
70aab0c2ea8b
8178350: klassVtable and klassItable should be ValueObj
iklam
parents:
46329
diff
changeset
|
168 |
Method * object_resolved_method = object_klass->vtable().method_at(index); |
20712
a06e1f01fb6e
8026124: JSR-292 bug: java.nio.file.Path.toString cores dump
drchase
parents:
20391
diff
changeset
|
169 |
assert(object_resolved_method->name() == resolved_method->name(), |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
170 |
"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
|
171 |
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
|
172 |
assert(object_resolved_method->signature() == resolved_method->signature(), |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
173 |
"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
|
174 |
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
|
175 |
#endif // ASSERT |
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 |
kind = CallInfo::vtable_call; |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
178 |
} else { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
179 |
// A regular interface call. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
180 |
kind = CallInfo::itable_call; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
181 |
index = resolved_method->itable_index(); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
182 |
} |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
183 |
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
|
184 |
_call_kind = kind; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
185 |
_call_index = index; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
186 |
_resolved_appendix = Handle(); |
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
187 |
// Find or create a ResolvedMethod instance for this Method* |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
188 |
set_resolved_method_name(CHECK); |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
189 |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
190 |
DEBUG_ONLY(verify()); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
191 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
192 |
|
46505
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
193 |
void CallInfo::set_resolved_method_name(TRAPS) { |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
194 |
Method* m = _resolved_method(); |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
195 |
assert(m != NULL, "Should already have a Method*"); |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
196 |
oop rmethod_name = java_lang_invoke_ResolvedMethodName::find_resolved_method(m, CHECK); |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
197 |
_resolved_method_name = Handle(THREAD, rmethod_name); |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
198 |
} |
fd4bc78630b1
8174749: Use hash table/oops for MemberName table
coleenp
parents:
46458
diff
changeset
|
199 |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
200 |
#ifdef ASSERT |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
201 |
void CallInfo::verify() { |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
202 |
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
|
203 |
case CallInfo::direct_call: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
204 |
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
|
205 |
// 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
|
206 |
case CallInfo::vtable_call: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
207 |
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
|
208 |
break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
209 |
case CallInfo::itable_call: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
210 |
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
|
211 |
break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
212 |
case CallInfo::unknown_kind: |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
213 |
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
|
214 |
break; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
215 |
default: |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
216 |
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
|
217 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
218 |
} |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
219 |
#endif //ASSERT |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
220 |
|
31019 | 221 |
#ifndef PRODUCT |
222 |
void CallInfo::print() { |
|
223 |
ResourceMark rm; |
|
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
224 |
const char* kindstr; |
31019 | 225 |
switch (_call_kind) { |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
226 |
case direct_call: kindstr = "direct"; break; |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
227 |
case vtable_call: kindstr = "vtable"; break; |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
228 |
case itable_call: kindstr = "itable"; break; |
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
229 |
default : kindstr = "unknown"; break; |
31019 | 230 |
} |
231 |
tty->print_cr("Call %s@%d %s", kindstr, _call_index, |
|
232 |
_resolved_method.is_null() ? "(none)" : _resolved_method->name_and_sig_as_C_string()); |
|
233 |
} |
|
234 |
#endif |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
235 |
|
31019 | 236 |
//------------------------------------------------------------------------------------------------------------------------ |
237 |
// Implementation of LinkInfo |
|
1 | 238 |
|
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
239 |
LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, const methodHandle& current_method, TRAPS) { |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
240 |
// resolve klass |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
241 |
_resolved_klass = pool->klass_ref_at(index, CHECK); |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
242 |
|
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
243 |
// Get name, signature, and static klass |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
244 |
_name = pool->name_ref_at(index); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
245 |
_signature = pool->signature_ref_at(index); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
246 |
_tag = pool->tag_ref_at(index); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
247 |
_current_klass = pool->pool_holder(); |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
248 |
_current_method = current_method; |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
249 |
|
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
250 |
// Coming from the constant pool always checks access |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
251 |
_check_access = true; |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
252 |
} |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
253 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
254 |
LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, TRAPS) { |
31019 | 255 |
// resolve klass |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
256 |
_resolved_klass = pool->klass_ref_at(index, CHECK); |
31019 | 257 |
|
258 |
// Get name, signature, and static klass |
|
259 |
_name = pool->name_ref_at(index); |
|
260 |
_signature = pool->signature_ref_at(index); |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
261 |
_tag = pool->tag_ref_at(index); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
262 |
_current_klass = pool->pool_holder(); |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
263 |
_current_method = methodHandle(); |
31019 | 264 |
|
265 |
// Coming from the constant pool always checks access |
|
266 |
_check_access = true; |
|
267 |
} |
|
268 |
||
269 |
char* LinkInfo::method_string() const { |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
270 |
return Method::name_and_sig_as_C_string(_resolved_klass, _name, _signature); |
31019 | 271 |
} |
272 |
||
273 |
#ifndef PRODUCT |
|
274 |
void LinkInfo::print() { |
|
275 |
ResourceMark rm; |
|
276 |
tty->print_cr("Link resolved_klass=%s name=%s signature=%s current_klass=%s check_access=%s", |
|
277 |
_resolved_klass->name()->as_C_string(), |
|
278 |
_name->as_C_string(), |
|
279 |
_signature->as_C_string(), |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
280 |
_current_klass == NULL ? "(none)" : _current_klass->name()->as_C_string(), |
31019 | 281 |
_check_access ? "true" : "false"); |
282 |
} |
|
283 |
#endif // PRODUCT |
|
1 | 284 |
//------------------------------------------------------------------------------------------------------------------------ |
285 |
// Klass resolution |
|
286 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
287 |
void LinkResolver::check_klass_accessability(Klass* ref_klass, Klass* sel_klass, TRAPS) { |
36508 | 288 |
Reflection::VerifyClassAccessResults vca_result = |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
289 |
Reflection::verify_class_access(ref_klass, InstanceKlass::cast(sel_klass), true); |
36508 | 290 |
if (vca_result != Reflection::ACCESS_OK) { |
1 | 291 |
ResourceMark rm(THREAD); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
292 |
char* msg = Reflection::verify_class_access_msg(ref_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
293 |
InstanceKlass::cast(sel_klass), |
46262
83280d968b96
8174092: Remove array-related access checks from Reflection::verify_class_access()
hseigel
parents:
42074
diff
changeset
|
294 |
vca_result); |
36508 | 295 |
if (msg == NULL) { |
296 |
Exceptions::fthrow( |
|
297 |
THREAD_AND_LOCATION, |
|
298 |
vmSymbols::java_lang_IllegalAccessError(), |
|
299 |
"failed to access class %s from class %s", |
|
300 |
sel_klass->external_name(), |
|
301 |
ref_klass->external_name()); |
|
302 |
} else { |
|
303 |
// Use module specific message returned by verify_class_access_msg(). |
|
304 |
Exceptions::fthrow( |
|
305 |
THREAD_AND_LOCATION, |
|
306 |
vmSymbols::java_lang_IllegalAccessError(), |
|
307 |
"%s", msg); |
|
308 |
} |
|
1 | 309 |
} |
310 |
} |
|
311 |
||
312 |
//------------------------------------------------------------------------------------------------------------------------ |
|
313 |
// Method resolution |
|
314 |
// |
|
315 |
// According to JVM spec. $5.4.3c & $5.4.3d |
|
316 |
||
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
317 |
// Look up method in klasses, including static methods |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
318 |
// Then look up local default methods |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
319 |
Method* LinkResolver::lookup_method_in_klasses(const LinkInfo& link_info, |
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
320 |
bool checkpolymorphism, |
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
321 |
bool in_imethod_resolve) { |
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
322 |
NoSafepointVerifier nsv; // Method* returned may not be reclaimed |
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
323 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
324 |
Klass* klass = link_info.resolved_klass(); |
31019 | 325 |
Symbol* name = link_info.name(); |
326 |
Symbol* signature = link_info.signature(); |
|
327 |
||
23999
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
328 |
// Ignore overpasses so statics can be found during resolution |
31019 | 329 |
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
|
330 |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
331 |
if (klass->is_array_klass()) { |
27020 | 332 |
// Only consider klass and super klass for arrays |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
333 |
return result; |
27020 | 334 |
} |
335 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
336 |
InstanceKlass* ik = InstanceKlass::cast(klass); |
33602 | 337 |
|
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
338 |
// 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
|
339 |
// 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
|
340 |
// 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
|
341 |
if (in_imethod_resolve && |
31019 | 342 |
result != NULL && |
33602 | 343 |
ik->is_interface() && |
31019 | 344 |
(result->is_static() || !result->is_public()) && |
345 |
result->method_holder() == SystemDictionary::Object_klass()) { |
|
346 |
result = NULL; |
|
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
347 |
} |
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
348 |
|
23999
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
349 |
// 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
|
350 |
// current class if a method has not been found. |
31019 | 351 |
if (result == NULL) { |
33602 | 352 |
result = ik->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
|
353 |
} |
22eb7be3d99d
8033150: invokestatic: IncompatibleClassChangeError trying to invoke static method from a parent in presence of conflicting defaults.
lfoltan
parents:
22739
diff
changeset
|
354 |
|
31019 | 355 |
if (result == NULL) { |
33602 | 356 |
Array<Method*>* default_methods = ik->default_methods(); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
357 |
if (default_methods != NULL) { |
31019 | 358 |
result = InstanceKlass::find_method(default_methods, name, signature); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
359 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
360 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
361 |
|
31019 | 362 |
if (checkpolymorphism && result != NULL) { |
363 |
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
|
364 |
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
|
365 |
// Do not link directly to these. The VM must produce a synthetic one using lookup_polymorphic_method. |
31019 | 366 |
return NULL; |
5420
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
4571
diff
changeset
|
367 |
} |
586d3988e72b
6939134: JSR 292 adjustments to method handle invocation
jrose
parents:
4571
diff
changeset
|
368 |
} |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
369 |
return result; |
1 | 370 |
} |
371 |
||
372 |
// returns first instance method |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
373 |
// Looks up method in classes, then looks up local default methods |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
374 |
methodHandle LinkResolver::lookup_instance_method_in_klasses(Klass* klass, |
31019 | 375 |
Symbol* name, |
376 |
Symbol* signature, TRAPS) { |
|
377 |
Method* result = klass->uncached_lookup_method(name, signature, Klass::find_overpass); |
|
378 |
||
379 |
while (result != NULL && result->is_static() && result->method_holder()->super() != NULL) { |
|
380 |
Klass* super_klass = result->method_holder()->super(); |
|
381 |
result = super_klass->uncached_lookup_method(name, signature, Klass::find_overpass); |
|
1 | 382 |
} |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
383 |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
384 |
if (klass->is_array_klass()) { |
27020 | 385 |
// Only consider klass and super klass for arrays |
31019 | 386 |
return methodHandle(THREAD, result); |
27020 | 387 |
} |
388 |
||
31019 | 389 |
if (result == NULL) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
390 |
Array<Method*>* default_methods = InstanceKlass::cast(klass)->default_methods(); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
391 |
if (default_methods != NULL) { |
31019 | 392 |
result = InstanceKlass::find_method(default_methods, name, signature); |
393 |
assert(result == NULL || !result->is_static(), "static defaults not allowed"); |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
394 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
395 |
} |
31019 | 396 |
return methodHandle(THREAD, result); |
1 | 397 |
} |
398 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
399 |
int LinkResolver::vtable_index_of_interface_method(Klass* klass, |
31019 | 400 |
const methodHandle& resolved_method) { |
1 | 401 |
|
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
402 |
int vtable_index = Method::invalid_vtable_index; |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
403 |
Symbol* name = resolved_method->name(); |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
404 |
Symbol* signature = resolved_method->signature(); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
405 |
InstanceKlass* ik = InstanceKlass::cast(klass); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
406 |
|
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
407 |
// First check in default method array |
33602 | 408 |
if (!resolved_method->is_abstract() && ik->default_methods() != NULL) { |
409 |
int index = InstanceKlass::find_method_index(ik->default_methods(), |
|
32189
5264b560ab1b
8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
31019
diff
changeset
|
410 |
name, signature, Klass::find_overpass, |
5264b560ab1b
8087342: Crash in klassItable::initialize_itable_for_interface
acorn
parents:
31019
diff
changeset
|
411 |
Klass::find_static, Klass::find_private); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
412 |
if (index >= 0 ) { |
33602 | 413 |
vtable_index = ik->default_vtable_indices()->at(index); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
414 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
415 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
416 |
if (vtable_index == Method::invalid_vtable_index) { |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
417 |
// get vtable_index for miranda methods |
46408
70aab0c2ea8b
8178350: klassVtable and klassItable should be ValueObj
iklam
parents:
46329
diff
changeset
|
418 |
klassVtable vt = ik->vtable(); |
70aab0c2ea8b
8178350: klassVtable and klassItable should be ValueObj
iklam
parents:
46329
diff
changeset
|
419 |
vtable_index = vt.index_of_miranda(name, signature); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
420 |
} |
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
421 |
return vtable_index; |
1 | 422 |
} |
423 |
||
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
424 |
Method* LinkResolver::lookup_method_in_interfaces(const LinkInfo& cp_info) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
425 |
InstanceKlass *ik = InstanceKlass::cast(cp_info.resolved_klass()); |
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
426 |
|
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
427 |
// Specify 'true' in order to skip default methods when searching the |
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
428 |
// interfaces. Function lookup_method_in_klasses() already looked for |
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
429 |
// the method in the default methods table. |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
430 |
return ik->lookup_method_in_all_interfaces(cp_info.name(), cp_info.signature(), Klass::skip_defaults); |
1 | 431 |
} |
432 |
||
31019 | 433 |
methodHandle LinkResolver::lookup_polymorphic_method( |
434 |
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
|
435 |
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
|
436 |
Handle *method_type_result, |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
437 |
TRAPS) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
438 |
Klass* klass = link_info.resolved_klass(); |
31019 | 439 |
Symbol* name = link_info.name(); |
440 |
Symbol* full_signature = link_info.signature(); |
|
441 |
||
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
442 |
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
|
443 |
if (TraceMethodHandles) { |
16691 | 444 |
ResourceMark rm(THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
445 |
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
|
446 |
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
|
447 |
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
|
448 |
} |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
449 |
if ((klass == SystemDictionary::MethodHandle_klass() || |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
450 |
klass == SystemDictionary::VarHandle_klass()) && |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
451 |
iid != vmIntrinsics::_none) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
452 |
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
|
453 |
// 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
|
454 |
// 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
|
455 |
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
|
456 |
TempNewSymbol basic_signature = |
31019 | 457 |
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
|
458 |
if (TraceMethodHandles) { |
16691 | 459 |
ResourceMark rm(THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
460 |
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
|
461 |
name->as_C_string(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
462 |
full_signature->as_C_string(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
463 |
basic_signature->as_C_string()); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
464 |
} |
31019 | 465 |
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
|
466 |
basic_signature, |
31019 | 467 |
CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
468 |
if (result.not_null()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
469 |
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
|
470 |
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
|
471 |
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
|
472 |
if (TraceMethodHandles) { |
35543
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35135
diff
changeset
|
473 |
ttyLocker ttyl; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
474 |
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
|
475 |
result->print_on(tty); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
476 |
} |
6062
bab93afe9df7
6964498: JSR 292 invokedynamic sites need local bootstrap methods
jrose
parents:
5547
diff
changeset
|
477 |
} |
31019 | 478 |
return result; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
479 |
} else if (iid == vmIntrinsics::_invokeGeneric |
33160
c59f1676d27e
8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents:
32189
diff
changeset
|
480 |
&& THREAD->can_call_java() |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
481 |
&& appendix_result_or_null != NULL) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
482 |
// 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
|
483 |
// 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
|
484 |
if (!MethodHandles::enabled()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
485 |
// 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
|
486 |
Klass* natives = SystemDictionary::MethodHandleNatives_klass(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
487 |
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
|
488 |
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
|
489 |
Handle(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
490 |
Handle(), |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
491 |
true, |
31019 | 492 |
CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
493 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
494 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
495 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
496 |
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
|
497 |
Handle method_type; |
31019 | 498 |
methodHandle result = SystemDictionary::find_method_handle_invoker( |
36819 | 499 |
klass, |
31019 | 500 |
name, |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
501 |
full_signature, |
31019 | 502 |
link_info.current_klass(), |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
503 |
&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
|
504 |
&method_type, |
31019 | 505 |
CHECK_NULL); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
506 |
if (TraceMethodHandles) { |
35543
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35135
diff
changeset
|
507 |
ttyLocker ttyl; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
508 |
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
|
509 |
result->print_on(tty); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
510 |
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
|
511 |
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
|
512 |
else appendix->print_on(tty); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
513 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
514 |
if (result.not_null()) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
515 |
#ifdef ASSERT |
16691 | 516 |
ResourceMark rm(THREAD); |
517 |
||
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
518 |
TempNewSymbol basic_signature = |
31019 | 519 |
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
|
520 |
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
|
521 |
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
|
522 |
// +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
|
523 |
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
|
524 |
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
|
525 |
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
|
526 |
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
|
527 |
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
|
528 |
result->print(); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
529 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
530 |
assert(actual_size_of_params == expected_size_of_params, |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32189
diff
changeset
|
531 |
"%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
|
532 |
#endif //ASSERT |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
533 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
534 |
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
|
535 |
(*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
|
536 |
(*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
|
537 |
} |
31019 | 538 |
return result; |
2534 | 539 |
} |
540 |
} |
|
31019 | 541 |
return NULL; |
2534 | 542 |
} |
543 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
544 |
void LinkResolver::check_method_accessability(Klass* ref_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
545 |
Klass* resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
546 |
Klass* sel_klass, |
31019 | 547 |
const methodHandle& sel_method, |
1 | 548 |
TRAPS) { |
549 |
||
550 |
AccessFlags flags = sel_method->access_flags(); |
|
551 |
||
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
552 |
// Special case: arrays always override "clone". JVMS 2.15. |
1 | 553 |
// If the resolved klass is an array class, and the declaring class |
554 |
// is java.lang.Object and the method is "clone", set the flags |
|
555 |
// to public. |
|
556 |
// |
|
22219
4bfd5df70189
8028741: Interface Method Resolution should skip static and non-public methods in j.l.Object
hseigel
parents:
22218
diff
changeset
|
557 |
// 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
|
558 |
// 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
|
559 |
if (sel_method->name() == vmSymbols::clone_name() && |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
560 |
sel_klass == SystemDictionary::Object_klass() && |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
561 |
resolved_klass->is_array_klass()) { |
1 | 562 |
// 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
|
563 |
assert(flags.is_protected(), "clone not protected?"); |
1 | 564 |
jint new_flags = flags.as_int(); |
565 |
new_flags = new_flags & (~JVM_ACC_PROTECTED); |
|
566 |
new_flags = new_flags | JVM_ACC_PUBLIC; |
|
567 |
flags.set_flags(new_flags); |
|
568 |
} |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
569 |
// assert(extra_arg_result_or_null != NULL, "must be able to return extra argument"); |
1 | 570 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
571 |
if (!Reflection::verify_field_access(ref_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
572 |
resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
573 |
sel_klass, |
1 | 574 |
flags, |
575 |
true)) { |
|
576 |
ResourceMark rm(THREAD); |
|
577 |
Exceptions::fthrow( |
|
578 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
579 |
vmSymbols::java_lang_IllegalAccessError(), |
1 | 580 |
"tried to access method %s.%s%s from class %s", |
581 |
sel_klass->external_name(), |
|
582 |
sel_method->name()->as_C_string(), |
|
583 |
sel_method->signature()->as_C_string(), |
|
584 |
ref_klass->external_name() |
|
585 |
); |
|
586 |
return; |
|
587 |
} |
|
588 |
} |
|
589 |
||
31019 | 590 |
methodHandle LinkResolver::resolve_method_statically(Bytecodes::Code code, |
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
591 |
const 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
|
592 |
// This method is used only |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
593 |
// (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
|
594 |
// and |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
595 |
// (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
|
596 |
// 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
|
597 |
// FIXME: Remove this method and ciMethod::check_call; refactor to use the other LinkResolver entry points. |
1 | 598 |
// resolve klass |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
599 |
if (code == Bytecodes::_invokedynamic) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
600 |
Klass* 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
|
601 |
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
|
602 |
Symbol* method_signature = pool->signature_ref_at(index); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
603 |
Klass* current_klass = pool->pool_holder(); |
31019 | 604 |
LinkInfo link_info(resolved_klass, method_name, method_signature, current_klass); |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
605 |
return resolve_method(link_info, code, THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
606 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
607 |
|
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
608 |
LinkInfo link_info(pool, index, methodHandle(), CHECK_NULL); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
609 |
Klass* resolved_klass = link_info.resolved_klass(); |
1 | 610 |
|
10008
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
611 |
if (pool->has_preresolution() |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
612 |
|| (resolved_klass == SystemDictionary::MethodHandle_klass() && |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
613 |
MethodHandles::is_signature_polymorphic_name(resolved_klass, link_info.name()))) { |
31019 | 614 |
Method* result = ConstantPool::method_at_if_loaded(pool, index); |
615 |
if (result != NULL) { |
|
616 |
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
|
617 |
} |
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
618 |
} |
d84de97ad847
7056328: JSR 292 invocation sometimes fails in adapters for types not on boot class path
jrose
parents:
9967
diff
changeset
|
619 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
620 |
if (code == Bytecodes::_invokeinterface) { |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
621 |
return resolve_interface_method(link_info, code, THREAD); |
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
622 |
} else if (code == Bytecodes::_invokevirtual) { |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
623 |
return resolve_method(link_info, code, THREAD); |
21912 | 624 |
} else if (!resolved_klass->is_interface()) { |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
625 |
return resolve_method(link_info, code, THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
626 |
} else { |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
627 |
return resolve_interface_method(link_info, code, THREAD); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
628 |
} |
1 | 629 |
} |
630 |
||
31019 | 631 |
// Check and print a loader constraint violation message for method or interface method |
632 |
void LinkResolver::check_method_loader_constraints(const LinkInfo& link_info, |
|
633 |
const methodHandle& resolved_method, |
|
634 |
const char* method_type, TRAPS) { |
|
635 |
Handle current_loader(THREAD, link_info.current_klass()->class_loader()); |
|
636 |
Handle resolved_loader(THREAD, resolved_method->method_holder()->class_loader()); |
|
637 |
||
638 |
ResourceMark rm(THREAD); |
|
639 |
Symbol* failed_type_symbol = |
|
640 |
SystemDictionary::check_signature_loaders(link_info.signature(), current_loader, |
|
641 |
resolved_loader, true, CHECK); |
|
642 |
if (failed_type_symbol != NULL) { |
|
643 |
const char* msg = "loader constraint violation: when resolving %s" |
|
644 |
" \"%s\" the class loader (instance of %s) of the current class, %s," |
|
645 |
" and the class loader (instance of %s) for the method's defining class, %s, have" |
|
646 |
" different Class objects for the type %s used in the signature"; |
|
647 |
char* sig = link_info.method_string(); |
|
648 |
const char* loader1_name = SystemDictionary::loader_name(current_loader()); |
|
649 |
char* current = link_info.current_klass()->name()->as_C_string(); |
|
650 |
const char* loader2_name = SystemDictionary::loader_name(resolved_loader()); |
|
651 |
char* target = resolved_method->method_holder()->name()->as_C_string(); |
|
652 |
char* failed_type_name = failed_type_symbol->as_C_string(); |
|
653 |
size_t buflen = strlen(msg) + strlen(sig) + strlen(loader1_name) + |
|
654 |
strlen(current) + strlen(loader2_name) + strlen(target) + |
|
655 |
strlen(failed_type_name) + strlen(method_type) + 1; |
|
656 |
char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); |
|
657 |
jio_snprintf(buf, buflen, msg, method_type, sig, loader1_name, current, loader2_name, |
|
658 |
target, failed_type_name); |
|
659 |
THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); |
|
660 |
} |
|
661 |
} |
|
662 |
||
663 |
void LinkResolver::check_field_loader_constraints(Symbol* field, Symbol* sig, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
664 |
Klass* current_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
665 |
Klass* sel_klass, TRAPS) { |
31019 | 666 |
Handle ref_loader(THREAD, current_klass->class_loader()); |
667 |
Handle sel_loader(THREAD, sel_klass->class_loader()); |
|
668 |
||
669 |
ResourceMark rm(THREAD); // needed for check_signature_loaders |
|
670 |
Symbol* failed_type_symbol = |
|
671 |
SystemDictionary::check_signature_loaders(sig, |
|
672 |
ref_loader, sel_loader, |
|
673 |
false, |
|
674 |
CHECK); |
|
675 |
if (failed_type_symbol != NULL) { |
|
676 |
const char* msg = "loader constraint violation: when resolving field" |
|
677 |
" \"%s\" the class loader (instance of %s) of the referring class, " |
|
678 |
"%s, and the class loader (instance of %s) for the field's resolved " |
|
679 |
"type, %s, have different Class objects for that type"; |
|
680 |
char* field_name = field->as_C_string(); |
|
681 |
const char* loader1_name = SystemDictionary::loader_name(ref_loader()); |
|
682 |
char* sel = sel_klass->name()->as_C_string(); |
|
683 |
const char* loader2_name = SystemDictionary::loader_name(sel_loader()); |
|
684 |
char* failed_type_name = failed_type_symbol->as_C_string(); |
|
685 |
size_t buflen = strlen(msg) + strlen(field_name) + strlen(loader1_name) + |
|
686 |
strlen(sel) + strlen(loader2_name) + strlen(failed_type_name) + 1; |
|
687 |
char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen); |
|
688 |
jio_snprintf(buf, buflen, msg, field_name, loader1_name, sel, loader2_name, |
|
689 |
failed_type_name); |
|
690 |
THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); |
|
691 |
} |
|
692 |
} |
|
693 |
||
694 |
methodHandle LinkResolver::resolve_method(const LinkInfo& link_info, |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
695 |
Bytecodes::Code code, TRAPS) { |
1 | 696 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
697 |
Handle nested_exception; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
698 |
Klass* 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
|
699 |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
700 |
// 1. For invokevirtual, cannot call an interface method |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
701 |
if (code == Bytecodes::_invokevirtual && resolved_klass->is_interface()) { |
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
702 |
ResourceMark rm(THREAD); |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
703 |
char buf[200]; |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
704 |
jio_snprintf(buf, sizeof(buf), "Found interface %s, but class was expected", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
705 |
resolved_klass->external_name()); |
31019 | 706 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
20685
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
707 |
} |
2feadfa49bb7
8026299: invokespecial gets ICCE when it should get AME.
acorn
parents:
20391
diff
changeset
|
708 |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
709 |
// 2. check constant pool tag for called method - must be JVM_CONSTANT_Methodref |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
710 |
if (!link_info.tag().is_invalid() && !link_info.tag().is_method()) { |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
711 |
ResourceMark rm(THREAD); |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
712 |
char buf[200]; |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
713 |
jio_snprintf(buf, sizeof(buf), "Method %s must be Methodref constant", link_info.method_string()); |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
714 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
715 |
} |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
716 |
|
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
717 |
// 3. lookup method in resolved klass and its super klasses |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
718 |
methodHandle resolved_method(THREAD, lookup_method_in_klasses(link_info, true, false)); |
1 | 719 |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
720 |
// 4. lookup method in all the interfaces implemented by the resolved klass |
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
721 |
if (resolved_method.is_null() && !resolved_klass->is_array_klass()) { // not found in the class hierarchy |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
722 |
resolved_method = methodHandle(THREAD, lookup_method_in_interfaces(link_info)); |
1 | 723 |
|
724 |
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
|
725 |
// JSR 292: see if this is an implicitly generated method MethodHandle.linkToVirtual(*...), etc |
31019 | 726 |
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
|
727 |
if (HAS_PENDING_EXCEPTION) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
728 |
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
|
729 |
CLEAR_PENDING_EXCEPTION; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
730 |
} |
2534 | 731 |
} |
27020 | 732 |
} |
2534 | 733 |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
734 |
// 5. method lookup failed |
27020 | 735 |
if (resolved_method.is_null()) { |
736 |
ResourceMark rm(THREAD); |
|
31019 | 737 |
THROW_MSG_CAUSE_(vmSymbols::java_lang_NoSuchMethodError(), |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
738 |
Method::name_and_sig_as_C_string(resolved_klass, |
31019 | 739 |
link_info.name(), |
740 |
link_info.signature()), |
|
741 |
nested_exception, NULL); |
|
1 | 742 |
} |
743 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
744 |
// 5. access checks, access checking may be turned off when calling from within the VM. |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
745 |
Klass* current_klass = link_info.current_klass(); |
31019 | 746 |
if (link_info.check_access()) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
747 |
assert(current_klass != NULL , "current_klass should not be null"); |
1 | 748 |
|
749 |
// check if method can be accessed by the referring class |
|
750 |
check_method_accessability(current_klass, |
|
751 |
resolved_klass, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
752 |
resolved_method->method_holder(), |
1 | 753 |
resolved_method, |
31019 | 754 |
CHECK_NULL); |
1 | 755 |
|
756 |
// check loader constraints |
|
31019 | 757 |
check_method_loader_constraints(link_info, resolved_method, "method", CHECK_NULL); |
1 | 758 |
} |
31019 | 759 |
|
760 |
return resolved_method; |
|
1 | 761 |
} |
762 |
||
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
763 |
static void trace_method_resolution(const char* prefix, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
764 |
Klass* klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
765 |
Klass* resolved_klass, |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
766 |
const methodHandle& method, |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
767 |
bool logitables, |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
768 |
int index = -1) { |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
769 |
#ifndef PRODUCT |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
770 |
ResourceMark rm; |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
771 |
Log(itables) logi; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
772 |
LogStream lsi(logi.trace()); |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
773 |
Log(vtables) logv; |
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
774 |
LogStream lsv(logv.trace()); |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
775 |
outputStream* st; |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
776 |
if (logitables) { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
777 |
st = &lsi; |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
778 |
} else { |
46701
f559541c0daa
8181917: Refactor UL LogStreams to avoid using resource area
stuefe
parents:
46630
diff
changeset
|
779 |
st = &lsv; |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
780 |
} |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
781 |
st->print("%s%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ", |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
782 |
prefix, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
783 |
(klass == NULL ? "<NULL>" : klass->internal_name()), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
784 |
(resolved_klass == NULL ? "<NULL>" : resolved_klass->internal_name()), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
785 |
Method::name_and_sig_as_C_string(resolved_klass, |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
786 |
method->name(), |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
787 |
method->signature()), |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
788 |
method->method_holder()->internal_name()); |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
789 |
method->print_linkage_flags(st); |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
790 |
if (index != -1) { |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
791 |
st->print("vtable_index:%d", index); |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
792 |
} |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
793 |
st->cr(); |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
794 |
#endif // PRODUCT |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
795 |
} |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
796 |
|
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
797 |
// Do linktime resolution of a method in the interface within the context of the specied bytecode. |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
798 |
methodHandle LinkResolver::resolve_interface_method(const LinkInfo& link_info, Bytecodes::Code code, TRAPS) { |
31019 | 799 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
800 |
Klass* resolved_klass = link_info.resolved_klass(); |
1 | 801 |
|
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
802 |
// check if klass is interface |
1 | 803 |
if (!resolved_klass->is_interface()) { |
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
804 |
ResourceMark rm(THREAD); |
1 | 805 |
char buf[200]; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
806 |
jio_snprintf(buf, sizeof(buf), "Found class %s, but interface was expected", resolved_klass->external_name()); |
31019 | 807 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1 | 808 |
} |
809 |
||
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
810 |
// check constant pool tag for called method - must be JVM_CONSTANT_InterfaceMethodref |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
811 |
if (!link_info.tag().is_invalid() && !link_info.tag().is_interface_method()) { |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
812 |
ResourceMark rm(THREAD); |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
813 |
char buf[200]; |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
814 |
jio_snprintf(buf, sizeof(buf), "Method %s must be InterfaceMethodref constant", link_info.method_string()); |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
815 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
816 |
} |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
817 |
|
1 | 818 |
// lookup method in this interface or its super, java.lang.Object |
21912 | 819 |
// JDK8: also look for static methods |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
820 |
methodHandle resolved_method(THREAD, lookup_method_in_klasses(link_info, false, true)); |
1 | 821 |
|
33611
9abd65805e19
8139203: Consistent naming for klass type predicates
coleenp
parents:
33602
diff
changeset
|
822 |
if (resolved_method.is_null() && !resolved_klass->is_array_klass()) { |
1 | 823 |
// lookup method in all the super-interfaces |
46727
6e4a84748e2c
8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents:
46701
diff
changeset
|
824 |
resolved_method = methodHandle(THREAD, lookup_method_in_interfaces(link_info)); |
27020 | 825 |
} |
826 |
||
827 |
if (resolved_method.is_null()) { |
|
828 |
// no method found |
|
829 |
ResourceMark rm(THREAD); |
|
31019 | 830 |
THROW_MSG_NULL(vmSymbols::java_lang_NoSuchMethodError(), |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
831 |
Method::name_and_sig_as_C_string(resolved_klass, |
31019 | 832 |
link_info.name(), |
833 |
link_info.signature())); |
|
1 | 834 |
} |
835 |
||
31019 | 836 |
if (link_info.check_access()) { |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
837 |
// JDK8 adds non-public interface methods, and accessability check requirement |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
838 |
Klass* current_klass = link_info.current_klass(); |
31019 | 839 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
840 |
assert(current_klass != NULL , "current_klass should not be null"); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
841 |
|
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
842 |
// 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
|
843 |
check_method_accessability(current_klass, |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
844 |
resolved_klass, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
845 |
resolved_method->method_holder(), |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
846 |
resolved_method, |
31019 | 847 |
CHECK_NULL); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
848 |
|
31019 | 849 |
check_method_loader_constraints(link_info, resolved_method, "interface method", CHECK_NULL); |
1 | 850 |
} |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
851 |
|
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
852 |
if (code != Bytecodes::_invokestatic && resolved_method->is_static()) { |
22521
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
853 |
ResourceMark rm(THREAD); |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
854 |
char buf[200]; |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
855 |
jio_snprintf(buf, sizeof(buf), "Expected instance not static method %s", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
856 |
Method::name_and_sig_as_C_string(resolved_klass, |
22521
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
857 |
resolved_method->name(), resolved_method->signature())); |
31019 | 858 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
22521
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
859 |
} |
5387725ea99d
8031045: Access checks should precede additional per-instruction checks
hseigel
parents:
22232
diff
changeset
|
860 |
|
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
861 |
if (code == Bytecodes::_invokeinterface && resolved_method->is_private()) { |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
862 |
ResourceMark rm(THREAD); |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
863 |
char buf[200]; |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
864 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
865 |
Klass* current_klass = link_info.current_klass(); |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
866 |
jio_snprintf(buf, sizeof(buf), "private interface method requires invokespecial, not invokeinterface: method %s, caller-class:%s", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
867 |
Method::name_and_sig_as_C_string(resolved_klass, |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
868 |
resolved_method->name(), |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
869 |
resolved_method->signature()), |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
870 |
(current_klass == NULL ? "<NULL>" : current_klass->internal_name())); |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
871 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
872 |
} |
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
873 |
|
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35900
diff
changeset
|
874 |
if (log_develop_is_enabled(Trace, itables)) { |
41669
2091069b6851
8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents:
39699
diff
changeset
|
875 |
char buf[200]; |
2091069b6851
8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents:
39699
diff
changeset
|
876 |
jio_snprintf(buf, sizeof(buf), "%s resolved interface method: caller-class:", |
2091069b6851
8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents:
39699
diff
changeset
|
877 |
Bytecodes::name(code)); |
2091069b6851
8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents:
39699
diff
changeset
|
878 |
trace_method_resolution(buf, link_info.current_klass(), resolved_klass, |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
879 |
resolved_method, true); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
880 |
} |
31019 | 881 |
|
882 |
return resolved_method; |
|
1 | 883 |
} |
884 |
||
885 |
//------------------------------------------------------------------------------------------------------------------------ |
|
886 |
// Field resolution |
|
887 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
888 |
void LinkResolver::check_field_accessability(Klass* ref_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
889 |
Klass* resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
890 |
Klass* sel_klass, |
31019 | 891 |
const fieldDescriptor& fd, |
1 | 892 |
TRAPS) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
893 |
if (!Reflection::verify_field_access(ref_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
894 |
resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
895 |
sel_klass, |
1 | 896 |
fd.access_flags(), |
897 |
true)) { |
|
898 |
ResourceMark rm(THREAD); |
|
899 |
Exceptions::fthrow( |
|
900 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
901 |
vmSymbols::java_lang_IllegalAccessError(), |
1 | 902 |
"tried to access field %s.%s from class %s", |
903 |
sel_klass->external_name(), |
|
904 |
fd.name()->as_C_string(), |
|
905 |
ref_klass->external_name() |
|
906 |
); |
|
907 |
return; |
|
908 |
} |
|
909 |
} |
|
910 |
||
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
911 |
void LinkResolver::resolve_field_access(fieldDescriptor& fd, const constantPoolHandle& pool, int index, const methodHandle& method, Bytecodes::Code byte, TRAPS) { |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
912 |
LinkInfo link_info(pool, index, method, CHECK); |
31019 | 913 |
resolve_field(fd, link_info, byte, true, CHECK); |
1 | 914 |
} |
915 |
||
31019 | 916 |
void LinkResolver::resolve_field(fieldDescriptor& fd, |
917 |
const LinkInfo& link_info, |
|
918 |
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
|
919 |
TRAPS) { |
1 | 920 |
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
|
921 |
byte == Bytecodes::_getfield || byte == Bytecodes::_putfield || |
30117
cce2cdac56dc
8074345: Enable RewriteBytecodes when VM runs with CDS
minqi
parents:
29081
diff
changeset
|
922 |
byte == Bytecodes::_nofast_getfield || byte == Bytecodes::_nofast_putfield || |
31019 | 923 |
(byte == Bytecodes::_nop && !link_info.check_access()), "bad field access bytecode"); |
1 | 924 |
|
925 |
bool is_static = (byte == Bytecodes::_getstatic || byte == Bytecodes::_putstatic); |
|
30117
cce2cdac56dc
8074345: Enable RewriteBytecodes when VM runs with CDS
minqi
parents:
29081
diff
changeset
|
926 |
bool is_put = (byte == Bytecodes::_putfield || byte == Bytecodes::_putstatic || byte == Bytecodes::_nofast_putfield); |
1 | 927 |
// Check if there's a resolved klass containing the field |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
928 |
Klass* resolved_klass = link_info.resolved_klass(); |
31019 | 929 |
Symbol* field = link_info.name(); |
930 |
Symbol* sig = link_info.signature(); |
|
931 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
932 |
if (resolved_klass == NULL) { |
1 | 933 |
ResourceMark rm(THREAD); |
934 |
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); |
|
935 |
} |
|
936 |
||
937 |
// Resolve instance field |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
938 |
Klass* sel_klass = resolved_klass->find_field(field, sig, &fd); |
1 | 939 |
// check if field exists; i.e., if a klass containing the field def has been selected |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
940 |
if (sel_klass == NULL) { |
1 | 941 |
ResourceMark rm(THREAD); |
942 |
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string()); |
|
943 |
} |
|
944 |
||
31019 | 945 |
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
|
946 |
// 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
|
947 |
return; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
948 |
|
1 | 949 |
// check access |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
950 |
Klass* 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
|
951 |
check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK); |
1 | 952 |
|
953 |
// check for errors |
|
954 |
if (is_static != fd.is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
955 |
ResourceMark rm(THREAD); |
1 | 956 |
char msg[200]; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
957 |
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 | 958 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg); |
959 |
} |
|
960 |
||
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
961 |
// A final field can be modified only |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
962 |
// (1) by methods declared in the class declaring the field and |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
963 |
// (2) by the <clinit> method (in case of a static field) |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
964 |
// or by the <init> method (in case of an instance field). |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
965 |
if (is_put && fd.access_flags().is_final()) { |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
966 |
ResourceMark rm(THREAD); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
967 |
stringStream ss; |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
968 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
969 |
if (sel_klass != current_klass) { |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
970 |
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
971 |
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
972 |
current_klass->external_name()); |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
973 |
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
974 |
} |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
975 |
|
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
976 |
if (fd.constants()->pool_holder()->major_version() >= 53) { |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
977 |
methodHandle m = link_info.current_method(); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
978 |
assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes"); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
979 |
bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic && |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
980 |
fd.is_static() && |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
981 |
!m()->is_static_initializer()); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
982 |
bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) && |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
983 |
!fd.is_static() && |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
984 |
!m->is_object_initializer()); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
985 |
|
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
986 |
if (is_initialized_static_final_update || is_initialized_instance_final_update) { |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
987 |
ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
988 |
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(), |
39699
7a2a49fd5ee0
8160527: Check for final instance field updates can be omitted
zmajo
parents:
39421
diff
changeset
|
989 |
m()->name()->as_C_string(), |
39421
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
990 |
is_static ? "<clinit>" : "<init>"); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
991 |
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string()); |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
992 |
} |
a9652c919db8
8157181: Compilers accept modification of final fields outside initializer methods
zmajo
parents:
38939
diff
changeset
|
993 |
} |
1 | 994 |
} |
995 |
||
996 |
// initialize resolved_klass if necessary |
|
997 |
// note 1: the klass which declared the field must be initialized (i.e, sel_klass) |
|
998 |
// according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99) |
|
999 |
// |
|
1000 |
// note 2: we don't want to force initialization if we are just checking |
|
1001 |
// 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
|
1002 |
if (is_static && initialize_class) { |
1 | 1003 |
sel_klass->initialize(CHECK); |
1004 |
} |
|
1005 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1006 |
if (sel_klass != current_klass) { |
31019 | 1007 |
check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK); |
1 | 1008 |
} |
1009 |
||
1010 |
// return information. note that the klass is set to the actual klass containing the |
|
1011 |
// field, otherwise access of static fields in superclasses will not work. |
|
1012 |
} |
|
1013 |
||
1014 |
||
1015 |
//------------------------------------------------------------------------------------------------------------------------ |
|
1016 |
// Invoke resolution |
|
1017 |
// |
|
1018 |
// Naming conventions: |
|
1019 |
// |
|
1020 |
// resolved_method the specified method (i.e., static receiver specified via constant pool index) |
|
1021 |
// sel_method the selected method (selected via run-time lookup; e.g., based on dynamic receiver class) |
|
1022 |
// resolved_klass the specified klass (i.e., specified via constant pool index) |
|
1023 |
// recv_klass the receiver klass |
|
1024 |
||
1025 |
||
31019 | 1026 |
void LinkResolver::resolve_static_call(CallInfo& result, |
1027 |
const LinkInfo& link_info, |
|
1028 |
bool initialize_class, TRAPS) { |
|
1029 |
methodHandle resolved_method = linktime_resolve_static_method(link_info, CHECK); |
|
1 | 1030 |
|
31019 | 1031 |
// The resolved class can change as a result of this resolution. |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1032 |
Klass* resolved_klass = resolved_method->method_holder(); |
31019 | 1033 |
|
1 | 1034 |
// Initialize klass (this should only happen if everything is ok) |
1035 |
if (initialize_class && resolved_klass->should_be_initialized()) { |
|
1036 |
resolved_klass->initialize(CHECK); |
|
38939
c1b1d1d0e89b
8158397: Crash: assert(save_resolved_method == resolved_method()) failed: does this change?
coleenp
parents:
38719
diff
changeset
|
1037 |
// Use updated LinkInfo to reresolve with resolved method holder |
31019 | 1038 |
LinkInfo new_info(resolved_klass, link_info.name(), link_info.signature(), |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1039 |
link_info.current_klass(), |
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1040 |
link_info.check_access() ? LinkInfo::needs_access_check : LinkInfo::skip_access_check); |
31019 | 1041 |
resolved_method = linktime_resolve_static_method(new_info, CHECK); |
1 | 1042 |
} |
1043 |
||
1044 |
// setup result |
|
1045 |
result.set_static(resolved_klass, resolved_method, CHECK); |
|
1046 |
} |
|
1047 |
||
1048 |
// throws linktime exceptions |
|
31019 | 1049 |
methodHandle LinkResolver::linktime_resolve_static_method(const LinkInfo& link_info, TRAPS) { |
1 | 1050 |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1051 |
Klass* resolved_klass = link_info.resolved_klass(); |
31019 | 1052 |
methodHandle resolved_method; |
21912 | 1053 |
if (!resolved_klass->is_interface()) { |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1054 |
resolved_method = resolve_method(link_info, Bytecodes::_invokestatic, CHECK_NULL); |
21912 | 1055 |
} else { |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
1056 |
resolved_method = resolve_interface_method(link_info, Bytecodes::_invokestatic, CHECK_NULL); |
21912 | 1057 |
} |
1 | 1058 |
assert(resolved_method->name() != vmSymbols::class_initializer_name(), "should have been checked in verifier"); |
1059 |
||
1060 |
// check if static |
|
1061 |
if (!resolved_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1062 |
ResourceMark rm(THREAD); |
1 | 1063 |
char buf[200]; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1064 |
jio_snprintf(buf, sizeof(buf), "Expected static method %s", Method::name_and_sig_as_C_string(resolved_klass, |
1 | 1065 |
resolved_method->name(), |
1066 |
resolved_method->signature())); |
|
31019 | 1067 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1 | 1068 |
} |
31019 | 1069 |
return resolved_method; |
1 | 1070 |
} |
1071 |
||
1072 |
||
31019 | 1073 |
void LinkResolver::resolve_special_call(CallInfo& result, |
44738 | 1074 |
Handle recv, |
31019 | 1075 |
const LinkInfo& link_info, |
1076 |
TRAPS) { |
|
1077 |
methodHandle resolved_method = linktime_resolve_special_method(link_info, CHECK); |
|
47401 | 1078 |
runtime_resolve_special_method(result, link_info, resolved_method, recv, CHECK); |
1 | 1079 |
} |
1080 |
||
1081 |
// throws linktime exceptions |
|
31019 | 1082 |
methodHandle LinkResolver::linktime_resolve_special_method(const LinkInfo& link_info, |
1083 |
TRAPS) { |
|
1 | 1084 |
|
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1085 |
// Invokespecial is called for multiple special reasons: |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1086 |
// <init> |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1087 |
// 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
|
1088 |
// 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
|
1089 |
// 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
|
1090 |
// superinterface.method, which explicitly does not check shadowing |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1091 |
Klass* resolved_klass = link_info.resolved_klass(); |
31019 | 1092 |
methodHandle resolved_method; |
14385 | 1093 |
|
21912 | 1094 |
if (!resolved_klass->is_interface()) { |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1095 |
resolved_method = resolve_method(link_info, Bytecodes::_invokespecial, CHECK_NULL); |
21912 | 1096 |
} else { |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
1097 |
resolved_method = resolve_interface_method(link_info, Bytecodes::_invokespecial, CHECK_NULL); |
21912 | 1098 |
} |
1 | 1099 |
|
1100 |
// check if method name is <init>, that it is found in same klass as static type |
|
1101 |
if (resolved_method->name() == vmSymbols::object_initializer_name() && |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1102 |
resolved_method->method_holder() != resolved_klass) { |
1 | 1103 |
ResourceMark rm(THREAD); |
1104 |
Exceptions::fthrow( |
|
1105 |
THREAD_AND_LOCATION, |
|
8076
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
1106 |
vmSymbols::java_lang_NoSuchMethodError(), |
1 | 1107 |
"%s: method %s%s not found", |
1108 |
resolved_klass->external_name(), |
|
1109 |
resolved_method->name()->as_C_string(), |
|
1110 |
resolved_method->signature()->as_C_string() |
|
1111 |
); |
|
31019 | 1112 |
return NULL; |
1 | 1113 |
} |
1114 |
||
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1115 |
// check if invokespecial's interface method reference is in an indirect superinterface |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1116 |
Klass* current_klass = link_info.current_klass(); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1117 |
if (current_klass != NULL && resolved_klass->is_interface()) { |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1118 |
InstanceKlass* ck = InstanceKlass::cast(current_klass); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1119 |
InstanceKlass *klass_to_check = !ck->is_anonymous() ? |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1120 |
ck : |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1121 |
InstanceKlass::cast(ck->host_klass()); |
25057 | 1122 |
// Disable verification for the dynamically-generated reflection bytecodes. |
1123 |
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
|
1124 |
SystemDictionary::reflect_MagicAccessorImpl_klass()); |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1125 |
|
22218
71cff6a30ec1
8029415: java/lang/reflect/Method/invoke/TestPrivateInterfaceMethodReflect.java fails on all platforms with hs25-b61
hseigel
parents:
21913
diff
changeset
|
1126 |
if (!is_reflect && |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1127 |
!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
|
1128 |
ResourceMark rm(THREAD); |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1129 |
char buf[200]; |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1130 |
jio_snprintf(buf, sizeof(buf), |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1131 |
"Interface method reference: %s, is in an indirect superinterface of %s", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1132 |
Method::name_and_sig_as_C_string(resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1133 |
resolved_method->name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1134 |
resolved_method->signature()), |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1135 |
current_klass->external_name()); |
31019 | 1136 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
21768
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1137 |
} |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1138 |
} |
b7dba4cde1c6
8026065: InterfaceMethodref for invokespecial must name a direct superinterface
hseigel
parents:
21556
diff
changeset
|
1139 |
|
1 | 1140 |
// check if not static |
1141 |
if (resolved_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1142 |
ResourceMark rm(THREAD); |
1 | 1143 |
char buf[200]; |
1144 |
jio_snprintf(buf, sizeof(buf), |
|
1145 |
"Expecting non-static method %s", |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1146 |
Method::name_and_sig_as_C_string(resolved_klass, |
31019 | 1147 |
resolved_method->name(), |
1148 |
resolved_method->signature())); |
|
1149 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
|
1 | 1150 |
} |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1151 |
|
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35900
diff
changeset
|
1152 |
if (log_develop_is_enabled(Trace, itables)) { |
31019 | 1153 |
trace_method_resolution("invokespecial resolved method: caller-class:", |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
1154 |
current_klass, resolved_klass, resolved_method, true); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1155 |
} |
31019 | 1156 |
|
1157 |
return resolved_method; |
|
1 | 1158 |
} |
1159 |
||
1160 |
// throws runtime exceptions |
|
31019 | 1161 |
void LinkResolver::runtime_resolve_special_method(CallInfo& result, |
47401 | 1162 |
const LinkInfo& link_info, |
31019 | 1163 |
const methodHandle& resolved_method, |
47401 | 1164 |
Handle recv, TRAPS) { |
1165 |
||
1166 |
Klass* resolved_klass = link_info.resolved_klass(); |
|
1 | 1167 |
|
1168 |
// 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
|
1169 |
// for a superclass method |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1170 |
// 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
|
1171 |
// no checks for shadowing |
1 | 1172 |
methodHandle sel_method(THREAD, resolved_method()); |
1173 |
||
47401 | 1174 |
if (link_info.check_access() && |
44738 | 1175 |
// check if the method is not <init> |
1176 |
resolved_method->name() != vmSymbols::object_initializer_name()) { |
|
1 | 1177 |
|
47401 | 1178 |
// check if this is an old-style super call and do a new lookup if so |
1 | 1179 |
// a) check if ACC_SUPER flag is set for the current class |
47401 | 1180 |
Klass* current_klass = link_info.current_klass(); |
44738 | 1181 |
if ((current_klass->is_super() || !AllowNonVirtualCalls) && |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1182 |
// 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
|
1183 |
// (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
|
1184 |
// 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
|
1185 |
// in super interfaces. |
46458 | 1186 |
current_klass->is_subclass_of(resolved_klass) && |
1187 |
current_klass != resolved_klass) { |
|
1 | 1188 |
// Lookup super method |
46458 | 1189 |
Klass* super_klass = current_klass->super(); |
31019 | 1190 |
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
|
1191 |
resolved_method->name(), |
96d498ec7ae1
6990754: Use native memory and reference counting to implement SymbolTable
coleenp
parents:
7397
diff
changeset
|
1192 |
resolved_method->signature(), CHECK); |
1 | 1193 |
// check if found |
1194 |
if (sel_method.is_null()) { |
|
1195 |
ResourceMark rm(THREAD); |
|
1196 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
46458 | 1197 |
Method::name_and_sig_as_C_string(resolved_klass, |
1 | 1198 |
resolved_method->name(), |
1199 |
resolved_method->signature())); |
|
47401 | 1200 |
// check loader constraints if found a different method |
1201 |
} else if (sel_method() != resolved_method()) { |
|
1202 |
check_method_loader_constraints(link_info, sel_method, "method", CHECK); |
|
1 | 1203 |
} |
1204 |
} |
|
44738 | 1205 |
|
1206 |
// Check that the class of objectref (the receiver) is the current class or interface, |
|
1207 |
// or a subtype of the current class or interface (the sender), otherwise invokespecial |
|
1208 |
// throws IllegalAccessError. |
|
1209 |
// The verifier checks that the sender is a subtype of the class in the I/MR operand. |
|
1210 |
// The verifier also checks that the receiver is a subtype of the sender, if the sender is |
|
1211 |
// a class. If the sender is an interface, the check has to be performed at runtime. |
|
46458 | 1212 |
InstanceKlass* sender = InstanceKlass::cast(current_klass); |
44738 | 1213 |
sender = sender->is_anonymous() ? sender->host_klass() : sender; |
1214 |
if (sender->is_interface() && recv.not_null()) { |
|
1215 |
Klass* receiver_klass = recv->klass(); |
|
1216 |
if (!receiver_klass->is_subtype_of(sender)) { |
|
1217 |
ResourceMark rm(THREAD); |
|
1218 |
char buf[500]; |
|
1219 |
jio_snprintf(buf, sizeof(buf), |
|
1220 |
"Receiver class %s must be the current class or a subtype of interface %s", |
|
1221 |
receiver_klass->name()->as_C_string(), |
|
1222 |
sender->name()->as_C_string()); |
|
1223 |
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), buf); |
|
1224 |
} |
|
1225 |
} |
|
1 | 1226 |
} |
1227 |
||
1228 |
// check if not static |
|
1229 |
if (sel_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1230 |
ResourceMark rm(THREAD); |
1 | 1231 |
char buf[200]; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1232 |
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1233 |
resolved_method->name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1234 |
resolved_method->signature())); |
1 | 1235 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1236 |
} |
|
1237 |
||
1238 |
// check if abstract |
|
1239 |
if (sel_method->is_abstract()) { |
|
1240 |
ResourceMark rm(THREAD); |
|
1241 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1242 |
Method::name_and_sig_as_C_string(resolved_klass, |
31019 | 1243 |
sel_method->name(), |
1244 |
sel_method->signature())); |
|
1 | 1245 |
} |
1246 |
||
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35900
diff
changeset
|
1247 |
if (log_develop_is_enabled(Trace, itables)) { |
31019 | 1248 |
trace_method_resolution("invokespecial selected method: resolved-class:", |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
1249 |
resolved_klass, resolved_klass, sel_method, true); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1250 |
} |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1251 |
|
1 | 1252 |
// setup result |
1253 |
result.set_static(resolved_klass, sel_method, CHECK); |
|
1254 |
} |
|
1255 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1256 |
void LinkResolver::resolve_virtual_call(CallInfo& result, Handle recv, Klass* receiver_klass, |
31019 | 1257 |
const LinkInfo& link_info, |
1258 |
bool check_null_and_abstract, TRAPS) { |
|
1259 |
methodHandle resolved_method = linktime_resolve_virtual_method(link_info, CHECK); |
|
1260 |
runtime_resolve_virtual_method(result, resolved_method, |
|
1261 |
link_info.resolved_klass(), |
|
1262 |
recv, receiver_klass, |
|
1263 |
check_null_and_abstract, CHECK); |
|
1 | 1264 |
} |
1265 |
||
1266 |
// throws linktime exceptions |
|
31019 | 1267 |
methodHandle LinkResolver::linktime_resolve_virtual_method(const LinkInfo& link_info, |
1268 |
TRAPS) { |
|
1 | 1269 |
// normal method resolution |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1270 |
methodHandle resolved_method = resolve_method(link_info, Bytecodes::_invokevirtual, CHECK_NULL); |
1 | 1271 |
|
1272 |
assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier"); |
|
1273 |
assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier"); |
|
1274 |
||
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1275 |
// check if private interface method |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1276 |
Klass* resolved_klass = link_info.resolved_klass(); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1277 |
Klass* current_klass = link_info.current_klass(); |
31019 | 1278 |
|
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1279 |
// This is impossible, if resolve_klass is an interface, we've thrown icce in resolve_method |
20284
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 invokevirtual: method %s, caller-class:%s", |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1284 |
Method::name_and_sig_as_C_string(resolved_klass, |
20284
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()), |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1287 |
(current_klass == NULL ? "<NULL>" : current_klass->internal_name())); |
31019 | 1288 |
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
|
1289 |
} |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1290 |
|
1 | 1291 |
// check if not static |
1292 |
if (resolved_method->is_static()) { |
|
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1293 |
ResourceMark rm(THREAD); |
1 | 1294 |
char buf[200]; |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1295 |
jio_snprintf(buf, sizeof(buf), "Expecting non-static method %s", Method::name_and_sig_as_C_string(resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1296 |
resolved_method->name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1297 |
resolved_method->signature())); |
31019 | 1298 |
THROW_MSG_NULL(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1 | 1299 |
} |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1300 |
|
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35900
diff
changeset
|
1301 |
if (log_develop_is_enabled(Trace, vtables)) { |
31019 | 1302 |
trace_method_resolution("invokevirtual resolved method: caller-class:", |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
1303 |
current_klass, resolved_klass, resolved_method, false); |
20391
7b146c5ebb18
8009130: Lambda: Fix access controls, loader constraints.
acorn
parents:
20284
diff
changeset
|
1304 |
} |
31019 | 1305 |
|
1306 |
return resolved_method; |
|
1 | 1307 |
} |
1308 |
||
1309 |
// throws runtime exceptions |
|
1310 |
void LinkResolver::runtime_resolve_virtual_method(CallInfo& result, |
|
31019 | 1311 |
const methodHandle& resolved_method, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1312 |
Klass* resolved_klass, |
1 | 1313 |
Handle recv, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1314 |
Klass* recv_klass, |
1 | 1315 |
bool check_null_and_abstract, |
1316 |
TRAPS) { |
|
1317 |
||
1318 |
// setup default return values |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1319 |
int vtable_index = Method::invalid_vtable_index; |
1 | 1320 |
methodHandle selected_method; |
1321 |
||
1322 |
// runtime method resolution |
|
1323 |
if (check_null_and_abstract && recv.is_null()) { // check if receiver exists |
|
1324 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1325 |
} |
|
1326 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1327 |
// Virtual methods cannot be resolved before its klass has been linked, for otherwise the Method*'s |
1 | 1328 |
// has not been rewritten, and the vtable initialized. Make sure to do this after the nullcheck, since |
1329 |
// 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
|
1330 |
assert(resolved_method->method_holder()->is_linked(), "must be linked"); |
1 | 1331 |
|
1332 |
// 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
|
1333 |
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
|
1334 |
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
|
1335 |
resolved_method); |
1 | 1336 |
assert(vtable_index >= 0 , "we should have valid vtable index at this point"); |
1337 |
||
35900 | 1338 |
selected_method = methodHandle(THREAD, recv_klass->method_at_vtable(vtable_index)); |
1 | 1339 |
} else { |
1340 |
// 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
|
1341 |
// 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
|
1342 |
assert(!resolved_method->has_itable_index(), ""); |
1 | 1343 |
vtable_index = resolved_method->vtable_index(); |
1344 |
// We could get a negative vtable_index for final methods, |
|
1345 |
// because as an optimization they are they are never put in the vtable, |
|
1346 |
// unless they override an existing method. |
|
1347 |
// If we do get a negative, it means the resolved method is the the selected |
|
1348 |
// 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
|
1349 |
if (vtable_index == Method::nonvirtual_vtable_index) { |
1 | 1350 |
assert(resolved_method->can_be_statically_bound(), "cannot override this method"); |
1351 |
selected_method = resolved_method; |
|
1352 |
} else { |
|
35900 | 1353 |
selected_method = methodHandle(THREAD, recv_klass->method_at_vtable(vtable_index)); |
1 | 1354 |
} |
1355 |
} |
|
1356 |
||
1357 |
// check if method exists |
|
1358 |
if (selected_method.is_null()) { |
|
1359 |
ResourceMark rm(THREAD); |
|
1360 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1361 |
Method::name_and_sig_as_C_string(resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1362 |
resolved_method->name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1363 |
resolved_method->signature())); |
1 | 1364 |
} |
1365 |
||
1366 |
// check if abstract |
|
1367 |
if (check_null_and_abstract && selected_method->is_abstract()) { |
|
1368 |
ResourceMark rm(THREAD); |
|
1369 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1370 |
Method::name_and_sig_as_C_string(resolved_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1371 |
selected_method->name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1372 |
selected_method->signature())); |
1 | 1373 |
} |
1374 |
||
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35900
diff
changeset
|
1375 |
if (log_develop_is_enabled(Trace, vtables)) { |
31019 | 1376 |
trace_method_resolution("invokevirtual selected method: receiver-class:", |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
1377 |
recv_klass, resolved_klass, selected_method, |
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
1378 |
false, vtable_index); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1379 |
} |
1 | 1380 |
// setup result |
1381 |
result.set_virtual(resolved_klass, recv_klass, resolved_method, selected_method, vtable_index, CHECK); |
|
1382 |
} |
|
1383 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1384 |
void LinkResolver::resolve_interface_call(CallInfo& result, Handle recv, Klass* recv_klass, |
31019 | 1385 |
const LinkInfo& link_info, |
1386 |
bool check_null_and_abstract, TRAPS) { |
|
1387 |
// throws linktime exceptions |
|
1388 |
methodHandle resolved_method = linktime_resolve_interface_method(link_info, CHECK); |
|
1389 |
runtime_resolve_interface_method(result, resolved_method,link_info.resolved_klass(), |
|
1390 |
recv, recv_klass, check_null_and_abstract, CHECK); |
|
1 | 1391 |
} |
1392 |
||
31019 | 1393 |
methodHandle LinkResolver::linktime_resolve_interface_method(const LinkInfo& link_info, |
1394 |
TRAPS) { |
|
1 | 1395 |
// normal interface method resolution |
38034
f22f68545fd5
8153115: Move private interface check to linktime
iveresov
parents:
37267
diff
changeset
|
1396 |
methodHandle resolved_method = resolve_interface_method(link_info, Bytecodes::_invokeinterface, CHECK_NULL); |
1 | 1397 |
assert(resolved_method->name() != vmSymbols::object_initializer_name(), "should have been checked in verifier"); |
1398 |
assert(resolved_method->name() != vmSymbols::class_initializer_name (), "should have been checked in verifier"); |
|
31019 | 1399 |
|
1400 |
return resolved_method; |
|
1 | 1401 |
} |
1402 |
||
1403 |
// throws runtime exceptions |
|
31019 | 1404 |
void LinkResolver::runtime_resolve_interface_method(CallInfo& result, |
1405 |
const methodHandle& resolved_method, |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1406 |
Klass* resolved_klass, |
31019 | 1407 |
Handle recv, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1408 |
Klass* recv_klass, |
31019 | 1409 |
bool check_null_and_abstract, TRAPS) { |
1 | 1410 |
// check if receiver exists |
1411 |
if (check_null_and_abstract && recv.is_null()) { |
|
1412 |
THROW(vmSymbols::java_lang_NullPointerException()); |
|
1413 |
} |
|
1414 |
||
1415 |
// check if receiver klass implements the resolved interface |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1416 |
if (!recv_klass->is_subtype_of(resolved_klass)) { |
9425
6da66b869573
6728025: LinkResolver is missing some ResourceMarks
jcoomes
parents:
9116
diff
changeset
|
1417 |
ResourceMark rm(THREAD); |
1 | 1418 |
char buf[200]; |
1419 |
jio_snprintf(buf, sizeof(buf), "Class %s does not implement the requested interface %s", |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1420 |
recv_klass->external_name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1421 |
resolved_klass->external_name()); |
1 | 1422 |
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); |
1423 |
} |
|
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
1424 |
|
1 | 1425 |
// do lookup based on receiver klass |
22232
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
1426 |
// This search must match the linktime preparation search for itable initialization |
26acfad336c0
8027804: JCK resolveMethod test fails expecting AbstractMethodError
hseigel
parents:
22219
diff
changeset
|
1427 |
// to correctly enforce loader constraints for interface method inheritance |
31019 | 1428 |
methodHandle sel_method = lookup_instance_method_in_klasses(recv_klass, |
1429 |
resolved_method->name(), |
|
1430 |
resolved_method->signature(), CHECK); |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1431 |
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
|
1432 |
// 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
|
1433 |
// 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
|
1434 |
// This needs further study. |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1435 |
sel_method = resolved_method; |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
17024
diff
changeset
|
1436 |
} |
1 | 1437 |
// check if method exists |
1438 |
if (sel_method.is_null()) { |
|
1439 |
ResourceMark rm(THREAD); |
|
1440 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1441 |
Method::name_and_sig_as_C_string(recv_klass, |
31019 | 1442 |
resolved_method->name(), |
1443 |
resolved_method->signature())); |
|
1 | 1444 |
} |
17024
49cbeca23983
8006267: InterfaceMethod_ref should allow invokestatic and invokespecial
bharadwaj
parents:
16691
diff
changeset
|
1445 |
// check access |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1446 |
// 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
|
1447 |
if (!sel_method->is_public()) { |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1448 |
ResourceMark rm(THREAD); |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1449 |
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1450 |
Method::name_and_sig_as_C_string(recv_klass, |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1451 |
sel_method->name(), |
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1452 |
sel_method->signature())); |
17024
49cbeca23983
8006267: InterfaceMethod_ref should allow invokestatic and invokespecial
bharadwaj
parents:
16691
diff
changeset
|
1453 |
} |
1 | 1454 |
// check if abstract |
1455 |
if (check_null_and_abstract && sel_method->is_abstract()) { |
|
1456 |
ResourceMark rm(THREAD); |
|
1457 |
THROW_MSG(vmSymbols::java_lang_AbstractMethodError(), |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1458 |
Method::name_and_sig_as_C_string(recv_klass, |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1459 |
sel_method->name(), |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1460 |
sel_method->signature())); |
1 | 1461 |
} |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1462 |
|
35901
f5028c67e7cb
8147918: Rename develop_log_is_enabled() to log_develop_is_enabled()
pliden
parents:
35900
diff
changeset
|
1463 |
if (log_develop_is_enabled(Trace, itables)) { |
41669
2091069b6851
8081800: AbstractMethodError when evaluating a private method in an interface via debugger
dholmes
parents:
39699
diff
changeset
|
1464 |
trace_method_resolution("invokeinterface selected method: receiver-class:", |
35463
b32e362563bb
8141564: Convert TraceItables and PrintVtables to Unified Logging
rprotacio
parents:
34666
diff
changeset
|
1465 |
recv_klass, resolved_klass, sel_method, true); |
20284
595a25ab9474
8011311: Private interface methods. Default conflicts:ICCE. no erased_super_default.
acorn
parents:
20282
diff
changeset
|
1466 |
} |
21556
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1467 |
// setup result |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1468 |
if (!resolved_method->has_itable_index()) { |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1469 |
int vtable_index = resolved_method->vtable_index(); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1470 |
assert(vtable_index == sel_method->vtable_index(), "sanity check"); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1471 |
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
|
1472 |
} else { |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1473 |
int itable_index = resolved_method()->itable_index(); |
e75cd34a59e0
8027229: ICCE expected for >=2 maximally specific default methods.
acorn
parents:
21078
diff
changeset
|
1474 |
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
|
1475 |
} |
1 | 1476 |
} |
1477 |
||
1478 |
||
1479 |
methodHandle LinkResolver::linktime_resolve_interface_method_or_null( |
|
31019 | 1480 |
const LinkInfo& link_info) { |
1 | 1481 |
EXCEPTION_MARK; |
31019 | 1482 |
methodHandle method_result = linktime_resolve_interface_method(link_info, THREAD); |
1 | 1483 |
if (HAS_PENDING_EXCEPTION) { |
1484 |
CLEAR_PENDING_EXCEPTION; |
|
1485 |
return methodHandle(); |
|
1486 |
} else { |
|
1487 |
return method_result; |
|
1488 |
} |
|
1489 |
} |
|
1490 |
||
1491 |
methodHandle LinkResolver::linktime_resolve_virtual_method_or_null( |
|
31019 | 1492 |
const LinkInfo& link_info) { |
1 | 1493 |
EXCEPTION_MARK; |
31019 | 1494 |
methodHandle method_result = linktime_resolve_virtual_method(link_info, THREAD); |
1 | 1495 |
if (HAS_PENDING_EXCEPTION) { |
1496 |
CLEAR_PENDING_EXCEPTION; |
|
1497 |
return methodHandle(); |
|
1498 |
} else { |
|
1499 |
return method_result; |
|
1500 |
} |
|
1501 |
} |
|
1502 |
||
1503 |
methodHandle LinkResolver::resolve_virtual_call_or_null( |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1504 |
Klass* receiver_klass, |
31019 | 1505 |
const LinkInfo& link_info) { |
1 | 1506 |
EXCEPTION_MARK; |
1507 |
CallInfo info; |
|
31019 | 1508 |
resolve_virtual_call(info, Handle(), receiver_klass, link_info, false, THREAD); |
1 | 1509 |
if (HAS_PENDING_EXCEPTION) { |
1510 |
CLEAR_PENDING_EXCEPTION; |
|
1511 |
return methodHandle(); |
|
1512 |
} |
|
1513 |
return info.selected_method(); |
|
1514 |
} |
|
1515 |
||
1516 |
methodHandle LinkResolver::resolve_interface_call_or_null( |
|
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1517 |
Klass* receiver_klass, |
31019 | 1518 |
const LinkInfo& link_info) { |
1 | 1519 |
EXCEPTION_MARK; |
1520 |
CallInfo info; |
|
31019 | 1521 |
resolve_interface_call(info, Handle(), receiver_klass, link_info, false, THREAD); |
1 | 1522 |
if (HAS_PENDING_EXCEPTION) { |
1523 |
CLEAR_PENDING_EXCEPTION; |
|
1524 |
return methodHandle(); |
|
1525 |
} |
|
1526 |
return info.selected_method(); |
|
1527 |
} |
|
1528 |
||
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1529 |
int LinkResolver::resolve_virtual_vtable_index(Klass* receiver_klass, |
31019 | 1530 |
const LinkInfo& link_info) { |
1 | 1531 |
EXCEPTION_MARK; |
1532 |
CallInfo info; |
|
31019 | 1533 |
resolve_virtual_call(info, Handle(), receiver_klass, link_info, |
1534 |
/*check_null_or_abstract*/false, THREAD); |
|
1 | 1535 |
if (HAS_PENDING_EXCEPTION) { |
1536 |
CLEAR_PENDING_EXCEPTION; |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1537 |
return Method::invalid_vtable_index; |
1 | 1538 |
} |
1539 |
return info.vtable_index(); |
|
1540 |
} |
|
1541 |
||
31019 | 1542 |
methodHandle LinkResolver::resolve_static_call_or_null(const LinkInfo& link_info) { |
1 | 1543 |
EXCEPTION_MARK; |
1544 |
CallInfo info; |
|
31019 | 1545 |
resolve_static_call(info, link_info, /*initialize_class*/false, THREAD); |
1 | 1546 |
if (HAS_PENDING_EXCEPTION) { |
1547 |
CLEAR_PENDING_EXCEPTION; |
|
1548 |
return methodHandle(); |
|
1549 |
} |
|
1550 |
return info.selected_method(); |
|
1551 |
} |
|
1552 |
||
31019 | 1553 |
methodHandle LinkResolver::resolve_special_call_or_null(const LinkInfo& link_info) { |
1 | 1554 |
EXCEPTION_MARK; |
1555 |
CallInfo info; |
|
44738 | 1556 |
resolve_special_call(info, Handle(), link_info, THREAD); |
1 | 1557 |
if (HAS_PENDING_EXCEPTION) { |
1558 |
CLEAR_PENDING_EXCEPTION; |
|
1559 |
return methodHandle(); |
|
1560 |
} |
|
1561 |
return info.selected_method(); |
|
1562 |
} |
|
1563 |
||
1564 |
||
1565 |
||
1566 |
//------------------------------------------------------------------------------------------------------------------------ |
|
1567 |
// ConstantPool entries |
|
1568 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
1569 |
void LinkResolver::resolve_invoke(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, Bytecodes::Code byte, TRAPS) { |
1 | 1570 |
switch (byte) { |
1571 |
case Bytecodes::_invokestatic : resolve_invokestatic (result, pool, index, CHECK); break; |
|
44738 | 1572 |
case Bytecodes::_invokespecial : resolve_invokespecial (result, recv, pool, index, CHECK); break; |
1 | 1573 |
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
|
1574 |
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
|
1575 |
case Bytecodes::_invokedynamic : resolve_invokedynamic (result, pool, index, CHECK); break; |
1 | 1576 |
case Bytecodes::_invokeinterface: resolve_invokeinterface(result, recv, pool, index, CHECK); break; |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
1577 |
default : break; |
1 | 1578 |
} |
1579 |
return; |
|
1580 |
} |
|
1581 |
||
35086
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1582 |
void LinkResolver::resolve_invoke(CallInfo& result, Handle& recv, |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1583 |
const methodHandle& attached_method, |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1584 |
Bytecodes::Code byte, TRAPS) { |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1585 |
Klass* defc = attached_method->method_holder(); |
35086
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1586 |
Symbol* name = attached_method->name(); |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1587 |
Symbol* type = attached_method->signature(); |
38719
133bf85c3f36
8145148: InterfaceMethod CP entry pointing to a class should cause ICCE
coleenp
parents:
38139
diff
changeset
|
1588 |
LinkInfo link_info(defc, name, type); |
35086
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1589 |
switch(byte) { |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1590 |
case Bytecodes::_invokevirtual: |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1591 |
resolve_virtual_call(result, recv, recv->klass(), link_info, |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1592 |
/*check_null_and_abstract=*/true, CHECK); |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1593 |
break; |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1594 |
case Bytecodes::_invokeinterface: |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1595 |
resolve_interface_call(result, recv, recv->klass(), link_info, |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1596 |
/*check_null_and_abstract=*/true, CHECK); |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1597 |
break; |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1598 |
case Bytecodes::_invokestatic: |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1599 |
resolve_static_call(result, link_info, /*initialize_class=*/false, CHECK); |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1600 |
break; |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1601 |
case Bytecodes::_invokespecial: |
44738 | 1602 |
resolve_special_call(result, recv, link_info, CHECK); |
35086
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1603 |
break; |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1604 |
default: |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1605 |
fatal("bad call: %s", Bytecodes::name(byte)); |
46630
75aa3e39d02c
8182299: Enable disabled clang warnings, build on OSX 10 + Xcode 8
jwilhelm
parents:
46560
diff
changeset
|
1606 |
break; |
35086
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1607 |
} |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1608 |
} |
bbf32241d851
8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents:
34238
diff
changeset
|
1609 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
1610 |
void LinkResolver::resolve_invokestatic(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) { |
31019 | 1611 |
LinkInfo link_info(pool, index, CHECK); |
1612 |
resolve_static_call(result, link_info, /*initialize_class*/true, CHECK); |
|
1 | 1613 |
} |
1614 |
||
1615 |
||
44738 | 1616 |
void LinkResolver::resolve_invokespecial(CallInfo& result, Handle recv, |
1617 |
const constantPoolHandle& pool, int index, TRAPS) { |
|
31019 | 1618 |
LinkInfo link_info(pool, index, CHECK); |
44738 | 1619 |
resolve_special_call(result, recv, link_info, CHECK); |
1 | 1620 |
} |
1621 |
||
1622 |
||
1623 |
void LinkResolver::resolve_invokevirtual(CallInfo& result, Handle recv, |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
1624 |
const constantPoolHandle& pool, int index, |
1 | 1625 |
TRAPS) { |
1626 |
||
31019 | 1627 |
LinkInfo link_info(pool, index, CHECK); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1628 |
Klass* recvrKlass = recv.is_null() ? (Klass*)NULL : recv->klass(); |
31019 | 1629 |
resolve_virtual_call(result, recv, recvrKlass, link_info, /*check_null_or_abstract*/true, CHECK); |
1 | 1630 |
} |
1631 |
||
1632 |
||
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
1633 |
void LinkResolver::resolve_invokeinterface(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, TRAPS) { |
31019 | 1634 |
LinkInfo link_info(pool, index, CHECK); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1635 |
Klass* recvrKlass = recv.is_null() ? (Klass*)NULL : recv->klass(); |
31019 | 1636 |
resolve_interface_call(result, recv, recvrKlass, link_info, true, CHECK); |
1 | 1637 |
} |
1638 |
||
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1639 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
1640 |
void LinkResolver::resolve_invokehandle(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1641 |
// This guy is reached from InterpreterRuntime::resolve_invokehandle. |
31019 | 1642 |
LinkInfo link_info(pool, index, CHECK); |
16691 | 1643 |
if (TraceMethodHandles) { |
1644 |
ResourceMark rm(THREAD); |
|
31019 | 1645 |
tty->print_cr("resolve_invokehandle %s %s", link_info.name()->as_C_string(), |
1646 |
link_info.signature()->as_C_string()); |
|
16691 | 1647 |
} |
31019 | 1648 |
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
|
1649 |
} |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1650 |
|
31019 | 1651 |
void LinkResolver::resolve_handle_call(CallInfo& result, |
1652 |
const LinkInfo& link_info, |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1653 |
TRAPS) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1654 |
// JSR 292: this must be an implicitly generated method MethodHandle.invokeExact(*...) or similar |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1655 |
Klass* resolved_klass = link_info.resolved_klass(); |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1656 |
assert(resolved_klass == SystemDictionary::MethodHandle_klass() || |
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1657 |
resolved_klass == SystemDictionary::VarHandle_klass(), ""); |
31019 | 1658 |
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
|
1659 |
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
|
1660 |
Handle resolved_method_type; |
31019 | 1661 |
methodHandle resolved_method = lookup_polymorphic_method(link_info, |
1662 |
&resolved_appendix, &resolved_method_type, CHECK); |
|
36819 | 1663 |
result.set_handle(resolved_klass, 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
|
1664 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1665 |
|
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1666 |
static void wrap_invokedynamic_exception(TRAPS) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1667 |
if (HAS_PENDING_EXCEPTION) { |
42074
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1668 |
// See the "Linking Exceptions" section for the invokedynamic instruction |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1669 |
// in JVMS 6.5. |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1670 |
if (PENDING_EXCEPTION->is_a(SystemDictionary::Error_klass())) { |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1671 |
// Pass through an Error, including BootstrapMethodError, any other form |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1672 |
// of linkage error, or say ThreadDeath/OutOfMemoryError |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1673 |
if (TraceMethodHandles) { |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1674 |
tty->print_cr("invokedynamic passes through an Error for " INTPTR_FORMAT, p2i((void *)PENDING_EXCEPTION)); |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1675 |
PENDING_EXCEPTION->print(); |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1676 |
} |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1677 |
return; |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1678 |
} |
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1679 |
|
c069e5e285cb
8166974: invokedynamic implementation should not wrap Errors
psandoz
parents:
41669
diff
changeset
|
1680 |
// Otherwise wrap the exception in a BootstrapMethodError |
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1681 |
if (TraceMethodHandles) { |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1682 |
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
|
1683 |
PENDING_EXCEPTION->print(); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1684 |
} |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1685 |
Handle nested_exception(THREAD, PENDING_EXCEPTION); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1686 |
CLEAR_PENDING_EXCEPTION; |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1687 |
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
|
1688 |
} |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1689 |
} |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1690 |
|
33593
60764a78fa5c
8140274: methodHandles and constantPoolHandles should be passed as const references
coleenp
parents:
33198
diff
changeset
|
1691 |
void LinkResolver::resolve_invokedynamic(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) { |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1692 |
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
|
1693 |
Symbol* method_signature = pool->signature_ref_at(index); |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1694 |
Klass* current_klass = pool->pool_holder(); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1695 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1696 |
// 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
|
1697 |
Handle bootstrap_specifier; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1698 |
// Check if CallSite has been bound already: |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1699 |
ConstantPoolCacheEntry* cpce = pool->invokedynamic_cp_cache_entry_at(index); |
47684
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1700 |
int pool_index = cpce->constant_pool_index(); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1701 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1702 |
if (cpce->is_f1_null()) { |
47684
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1703 |
if (cpce->indy_resolution_failed()) { |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1704 |
ConstantPool::throw_resolution_error(pool, |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1705 |
ResolutionErrorTable::encode_cpcache_index(index), |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1706 |
CHECK); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1707 |
} |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1708 |
|
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1709 |
// The initial step in Call Site Specifier Resolution is to resolve the symbolic |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1710 |
// reference to a method handle which will be the bootstrap method for a dynamic |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1711 |
// call site. If resolution for the java.lang.invoke.MethodHandle for the bootstrap |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1712 |
// method fails, then a MethodHandleInError is stored at the corresponding bootstrap |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1713 |
// method's CP index for the CONSTANT_MethodHandle_info. So, there is no need to |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1714 |
// set the indy_rf flag since any subsequent invokedynamic instruction which shares |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1715 |
// this bootstrap method will encounter the resolution of MethodHandleInError. |
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1716 |
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
|
1717 |
wrap_invokedynamic_exception(CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1718 |
assert(bsm_info != NULL, ""); |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1719 |
// 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
|
1720 |
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
|
1721 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1722 |
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
|
1723 |
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
|
1724 |
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
|
1725 |
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
|
1726 |
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
|
1727 |
wrap_invokedynamic_exception(CHECK); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1728 |
return; |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1729 |
} |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1730 |
|
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1731 |
if (TraceMethodHandles) { |
35543
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35135
diff
changeset
|
1732 |
ResourceMark rm(THREAD); |
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35135
diff
changeset
|
1733 |
tty->print_cr("resolve_invokedynamic #%d %s %s in %s", |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13396
diff
changeset
|
1734 |
ConstantPool::decode_invokedynamic_index(index), |
35543
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35135
diff
changeset
|
1735 |
method_name->as_C_string(), method_signature->as_C_string(), |
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35135
diff
changeset
|
1736 |
current_klass->name()->as_C_string()); |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1737 |
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
|
1738 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1739 |
|
47684
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1740 |
resolve_dynamic_call(result, bootstrap_specifier, method_name, |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1741 |
method_signature, current_klass, THREAD); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1742 |
if (HAS_PENDING_EXCEPTION && PENDING_EXCEPTION->is_a(SystemDictionary::LinkageError_klass())) { |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1743 |
int encoded_index = ResolutionErrorTable::encode_cpcache_index(index); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1744 |
bool recorded_res_status = cpce->save_and_throw_indy_exc(pool, pool_index, |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1745 |
encoded_index, |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1746 |
pool()->tag_at(pool_index), |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1747 |
CHECK); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1748 |
if (!recorded_res_status) { |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1749 |
// Another thread got here just before we did. So, either use the method |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1750 |
// that it resolved or throw the LinkageError exception that it threw. |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1751 |
if (!cpce->is_f1_null()) { |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1752 |
methodHandle method( THREAD, cpce->f1_as_method()); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1753 |
Handle appendix( THREAD, cpce->appendix_if_resolved(pool)); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1754 |
Handle method_type(THREAD, cpce->method_type_if_resolved(pool)); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1755 |
result.set_handle(method, appendix, method_type, THREAD); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1756 |
wrap_invokedynamic_exception(CHECK); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1757 |
} else { |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1758 |
assert(cpce->indy_resolution_failed(), "Resolution failure flag not set"); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1759 |
ConstantPool::throw_resolution_error(pool, encoded_index, CHECK); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1760 |
} |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1761 |
return; |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1762 |
} |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1763 |
assert(cpce->indy_resolution_failed(), "Resolution failure flag wasn't set"); |
c3c04b6e14f8
8174954: Parameter target type is allowed access after a module read edge or a package export has occurred after failed resolution
hseigel
parents:
47216
diff
changeset
|
1764 |
} |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1765 |
} |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1766 |
|
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1767 |
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
|
1768 |
Handle bootstrap_specifier, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1769 |
Symbol* method_name, Symbol* method_signature, |
46329
53ccc37bda19
8155672: Remove instanceKlassHandles and KlassHandles
coleenp
parents:
46262
diff
changeset
|
1770 |
Klass* current_klass, |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1771 |
TRAPS) { |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1772 |
// 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
|
1773 |
// 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
|
1774 |
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
|
1775 |
Handle resolved_method_type; |
13391
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1776 |
methodHandle resolved_method = |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1777 |
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
|
1778 |
bootstrap_specifier, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1779 |
method_name, method_signature, |
30245956af37
7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents:
10565
diff
changeset
|
1780 |
&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
|
1781 |
&resolved_method_type, |
13732
a9865f5514fc
7196120: NPG: JSR 2292 test fails because missing fix for 7188911
twisti
parents:
13728
diff
changeset
|
1782 |
THREAD); |
30746
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1783 |
wrap_invokedynamic_exception(CHECK); |
dfce1db72058
8051045: HotSpot fails to wrap Exceptions from invokedynamic in a BootstrapMethodError
aeriksso
parents:
30227
diff
changeset
|
1784 |
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
|
1785 |
wrap_invokedynamic_exception(CHECK); |
2570
ecc7862946d4
6655646: dynamic languages need dynamically linked call sites
jrose
parents:
2534
diff
changeset
|
1786 |
} |