--- old/src/share/vm/opto/macro.cpp 2015-10-14 13:54:22.009701079 +0200 +++ new/src/share/vm/opto/macro.cpp 2015-10-14 13:54:21.897703787 +0200 @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "compiler/compileLog.hpp" +#include "gc/shenandoah/brooksPointer.hpp" #include "libadt/vectset.hpp" #include "opto/addnode.hpp" #include "opto/arraycopynode.hpp" @@ -42,6 +43,7 @@ #include "opto/phaseX.hpp" #include "opto/rootnode.hpp" #include "opto/runtime.hpp" +#include "opto/shenandoahSupport.hpp" #include "opto/subnode.hpp" #include "opto/type.hpp" #include "runtime/sharedRuntime.hpp" @@ -933,6 +935,9 @@ field_val = transform_later(new DecodeNNode(field_val, field_val->get_ptr_type())); } } + if (field_val->isa_ShenandoahBarrier()) { + field_val = field_val->in(ShenandoahBarrierNode::ValueIn); + } sfpt->add_req(field_val); } JVMState *jvms = sfpt->jvms(); @@ -1411,6 +1416,13 @@ transform_later(old_eden_top); // Add to heap top to get a new heap top + + if (UseShenandoahGC) { + // Allocate one word more for the Shenandoah brooks pointer. + size_in_bytes = new AddLNode(size_in_bytes, _igvn.MakeConX(8)); + transform_later(size_in_bytes); + } + Node *new_eden_top = new AddPNode(top(), old_eden_top, size_in_bytes); transform_later(new_eden_top); // Check for needing a GC; compare against heap end @@ -1501,6 +1513,13 @@ 0, new_alloc_bytes, T_LONG); } + if (UseShenandoahGC) { + // Bump up object by one word. The preceding word is used for + // the Shenandoah brooks pointer. + fast_oop = new AddPNode(top(), fast_oop, _igvn.MakeConX(8)); + transform_later(fast_oop); + } + InitializeNode* init = alloc->initialization(); fast_oop_rawmem = initialize_object(alloc, fast_oop_ctrl, fast_oop_rawmem, fast_oop, @@ -1778,6 +1797,11 @@ header_size = Klass::layout_helper_header_size(k->layout_helper()); } + if (UseShenandoahGC) { + // Initialize Shenandoah brooks pointer to point to the object itself. + rawmem = make_store(control, rawmem, object, BrooksPointer::BYTE_OFFSET, object, T_OBJECT); + } + // Clear the object body, if necessary. if (init == NULL) { // The init has somehow disappeared; be cautious and clear everything.