comparison src/share/vm/interpreter/linkResolver.cpp @ 1135:e66fd840cb6b

6893081: method handle & invokedynamic code needs additional cleanup (post 6815692, 6858164) Summary: During the work for 6829187 we have fixed a number of basic bugs which are logically grouped with 6815692 and 6858164 but which must be reviewed and pushed separately. Reviewed-by: kvn, never
author twisti
date Mon, 04 Jan 2010 18:38:08 +0100
parents 389049f3f393
children 4ce7240d622c
comparison
equal deleted inserted replaced
1134:0910903272e5 1135:e66fd840cb6b
73 _selected_klass = selected_klass; 73 _selected_klass = selected_klass;
74 _resolved_method = resolved_method; 74 _resolved_method = resolved_method;
75 _selected_method = selected_method; 75 _selected_method = selected_method;
76 _vtable_index = vtable_index; 76 _vtable_index = vtable_index;
77 if (CompilationPolicy::mustBeCompiled(selected_method)) { 77 if (CompilationPolicy::mustBeCompiled(selected_method)) {
78 // This path is unusual, mostly used by the '-Xcomp' stress test mode.
79
78 // Note: with several active threads, the mustBeCompiled may be true 80 // Note: with several active threads, the mustBeCompiled may be true
79 // while canBeCompiled is false; remove assert 81 // while canBeCompiled is false; remove assert
80 // assert(CompilationPolicy::canBeCompiled(selected_method), "cannot compile"); 82 // assert(CompilationPolicy::canBeCompiled(selected_method), "cannot compile");
81 if (THREAD->is_Compiler_thread()) { 83 if (THREAD->is_Compiler_thread()) {
82 // don't force compilation, resolve was on behalf of compiler 84 // don't force compilation, resolve was on behalf of compiler
85 return;
86 }
87 if (instanceKlass::cast(selected_method->method_holder())->is_not_initialized()) {
88 // 'is_not_initialized' means not only '!is_initialized', but also that
89 // initialization has not been started yet ('!being_initialized')
90 // Do not force compilation of methods in uninitialized classes.
91 // Note that doing this would throw an assert later,
92 // in CompileBroker::compile_method.
93 // We sometimes use the link resolver to do reflective lookups
94 // even before classes are initialized.
83 return; 95 return;
84 } 96 }
85 CompileBroker::compile_method(selected_method, InvocationEntryBci, 97 CompileBroker::compile_method(selected_method, InvocationEntryBci,
86 methodHandle(), 0, "mustBeCompiled", CHECK); 98 methodHandle(), 0, "mustBeCompiled", CHECK);
87 } 99 }
217 resolve_klass(resolved_klass, pool, index, CHECK); 229 resolve_klass(resolved_klass, pool, index, CHECK);
218 230
219 symbolHandle method_name (THREAD, pool->name_ref_at(index)); 231 symbolHandle method_name (THREAD, pool->name_ref_at(index));
220 symbolHandle method_signature (THREAD, pool->signature_ref_at(index)); 232 symbolHandle method_signature (THREAD, pool->signature_ref_at(index));
221 KlassHandle current_klass(THREAD, pool->pool_holder()); 233 KlassHandle current_klass(THREAD, pool->pool_holder());
234
235 resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
236 }
237
238 void LinkResolver::resolve_dynamic_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) {
239 // The class is java.dyn.MethodHandle
240 resolved_klass = SystemDictionaryHandles::MethodHandle_klass();
241
242 symbolHandle method_name = vmSymbolHandles::invoke_name();
243
244 symbolHandle method_signature(THREAD, pool->signature_ref_at(index));
245 KlassHandle current_klass (THREAD, pool->pool_holder());
222 246
223 resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK); 247 resolve_method(resolved_method, resolved_klass, method_name, method_signature, current_klass, true, CHECK);
224 } 248 }
225 249
226 void LinkResolver::resolve_interface_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) { 250 void LinkResolver::resolve_interface_method(methodHandle& resolved_method, KlassHandle& resolved_klass, constantPoolHandle pool, int index, TRAPS) {