1 /*
   2  * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  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 #ifndef SHARE_VM_C1_C1_CODESTUBS_HPP
  26 #define SHARE_VM_C1_C1_CODESTUBS_HPP
  27 
  28 #include "c1/c1_FrameMap.hpp"
  29 #include "c1/c1_IR.hpp"
  30 #include "c1/c1_Instruction.hpp"
  31 #include "c1/c1_LIR.hpp"
  32 #include "c1/c1_Runtime1.hpp"
  33 #include "utilities/array.hpp"
  34 #include "utilities/macros.hpp"
  35 
  36 class CodeEmitInfo;
  37 class LIR_Assembler;
  38 class LIR_OpVisitState;
  39 
  40 // CodeStubs are little 'out-of-line' pieces of code that
  41 // usually handle slow cases of operations. All code stubs
  42 // are collected and code is emitted at the end of the
  43 // nmethod.
  44 
  45 class CodeStub: public CompilationResourceObj {
  46  protected:
  47   Label _entry;                                  // label at the stub entry point
  48   Label _continuation;                           // label where stub continues, if any
  49 
  50  public:
  51   CodeStub() {}
  52 
  53   // code generation
  54   void assert_no_unbound_labels()                { assert(!_entry.is_unbound() && !_continuation.is_unbound(), "unbound label"); }
  55   virtual void emit_code(LIR_Assembler* e) = 0;
  56   virtual CodeEmitInfo* info() const             { return NULL; }
  57   virtual bool is_exception_throw_stub() const   { return false; }
  58   virtual bool is_range_check_stub() const       { return false; }
  59   virtual bool is_divbyzero_stub() const         { return false; }
  60 #ifndef PRODUCT
  61   virtual void print_name(outputStream* out) const = 0;
  62 #endif
  63 
  64   // label access
  65   Label* entry()                                 { return &_entry; }
  66   Label* continuation()                          { return &_continuation; }
  67   // for LIR
  68   virtual void visit(LIR_OpVisitState* visit) {
  69 #ifndef PRODUCT
  70     if (LIRTracePeephole && Verbose) {
  71       tty->print("no visitor for ");
  72       print_name(tty);
  73       tty->cr();
  74     }
  75 #endif
  76   }
  77 };
  78 
  79 
  80 define_array(CodeStubArray, CodeStub*)
  81 define_stack(_CodeStubList, CodeStubArray)
  82 
  83 class CodeStubList: public _CodeStubList {
  84  public:
  85   CodeStubList(): _CodeStubList() {}
  86 
  87   void append(CodeStub* stub) {
  88     if (!contains(stub)) {
  89       _CodeStubList::append(stub);
  90     }
  91   }
  92 };
  93 
  94 class CounterOverflowStub: public CodeStub {
  95  private:
  96   CodeEmitInfo* _info;
  97   int           _bci;
  98   LIR_Opr       _method;
  99 
 100 public:
 101   CounterOverflowStub(CodeEmitInfo* info, int bci, LIR_Opr method) :  _info(info), _bci(bci), _method(method) {
 102   }
 103 
 104   virtual void emit_code(LIR_Assembler* e);
 105 
 106   virtual void visit(LIR_OpVisitState* visitor) {
 107     visitor->do_slow_case(_info);
 108     visitor->do_input(_method);
 109   }
 110 
 111 #ifndef PRODUCT
 112   virtual void print_name(outputStream* out) const { out->print("CounterOverflowStub"); }
 113 #endif // PRODUCT
 114 
 115 };
 116 
 117 class ConversionStub: public CodeStub {
 118  private:
 119   Bytecodes::Code _bytecode;
 120   LIR_Opr         _input;
 121   LIR_Opr         _result;
 122 
 123   static float float_zero;
 124   static double double_zero;
 125  public:
 126   ConversionStub(Bytecodes::Code bytecode, LIR_Opr input, LIR_Opr result)
 127     : _bytecode(bytecode), _input(input), _result(result) {
 128   }
 129 
 130   Bytecodes::Code bytecode() { return _bytecode; }
 131   LIR_Opr         input()    { return _input; }
 132   LIR_Opr         result()   { return _result; }
 133 
 134   virtual void emit_code(LIR_Assembler* e);
 135   virtual void visit(LIR_OpVisitState* visitor) {
 136     visitor->do_slow_case();
 137     visitor->do_input(_input);
 138     visitor->do_output(_result);
 139   }
 140 #ifndef PRODUCT
 141   virtual void print_name(outputStream* out) const { out->print("ConversionStub"); }
 142 #endif // PRODUCT
 143 };
 144 
 145 
 146 // Throws ArrayIndexOutOfBoundsException by default but can be
 147 // configured to throw IndexOutOfBoundsException in constructor
 148 class RangeCheckStub: public CodeStub {
 149  private:
 150   CodeEmitInfo* _info;
 151   LIR_Opr       _index;
 152   bool          _throw_index_out_of_bounds_exception;
 153 
 154  public:
 155   RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, bool throw_index_out_of_bounds_exception = false);
 156   virtual void emit_code(LIR_Assembler* e);
 157   virtual CodeEmitInfo* info() const             { return _info; }
 158   virtual bool is_exception_throw_stub() const   { return true; }
 159   virtual bool is_range_check_stub() const       { return true; }
 160   virtual void visit(LIR_OpVisitState* visitor) {
 161     visitor->do_slow_case(_info);
 162     visitor->do_input(_index);
 163   }
 164 #ifndef PRODUCT
 165   virtual void print_name(outputStream* out) const { out->print("RangeCheckStub"); }
 166 #endif // PRODUCT
 167 };
 168 
 169 // stub used when predicate fails and deoptimization is needed
 170 class PredicateFailedStub: public CodeStub {
 171  private:
 172   CodeEmitInfo* _info;
 173 
 174  public:
 175   PredicateFailedStub(CodeEmitInfo* info);
 176   virtual void emit_code(LIR_Assembler* e);
 177   virtual CodeEmitInfo* info() const             { return _info; }
 178   virtual void visit(LIR_OpVisitState* visitor) {
 179     visitor->do_slow_case(_info);
 180   }
 181 #ifndef PRODUCT
 182   virtual void print_name(outputStream* out) const { out->print("PredicateFailedStub"); }
 183 #endif // PRODUCT
 184 };
 185 
 186 class DivByZeroStub: public CodeStub {
 187  private:
 188   CodeEmitInfo* _info;
 189   int           _offset;
 190 
 191  public:
 192   DivByZeroStub(CodeEmitInfo* info)
 193     : _info(info), _offset(-1) {
 194   }
 195   DivByZeroStub(int offset, CodeEmitInfo* info)
 196     : _info(info), _offset(offset) {
 197   }
 198   virtual void emit_code(LIR_Assembler* e);
 199   virtual CodeEmitInfo* info() const             { return _info; }
 200   virtual bool is_exception_throw_stub() const   { return true; }
 201   virtual bool is_divbyzero_stub() const         { return true; }
 202   virtual void visit(LIR_OpVisitState* visitor) {
 203     visitor->do_slow_case(_info);
 204   }
 205 #ifndef PRODUCT
 206   virtual void print_name(outputStream* out) const { out->print("DivByZeroStub"); }
 207 #endif // PRODUCT
 208 };
 209 
 210 
 211 class ImplicitNullCheckStub: public CodeStub {
 212  private:
 213   CodeEmitInfo* _info;
 214   int           _offset;
 215 
 216  public:
 217   ImplicitNullCheckStub(int offset, CodeEmitInfo* info)
 218     : _offset(offset), _info(info) {
 219   }
 220   virtual void emit_code(LIR_Assembler* e);
 221   virtual CodeEmitInfo* info() const             { return _info; }
 222   virtual bool is_exception_throw_stub() const   { return true; }
 223   virtual void visit(LIR_OpVisitState* visitor) {
 224     visitor->do_slow_case(_info);
 225   }
 226 #ifndef PRODUCT
 227   virtual void print_name(outputStream* out) const { out->print("ImplicitNullCheckStub"); }
 228 #endif // PRODUCT
 229 };
 230 
 231 
 232 class NewInstanceStub: public CodeStub {
 233  private:
 234   ciInstanceKlass* _klass;
 235   LIR_Opr          _klass_reg;
 236   LIR_Opr          _result;
 237   CodeEmitInfo*    _info;
 238   Runtime1::StubID _stub_id;
 239 
 240  public:
 241   NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id);
 242   virtual void emit_code(LIR_Assembler* e);
 243   virtual CodeEmitInfo* info() const             { return _info; }
 244   virtual void visit(LIR_OpVisitState* visitor) {
 245     visitor->do_slow_case(_info);
 246     visitor->do_input(_klass_reg);
 247     visitor->do_output(_result);
 248   }
 249 #ifndef PRODUCT
 250   virtual void print_name(outputStream* out) const { out->print("NewInstanceStub"); }
 251 #endif // PRODUCT
 252 };
 253 
 254 
 255 class NewTypeArrayStub: public CodeStub {
 256  private:
 257   LIR_Opr       _klass_reg;
 258   LIR_Opr       _length;
 259   LIR_Opr       _result;
 260   CodeEmitInfo* _info;
 261 
 262  public:
 263   NewTypeArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
 264   virtual void emit_code(LIR_Assembler* e);
 265   virtual CodeEmitInfo* info() const             { return _info; }
 266   virtual void visit(LIR_OpVisitState* visitor) {
 267     visitor->do_slow_case(_info);
 268     visitor->do_input(_klass_reg);
 269     visitor->do_input(_length);
 270     assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
 271   }
 272 #ifndef PRODUCT
 273   virtual void print_name(outputStream* out) const { out->print("NewTypeArrayStub"); }
 274 #endif // PRODUCT
 275 };
 276 
 277 
 278 class NewObjectArrayStub: public CodeStub {
 279  private:
 280   LIR_Opr        _klass_reg;
 281   LIR_Opr        _length;
 282   LIR_Opr        _result;
 283   CodeEmitInfo*  _info;
 284 
 285  public:
 286   NewObjectArrayStub(LIR_Opr klass_reg, LIR_Opr length, LIR_Opr result, CodeEmitInfo* info);
 287   virtual void emit_code(LIR_Assembler* e);
 288   virtual CodeEmitInfo* info() const             { return _info; }
 289   virtual void visit(LIR_OpVisitState* visitor) {
 290     visitor->do_slow_case(_info);
 291     visitor->do_input(_klass_reg);
 292     visitor->do_input(_length);
 293     assert(_result->is_valid(), "must be valid"); visitor->do_output(_result);
 294   }
 295 #ifndef PRODUCT
 296   virtual void print_name(outputStream* out) const { out->print("NewObjectArrayStub"); }
 297 #endif // PRODUCT
 298 };
 299 
 300 
 301 class MonitorAccessStub: public CodeStub {
 302  protected:
 303   LIR_Opr _obj_reg;
 304   LIR_Opr _lock_reg;
 305   CodeEmitInfo* _info;
 306 
 307  public:
 308   MonitorAccessStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info) {
 309     _obj_reg  = obj_reg;
 310     _lock_reg  = lock_reg;
 311     _info = (info != NULL) ? new CodeEmitInfo(info) : NULL;
 312   }
 313   virtual CodeEmitInfo* info() const             { return _info; }
 314 
 315 #ifndef PRODUCT
 316   virtual void print_name(outputStream* out) const { out->print("MonitorAccessStub"); }
 317 #endif // PRODUCT
 318 };
 319 
 320 
 321 class MonitorEnterStub: public MonitorAccessStub {
 322  public:
 323   MonitorEnterStub(LIR_Opr obj_reg, LIR_Opr lock_reg, CodeEmitInfo* info);
 324 
 325   virtual void emit_code(LIR_Assembler* e);
 326   virtual void visit(LIR_OpVisitState* visitor) {
 327     visitor->do_input(_obj_reg);
 328     visitor->do_input(_lock_reg);
 329     visitor->do_slow_case(_info);
 330   }
 331 #ifndef PRODUCT
 332   virtual void print_name(outputStream* out) const { out->print("MonitorEnterStub"); }
 333 #endif // PRODUCT
 334 };
 335 
 336 
 337 class MonitorExitStub: public MonitorAccessStub {
 338  private:
 339   bool _compute_lock;
 340   int  _monitor_ix;
 341 
 342  public:
 343   MonitorExitStub(LIR_Opr lock_reg, bool compute_lock, int monitor_ix, CodeEmitInfo* info)
 344     : MonitorAccessStub(LIR_OprFact::illegalOpr, lock_reg, info),
 345       _compute_lock(compute_lock), _monitor_ix(monitor_ix) { }
 346   virtual void emit_code(LIR_Assembler* e);
 347   virtual void visit(LIR_OpVisitState* visitor) {
 348     assert(_obj_reg->is_illegal(), "unused");
 349     if (_compute_lock) {
 350       visitor->do_temp(_lock_reg);
 351     } else {
 352       visitor->do_input(_lock_reg);
 353     }
 354     /* Do NOT call this, we don't need it to emit non-safepoint debug info.
 355      * This makes the compiler assume there is a safepoint associated with
 356      * this stub, but there's not. It causes C1 crashes in Eclipse and other
 357      * OSGi applications.
 358 
 359     if (_info != NULL) {
 360       visitor->do_slow_case(_info);
 361     }
 362     */
 363   }
 364 #ifndef PRODUCT
 365   virtual void print_name(outputStream* out) const { out->print("MonitorExitStub"); }
 366 #endif // PRODUCT
 367 };
 368 
 369 
 370 class PatchingStub: public CodeStub {
 371  public:
 372   enum PatchID {
 373     access_field_id,
 374     load_klass_id,
 375     load_mirror_id,
 376     load_appendix_id
 377   };
 378   enum constants {
 379     patch_info_size = 3
 380   };
 381  private:
 382   PatchID       _id;
 383   address       _pc_start;
 384   int           _bytes_to_copy;
 385   Label         _patched_code_entry;
 386   Label         _patch_site_entry;
 387   Label         _patch_site_continuation;
 388   Register      _obj;
 389   CodeEmitInfo* _info;
 390   int           _index;  // index of the patchable oop or Klass* in nmethod oop or metadata table if needed
 391   static int    _patch_info_offset;
 392 
 393   void align_patch_site(MacroAssembler* masm);
 394 
 395  public:
 396   static int patch_info_offset() { return _patch_info_offset; }
 397 
 398   PatchingStub(MacroAssembler* masm, PatchID id, int index = -1):
 399       _id(id)
 400     , _info(NULL)
 401     , _index(index) {
 402     if (os::is_MP()) {
 403       // force alignment of patch sites on MP hardware so we
 404       // can guarantee atomic writes to the patch site.
 405       align_patch_site(masm);
 406     }
 407     _pc_start = masm->pc();
 408     masm->bind(_patch_site_entry);
 409   }
 410 
 411   void install(MacroAssembler* masm, LIR_PatchCode patch_code, Register obj, CodeEmitInfo* info) {
 412     _info = info;
 413     _obj = obj;
 414     masm->bind(_patch_site_continuation);
 415     _bytes_to_copy = masm->pc() - pc_start();
 416     if (_id == PatchingStub::access_field_id) {
 417       // embed a fixed offset to handle long patches which need to be offset by a word.
 418       // the patching code will just add the field offset field to this offset so
 419       // that we can refernce either the high or low word of a double word field.
 420       int field_offset = 0;
 421       switch (patch_code) {
 422       case lir_patch_low:         field_offset = lo_word_offset_in_bytes; break;
 423       case lir_patch_high:        field_offset = hi_word_offset_in_bytes; break;
 424       case lir_patch_normal:      field_offset = 0;                       break;
 425       default: ShouldNotReachHere();
 426       }
 427       NativeMovRegMem* n_move = nativeMovRegMem_at(pc_start());
 428       n_move->set_offset(field_offset);
 429     } else if (_id == load_klass_id || _id == load_mirror_id || _id == load_appendix_id) {
 430       assert(_obj != noreg, "must have register object for load_klass/load_mirror");
 431 #ifdef ASSERT
 432       // verify that we're pointing at a NativeMovConstReg
 433       nativeMovConstReg_at(pc_start());
 434 #endif
 435     } else {
 436       ShouldNotReachHere();
 437     }
 438     assert(_bytes_to_copy <= (masm->pc() - pc_start()), "not enough bytes");
 439   }
 440 
 441   address pc_start() const                       { return _pc_start; }
 442   PatchID id() const                             { return _id; }
 443 
 444   virtual void emit_code(LIR_Assembler* e);
 445   virtual CodeEmitInfo* info() const             { return _info; }
 446   virtual void visit(LIR_OpVisitState* visitor) {
 447     visitor->do_slow_case(_info);
 448   }
 449 #ifndef PRODUCT
 450   virtual void print_name(outputStream* out) const { out->print("PatchingStub"); }
 451 #endif // PRODUCT
 452 };
 453 
 454 
 455 //------------------------------------------------------------------------------
 456 // DeoptimizeStub
 457 //
 458 class DeoptimizeStub : public CodeStub {
 459 private:
 460   CodeEmitInfo* _info;
 461 
 462 public:
 463   DeoptimizeStub(CodeEmitInfo* info) : _info(new CodeEmitInfo(info)) {}
 464 
 465   virtual void emit_code(LIR_Assembler* e);
 466   virtual CodeEmitInfo* info() const           { return _info; }
 467   virtual bool is_exception_throw_stub() const { return true; }
 468   virtual void visit(LIR_OpVisitState* visitor) {
 469     visitor->do_slow_case(_info);
 470   }
 471 #ifndef PRODUCT
 472   virtual void print_name(outputStream* out) const { out->print("DeoptimizeStub"); }
 473 #endif // PRODUCT
 474 };
 475 
 476 
 477 class SimpleExceptionStub: public CodeStub {
 478  private:
 479   LIR_Opr          _obj;
 480   Runtime1::StubID _stub;
 481   CodeEmitInfo*    _info;
 482 
 483  public:
 484   SimpleExceptionStub(Runtime1::StubID stub, LIR_Opr obj, CodeEmitInfo* info):
 485     _obj(obj), _info(info), _stub(stub) {
 486   }
 487 
 488   void set_obj(LIR_Opr obj) {
 489     _obj = obj;
 490   }
 491 
 492   virtual void emit_code(LIR_Assembler* e);
 493   virtual CodeEmitInfo* info() const             { return _info; }
 494   virtual bool is_exception_throw_stub() const   { return true; }
 495   virtual void visit(LIR_OpVisitState* visitor) {
 496     if (_obj->is_valid()) visitor->do_input(_obj);
 497     visitor->do_slow_case(_info);
 498   }
 499 #ifndef PRODUCT
 500   virtual void print_name(outputStream* out) const { out->print("SimpleExceptionStub"); }
 501 #endif // PRODUCT
 502 };
 503 
 504 
 505 
 506 class ArrayStoreExceptionStub: public SimpleExceptionStub {
 507  private:
 508   CodeEmitInfo* _info;
 509 
 510  public:
 511   ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
 512 #ifndef PRODUCT
 513   virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
 514 #endif // PRODUCT
 515 };
 516 
 517 
 518 class ArrayCopyStub: public CodeStub {
 519  private:
 520   LIR_OpArrayCopy* _op;
 521 
 522  public:
 523   ArrayCopyStub(LIR_OpArrayCopy* op): _op(op) { }
 524 
 525   LIR_Opr src() const                         { return _op->src(); }
 526   LIR_Opr src_pos() const                     { return _op->src_pos(); }
 527   LIR_Opr dst() const                         { return _op->dst(); }
 528   LIR_Opr dst_pos() const                     { return _op->dst_pos(); }
 529   LIR_Opr length() const                      { return _op->length(); }
 530   LIR_Opr tmp() const                         { return _op->tmp(); }
 531 
 532   virtual void emit_code(LIR_Assembler* e);
 533   virtual CodeEmitInfo* info() const          { return _op->info(); }
 534   virtual void visit(LIR_OpVisitState* visitor) {
 535     // don't pass in the code emit info since it's processed in the fast path
 536     visitor->do_slow_case();
 537   }
 538 #ifndef PRODUCT
 539   virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); }
 540 #endif // PRODUCT
 541 };
 542 
 543 //////////////////////////////////////////////////////////////////////////////////////////
 544 #if INCLUDE_ALL_GCS
 545 
 546 // Code stubs for Garbage-First barriers.
 547 class G1PreBarrierStub: public CodeStub {
 548  private:
 549   bool _do_load;
 550   LIR_Opr _addr;
 551   LIR_Opr _pre_val;
 552   LIR_PatchCode _patch_code;
 553   CodeEmitInfo* _info;
 554 
 555  public:
 556   // Version that _does_ generate a load of the previous value from addr.
 557   // addr (the address of the field to be read) must be a LIR_Address
 558   // pre_val (a temporary register) must be a register;
 559   G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) :
 560     _addr(addr), _pre_val(pre_val), _do_load(true),
 561     _patch_code(patch_code), _info(info)
 562   {
 563     assert(_pre_val->is_register(), "should be temporary register");
 564     assert(_addr->is_address(), "should be the address of the field");
 565   }
 566 
 567   // Version that _does not_ generate load of the previous value; the
 568   // previous value is assumed to have already been loaded into pre_val.
 569   G1PreBarrierStub(LIR_Opr pre_val) :
 570     _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false),
 571     _patch_code(lir_patch_none), _info(NULL)
 572   {
 573     assert(_pre_val->is_register(), "should be a register");
 574   }
 575 
 576   LIR_Opr addr() const { return _addr; }
 577   LIR_Opr pre_val() const { return _pre_val; }
 578   LIR_PatchCode patch_code() const { return _patch_code; }
 579   CodeEmitInfo* info() const { return _info; }
 580   bool do_load() const { return _do_load; }
 581 
 582   virtual void emit_code(LIR_Assembler* e);
 583   virtual void visit(LIR_OpVisitState* visitor) {
 584     if (_do_load) {
 585       // don't pass in the code emit info since it's processed in the fast
 586       // path
 587       if (_info != NULL)
 588         visitor->do_slow_case(_info);
 589       else
 590         visitor->do_slow_case();
 591 
 592       visitor->do_input(_addr);
 593       visitor->do_temp(_pre_val);
 594     } else {
 595       visitor->do_slow_case();
 596       visitor->do_input(_pre_val);
 597     }
 598   }
 599 #ifndef PRODUCT
 600   virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); }
 601 #endif // PRODUCT
 602 };
 603 
 604 class G1PostBarrierStub: public CodeStub {
 605  private:
 606   LIR_Opr _addr;
 607   LIR_Opr _new_val;
 608 
 609   static jbyte* _byte_map_base;
 610   static jbyte* byte_map_base_slow();
 611   static jbyte* byte_map_base() {
 612     if (_byte_map_base == NULL) {
 613       _byte_map_base = byte_map_base_slow();
 614     }
 615     return _byte_map_base;
 616   }
 617 
 618  public:
 619   // addr (the address of the object head) and new_val must be registers.
 620   G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { }
 621 
 622   LIR_Opr addr() const { return _addr; }
 623   LIR_Opr new_val() const { return _new_val; }
 624 
 625   virtual void emit_code(LIR_Assembler* e);
 626   virtual void visit(LIR_OpVisitState* visitor) {
 627     // don't pass in the code emit info since it's processed in the fast path
 628     visitor->do_slow_case();
 629     visitor->do_input(_addr);
 630     visitor->do_input(_new_val);
 631   }
 632 #ifndef PRODUCT
 633   virtual void print_name(outputStream* out) const { out->print("G1PostBarrierStub"); }
 634 #endif // PRODUCT
 635 };
 636 
 637 #endif // INCLUDE_ALL_GCS
 638 //////////////////////////////////////////////////////////////////////////////////////////
 639 
 640 #endif // SHARE_VM_C1_C1_CODESTUBS_HPP