void LIR_OopMapGenerator::process_move(LIR_Op* op) {
  LIR_Op1* op1 = op->as_Op1();
  LIR_Opr src = op1->in_opr();
  LIR_Opr dst = op1->result_opr();
  
  assert(!src->is_stack() || !dst->is_stack(), "No memory-memory moves allowed");
  if ((src->is_stack() && frame_map()->is_spill_pos(src)) ||
      (dst->is_stack() && frame_map()->is_spill_pos(dst))) {
    // Oops in the spill area are handled by another mechanism (see
    // CodeEmitInfo::record_spilled_oops)
    return;
  }
  if (dst->is_oop()) {
    assert((src->is_oop() &&
            (src->is_stack() || src->is_register() || src->is_constant())
           ) ||
           src->is_address(), "Wrong tracking of oops/non-oops in LIR");
    assert(!src->is_stack() || is_marked(src->single_stack_ix()),
           "Error in tracking of oop stores to stack");
    if (dst->is_stack()) {
      mark(dst->single_stack_ix());
    } else if (dst->is_register()) {
      if (LIRCacheLocals) {
        if (local_mapping()->is_cache_reg(dst)) {
          mark(dst);
        }
      } else {
        assert(local_mapping() == NULL, "expected no local mapping");
      }
    }
  } else {
    // !dst->is_oop()
    // Note that dst may be an address
    assert(!src->is_single_stack() || !is_marked(src->single_stack_ix()), "Error in tracking of oop stores to stack");
    assert(!src->is_double_stack() || !is_marked(src->double_stack_ix()), "Error in tracking of oop stores to stack");
    assert(!src->is_double_stack() || !is_marked(1 + src->double_stack_ix()), "Error in tracking of oop stores to stack");
    if (dst->is_stack()) {
      if (dst->is_single_stack()) {
        clear_all(dst->single_stack_ix());
      } else {
        clear_all(dst->double_stack_ix());
        clear_all(1 + dst->double_stack_ix());
      }
    } else if (dst->is_register()) {
      if (LIRCacheLocals) {
        if (local_mapping()->is_cache_reg(dst)) {
          clear_all(dst);
        }
      } else {
        assert(local_mapping() == NULL, "expected no local mapping");
      }
    }
  }
}
void C1_MacroAssembler::build_frame(FrameMap* frame_map) {
  // offset from the expected fixed sp within the method
  int sp_offset = in_bytes(frame_map->framesize_in_bytes()) - 8; // call pushed the return IP
  if( frame_map->num_callee_saves() > 0 ) {
    int callee_save_num = frame_map->num_callee_saves()-1;
    int callee_saves    = frame_map->callee_saves(); // bitmap
    for (int i=LinearScan::nof_cpu_regs-1; i>=0; i--) {
      if ((callee_saves & 1<<i) != 0) {
        int wanted_sp_offset = frame_map->address_for_callee_save(callee_save_num)._disp;
        assert0( sp_offset-8 == wanted_sp_offset );
        push((Register)i);
        sp_offset -= 8;
        callee_save_num--;
        assert0( callee_save_num >= -1 );
      }
    }
#ifdef ASSERT
for(int i=0;i<LinearScan::nof_xmm_regs;i++){
      int reg = LinearScan::nof_cpu_regs+i;
      assert ((callee_saves & 1<<reg) == 0, "Unexpected callee save XMM register");
    }
#endif
  }
  if (sp_offset != 0) {
    // make sp equal expected sp for method
    if (sp_offset == 8) push  (RCX);            // push reg as smaller encoding than sub8i
    else                sub8i (RSP, sp_offset );
  }
  if( should_verify_oop(MacroAssembler::OopVerify_IncomingArgument) ) {
    int args_len = frame_map->incoming_arguments()->length();
    for(int i=0; i < args_len; i++) {
      LIR_Opr arg = frame_map->incoming_arguments()->at(i);
      if (arg->is_valid() && arg->is_oop()) {
        VOopReg::VR oop = frame_map->oopregname(arg);
        verify_oop(oop, MacroAssembler::OopVerify_IncomingArgument);
      }
    }
  }
}
void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {
  if( _masm->should_verify_oop(MacroAssembler::OopVerify_OutgoingArgument) ) {
    int len = op->arguments()->length();
for(int i=0;i<len;i++){
      LIR_Opr opr = op->arguments()->at(i);
      if( opr->is_oop() ) _masm->verify_oop(_frame_map->oopregname(opr), MacroAssembler::OopVerify_OutgoingArgument);
    }
  }
  switch (op->code()) {
  case lir_static_call:  
call(op->addr(),op->info());
    break;
  case lir_optvirtual_call: 
call(op->addr(),op->info());
    break;
  case lir_icvirtual_call:
    ic_call(op->addr(), op->info());
    break;
  case lir_virtual_call:
    vtable_call(op->vtable_offset(), op->info());
    break;
  default: ShouldNotReachHere();
  }
}