comparison src/share/vm/runtime/javaCalls.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents f08d439fab8c
children 18fb7da42534
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
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.
87 // the JavaCallWrapper before the entry frame is on the stack. 87 // the JavaCallWrapper before the entry frame is on the stack.
88 _callee_method = callee_method(); 88 _callee_method = callee_method();
89 _receiver = receiver(); 89 _receiver = receiver();
90 90
91 #ifdef CHECK_UNHANDLED_OOPS 91 #ifdef CHECK_UNHANDLED_OOPS
92 THREAD->allow_unhandled_oop(&_callee_method);
93 THREAD->allow_unhandled_oop(&_receiver); 92 THREAD->allow_unhandled_oop(&_receiver);
94 #endif // CHECK_UNHANDLED_OOPS 93 #endif // CHECK_UNHANDLED_OOPS
95 94
96 _thread = (JavaThread *)thread; 95 _thread = (JavaThread *)thread;
97 _handles = _thread->active_handles(); // save previous handle block & Java frame linkage 96 _handles = _thread->active_handles(); // save previous handle block & Java frame linkage
152 JNIHandleBlock::release_block(_old_handles, _thread); 151 JNIHandleBlock::release_block(_old_handles, _thread);
153 } 152 }
154 153
155 154
156 void JavaCallWrapper::oops_do(OopClosure* f) { 155 void JavaCallWrapper::oops_do(OopClosure* f) {
157 f->do_oop((oop*)&_callee_method);
158 f->do_oop((oop*)&_receiver); 156 f->do_oop((oop*)&_receiver);
159 handles()->oops_do(f); 157 handles()->oops_do(f);
160 } 158 }
161 159
162 160
189 187
190 void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS) { 188 void JavaCalls::call_default_constructor(JavaThread* thread, methodHandle method, Handle receiver, TRAPS) {
191 assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor"); 189 assert(method->name() == vmSymbols::object_initializer_name(), "Should only be called for default constructor");
192 assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor"); 190 assert(method->signature() == vmSymbols::void_method_signature(), "Should only be called for default constructor");
193 191
194 instanceKlass* ik = instanceKlass::cast(method->method_holder()); 192 InstanceKlass* ik = InstanceKlass::cast(method->method_holder());
195 if (ik->is_initialized() && ik->has_vanilla_constructor()) { 193 if (ik->is_initialized() && ik->has_vanilla_constructor()) {
196 // safe to skip constructor call 194 // safe to skip constructor call
197 } else { 195 } else {
198 static JavaValue result(T_VOID); 196 static JavaValue result(T_VOID);
199 JavaCallArguments args(receiver); 197 JavaCallArguments args(receiver);
204 // ============ Virtual calls ============ 202 // ============ Virtual calls ============
205 203
206 void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { 204 void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) {
207 CallInfo callinfo; 205 CallInfo callinfo;
208 Handle receiver = args->receiver(); 206 Handle receiver = args->receiver();
209 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (klassOop)NULL : receiver->klass()); 207 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (Klass*)NULL : receiver->klass());
210 LinkResolver::resolve_virtual_call( 208 LinkResolver::resolve_virtual_call(
211 callinfo, receiver, recvrKlass, spec_klass, name, signature, 209 callinfo, receiver, recvrKlass, spec_klass, name, signature,
212 KlassHandle(), false, true, CHECK); 210 KlassHandle(), false, true, CHECK);
213 methodHandle method = callinfo.selected_method(); 211 methodHandle method = callinfo.selected_method();
214 assert(method.not_null(), "should have thrown exception"); 212 assert(method.not_null(), "should have thrown exception");
344 return; 342 return;
345 } 343 }
346 344
347 345
348 #ifdef ASSERT 346 #ifdef ASSERT
349 { klassOop holder = method->method_holder(); 347 { Klass* holder = method->method_holder();
350 // A klass might not be initialized since JavaCall's might be used during the executing of 348 // A klass might not be initialized since JavaCall's might be used during the executing of
351 // the <clinit>. For example, a Thread.start might start executing on an object that is 349 // the <clinit>. For example, a Thread.start might start executing on an object that is
352 // not fully initialized! (bad Java programming style) 350 // not fully initialized! (bad Java programming style)
353 assert(instanceKlass::cast(holder)->is_linked(), "rewritting must have taken place"); 351 assert(InstanceKlass::cast(holder)->is_linked(), "rewritting must have taken place");
354 } 352 }
355 #endif 353 #endif
356 354
357 355
358 assert(!thread->is_Compiler_thread(), "cannot compile from the compiler"); 356 assert(!thread->is_Compiler_thread(), "cannot compile from the compiler");