1 /* |
1 /* |
2 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
531 #ifndef PRODUCT |
531 #ifndef PRODUCT |
532 virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); } |
532 virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); } |
533 #endif // PRODUCT |
533 #endif // PRODUCT |
534 }; |
534 }; |
535 |
535 |
536 ////////////////////////////////////////////////////////////////////////////////////////// |
|
537 #if INCLUDE_ALL_GCS |
|
538 |
|
539 // Code stubs for Garbage-First barriers. |
|
540 class G1PreBarrierStub: public CodeStub { |
|
541 private: |
|
542 bool _do_load; |
|
543 LIR_Opr _addr; |
|
544 LIR_Opr _pre_val; |
|
545 LIR_PatchCode _patch_code; |
|
546 CodeEmitInfo* _info; |
|
547 |
|
548 public: |
|
549 // Version that _does_ generate a load of the previous value from addr. |
|
550 // addr (the address of the field to be read) must be a LIR_Address |
|
551 // pre_val (a temporary register) must be a register; |
|
552 G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) : |
|
553 _addr(addr), _pre_val(pre_val), _do_load(true), |
|
554 _patch_code(patch_code), _info(info) |
|
555 { |
|
556 assert(_pre_val->is_register(), "should be temporary register"); |
|
557 assert(_addr->is_address(), "should be the address of the field"); |
|
558 } |
|
559 |
|
560 // Version that _does not_ generate load of the previous value; the |
|
561 // previous value is assumed to have already been loaded into pre_val. |
|
562 G1PreBarrierStub(LIR_Opr pre_val) : |
|
563 _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false), |
|
564 _patch_code(lir_patch_none), _info(NULL) |
|
565 { |
|
566 assert(_pre_val->is_register(), "should be a register"); |
|
567 } |
|
568 |
|
569 LIR_Opr addr() const { return _addr; } |
|
570 LIR_Opr pre_val() const { return _pre_val; } |
|
571 LIR_PatchCode patch_code() const { return _patch_code; } |
|
572 CodeEmitInfo* info() const { return _info; } |
|
573 bool do_load() const { return _do_load; } |
|
574 |
|
575 virtual void emit_code(LIR_Assembler* e); |
|
576 virtual void visit(LIR_OpVisitState* visitor) { |
|
577 if (_do_load) { |
|
578 // don't pass in the code emit info since it's processed in the fast |
|
579 // path |
|
580 if (_info != NULL) |
|
581 visitor->do_slow_case(_info); |
|
582 else |
|
583 visitor->do_slow_case(); |
|
584 |
|
585 visitor->do_input(_addr); |
|
586 visitor->do_temp(_pre_val); |
|
587 } else { |
|
588 visitor->do_slow_case(); |
|
589 visitor->do_input(_pre_val); |
|
590 } |
|
591 } |
|
592 #ifndef PRODUCT |
|
593 virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); } |
|
594 #endif // PRODUCT |
|
595 }; |
|
596 |
|
597 class G1PostBarrierStub: public CodeStub { |
|
598 private: |
|
599 LIR_Opr _addr; |
|
600 LIR_Opr _new_val; |
|
601 |
|
602 public: |
|
603 // addr (the address of the object head) and new_val must be registers. |
|
604 G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { } |
|
605 |
|
606 LIR_Opr addr() const { return _addr; } |
|
607 LIR_Opr new_val() const { return _new_val; } |
|
608 |
|
609 virtual void emit_code(LIR_Assembler* e); |
|
610 virtual void visit(LIR_OpVisitState* visitor) { |
|
611 // don't pass in the code emit info since it's processed in the fast path |
|
612 visitor->do_slow_case(); |
|
613 visitor->do_input(_addr); |
|
614 visitor->do_input(_new_val); |
|
615 } |
|
616 #ifndef PRODUCT |
|
617 virtual void print_name(outputStream* out) const { out->print("G1PostBarrierStub"); } |
|
618 #endif // PRODUCT |
|
619 }; |
|
620 |
|
621 #endif // INCLUDE_ALL_GCS |
|
622 ////////////////////////////////////////////////////////////////////////////////////////// |
|
623 |
|
624 #endif // SHARE_VM_C1_C1_CODESTUBS_HPP |
536 #endif // SHARE_VM_C1_C1_CODESTUBS_HPP |