src/share/vm/c1/c1_LIRAssembler.cpp

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_Compilation.hpp"
  27 #include "c1/c1_Instruction.hpp"
  28 #include "c1/c1_InstructionPrinter.hpp"
  29 #include "c1/c1_LIRAssembler.hpp"
  30 #include "c1/c1_MacroAssembler.hpp"
  31 #include "c1/c1_ValueStack.hpp"
  32 #include "ci/ciInstance.hpp"
  33 #include "runtime/os.hpp"
  34 
  35 void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
  36   // we must have enough patching space so that call can be inserted


  37   while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeCall::instruction_size) {
  38     _masm->nop();
  39   }
  40   patch->install(_masm, patch_code, obj, info);
  41   append_code_stub(patch);
  42 
  43 #ifdef ASSERT
  44   Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());
  45   if (patch->id() == PatchingStub::access_field_id) {
  46     switch (code) {
  47       case Bytecodes::_putstatic:
  48       case Bytecodes::_getstatic:
  49       case Bytecodes::_putfield:
  50       case Bytecodes::_getfield:
  51         break;
  52       default:
  53         ShouldNotReachHere();
  54     }
  55   } else if (patch->id() == PatchingStub::load_klass_id) {
  56     switch (code) {


 574 
 575     case lir_unpack64:
 576       unpack64(op->in_opr(), op->result_opr());
 577       break;
 578 #endif
 579 
 580     case lir_unwind:
 581       unwind_op(op->in_opr());
 582       break;
 583 
 584     default:
 585       Unimplemented();
 586       break;
 587   }
 588 }
 589 
 590 
 591 void LIR_Assembler::emit_op0(LIR_Op0* op) {
 592   switch (op->code()) {
 593     case lir_word_align: {
 594       while (code_offset() % BytesPerWord != 0) {
 595         _masm->nop();
 596       }
 597       break;
 598     }
 599 
 600     case lir_nop:
 601       assert(op->info() == NULL, "not supported");
 602       _masm->nop();
 603       break;
 604 
 605     case lir_label:
 606       Unimplemented();
 607       break;
 608 
 609     case lir_build_frame:
 610       build_frame();
 611       break;
 612 
 613     case lir_std_entry:
 614       // init offsets
 615       offsets()->set_value(CodeOffsets::OSR_Entry, _masm->offset());
 616       _masm->align(CodeEntryAlignment);




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "c1/c1_Compilation.hpp"
  27 #include "c1/c1_Instruction.hpp"
  28 #include "c1/c1_InstructionPrinter.hpp"
  29 #include "c1/c1_LIRAssembler.hpp"
  30 #include "c1/c1_MacroAssembler.hpp"
  31 #include "c1/c1_ValueStack.hpp"
  32 #include "ci/ciInstance.hpp"
  33 #include "runtime/os.hpp"
  34 
  35 void LIR_Assembler::patching_epilog(PatchingStub* patch, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
  36   // We must have enough patching space so that call can be inserted.
  37   // We cannot use fat nops here, since the concurrent code rewrite may transiently
  38   // create the illegal instruction sequence.
  39   while ((intx) _masm->pc() - (intx) patch->pc_start() < NativeCall::instruction_size) {
  40     _masm->nop();
  41   }
  42   patch->install(_masm, patch_code, obj, info);
  43   append_code_stub(patch);
  44 
  45 #ifdef ASSERT
  46   Bytecodes::Code code = info->scope()->method()->java_code_at_bci(info->stack()->bci());
  47   if (patch->id() == PatchingStub::access_field_id) {
  48     switch (code) {
  49       case Bytecodes::_putstatic:
  50       case Bytecodes::_getstatic:
  51       case Bytecodes::_putfield:
  52       case Bytecodes::_getfield:
  53         break;
  54       default:
  55         ShouldNotReachHere();
  56     }
  57   } else if (patch->id() == PatchingStub::load_klass_id) {
  58     switch (code) {


 576 
 577     case lir_unpack64:
 578       unpack64(op->in_opr(), op->result_opr());
 579       break;
 580 #endif
 581 
 582     case lir_unwind:
 583       unwind_op(op->in_opr());
 584       break;
 585 
 586     default:
 587       Unimplemented();
 588       break;
 589   }
 590 }
 591 
 592 
 593 void LIR_Assembler::emit_op0(LIR_Op0* op) {
 594   switch (op->code()) {
 595     case lir_word_align: {
 596       _masm->align(BytesPerWord);


 597       break;
 598     }
 599 
 600     case lir_nop:
 601       assert(op->info() == NULL, "not supported");
 602       _masm->nop();
 603       break;
 604 
 605     case lir_label:
 606       Unimplemented();
 607       break;
 608 
 609     case lir_build_frame:
 610       build_frame();
 611       break;
 612 
 613     case lir_std_entry:
 614       // init offsets
 615       offsets()->set_value(CodeOffsets::OSR_Entry, _masm->offset());
 616       _masm->align(CodeEntryAlignment);