< prev index next >

src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp

Print this page
rev 55608 : Rename ShenandoahBrooksPointer to ShenandoahForwarding
rev 55609 : Eliminate extra forwarding pointer per object


   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 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 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "gc/shared/barrierSet.hpp"
  26 #include "gc/shenandoah/shenandoahForwarding.hpp"
  27 #include "gc/shenandoah/shenandoahHeap.hpp"
  28 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  29 #include "gc/shenandoah/shenandoahRuntime.hpp"
  30 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  31 #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
  32 #include "gc/shenandoah/c2/shenandoahSupport.hpp"
  33 #include "opto/arraycopynode.hpp"
  34 #include "opto/escape.hpp"
  35 #include "opto/graphKit.hpp"
  36 #include "opto/idealKit.hpp"
  37 #include "opto/macro.hpp"
  38 #include "opto/movenode.hpp"
  39 #include "opto/narrowptrnode.hpp"
  40 #include "opto/rootnode.hpp"
  41 
  42 ShenandoahBarrierSetC2* ShenandoahBarrierSetC2::bsc2() {
  43   return reinterpret_cast<ShenandoahBarrierSetC2*>(BarrierSet::barrier_set()->barrier_set_c2());
  44 }
  45 
  46 ShenandoahBarrierSetC2State::ShenandoahBarrierSetC2State(Arena* comp_arena)


 691 }
 692 
 693 Node* ShenandoahBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& access, Node* val, const Type* value_type) const {
 694   GraphKit* kit = access.kit();
 695   if (access.is_oop()) {
 696     val = shenandoah_storeval_barrier(kit, val);
 697   }
 698   Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, val, value_type);
 699   if (access.is_oop()) {
 700     result = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, result));
 701     shenandoah_write_barrier_pre(kit, false /* do_load */,
 702                                  NULL, NULL, max_juint, NULL, NULL,
 703                                  result /* pre_val */, T_OBJECT);
 704   }
 705   return result;
 706 }
 707 
 708 void ShenandoahBarrierSetC2::clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const {
 709   assert(!src->is_AddP(), "unexpected input");
 710   BarrierSetC2::clone(kit, src, dst, size, is_array);
 711 }
 712 
 713 Node* ShenandoahBarrierSetC2::obj_allocate(PhaseMacroExpand* macro, Node* ctrl, Node* mem, Node* toobig_false, Node* size_in_bytes,
 714                                            Node*& i_o, Node*& needgc_ctrl,
 715                                            Node*& fast_oop_ctrl, Node*& fast_oop_rawmem,
 716                                            intx prefetch_lines) const {
 717   PhaseIterGVN& igvn = macro->igvn();
 718 
 719   // Allocate several words more for the Shenandoah brooks pointer.
 720   size_in_bytes = new AddXNode(size_in_bytes, igvn.MakeConX(ShenandoahForwarding::byte_size()));
 721   macro->transform_later(size_in_bytes);
 722 
 723   Node* fast_oop = BarrierSetC2::obj_allocate(macro, ctrl, mem, toobig_false, size_in_bytes,
 724                                               i_o, needgc_ctrl, fast_oop_ctrl, fast_oop_rawmem,
 725                                               prefetch_lines);
 726 
 727   // Bump up object for Shenandoah brooks pointer.
 728   fast_oop = new AddPNode(macro->top(), fast_oop, igvn.MakeConX(ShenandoahForwarding::byte_size()));
 729   macro->transform_later(fast_oop);
 730 
 731   // Initialize Shenandoah brooks pointer to point to the object itself.
 732   fast_oop_rawmem = macro->make_store(fast_oop_ctrl, fast_oop_rawmem, fast_oop, ShenandoahForwarding::byte_offset(), fast_oop, T_OBJECT);
 733 
 734   return fast_oop;
 735 }
 736 
 737 // Support for GC barriers emitted during parsing
 738 bool ShenandoahBarrierSetC2::is_gc_barrier_node(Node* node) const {
 739   if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) return true;
 740   if (node->Opcode() != Op_CallLeaf && node->Opcode() != Op_CallLeafNoFP) {
 741     return false;
 742   }
 743   CallLeafNode *call = node->as_CallLeaf();
 744   if (call->_name == NULL) {
 745     return false;
 746   }
 747 
 748   return strcmp(call->_name, "shenandoah_clone_barrier") == 0 ||
 749          strcmp(call->_name, "shenandoah_cas_obj") == 0 ||
 750          strcmp(call->_name, "shenandoah_wb_pre") == 0;
 751 }
 752 
 753 Node* ShenandoahBarrierSetC2::step_over_gc_barrier(Node* c) const {
 754   if (c->Opcode() == Op_ShenandoahLoadReferenceBarrier) {




   6  * published by the Free Software Foundation.
   7  *
   8  * This code is distributed in the hope that it will be useful, but WITHOUT
   9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  11  * version 2 for more details (a copy is included in the LICENSE file that
  12  * accompanied this code).
  13  *
  14  * You should have received a copy of the GNU General Public License version
  15  * 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 USA
  19  * or visit www.oracle.com if you need additional information or have any
  20  * questions.
  21  *
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "gc/shared/barrierSet.hpp"

  26 #include "gc/shenandoah/shenandoahHeap.hpp"
  27 #include "gc/shenandoah/shenandoahHeuristics.hpp"
  28 #include "gc/shenandoah/shenandoahRuntime.hpp"
  29 #include "gc/shenandoah/shenandoahThreadLocalData.hpp"
  30 #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp"
  31 #include "gc/shenandoah/c2/shenandoahSupport.hpp"
  32 #include "opto/arraycopynode.hpp"
  33 #include "opto/escape.hpp"
  34 #include "opto/graphKit.hpp"
  35 #include "opto/idealKit.hpp"
  36 #include "opto/macro.hpp"
  37 #include "opto/movenode.hpp"
  38 #include "opto/narrowptrnode.hpp"
  39 #include "opto/rootnode.hpp"
  40 
  41 ShenandoahBarrierSetC2* ShenandoahBarrierSetC2::bsc2() {
  42   return reinterpret_cast<ShenandoahBarrierSetC2*>(BarrierSet::barrier_set()->barrier_set_c2());
  43 }
  44 
  45 ShenandoahBarrierSetC2State::ShenandoahBarrierSetC2State(Arena* comp_arena)


 690 }
 691 
 692 Node* ShenandoahBarrierSetC2::atomic_xchg_at_resolved(C2AtomicParseAccess& access, Node* val, const Type* value_type) const {
 693   GraphKit* kit = access.kit();
 694   if (access.is_oop()) {
 695     val = shenandoah_storeval_barrier(kit, val);
 696   }
 697   Node* result = BarrierSetC2::atomic_xchg_at_resolved(access, val, value_type);
 698   if (access.is_oop()) {
 699     result = kit->gvn().transform(new ShenandoahLoadReferenceBarrierNode(NULL, result));
 700     shenandoah_write_barrier_pre(kit, false /* do_load */,
 701                                  NULL, NULL, max_juint, NULL, NULL,
 702                                  result /* pre_val */, T_OBJECT);
 703   }
 704   return result;
 705 }
 706 
 707 void ShenandoahBarrierSetC2::clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const {
 708   assert(!src->is_AddP(), "unexpected input");
 709   BarrierSetC2::clone(kit, src, dst, size, is_array);
























 710 }
 711 
 712 // Support for GC barriers emitted during parsing
 713 bool ShenandoahBarrierSetC2::is_gc_barrier_node(Node* node) const {
 714   if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) return true;
 715   if (node->Opcode() != Op_CallLeaf && node->Opcode() != Op_CallLeafNoFP) {
 716     return false;
 717   }
 718   CallLeafNode *call = node->as_CallLeaf();
 719   if (call->_name == NULL) {
 720     return false;
 721   }
 722 
 723   return strcmp(call->_name, "shenandoah_clone_barrier") == 0 ||
 724          strcmp(call->_name, "shenandoah_cas_obj") == 0 ||
 725          strcmp(call->_name, "shenandoah_wb_pre") == 0;
 726 }
 727 
 728 Node* ShenandoahBarrierSetC2::step_over_gc_barrier(Node* c) const {
 729   if (c->Opcode() == Op_ShenandoahLoadReferenceBarrier) {


< prev index next >