hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
changeset 6176 4d9030fe341f
parent 5882 6b2aecc4f7d8
child 6453 970dc585ab63
equal deleted inserted replaced
6175:86dbf3cacacc 6176:4d9030fe341f
  3110 
  3110 
  3111 void TemplateTable::_new() {
  3111 void TemplateTable::_new() {
  3112   transition(vtos, atos);
  3112   transition(vtos, atos);
  3113   __ get_unsigned_2_byte_index_at_bcp(rdx, 1);
  3113   __ get_unsigned_2_byte_index_at_bcp(rdx, 1);
  3114   Label slow_case;
  3114   Label slow_case;
       
  3115   Label slow_case_no_pop;
  3115   Label done;
  3116   Label done;
  3116   Label initialize_header;
  3117   Label initialize_header;
  3117   Label initialize_object;  // including clearing the fields
  3118   Label initialize_object;  // including clearing the fields
  3118   Label allocate_shared;
  3119   Label allocate_shared;
  3119 
  3120 
  3120   __ get_cpool_and_tags(rcx, rax);
  3121   __ get_cpool_and_tags(rcx, rax);
       
  3122 
       
  3123   // Make sure the class we're about to instantiate has been resolved.
       
  3124   // This is done before loading instanceKlass to be consistent with the order
       
  3125   // how Constant Pool is updated (see constantPoolOopDesc::klass_at_put)
       
  3126   const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
       
  3127   __ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
       
  3128   __ jcc(Assembler::notEqual, slow_case_no_pop);
       
  3129 
  3121   // get instanceKlass
  3130   // get instanceKlass
  3122   __ movptr(rcx, Address(rcx, rdx, Address::times_ptr, sizeof(constantPoolOopDesc)));
  3131   __ movptr(rcx, Address(rcx, rdx, Address::times_ptr, sizeof(constantPoolOopDesc)));
  3123   __ push(rcx);  // save the contexts of klass for initializing the header
  3132   __ push(rcx);  // save the contexts of klass for initializing the header
  3124 
       
  3125   // make sure the class we're about to instantiate has been resolved.
       
  3126   // Note: slow_case does a pop of stack, which is why we loaded class/pushed above
       
  3127   const int tags_offset = typeArrayOopDesc::header_size(T_BYTE) * wordSize;
       
  3128   __ cmpb(Address(rax, rdx, Address::times_1, tags_offset), JVM_CONSTANT_Class);
       
  3129   __ jcc(Assembler::notEqual, slow_case);
       
  3130 
  3133 
  3131   // make sure klass is initialized & doesn't have finalizer
  3134   // make sure klass is initialized & doesn't have finalizer
  3132   // make sure klass is fully initialized
  3135   // make sure klass is fully initialized
  3133   __ cmpl(Address(rcx, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)), instanceKlass::fully_initialized);
  3136   __ cmpl(Address(rcx, instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)), instanceKlass::fully_initialized);
  3134   __ jcc(Assembler::notEqual, slow_case);
  3137   __ jcc(Assembler::notEqual, slow_case);
  3253   }
  3256   }
  3254 
  3257 
  3255   // slow case
  3258   // slow case
  3256   __ bind(slow_case);
  3259   __ bind(slow_case);
  3257   __ pop(rcx);   // restore stack pointer to what it was when we came in.
  3260   __ pop(rcx);   // restore stack pointer to what it was when we came in.
       
  3261   __ bind(slow_case_no_pop);
  3258   __ get_constant_pool(rax);
  3262   __ get_constant_pool(rax);
  3259   __ get_unsigned_2_byte_index_at_bcp(rdx, 1);
  3263   __ get_unsigned_2_byte_index_at_bcp(rdx, 1);
  3260   call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), rax, rdx);
  3264   call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::_new), rax, rdx);
  3261 
  3265 
  3262   // continue
  3266   // continue