hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
changeset 6745 a34ef8968a84
parent 6453 970dc585ab63
child 7397 5b173b4ca846
equal deleted inserted replaced
6743:ef1795cd50a7 6745:a34ef8968a84
    33   }
    33   }
    34   patch->install(_masm, patch_code, obj, info);
    34   patch->install(_masm, patch_code, obj, info);
    35   append_patching_stub(patch);
    35   append_patching_stub(patch);
    36 
    36 
    37 #ifdef ASSERT
    37 #ifdef ASSERT
    38   Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->bci());
    38   Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());
    39   if (patch->id() == PatchingStub::access_field_id) {
    39   if (patch->id() == PatchingStub::access_field_id) {
    40     switch (code) {
    40     switch (code) {
    41       case Bytecodes::_putstatic:
    41       case Bytecodes::_putstatic:
    42       case Bytecodes::_getstatic:
    42       case Bytecodes::_getstatic:
    43       case Bytecodes::_putfield:
    43       case Bytecodes::_putfield:
   219   X86_ONLY(assert(_masm->rsp_offset() == 0, "frame size should be fixed"));
   219   X86_ONLY(assert(_masm->rsp_offset() == 0, "frame size should be fixed"));
   220 
   220 
   221 #ifndef PRODUCT
   221 #ifndef PRODUCT
   222   if (CommentedAssembly) {
   222   if (CommentedAssembly) {
   223     stringStream st;
   223     stringStream st;
   224     st.print_cr(" block B%d [%d, %d]", block->block_id(), block->bci(), block->end()->bci());
   224     st.print_cr(" block B%d [%d, %d]", block->block_id(), block->bci(), block->end()->printable_bci());
   225     _masm->block_comment(st.as_string());
   225     _masm->block_comment(st.as_string());
   226   }
   226   }
   227 #endif
   227 #endif
   228 
   228 
   229   emit_lir_list(block->lir());
   229   emit_lir_list(block->lir());
   310 }
   310 }
   311 
   311 
   312 static ValueStack* debug_info(Instruction* ins) {
   312 static ValueStack* debug_info(Instruction* ins) {
   313   StateSplit* ss = ins->as_StateSplit();
   313   StateSplit* ss = ins->as_StateSplit();
   314   if (ss != NULL) return ss->state();
   314   if (ss != NULL) return ss->state();
   315   return ins->lock_stack();
   315   return ins->state_before();
   316 }
   316 }
   317 
   317 
   318 void LIR_Assembler::process_debug_info(LIR_Op* op) {
   318 void LIR_Assembler::process_debug_info(LIR_Op* op) {
   319   Instruction* src = op->source();
   319   Instruction* src = op->source();
   320   if (src == NULL)  return;
   320   if (src == NULL)  return;
   325   }
   325   }
   326   ValueStack* vstack = debug_info(src);
   326   ValueStack* vstack = debug_info(src);
   327   if (vstack == NULL)  return;
   327   if (vstack == NULL)  return;
   328   if (_pending_non_safepoint != NULL) {
   328   if (_pending_non_safepoint != NULL) {
   329     // Got some old debug info.  Get rid of it.
   329     // Got some old debug info.  Get rid of it.
   330     if (_pending_non_safepoint->bci() == src->bci() &&
   330     if (debug_info(_pending_non_safepoint) == vstack) {
   331         debug_info(_pending_non_safepoint) == vstack) {
       
   332       _pending_non_safepoint_offset = pc_offset;
   331       _pending_non_safepoint_offset = pc_offset;
   333       return;
   332       return;
   334     }
   333     }
   335     if (_pending_non_safepoint_offset < pc_offset) {
   334     if (_pending_non_safepoint_offset < pc_offset) {
   336       record_non_safepoint_debug_info();
   335       record_non_safepoint_debug_info();
   356   if (t == NULL)  return NULL;
   355   if (t == NULL)  return NULL;
   357   for (;;) {
   356   for (;;) {
   358     ValueStack* tc = t->caller_state();
   357     ValueStack* tc = t->caller_state();
   359     if (tc == NULL)  return s;
   358     if (tc == NULL)  return s;
   360     t = tc;
   359     t = tc;
   361     bci_result = s->scope()->caller_bci();
   360     bci_result = tc->bci();
   362     s = s->caller_state();
   361     s = s->caller_state();
   363   }
   362   }
   364 }
   363 }
   365 
   364 
   366 void LIR_Assembler::record_non_safepoint_debug_info() {
   365 void LIR_Assembler::record_non_safepoint_debug_info() {
   367   int         pc_offset = _pending_non_safepoint_offset;
   366   int         pc_offset = _pending_non_safepoint_offset;
   368   ValueStack* vstack    = debug_info(_pending_non_safepoint);
   367   ValueStack* vstack    = debug_info(_pending_non_safepoint);
   369   int         bci       = _pending_non_safepoint->bci();
   368   int         bci       = vstack->bci();
   370 
   369 
   371   DebugInformationRecorder* debug_info = compilation()->debug_info_recorder();
   370   DebugInformationRecorder* debug_info = compilation()->debug_info_recorder();
   372   assert(debug_info->recording_non_safepoints(), "sanity");
   371   assert(debug_info->recording_non_safepoints(), "sanity");
   373 
   372 
   374   debug_info->add_non_safepoint(pc_offset);
   373   debug_info->add_non_safepoint(pc_offset);
   378     int s_bci = bci;
   377     int s_bci = bci;
   379     ValueStack* s = nth_oldest(vstack, n, s_bci);
   378     ValueStack* s = nth_oldest(vstack, n, s_bci);
   380     if (s == NULL)  break;
   379     if (s == NULL)  break;
   381     IRScope* scope = s->scope();
   380     IRScope* scope = s->scope();
   382     //Always pass false for reexecute since these ScopeDescs are never used for deopt
   381     //Always pass false for reexecute since these ScopeDescs are never used for deopt
   383     debug_info->describe_scope(pc_offset, scope->method(), s_bci, false/*reexecute*/);
   382     debug_info->describe_scope(pc_offset, scope->method(), s->bci(), false/*reexecute*/);
   384   }
   383   }
   385 
   384 
   386   debug_info->end_non_safepoint(pc_offset);
   385   debug_info->end_non_safepoint(pc_offset);
   387 }
   386 }
   388 
   387