src/hotspot/share/opto/runtime.cpp
changeset 48961 120b61d50f85
parent 47634 6a0c42c40cd1
child 49347 edb65305d3ac
--- a/src/hotspot/share/opto/runtime.cpp	Mon Feb 12 16:08:33 2018 -0800
+++ b/src/hotspot/share/opto/runtime.cpp	Wed Jan 10 22:48:27 2018 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,23 +194,6 @@
 // We failed the fast-path allocation.  Now we need to do a scavenge or GC
 // and try allocation again.
 
-void OptoRuntime::new_store_pre_barrier(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.
-  // NOTE: Keep this code consistent with GraphKit::store_barrier.
-
-  oop new_obj = thread->vm_result();
-  if (new_obj == NULL)  return;
-
-  assert(Universe::heap()->can_elide_tlab_store_barriers(),
-         "compiler must check this first");
-  // GC may decide to give back a safer copy of new_obj.
-  new_obj = Universe::heap()->new_store_pre_barrier(thread, new_obj);
-  thread->set_vm_result(new_obj);
-}
-
 // object allocation
 JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thread))
   JRT_BLOCK;
@@ -244,10 +227,8 @@
   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
   JRT_BLOCK_END;
 
-  if (GraphKit::use_ReduceInitialCardMarks()) {
-    // inform GC that we won't do card marks for initializing writes.
-    new_store_pre_barrier(thread);
-  }
+  // inform GC that we won't do card marks for initializing writes.
+  SharedRuntime::on_slowpath_allocation_exit(thread);
 JRT_END
 
 
@@ -284,10 +265,8 @@
   thread->set_vm_result(result);
   JRT_BLOCK_END;
 
-  if (GraphKit::use_ReduceInitialCardMarks()) {
-    // inform GC that we won't do card marks for initializing writes.
-    new_store_pre_barrier(thread);
-  }
+  // inform GC that we won't do card marks for initializing writes.
+  SharedRuntime::on_slowpath_allocation_exit(thread);
 JRT_END
 
 // array allocation without zeroing
@@ -314,10 +293,9 @@
   thread->set_vm_result(result);
   JRT_BLOCK_END;
 
-  if (GraphKit::use_ReduceInitialCardMarks()) {
-    // inform GC that we won't do card marks for initializing writes.
-    new_store_pre_barrier(thread);
-  }
+
+  // inform GC that we won't do card marks for initializing writes.
+  SharedRuntime::on_slowpath_allocation_exit(thread);
 
   oop result = thread->vm_result();
   if ((len > 0) && (result != NULL) &&