src/share/vm/c1/c1_CodeStubs.hpp

Tue, 09 Mar 2010 20:16:19 +0100

author
twisti
date
Tue, 09 Mar 2010 20:16:19 +0100
changeset 1730
3cf667df43ef
parent 777
37f87013dfd8
child 1907
c18cbe5936b8
permissions
-rw-r--r--

6919934: JSR 292 needs to support x86 C1
Summary: This implements JSR 292 support for C1 x86.
Reviewed-by: never, jrose, kvn

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

mercurial