void LIR_Assembler::verify_oop_map(CodeEmitInfo* info) {
#ifndef PRODUCT
    if (VerifyOops) {
        OopMapStream s(info->oop_map());
        while (!s.is_done()) {
            OopMapValue v = s.current();
            if (v.is_oop()) {
                VMReg r = v.reg();
                if (!r->is_stack()) {
                    stringStream st;
                    st.print("bad oop %s at %d", r->as_Register()->name(), _masm->offset());
#ifdef SPARC
                    _masm->_verify_oop(r->as_Register(), os::strdup(st.as_string(), mtCompiler), __FILE__, __LINE__);
#else
                    _masm->verify_oop(r->as_Register());
#endif
                } else {
                    _masm->verify_stack_oop(r->reg2stack() * VMRegImpl::stack_slot_size);
                }
            }
            check_codespace();
            CHECK_BAILOUT();

            s.next();
        }
    }
#endif
}
void LIR_Assembler::emit_stubs(CodeStubList* stub_list) {
  for (int m = 0; m < stub_list->length(); m++) {
    CodeStub* s = (*stub_list)[m];

    check_codespace();
    CHECK_BAILOUT();

#ifndef PRODUCT
    stringStream st;
    s->print_name(&st);
    st.print(" slow case");
    _masm->block_comment(st.as_string());
#endif
    s->emit_code(this);
  }
}
void LIR_Assembler::emit_lir_list(LIR_List* list) {
    peephole(list);

    int n = list->length();
    for (int i = 0; i < n; i++) {
        LIR_Op* op = list->at(i);

        check_codespace();
        CHECK_BAILOUT();

#ifndef PRODUCT
        if (CommentedAssembly) {
            // Don't record out every op since that's too verbose.  Print
            // branches since they include block and stub names.  Also print
            // patching moves since they generate funny looking code.
            if (op->code() == lir_branch ||
                    (op->code() == lir_move && op->as_Op1()->patch_code() != lir_patch_none)) {
                stringStream st;
                op->print_on(&st);
                _masm->block_comment(st.as_string());
            }
        }
        if (PrintLIRWithAssembly) {
            // print out the LIR operation followed by the resulting assembly
            list->at(i)->print();
            tty->cr();
        }
#endif /* PRODUCT */

        op->emit_code(this);

        if (compilation()->debug_info_recorder()->recording_non_safepoints()) {
            process_debug_info(op);
        }

#ifndef PRODUCT
        if (PrintLIRWithAssembly) {
            _masm->code()->decode();
        }
#endif /* PRODUCT */
    }
}
void LIR_Assembler::emit_lir_list(LIR_List* list) {
  peephole(list);

  int n = list->length();
  for (int i = 0; i < n; i++) {
    LIR_Op* op = list->at(i);

    check_codespace();
    CHECK_BAILOUT();

#ifndef PRODUCT
    // Don't record out every op since that's too verbose.  Print
    // branches since they include block and stub names.  Also print
    // patching moves since they generate funny looking code.
    if (op->code() == lir_branch ||
        (op->code() == lir_move && op->as_Op1()->patch_code() != lir_patch_none)) {
      stringStream st;
      op->print_on(&st);
      _masm->block_comment(st.as_string());
    }
    int start_relpc = _masm->rel_pc();
    if (PrintLIRWithAssembly) {
      // print out the LIR operation followed by the resulting assembly
list->at(i)->print(C1OUT);C1OUT->cr();
    }
#endif /* PRODUCT */

    op->emit_code(this);

#ifndef PRODUCT
    if (PrintLIRWithAssembly) {
      address code = (address)_masm->blob();
      Disassembler::decode(code+start_relpc, code+_masm->rel_pc(), C1OUT);
    }
#endif /* PRODUCT */
  }
#ifndef PRODUCT
  if (PrintLIRWithAssembly) {
C1OUT->flush();
  }
#endif
}