Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/c1/c1_LIRAssembler.cpp
32285 views
/*1* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "c1/c1_Compilation.hpp"26#include "c1/c1_Instruction.hpp"27#include "c1/c1_InstructionPrinter.hpp"28#include "c1/c1_LIRAssembler.hpp"29#include "c1/c1_MacroAssembler.hpp"30#include "c1/c1_ValueStack.hpp"31#include "ci/ciInstance.hpp"32#ifdef TARGET_ARCH_x8633# include "nativeInst_x86.hpp"34# include "vmreg_x86.inline.hpp"35#endif36#ifdef TARGET_ARCH_aarch3237# include "nativeInst_aarch32.hpp"38# include "vmreg_aarch32.inline.hpp"39#endif40#ifdef TARGET_ARCH_aarch6441# include "nativeInst_aarch64.hpp"42# include "vmreg_aarch64.inline.hpp"43#endif44#ifdef TARGET_ARCH_sparc45# include "nativeInst_sparc.hpp"46# include "vmreg_sparc.inline.hpp"47#endif48#ifdef TARGET_ARCH_zero49# include "nativeInst_zero.hpp"50# include "vmreg_zero.inline.hpp"51#endif52#ifdef TARGET_ARCH_arm53# include "nativeInst_arm.hpp"54# include "vmreg_arm.inline.hpp"55#endif56#ifdef TARGET_ARCH_ppc57# include "nativeInst_ppc.hpp"58# include "vmreg_ppc.inline.hpp"59#endif606162void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {63// we must have enough patching space so that call can be inserted64while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeCall::instruction_size) {65_masm->nop();66}67patch->install(_masm, patch_code, obj, info);68append_code_stub(patch);6970#ifdef ASSERT71Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());72if (patch->id() == PatchingStub::access_field_id) {73switch (code) {74case Bytecodes::_putstatic:75case Bytecodes::_getstatic:76case Bytecodes::_putfield:77case Bytecodes::_getfield:78break;79default:80ShouldNotReachHere();81}82} else if (patch->id() == PatchingStub::load_klass_id) {83switch (code) {84case Bytecodes::_new:85case Bytecodes::_anewarray:86case Bytecodes::_multianewarray:87case Bytecodes::_instanceof:88case Bytecodes::_checkcast:89break;90default:91ShouldNotReachHere();92}93} else if (patch->id() == PatchingStub::load_mirror_id) {94switch (code) {95case Bytecodes::_putstatic:96case Bytecodes::_getstatic:97case Bytecodes::_ldc:98case Bytecodes::_ldc_w:99break;100default:101ShouldNotReachHere();102}103} else if (patch->id() == PatchingStub::load_appendix_id) {104Bytecodes::Code bc_raw = info->scope()->method()->raw_code_at_bci(info->stack()->bci());105assert(Bytecodes::has_optional_appendix(bc_raw), "unexpected appendix resolution");106} else {107ShouldNotReachHere();108}109#endif110}111112PatchingStub::PatchID LIR_Assembler::patching_id(CodeEmitInfo* info) {113IRScope* scope = info->scope();114Bytecodes::Code bc_raw = scope->method()->raw_code_at_bci(info->stack()->bci());115if (Bytecodes::has_optional_appendix(bc_raw)) {116return PatchingStub::load_appendix_id;117}118return PatchingStub::load_mirror_id;119}120121//---------------------------------------------------------------122123124LIR_Assembler::LIR_Assembler(Compilation* c):125_compilation(c)126, _masm(c->masm())127, _bs(Universe::heap()->barrier_set())128, _frame_map(c->frame_map())129, _current_block(NULL)130, _pending_non_safepoint(NULL)131, _pending_non_safepoint_offset(0)132{133_slow_case_stubs = new CodeStubList();134#ifdef TARGET_ARCH_aarch64135init(); // Target-dependent initialization136#endif137}138139140LIR_Assembler::~LIR_Assembler() {141// The unwind handler label may be unbound if this destructor is invoked because of a bail-out.142// Reset it here to avoid an assertion.143_unwind_handler_entry.reset();144}145146147void LIR_Assembler::check_codespace() {148CodeSection* cs = _masm->code_section();149if (cs->remaining() < (int)(NOT_LP64(1*K)LP64_ONLY(2*K))) {150BAILOUT("CodeBuffer overflow");151}152}153154155void LIR_Assembler::append_code_stub(CodeStub* stub) {156_slow_case_stubs->append(stub);157}158159void LIR_Assembler::emit_stubs(CodeStubList* stub_list) {160for (int m = 0; m < stub_list->length(); m++) {161CodeStub* s = (*stub_list)[m];162163check_codespace();164CHECK_BAILOUT();165166#ifndef PRODUCT167if (CommentedAssembly) {168stringStream st;169s->print_name(&st);170st.print(" slow case");171_masm->block_comment(st.as_string());172}173#endif174s->emit_code(this);175#ifdef ASSERT176#ifndef AARCH64177s->assert_no_unbound_labels();178#endif179#endif180}181}182183184void LIR_Assembler::emit_slow_case_stubs() {185emit_stubs(_slow_case_stubs);186}187188189bool LIR_Assembler::needs_icache(ciMethod* method) const {190return !method->is_static();191}192193194int LIR_Assembler::code_offset() const {195return _masm->offset();196}197198199address LIR_Assembler::pc() const {200return _masm->pc();201}202203// To bang the stack of this compiled method we use the stack size204// that the interpreter would need in case of a deoptimization. This205// removes the need to bang the stack in the deoptimization blob which206// in turn simplifies stack overflow handling.207int LIR_Assembler::bang_size_in_bytes() const {208return MAX2(initial_frame_size_in_bytes(), _compilation->interpreter_frame_size());209}210211void LIR_Assembler::emit_exception_entries(ExceptionInfoList* info_list) {212for (int i = 0; i < info_list->length(); i++) {213XHandlers* handlers = info_list->at(i)->exception_handlers();214215for (int j = 0; j < handlers->length(); j++) {216XHandler* handler = handlers->handler_at(j);217assert(handler->lir_op_id() != -1, "handler not processed by LinearScan");218assert(handler->entry_code() == NULL ||219handler->entry_code()->instructions_list()->last()->code() == lir_branch ||220handler->entry_code()->instructions_list()->last()->code() == lir_delay_slot, "last operation must be branch");221222if (handler->entry_pco() == -1) {223// entry code not emitted yet224if (handler->entry_code() != NULL && handler->entry_code()->instructions_list()->length() > 1) {225handler->set_entry_pco(code_offset());226if (CommentedAssembly) {227_masm->block_comment("Exception adapter block");228}229emit_lir_list(handler->entry_code());230} else {231handler->set_entry_pco(handler->entry_block()->exception_handler_pco());232}233234assert(handler->entry_pco() != -1, "must be set now");235}236}237}238}239240241void LIR_Assembler::emit_code(BlockList* hir) {242if (PrintLIR) {243print_LIR(hir);244}245246int n = hir->length();247for (int i = 0; i < n; i++) {248emit_block(hir->at(i));249CHECK_BAILOUT();250}251252flush_debug_info(code_offset());253254DEBUG_ONLY(check_no_unbound_labels());255}256257258void LIR_Assembler::emit_block(BlockBegin* block) {259if (block->is_set(BlockBegin::backward_branch_target_flag)) {260align_backward_branch_target();261}262263// if this block is the start of an exception handler, record the264// PC offset of the first instruction for later construction of265// the ExceptionHandlerTable266if (block->is_set(BlockBegin::exception_entry_flag)) {267block->set_exception_handler_pco(code_offset());268}269270#ifndef PRODUCT271if (PrintLIRWithAssembly) {272// don't print Phi's273InstructionPrinter ip(false);274block->print(ip);275}276#endif /* PRODUCT */277278assert(block->lir() != NULL, "must have LIR");279X86_ONLY(assert(_masm->rsp_offset() == 0, "frame size should be fixed"));280281#ifndef PRODUCT282if (CommentedAssembly) {283stringStream st;284st.print_cr(" block B%d [%d, %d]", block->block_id(), block->bci(), block->end()->printable_bci());285_masm->block_comment(st.as_string());286}287#endif288289emit_lir_list(block->lir());290291X86_ONLY(assert(_masm->rsp_offset() == 0, "frame size should be fixed"));292}293294295void LIR_Assembler::emit_lir_list(LIR_List* list) {296peephole(list);297298int n = list->length();299for (int i = 0; i < n; i++) {300LIR_Op* op = list->at(i);301302check_codespace();303CHECK_BAILOUT();304305#ifndef PRODUCT306if (CommentedAssembly) {307// Don't record out every op since that's too verbose. Print308// branches since they include block and stub names. Also print309// patching moves since they generate funny looking code.310if (op->code() == lir_branch ||311(op->code() == lir_move && op->as_Op1()->patch_code() != lir_patch_none) ||312(op->code() == lir_leal && op->as_Op1()->patch_code() != lir_patch_none)) {313stringStream st;314op->print_on(&st);315_masm->block_comment(st.as_string());316}317}318if (PrintLIRWithAssembly) {319// print out the LIR operation followed by the resulting assembly320list->at(i)->print(); tty->cr();321}322#endif /* PRODUCT */323324op->emit_code(this);325326if (compilation()->debug_info_recorder()->recording_non_safepoints()) {327process_debug_info(op);328}329330#ifndef PRODUCT331if (PrintLIRWithAssembly) {332_masm->code()->decode();333}334#endif /* PRODUCT */335}336}337338#ifdef ASSERT339void LIR_Assembler::check_no_unbound_labels() {340CHECK_BAILOUT();341342for (int i = 0; i < _branch_target_blocks.length() - 1; i++) {343if (!_branch_target_blocks.at(i)->label()->is_bound()) {344tty->print_cr("label of block B%d is not bound", _branch_target_blocks.at(i)->block_id());345assert(false, "unbound label");346}347}348}349#endif350351//----------------------------------debug info--------------------------------352353354void LIR_Assembler::add_debug_info_for_branch(CodeEmitInfo* info) {355_masm->code_section()->relocate(pc(), relocInfo::poll_type);356int pc_offset = code_offset();357flush_debug_info(pc_offset);358info->record_debug_info(compilation()->debug_info_recorder(), pc_offset);359if (info->exception_handlers() != NULL) {360compilation()->add_exception_handlers_for_pco(pc_offset, info->exception_handlers());361}362}363364365void LIR_Assembler::add_call_info(int pc_offset, CodeEmitInfo* cinfo) {366flush_debug_info(pc_offset);367cinfo->record_debug_info(compilation()->debug_info_recorder(), pc_offset);368if (cinfo->exception_handlers() != NULL) {369compilation()->add_exception_handlers_for_pco(pc_offset, cinfo->exception_handlers());370}371}372373static ValueStack* debug_info(Instruction* ins) {374StateSplit* ss = ins->as_StateSplit();375if (ss != NULL) return ss->state();376return ins->state_before();377}378379void LIR_Assembler::process_debug_info(LIR_Op* op) {380Instruction* src = op->source();381if (src == NULL) return;382int pc_offset = code_offset();383if (_pending_non_safepoint == src) {384_pending_non_safepoint_offset = pc_offset;385return;386}387ValueStack* vstack = debug_info(src);388if (vstack == NULL) return;389if (_pending_non_safepoint != NULL) {390// Got some old debug info. Get rid of it.391if (debug_info(_pending_non_safepoint) == vstack) {392_pending_non_safepoint_offset = pc_offset;393return;394}395if (_pending_non_safepoint_offset < pc_offset) {396record_non_safepoint_debug_info();397}398_pending_non_safepoint = NULL;399}400// Remember the debug info.401if (pc_offset > compilation()->debug_info_recorder()->last_pc_offset()) {402_pending_non_safepoint = src;403_pending_non_safepoint_offset = pc_offset;404}405}406407// Index caller states in s, where 0 is the oldest, 1 its callee, etc.408// Return NULL if n is too large.409// Returns the caller_bci for the next-younger state, also.410static ValueStack* nth_oldest(ValueStack* s, int n, int& bci_result) {411ValueStack* t = s;412for (int i = 0; i < n; i++) {413if (t == NULL) break;414t = t->caller_state();415}416if (t == NULL) return NULL;417for (;;) {418ValueStack* tc = t->caller_state();419if (tc == NULL) return s;420t = tc;421bci_result = tc->bci();422s = s->caller_state();423}424}425426void LIR_Assembler::record_non_safepoint_debug_info() {427int pc_offset = _pending_non_safepoint_offset;428ValueStack* vstack = debug_info(_pending_non_safepoint);429int bci = vstack->bci();430431DebugInformationRecorder* debug_info = compilation()->debug_info_recorder();432assert(debug_info->recording_non_safepoints(), "sanity");433434debug_info->add_non_safepoint(pc_offset);435436// Visit scopes from oldest to youngest.437for (int n = 0; ; n++) {438int s_bci = bci;439ValueStack* s = nth_oldest(vstack, n, s_bci);440if (s == NULL) break;441IRScope* scope = s->scope();442//Always pass false for reexecute since these ScopeDescs are never used for deopt443debug_info->describe_scope(pc_offset, scope->method(), s->bci(), false/*reexecute*/);444}445446debug_info->end_non_safepoint(pc_offset);447}448449450void LIR_Assembler::add_debug_info_for_null_check_here(CodeEmitInfo* cinfo) {451add_debug_info_for_null_check(code_offset(), cinfo);452}453454void LIR_Assembler::add_debug_info_for_null_check(int pc_offset, CodeEmitInfo* cinfo) {455ImplicitNullCheckStub* stub = new ImplicitNullCheckStub(pc_offset, cinfo);456append_code_stub(stub);457}458459void LIR_Assembler::add_debug_info_for_div0_here(CodeEmitInfo* info) {460add_debug_info_for_div0(code_offset(), info);461}462463void LIR_Assembler::add_debug_info_for_div0(int pc_offset, CodeEmitInfo* cinfo) {464DivByZeroStub* stub = new DivByZeroStub(pc_offset, cinfo);465append_code_stub(stub);466}467468void LIR_Assembler::emit_rtcall(LIR_OpRTCall* op) {469rt_call(op->result_opr(), op->addr(), op->arguments(), op->tmp(), op->info());470}471472473void LIR_Assembler::emit_call(LIR_OpJavaCall* op) {474verify_oop_map(op->info());475476if (os::is_MP()) {477// must align calls sites, otherwise they can't be updated atomically on MP hardware478align_call(op->code());479}480481// emit the static call stub stuff out of line482emit_static_call_stub();483CHECK_BAILOUT();484485switch (op->code()) {486case lir_static_call:487case lir_dynamic_call:488call(op, relocInfo::static_call_type);489break;490case lir_optvirtual_call:491call(op, relocInfo::opt_virtual_call_type);492break;493case lir_icvirtual_call:494ic_call(op);495break;496case lir_virtual_call:497vtable_call(op);498break;499default:500fatal(err_msg_res("unexpected op code: %s", op->name()));501break;502}503504// JSR 292505// Record if this method has MethodHandle invokes.506if (op->is_method_handle_invoke()) {507compilation()->set_has_method_handle_invokes(true);508}509510#if defined(X86) && defined(TIERED)511// C2 leave fpu stack dirty clean it512if (UseSSE < 2) {513int i;514for ( i = 1; i <= 7 ; i++ ) {515ffree(i);516}517if (!op->result_opr()->is_float_kind()) {518ffree(0);519}520}521#endif // X86 && TIERED522}523524525void LIR_Assembler::emit_opLabel(LIR_OpLabel* op) {526_masm->bind (*(op->label()));527}528529530void LIR_Assembler::emit_op1(LIR_Op1* op) {531switch (op->code()) {532case lir_move:533if (op->move_kind() == lir_move_volatile) {534assert(op->patch_code() == lir_patch_none, "can't patch volatiles");535volatile_move_op(op->in_opr(), op->result_opr(), op->type(), op->info());536} else {537move_op(op->in_opr(), op->result_opr(), op->type(),538op->patch_code(), op->info(), op->pop_fpu_stack(),539op->move_kind() == lir_move_unaligned,540op->move_kind() == lir_move_wide);541}542break;543544case lir_prefetchr:545prefetchr(op->in_opr());546break;547548case lir_prefetchw:549prefetchw(op->in_opr());550break;551552case lir_roundfp: {553LIR_OpRoundFP* round_op = op->as_OpRoundFP();554roundfp_op(round_op->in_opr(), round_op->tmp(), round_op->result_opr(), round_op->pop_fpu_stack());555break;556}557558case lir_return:559return_op(op->in_opr());560break;561562case lir_safepoint:563if (compilation()->debug_info_recorder()->last_pc_offset() == code_offset()) {564_masm->nop();565}566safepoint_poll(op->in_opr(), op->info());567break;568569case lir_fxch:570fxch(op->in_opr()->as_jint());571break;572573case lir_fld:574fld(op->in_opr()->as_jint());575break;576577case lir_ffree:578ffree(op->in_opr()->as_jint());579break;580581case lir_branch:582break;583584case lir_push:585push(op->in_opr());586break;587588case lir_pop:589pop(op->in_opr());590break;591592case lir_neg:593negate(op->in_opr(), op->result_opr());594break;595596case lir_leal:597leal(op->in_opr(), op->result_opr(), op->patch_code(), op->info());598break;599600case lir_null_check:601if (GenerateCompilerNullChecks) {602add_debug_info_for_null_check_here(op->info());603604if (op->in_opr()->is_single_cpu()) {605_masm->null_check(op->in_opr()->as_register());606} else {607Unimplemented();608}609}610break;611612case lir_monaddr:613monitor_address(op->in_opr()->as_constant_ptr()->as_jint(), op->result_opr());614break;615616#ifdef SPARC617case lir_pack64:618pack64(op->in_opr(), op->result_opr());619break;620621case lir_unpack64:622unpack64(op->in_opr(), op->result_opr());623break;624#endif625626case lir_unwind:627unwind_op(op->in_opr());628break;629630default:631Unimplemented();632break;633}634}635636637void LIR_Assembler::emit_op0(LIR_Op0* op) {638switch (op->code()) {639case lir_word_align: {640while (code_offset() % BytesPerWord != 0) {641_masm->nop();642}643break;644}645646case lir_nop:647assert(op->info() == NULL, "not supported");648_masm->nop();649break;650651case lir_label:652Unimplemented();653break;654655case lir_build_frame:656build_frame();657break;658659case lir_std_entry:660// init offsets661offsets()->set_value(CodeOffsets::OSR_Entry, _masm->offset());662_masm->align(CodeEntryAlignment);663if (needs_icache(compilation()->method())) {664check_icache();665}666offsets()->set_value(CodeOffsets::Verified_Entry, _masm->offset());667_masm->verified_entry();668build_frame();669offsets()->set_value(CodeOffsets::Frame_Complete, _masm->offset());670break;671672case lir_osr_entry:673offsets()->set_value(CodeOffsets::OSR_Entry, _masm->offset());674osr_entry();675break;676677case lir_24bit_FPU:678set_24bit_FPU();679break;680681case lir_reset_FPU:682reset_FPU();683break;684685case lir_breakpoint:686breakpoint();687break;688689case lir_fpop_raw:690fpop();691break;692693case lir_membar:694membar();695break;696697case lir_membar_acquire:698membar_acquire();699break;700701case lir_membar_release:702membar_release();703break;704705case lir_membar_loadload:706membar_loadload();707break;708709case lir_membar_storestore:710membar_storestore();711break;712713case lir_membar_loadstore:714membar_loadstore();715break;716717case lir_membar_storeload:718membar_storeload();719break;720721case lir_get_thread:722get_thread(op->result_opr());723break;724725default:726ShouldNotReachHere();727break;728}729}730731732void LIR_Assembler::emit_op2(LIR_Op2* op) {733switch (op->code()) {734case lir_cmp:735if (op->info() != NULL) {736assert(op->in_opr1()->is_address() || op->in_opr2()->is_address(),737"shouldn't be codeemitinfo for non-address operands");738add_debug_info_for_null_check_here(op->info()); // exception possible739}740comp_op(op->condition(), op->in_opr1(), op->in_opr2(), op);741break;742743case lir_cmp_l2i:744case lir_cmp_fd2i:745case lir_ucmp_fd2i:746comp_fl2i(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op);747break;748749case lir_cmove:750cmove(op->condition(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->type());751break;752753case lir_shl:754case lir_shr:755case lir_ushr:756if (op->in_opr2()->is_constant()) {757shift_op(op->code(), op->in_opr1(), op->in_opr2()->as_constant_ptr()->as_jint(), op->result_opr());758} else {759shift_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp1_opr());760}761break;762763case lir_add:764case lir_sub:765case lir_mul:766case lir_mul_strictfp:767case lir_div:768case lir_div_strictfp:769case lir_rem:770assert(op->fpu_pop_count() < 2, "");771arith_op(772op->code(),773op->in_opr1(),774op->in_opr2(),775op->result_opr(),776op->info(),777op->fpu_pop_count() == 1);778break;779780case lir_abs:781case lir_sqrt:782case lir_sin:783case lir_tan:784case lir_cos:785case lir_log:786case lir_log10:787case lir_exp:788case lir_pow:789intrinsic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op);790break;791792case lir_logic_and:793case lir_logic_or:794case lir_logic_xor:795logic_op(796op->code(),797op->in_opr1(),798op->in_opr2(),799op->result_opr());800break;801802case lir_throw:803throw_op(op->in_opr1(), op->in_opr2(), op->info());804break;805806case lir_xadd:807case lir_xchg:808atomic_op(op->code(), op->in_opr1(), op->in_opr2(), op->result_opr(), op->tmp1_opr());809break;810811default:812Unimplemented();813break;814}815}816817818void LIR_Assembler::build_frame() {819_masm->build_frame(initial_frame_size_in_bytes(), bang_size_in_bytes());820}821822823void LIR_Assembler::roundfp_op(LIR_Opr src, LIR_Opr tmp, LIR_Opr dest, bool pop_fpu_stack) {824assert((src->is_single_fpu() && dest->is_single_stack()) ||825(src->is_double_fpu() && dest->is_double_stack()),826"round_fp: rounds register -> stack location");827828reg2stack (src, dest, src->type(), pop_fpu_stack);829}830831832void LIR_Assembler::move_op(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_PatchCode patch_code, CodeEmitInfo* info, bool pop_fpu_stack, bool unaligned, bool wide) {833if (src->is_register()) {834if (dest->is_register()) {835assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");836reg2reg(src, dest);837} else if (dest->is_stack()) {838assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");839reg2stack(src, dest, type, pop_fpu_stack);840} else if (dest->is_address()) {841reg2mem(src, dest, type, patch_code, info, pop_fpu_stack, wide, unaligned);842} else {843ShouldNotReachHere();844}845846} else if (src->is_stack()) {847assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");848if (dest->is_register()) {849stack2reg(src, dest, type);850} else if (dest->is_stack()) {851stack2stack(src, dest, type);852} else {853ShouldNotReachHere();854}855856} else if (src->is_constant()) {857if (dest->is_register()) {858const2reg(src, dest, patch_code, info); // patching is possible859} else if (dest->is_stack()) {860assert(patch_code == lir_patch_none && info == NULL, "no patching and info allowed here");861const2stack(src, dest);862} else if (dest->is_address()) {863assert(patch_code == lir_patch_none, "no patching allowed here");864const2mem(src, dest, type, info, wide);865} else {866ShouldNotReachHere();867}868869} else if (src->is_address()) {870mem2reg(src, dest, type, patch_code, info, wide, unaligned);871872} else {873ShouldNotReachHere();874}875}876877878void LIR_Assembler::verify_oop_map(CodeEmitInfo* info) {879#ifndef PRODUCT880if (VerifyOops) {881OopMapStream s(info->oop_map());882while (!s.is_done()) {883OopMapValue v = s.current();884if (v.is_oop()) {885VMReg r = v.reg();886if (!r->is_stack()) {887stringStream st;888st.print("bad oop %s at %d", r->as_Register()->name(), _masm->offset());889#ifdef SPARC890_masm->_verify_oop(r->as_Register(), strdup(st.as_string()), __FILE__, __LINE__);891#else892_masm->verify_oop(r->as_Register());893#endif894} else {895_masm->verify_stack_oop(r->reg2stack() * VMRegImpl::stack_slot_size);896}897}898check_codespace();899CHECK_BAILOUT();900901s.next();902}903}904#endif905}906907908