187 |
187 |
188 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) { |
189 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"); |
190 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"); |
191 |
191 |
192 InstanceKlass* ik = InstanceKlass::cast(method->method_holder()); |
192 InstanceKlass* ik = method->method_holder(); |
193 if (ik->is_initialized() && ik->has_vanilla_constructor()) { |
193 if (ik->is_initialized() && ik->has_vanilla_constructor()) { |
194 // safe to skip constructor call |
194 // safe to skip constructor call |
195 } else { |
195 } else { |
196 static JavaValue result(T_VOID); |
196 static JavaValue result(T_VOID); |
197 JavaCallArguments args(receiver); |
197 JavaCallArguments args(receiver); |
342 return; |
342 return; |
343 } |
343 } |
344 |
344 |
345 |
345 |
346 #ifdef ASSERT |
346 #ifdef ASSERT |
347 { Klass* holder = method->method_holder(); |
347 { InstanceKlass* holder = method->method_holder(); |
348 // 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 |
349 // 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 |
350 // not fully initialized! (bad Java programming style) |
350 // not fully initialized! (bad Java programming style) |
351 assert(InstanceKlass::cast(holder)->is_linked(), "rewritting must have taken place"); |
351 assert(holder->is_linked(), "rewritting must have taken place"); |
352 } |
352 } |
353 #endif |
353 #endif |
354 |
354 |
355 |
355 |
356 assert(!thread->is_Compiler_thread(), "cannot compile from the compiler"); |
356 assert(!thread->is_Compiler_thread(), "cannot compile from the compiler"); |