--- old/src/share/vm/runtime/sharedRuntime.cpp 2017-04-25 16:45:52.875172480 +0200 +++ new/src/share/vm/runtime/sharedRuntime.cpp 2017-04-25 16:45:52.731172485 +0200 @@ -200,27 +200,6 @@ } #endif // PRODUCT -#if INCLUDE_ALL_GCS - -// G1 write-barrier pre: executed before a pointer store. -JRT_LEAF(void, SharedRuntime::g1_wb_pre(oopDesc* orig, JavaThread *thread)) - if (orig == NULL) { - assert(false, "should be optimized out"); - return; - } - assert(orig->is_oop(true /* ignore mark word */), "Error"); - // store the original value that was in the field reference - thread->satb_mark_queue().enqueue(orig); -JRT_END - -// G1 write-barrier post: executed after a pointer store. -JRT_LEAF(void, SharedRuntime::g1_wb_post(void* card_addr, JavaThread* thread)) - thread->dirty_card_queue().enqueue(card_addr); -JRT_END - -#endif // INCLUDE_ALL_GCS - - JRT_LEAF(jlong, SharedRuntime::lmul(jlong y, jlong x)) return x * y; JRT_END @@ -3168,3 +3147,17 @@ return activation; } +void SharedRuntime::on_slowpath_allocation(JavaThread* thread) { + // After any safepoint, just before going back to compiled code, + // we inform the GC that we will be doing initializing writes to + // this object in the future without emitting card-marks, so + // GC may take any compensating steps. + + oop new_obj = thread->vm_result(); + if (new_obj == NULL) return; + + BarrierSet *bs = Universe::heap()->barrier_set(); + // GC may decide to give back a safer copy of new_obj. + bs->on_slowpath_allocation(thread, new_obj); + thread->set_vm_result(new_obj); +}