comparison src/share/vm/runtime/javaCalls.cpp @ 7066:7d815d842ee0

Merge.
author Christian Haeubl <haeubl@ssw.jku.at>
date Fri, 23 Nov 2012 11:50:27 +0100
parents e522a00b91aa
children 291ffc492eb6
comparison
equal deleted inserted replaced
7065:cfacf5d5bade 7066:7d815d842ee0
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 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 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
90 // the JavaCallWrapper before the entry frame is on the stack. 90 // the JavaCallWrapper before the entry frame is on the stack.
91 _callee_method = callee_method(); 91 _callee_method = callee_method();
92 _receiver = receiver(); 92 _receiver = receiver();
93 93
94 #ifdef CHECK_UNHANDLED_OOPS 94 #ifdef CHECK_UNHANDLED_OOPS
95 THREAD->allow_unhandled_oop(&_callee_method);
96 THREAD->allow_unhandled_oop(&_receiver); 95 THREAD->allow_unhandled_oop(&_receiver);
97 #endif // CHECK_UNHANDLED_OOPS 96 #endif // CHECK_UNHANDLED_OOPS
98 97
99 _thread = (JavaThread *)thread; 98 _thread = (JavaThread *)thread;
100 _handles = _thread->active_handles(); // save previous handle block & Java frame linkage 99 _handles = _thread->active_handles(); // save previous handle block & Java frame linkage
155 JNIHandleBlock::release_block(_old_handles, _thread); 154 JNIHandleBlock::release_block(_old_handles, _thread);
156 } 155 }
157 156
158 157
159 void JavaCallWrapper::oops_do(OopClosure* f) { 158 void JavaCallWrapper::oops_do(OopClosure* f) {
160 f->do_oop((oop*)&_callee_method);
161 f->do_oop((oop*)&_receiver); 159 f->do_oop((oop*)&_receiver);
162 handles()->oops_do(f); 160 handles()->oops_do(f);
163 } 161 }
164 162
165 163
192 190
193 void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS) { 191 void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS) {
194 assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor"); 192 assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor");
195 assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor"); 193 assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor");
196 194
197 instanceKlass* ik = instanceKlass::cast(method->method_holder()); 195 InstanceKlass* ik = method->method_holder();
198 if (ik->is_initialized() && ik->has_vanilla_constructor()) { 196 if (ik->is_initialized() && ik->has_vanilla_constructor()) {
199 // safe to skip constructor call 197 // safe to skip constructor call
200 } else { 198 } else {
201 static JavaValue result(T_VOID); 199 static JavaValue result(T_VOID);
202 JavaCallArguments args(receiver); 200 JavaCallArguments args(receiver);
207 // ============ Interface calls ============ 205 // ============ Interface calls ============
208 206
209 void JavaCalls::call_interface(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { 207 void JavaCalls::call_interface(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
210 CallInfo callinfo; 208 CallInfo callinfo;
211 Handle receiver = args->receiver(); 209 Handle receiver = args->receiver();
212 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (klassOop)NULL : receiver->klass()); 210 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (Klass*)NULL : receiver->klass());
213 LinkResolver::resolve_interface_call( 211 LinkResolver::resolve_interface_call(
214 callinfo, receiver, recvrKlass, spec_klass, name, signature, 212 callinfo, receiver, recvrKlass, spec_klass, name, signature,
215 KlassHandle(), false, true, CHECK); 213 KlassHandle(), false, true, CHECK);
216 methodHandle method = callinfo.selected_method(); 214 methodHandle method = callinfo.selected_method();
217 assert(method.not_null(), "should have thrown exception"); 215 assert(method.not_null(), "should have thrown exception");
224 // ============ Virtual calls ============ 222 // ============ Virtual calls ============
225 223
226 void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { 224 void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
227 CallInfo callinfo; 225 CallInfo callinfo;
228 Handle receiver = args->receiver(); 226 Handle receiver = args->receiver();
229 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (klassOop)NULL : receiver->klass()); 227 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (Klass*)NULL : receiver->klass());
230 LinkResolver::resolve_virtual_call( 228 LinkResolver::resolve_virtual_call(
231 callinfo, receiver, recvrKlass, spec_klass, name, signature, 229 callinfo, receiver, recvrKlass, spec_klass, name, signature,
232 KlassHandle(), false, true, CHECK); 230 KlassHandle(), false, true, CHECK);
233 methodHandle method = callinfo.selected_method(); 231 methodHandle method = callinfo.selected_method();
234 assert(method.not_null(), "should have thrown exception"); 232 assert(method.not_null(), "should have thrown exception");
373 return; 371 return;
374 } 372 }
375 373
376 374
377 #ifdef ASSERT 375 #ifdef ASSERT
378 { klassOop holder = method->method_holder(); 376 { InstanceKlass* holder = method->method_holder();
379 // A klass might not be initialized since JavaCall's might be used during the executing of 377 // A klass might not be initialized since JavaCall's might be used during the executing of
380 // the <clinit>. For example, a Thread.start might start executing on an object that is 378 // the <clinit>. For example, a Thread.start might start executing on an object that is
381 // not fully initialized! (bad Java programming style) 379 // not fully initialized! (bad Java programming style)
382 assert(instanceKlass::cast(holder)->is_linked(), "rewritting must have taken place"); 380 assert(holder->is_linked(), "rewritting must have taken place");
383 } 381 }
384 #endif 382 #endif
385 383
386 384
387 assert(!thread->is_Compiler_thread(), "cannot compile from the compiler"); 385 assert(!thread->is_Compiler_thread(), "cannot compile from the compiler");