8198424: Remove G1AllocationContext
authorsjohanss
Fri, 02 Mar 2018 10:09:08 +0100
changeset 49323 565336327354
parent 49322 38933ade5bf5
child 49324 e6fbaf07192f
8198424: Remove G1AllocationContext Reviewed-by: ehelin, tschatzl
src/hotspot/share/gc/g1/g1AllocRegion.cpp
src/hotspot/share/gc/g1/g1AllocRegion.hpp
src/hotspot/share/gc/g1/g1AllocationContext.hpp
src/hotspot/share/gc/g1/g1Allocator.cpp
src/hotspot/share/gc/g1/g1Allocator.hpp
src/hotspot/share/gc/g1/g1Allocator.inline.hpp
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
src/hotspot/share/gc/g1/g1CollectedHeap.hpp
src/hotspot/share/gc/g1/g1ParScanThreadState.cpp
src/hotspot/share/gc/g1/g1ParScanThreadState.hpp
src/hotspot/share/gc/g1/heapRegion.cpp
src/hotspot/share/gc/g1/heapRegion.hpp
src/hotspot/share/gc/g1/heapRegionTracer.cpp
src/hotspot/share/gc/g1/heapRegionTracer.hpp
src/hotspot/share/gc/g1/vm_operations_g1.cpp
src/hotspot/share/gc/g1/vm_operations_g1.hpp
src/hotspot/share/runtime/vm_operations.hpp
src/hotspot/share/trace/traceevents.xml
--- a/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -183,7 +183,6 @@
   assert_alloc_region(alloc_region != NULL && !alloc_region->is_empty(), "pre-condition");
 
   _alloc_region = alloc_region;
-  _alloc_region->set_allocation_context(allocation_context());
   _count += 1;
   trace("updated");
 }
@@ -246,8 +245,7 @@
 G1AllocRegion::G1AllocRegion(const char* name,
                              bool bot_updates)
   : _name(name), _bot_updates(bot_updates),
-    _alloc_region(NULL), _count(0), _used_bytes_before(0),
-    _allocation_context(AllocationContext::system()) { }
+    _alloc_region(NULL), _count(0), _used_bytes_before(0) { }
 
 
 HeapRegion* MutatorAllocRegion::allocate_new_region(size_t word_size,
--- a/src/hotspot/share/gc/g1/g1AllocRegion.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -53,9 +53,6 @@
   // correct use of init() and release()).
   HeapRegion* volatile _alloc_region;
 
-  // Allocation context associated with this alloc region.
-  AllocationContext_t _allocation_context;
-
   // It keeps track of the distinct number of regions that are used
   // for allocation in the active interval of this object, i.e.,
   // between a call to init() and a call to release(). The count
@@ -140,9 +137,6 @@
     return (hr == _dummy_region) ? NULL : hr;
   }
 
-  void set_allocation_context(AllocationContext_t context) { _allocation_context = context; }
-  AllocationContext_t  allocation_context() { return _allocation_context; }
-
   uint count() { return _count; }
 
   // The following two are the building blocks for the allocation method.
--- a/src/hotspot/share/gc/g1/g1AllocationContext.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2014, 2015, 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_VM_GC_G1_G1ALLOCATIONCONTEXT_HPP
-#define SHARE_VM_GC_G1_G1ALLOCATIONCONTEXT_HPP
-
-#include "memory/allocation.hpp"
-
-typedef unsigned char AllocationContext_t;
-
-class AllocationContext : AllStatic {
-public:
-  // Currently used context
-  static AllocationContext_t current() {
-    return 0;
-  }
-  // System wide default context
-  static AllocationContext_t system() {
-    return 0;
-  }
-};
-
-#endif // SHARE_VM_GC_G1_G1ALLOCATIONCONTEXT_HPP
--- a/src/hotspot/share/gc/g1/g1Allocator.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -100,41 +100,40 @@
 }
 
 void G1DefaultAllocator::release_gc_alloc_regions(EvacuationInfo& evacuation_info) {
-  AllocationContext_t context = AllocationContext::current();
-  evacuation_info.set_allocation_regions(survivor_gc_alloc_region(context)->count() +
-                                         old_gc_alloc_region(context)->count());
-  survivor_gc_alloc_region(context)->release();
+  evacuation_info.set_allocation_regions(survivor_gc_alloc_region()->count() +
+                                         old_gc_alloc_region()->count());
+  survivor_gc_alloc_region()->release();
   // If we have an old GC alloc region to release, we'll save it in
   // _retained_old_gc_alloc_region. If we don't
   // _retained_old_gc_alloc_region will become NULL. This is what we
   // want either way so no reason to check explicitly for either
   // condition.
-  _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release();
+  _retained_old_gc_alloc_region = old_gc_alloc_region()->release();
 }
 
 void G1DefaultAllocator::abandon_gc_alloc_regions() {
-  assert(survivor_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition");
-  assert(old_gc_alloc_region(AllocationContext::current())->get() == NULL, "pre-condition");
+  assert(survivor_gc_alloc_region()->get() == NULL, "pre-condition");
+  assert(old_gc_alloc_region()->get() == NULL, "pre-condition");
   _retained_old_gc_alloc_region = NULL;
 }
 
-bool G1DefaultAllocator::survivor_is_full(AllocationContext_t context) const {
+bool G1DefaultAllocator::survivor_is_full() const {
   return _survivor_is_full;
 }
 
-bool G1DefaultAllocator::old_is_full(AllocationContext_t context) const {
+bool G1DefaultAllocator::old_is_full() const {
   return _old_is_full;
 }
 
-void G1DefaultAllocator::set_survivor_full(AllocationContext_t context) {
+void G1DefaultAllocator::set_survivor_full() {
   _survivor_is_full = true;
 }
 
-void G1DefaultAllocator::set_old_full(AllocationContext_t context) {
+void G1DefaultAllocator::set_old_full() {
   _old_is_full = true;
 }
 
-size_t G1Allocator::unsafe_max_tlab_alloc(AllocationContext_t context) {
+size_t G1Allocator::unsafe_max_tlab_alloc() {
   // Return the remaining space in the cur alloc region, but not less than
   // the min TLAB size.
 
@@ -142,7 +141,7 @@
   // since we can't allow tlabs to grow big enough to accommodate
   // humongous objects.
 
-  HeapRegion* hr = mutator_alloc_region(context)->get();
+  HeapRegion* hr = mutator_alloc_region()->get();
   size_t max_tlab = _g1h->max_tlab_size() * wordSize;
   if (hr == NULL) {
     return max_tlab;
@@ -152,10 +151,9 @@
 }
 
 HeapWord* G1Allocator::par_allocate_during_gc(InCSetState dest,
-                                              size_t word_size,
-                                              AllocationContext_t context) {
+                                              size_t word_size) {
   size_t temp = 0;
-  HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, context);
+  HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp);
   assert(result == NULL || temp == word_size,
          "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,
          word_size, temp, p2i(result));
@@ -165,13 +163,12 @@
 HeapWord* G1Allocator::par_allocate_during_gc(InCSetState dest,
                                               size_t min_word_size,
                                               size_t desired_word_size,
-                                              size_t* actual_word_size,
-                                              AllocationContext_t context) {
+                                              size_t* actual_word_size) {
   switch (dest.value()) {
     case InCSetState::Young:
-      return survivor_attempt_allocation(min_word_size, desired_word_size, actual_word_size, context);
+      return survivor_attempt_allocation(min_word_size, desired_word_size, actual_word_size);
     case InCSetState::Old:
-      return old_attempt_allocation(min_word_size, desired_word_size, actual_word_size, context);
+      return old_attempt_allocation(min_word_size, desired_word_size, actual_word_size);
     default:
       ShouldNotReachHere();
       return NULL; // Keep some compilers happy
@@ -180,21 +177,20 @@
 
 HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size,
                                                    size_t desired_word_size,
-                                                   size_t* actual_word_size,
-                                                   AllocationContext_t context) {
+                                                   size_t* actual_word_size) {
   assert(!_g1h->is_humongous(desired_word_size),
          "we should not be seeing humongous-size allocations in this path");
 
-  HeapWord* result = survivor_gc_alloc_region(context)->attempt_allocation(min_word_size,
-                                                                           desired_word_size,
-                                                                           actual_word_size);
-  if (result == NULL && !survivor_is_full(context)) {
+  HeapWord* result = survivor_gc_alloc_region()->attempt_allocation(min_word_size,
+                                                                    desired_word_size,
+                                                                    actual_word_size);
+  if (result == NULL && !survivor_is_full()) {
     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
-    result = survivor_gc_alloc_region(context)->attempt_allocation_locked(min_word_size,
-                                                                          desired_word_size,
-                                                                          actual_word_size);
+    result = survivor_gc_alloc_region()->attempt_allocation_locked(min_word_size,
+                                                                   desired_word_size,
+                                                                   actual_word_size);
     if (result == NULL) {
-      set_survivor_full(context);
+      set_survivor_full();
     }
   }
   if (result != NULL) {
@@ -205,21 +201,20 @@
 
 HeapWord* G1Allocator::old_attempt_allocation(size_t min_word_size,
                                               size_t desired_word_size,
-                                              size_t* actual_word_size,
-                                              AllocationContext_t context) {
+                                              size_t* actual_word_size) {
   assert(!_g1h->is_humongous(desired_word_size),
          "we should not be seeing humongous-size allocations in this path");
 
-  HeapWord* result = old_gc_alloc_region(context)->attempt_allocation(min_word_size,
-                                                                      desired_word_size,
-                                                                      actual_word_size);
-  if (result == NULL && !old_is_full(context)) {
+  HeapWord* result = old_gc_alloc_region()->attempt_allocation(min_word_size,
+                                                               desired_word_size,
+                                                               actual_word_size);
+  if (result == NULL && !old_is_full()) {
     MutexLockerEx x(FreeList_lock, Mutex::_no_safepoint_check_flag);
-    result = old_gc_alloc_region(context)->attempt_allocation_locked(min_word_size,
-                                                                     desired_word_size,
-                                                                     actual_word_size);
+    result = old_gc_alloc_region()->attempt_allocation_locked(min_word_size,
+                                                              desired_word_size,
+                                                              actual_word_size);
     if (result == NULL) {
-      set_old_full(context);
+      set_old_full();
     }
   }
   return result;
@@ -240,7 +235,6 @@
 
 HeapWord* G1PLABAllocator::allocate_direct_or_new_plab(InCSetState dest,
                                                        size_t word_sz,
-                                                       AllocationContext_t context,
                                                        bool* plab_refill_failed) {
   size_t plab_word_size = G1CollectedHeap::heap()->desired_plab_sz(dest);
   size_t required_in_plab = PLAB::size_required_for_allocation(word_sz);
@@ -250,15 +244,14 @@
   if ((required_in_plab <= plab_word_size) &&
     may_throw_away_buffer(required_in_plab, plab_word_size)) {
 
-    PLAB* alloc_buf = alloc_buffer(dest, context);
+    PLAB* alloc_buf = alloc_buffer(dest);
     alloc_buf->retire();
 
     size_t actual_plab_size = 0;
     HeapWord* buf = _allocator->par_allocate_during_gc(dest,
                                                        required_in_plab,
                                                        plab_word_size,
-                                                       &actual_plab_size,
-                                                       context);
+                                                       &actual_plab_size);
 
     assert(buf == NULL || ((actual_plab_size >= required_in_plab) && (actual_plab_size <= plab_word_size)),
            "Requested at minimum " SIZE_FORMAT ", desired " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT,
@@ -277,15 +270,15 @@
     *plab_refill_failed = true;
   }
   // Try direct allocation.
-  HeapWord* result = _allocator->par_allocate_during_gc(dest, word_sz, context);
+  HeapWord* result = _allocator->par_allocate_during_gc(dest, word_sz);
   if (result != NULL) {
     _direct_allocated[dest.value()] += word_sz;
   }
   return result;
 }
 
-void G1PLABAllocator::undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz, AllocationContext_t context) {
-  alloc_buffer(dest, context)->undo_allocation(obj, word_sz);
+void G1PLABAllocator::undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz) {
+  alloc_buffer(dest)->undo_allocation(obj, word_sz);
 }
 
 G1DefaultPLABAllocator::G1DefaultPLABAllocator(G1Allocator* allocator) :
--- a/src/hotspot/share/gc/g1/g1Allocator.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -26,7 +26,6 @@
 #define SHARE_VM_GC_G1_G1ALLOCATOR_HPP
 
 #include "gc/g1/g1AllocRegion.hpp"
-#include "gc/g1/g1AllocationContext.hpp"
 #include "gc/g1/g1InCSetState.hpp"
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/plab.hpp"
@@ -41,35 +40,33 @@
 protected:
   G1CollectedHeap* _g1h;
 
-  virtual MutatorAllocRegion* mutator_alloc_region(AllocationContext_t context) = 0;
+  virtual MutatorAllocRegion* mutator_alloc_region() = 0;
 
-  virtual bool survivor_is_full(AllocationContext_t context) const = 0;
-  virtual bool old_is_full(AllocationContext_t context) const = 0;
+  virtual bool survivor_is_full() const = 0;
+  virtual bool old_is_full() const = 0;
 
-  virtual void set_survivor_full(AllocationContext_t context) = 0;
-  virtual void set_old_full(AllocationContext_t context) = 0;
+  virtual void set_survivor_full() = 0;
+  virtual void set_old_full() = 0;
 
   // Accessors to the allocation regions.
-  virtual SurvivorGCAllocRegion* survivor_gc_alloc_region(AllocationContext_t context) = 0;
-  virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) = 0;
+  virtual SurvivorGCAllocRegion* survivor_gc_alloc_region() = 0;
+  virtual OldGCAllocRegion* old_gc_alloc_region() = 0;
 
   // Allocation attempt during GC for a survivor object / PLAB.
   inline HeapWord* survivor_attempt_allocation(size_t min_word_size,
                                                size_t desired_word_size,
-                                               size_t* actual_word_size,
-                                               AllocationContext_t context);
+                                               size_t* actual_word_size);
   // Allocation attempt during GC for an old object / PLAB.
   inline HeapWord* old_attempt_allocation(size_t min_word_size,
                                           size_t desired_word_size,
-                                          size_t* actual_word_size,
-                                          AllocationContext_t context);
+                                          size_t* actual_word_size);
 public:
   G1Allocator(G1CollectedHeap* heap) : _g1h(heap) { }
   virtual ~G1Allocator() { }
 
 #ifdef ASSERT
   // Do we currently have an active mutator region to allocate into?
-  bool has_mutator_alloc_region(AllocationContext_t context) { return mutator_alloc_region(context)->get() != NULL; }
+  bool has_mutator_alloc_region() { return mutator_alloc_region()->get() != NULL; }
 #endif
   virtual void init_mutator_alloc_region() = 0;
   virtual void release_mutator_alloc_region() = 0;
@@ -87,25 +84,23 @@
 
   // Allocate blocks of memory during mutator time.
 
-  inline HeapWord* attempt_allocation(size_t word_size, AllocationContext_t context);
-  inline HeapWord* attempt_allocation_locked(size_t word_size, AllocationContext_t context);
-  inline HeapWord* attempt_allocation_force(size_t word_size, AllocationContext_t context);
+  inline HeapWord* attempt_allocation(size_t word_size);
+  inline HeapWord* attempt_allocation_locked(size_t word_size);
+  inline HeapWord* attempt_allocation_force(size_t word_size);
 
-  size_t unsafe_max_tlab_alloc(AllocationContext_t context);
+  size_t unsafe_max_tlab_alloc();
 
   // Allocate blocks of memory during garbage collection. Will ensure an
   // allocation region, either by picking one or expanding the
   // heap, and then allocate a block of the given size. The block
   // may not be a humongous - it must fit into a single heap region.
   HeapWord* par_allocate_during_gc(InCSetState dest,
-                                   size_t word_size,
-                                   AllocationContext_t context);
+                                   size_t word_size);
 
   HeapWord* par_allocate_during_gc(InCSetState dest,
                                    size_t min_word_size,
                                    size_t desired_word_size,
-                                   size_t* actual_word_size,
-                                   AllocationContext_t context);
+                                   size_t* actual_word_size);
 
   virtual size_t used_in_alloc_regions() = 0;
 };
@@ -133,11 +128,11 @@
 public:
   G1DefaultAllocator(G1CollectedHeap* heap);
 
-  virtual bool survivor_is_full(AllocationContext_t context) const;
-  virtual bool old_is_full(AllocationContext_t context) const ;
+  virtual bool survivor_is_full() const;
+  virtual bool old_is_full() const ;
 
-  virtual void set_survivor_full(AllocationContext_t context);
-  virtual void set_old_full(AllocationContext_t context);
+  virtual void set_survivor_full();
+  virtual void set_old_full();
 
   virtual void init_mutator_alloc_region();
   virtual void release_mutator_alloc_region();
@@ -150,15 +145,15 @@
     return _retained_old_gc_alloc_region == hr;
   }
 
-  virtual MutatorAllocRegion* mutator_alloc_region(AllocationContext_t context) {
+  virtual MutatorAllocRegion* mutator_alloc_region() {
     return &_mutator_alloc_region;
   }
 
-  virtual SurvivorGCAllocRegion* survivor_gc_alloc_region(AllocationContext_t context) {
+  virtual SurvivorGCAllocRegion* survivor_gc_alloc_region() {
     return &_survivor_gc_alloc_region;
   }
 
-  virtual OldGCAllocRegion* old_gc_alloc_region(AllocationContext_t context) {
+  virtual OldGCAllocRegion* old_gc_alloc_region() {
     return &_old_gc_alloc_region;
   }
 
@@ -168,7 +163,7 @@
     size_t result = 0;
 
     // Read only once in case it is set to NULL concurrently
-    HeapRegion* hr = mutator_alloc_region(AllocationContext::current())->get();
+    HeapRegion* hr = mutator_alloc_region()->get();
     if (hr != NULL) {
       result += hr->used();
     }
@@ -196,7 +191,7 @@
   size_t _direct_allocated[InCSetState::Num];
 
   virtual void flush_and_retire_stats() = 0;
-  virtual PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) = 0;
+  virtual PLAB* alloc_buffer(InCSetState dest) = 0;
 
   // Calculate the survivor space object alignment in bytes. Returns that or 0 if
   // there are no restrictions on survivor alignment.
@@ -213,8 +208,7 @@
   }
 
   HeapWord* allocate_new_plab(InCSetState dest,
-                              size_t word_sz,
-                              AllocationContext_t context);
+                              size_t word_sz);
 
   bool may_throw_away_buffer(size_t const allocation_word_sz, size_t const buffer_size) const;
 public:
@@ -229,27 +223,24 @@
   // PLAB failed or not.
   HeapWord* allocate_direct_or_new_plab(InCSetState dest,
                                         size_t word_sz,
-                                        AllocationContext_t context,
                                         bool* plab_refill_failed);
 
   // Allocate word_sz words in the PLAB of dest.  Returns the address of the
   // allocated memory, NULL if not successful.
   inline HeapWord* plab_allocate(InCSetState dest,
-                                 size_t word_sz,
-                                 AllocationContext_t context);
+                                 size_t word_sz);
 
   HeapWord* allocate(InCSetState dest,
                      size_t word_sz,
-                     AllocationContext_t context,
                      bool* refill_failed) {
-    HeapWord* const obj = plab_allocate(dest, word_sz, context);
+    HeapWord* const obj = plab_allocate(dest, word_sz);
     if (obj != NULL) {
       return obj;
     }
-    return allocate_direct_or_new_plab(dest, word_sz, context, refill_failed);
+    return allocate_direct_or_new_plab(dest, word_sz, refill_failed);
   }
 
-  void undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz, AllocationContext_t context);
+  void undo_allocation(InCSetState dest, HeapWord* obj, size_t word_sz);
 };
 
 // The default PLAB allocator for G1. Keeps the current (single) PLAB for survivor
@@ -262,7 +253,7 @@
 public:
   G1DefaultPLABAllocator(G1Allocator* _allocator);
 
-  virtual PLAB* alloc_buffer(InCSetState dest, AllocationContext_t context) {
+  virtual PLAB* alloc_buffer(InCSetState dest) {
     assert(dest.is_valid(),
            "Allocation buffer index out-of-bounds: " CSETSTATE_FORMAT, dest.value());
     assert(_alloc_buffers[dest.value()] != NULL,
--- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -29,25 +29,24 @@
 #include "gc/g1/g1AllocRegion.inline.hpp"
 #include "gc/shared/plab.inline.hpp"
 
-HeapWord* G1Allocator::attempt_allocation(size_t word_size, AllocationContext_t context) {
-  return mutator_alloc_region(context)->attempt_allocation(word_size);
+HeapWord* G1Allocator::attempt_allocation(size_t word_size) {
+  return mutator_alloc_region()->attempt_allocation(word_size);
 }
 
-HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size, AllocationContext_t context) {
-  HeapWord* result = mutator_alloc_region(context)->attempt_allocation_locked(word_size);
-  assert(result != NULL || mutator_alloc_region(context)->get() == NULL,
-         "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region(context)->get()));
+HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size) {
+  HeapWord* result = mutator_alloc_region()->attempt_allocation_locked(word_size);
+  assert(result != NULL || mutator_alloc_region()->get() == NULL,
+         "Must not have a mutator alloc region if there is no memory, but is " PTR_FORMAT, p2i(mutator_alloc_region()->get()));
   return result;
 }
 
-HeapWord* G1Allocator::attempt_allocation_force(size_t word_size, AllocationContext_t context) {
-  return mutator_alloc_region(context)->attempt_allocation_force(word_size);
+HeapWord* G1Allocator::attempt_allocation_force(size_t word_size) {
+  return mutator_alloc_region()->attempt_allocation_force(word_size);
 }
 
 inline HeapWord* G1PLABAllocator::plab_allocate(InCSetState dest,
-                                                size_t word_sz,
-                                                AllocationContext_t context) {
-  PLAB* buffer = alloc_buffer(dest, context);
+                                                size_t word_sz) {
+  PLAB* buffer = alloc_buffer(dest);
   if (_survivor_alignment_bytes == 0 || !dest.is_young()) {
     return buffer->allocate(word_sz);
   } else {
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -237,8 +237,7 @@
 HeapWord*
 G1CollectedHeap::humongous_obj_allocate_initialize_regions(uint first,
                                                            uint num_regions,
-                                                           size_t word_size,
-                                                           AllocationContext_t context) {
+                                                           size_t word_size) {
   assert(first != G1_NO_HRM_INDEX, "pre-condition");
   assert(is_humongous(word_size), "word_size should be humongous");
   assert(num_regions * HeapRegion::GrainWords >= word_size, "pre-condition");
@@ -302,14 +301,12 @@
   // that there is a single object that starts at the bottom of the
   // first region.
   first_hr->set_starts_humongous(obj_top, word_fill_size);
-  first_hr->set_allocation_context(context);
   // Then, if there are any, we will set up the "continues
   // humongous" regions.
   HeapRegion* hr = NULL;
   for (uint i = first + 1; i <= last; ++i) {
     hr = region_at(i);
     hr->set_continues_humongous(first_hr);
-    hr->set_allocation_context(context);
   }
 
   // Up to this point no concurrent thread would have been able to
@@ -362,7 +359,7 @@
 // If could fit into free regions w/o expansion, try.
 // Otherwise, if can expand, do so.
 // Otherwise, if using ex regions might help, try with ex given back.
-HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size, AllocationContext_t context) {
+HeapWord* G1CollectedHeap::humongous_obj_allocate(size_t word_size) {
   assert_heap_locked_or_at_safepoint(true /* should_be_vm_thread */);
 
   _verifier->verify_region_sets_optional();
@@ -428,8 +425,7 @@
 
   HeapWord* result = NULL;
   if (first != G1_NO_HRM_INDEX) {
-    result = humongous_obj_allocate_initialize_regions(first, obj_regions,
-                                                       word_size, context);
+    result = humongous_obj_allocate_initialize_regions(first, obj_regions, word_size);
     assert(result != NULL, "it should always return a valid result");
 
     // A successful humongous object allocation changes the used space
@@ -461,8 +457,7 @@
   return attempt_allocation(word_size);
 }
 
-HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size,
-                                                   AllocationContext_t context) {
+HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) {
   ResourceMark rm; // For retrieving the thread names in log messages.
 
   // Make sure you read the note in attempt_allocation_humongous().
@@ -485,7 +480,7 @@
 
     {
       MutexLockerEx x(Heap_lock);
-      result = _allocator->attempt_allocation_locked(word_size, context);
+      result = _allocator->attempt_allocation_locked(word_size);
       if (result != NULL) {
         return result;
       }
@@ -496,7 +491,7 @@
       if (GCLocker::is_active_and_needs_gc() && g1_policy()->can_expand_young_list()) {
         // No need for an ergo message here, can_expand_young_list() does this when
         // it returns true.
-        result = _allocator->attempt_allocation_force(word_size, context);
+        result = _allocator->attempt_allocation_force(word_size);
         if (result != NULL) {
           return result;
         }
@@ -553,7 +548,7 @@
     // follow-on attempt will be at the start of the next loop
     // iteration (after taking the Heap_lock).
 
-    result = _allocator->attempt_allocation(word_size, context);
+    result = _allocator->attempt_allocation(word_size);
     if (result != NULL) {
       return result;
     }
@@ -685,7 +680,7 @@
     }
 
     // Mark each G1 region touched by the range as archive, add it to
-    // the old set, and set the allocation context and top.
+    // the old set, and set top.
     HeapRegion* curr_region = _hrm.addr_to_region(start_address);
     HeapRegion* last_region = _hrm.addr_to_region(last_address);
     prev_last_region = last_region;
@@ -693,7 +688,6 @@
     while (curr_region != NULL) {
       assert(curr_region->is_empty() && !curr_region->is_pinned(),
              "Region already in use (index %u)", curr_region->hrm_index());
-      curr_region->set_allocation_context(AllocationContext::system());
       if (open) {
         curr_region->set_open_archive();
       } else {
@@ -788,11 +782,10 @@
   assert(!is_humongous(word_size), "attempt_allocation() should not "
          "be called for humongous allocation requests");
 
-  AllocationContext_t context = AllocationContext::current();
-  HeapWord* result = _allocator->attempt_allocation(word_size, context);
+  HeapWord* result = _allocator->attempt_allocation(word_size);
 
   if (result == NULL) {
-    result = attempt_allocation_slow(word_size, context);
+    result = attempt_allocation_slow(word_size);
   }
   assert_heap_not_locked();
   if (result != NULL) {
@@ -917,7 +910,7 @@
       // Given that humongous objects are not allocated in young
       // regions, we'll first try to do the allocation without doing a
       // collection hoping that there's enough space in the heap.
-      result = humongous_obj_allocate(word_size, AllocationContext::current());
+      result = humongous_obj_allocate(word_size);
       if (result != NULL) {
         size_t size_in_regions = humongous_obj_size_in_regions(word_size);
         g1_policy()->add_bytes_allocated_in_old_since_last_gc(size_in_regions * HeapRegion::GrainBytes);
@@ -989,16 +982,15 @@
 }
 
 HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size,
-                                                           AllocationContext_t context,
                                                            bool expect_null_mutator_alloc_region) {
   assert_at_safepoint(true /* should_be_vm_thread */);
-  assert(!_allocator->has_mutator_alloc_region(context) || !expect_null_mutator_alloc_region,
+  assert(!_allocator->has_mutator_alloc_region() || !expect_null_mutator_alloc_region,
          "the current alloc region was unexpectedly found to be non-NULL");
 
   if (!is_humongous(word_size)) {
-    return _allocator->attempt_allocation_locked(word_size, context);
+    return _allocator->attempt_allocation_locked(word_size);
   } else {
-    HeapWord* result = humongous_obj_allocate(word_size, context);
+    HeapWord* result = humongous_obj_allocate(word_size);
     if (result != NULL && g1_policy()->need_to_start_conc_mark("STW humongous allocation")) {
       collector_state()->set_initiate_conc_mark_if_possible(true);
     }
@@ -1270,7 +1262,6 @@
 }
 
 HeapWord* G1CollectedHeap::satisfy_failed_allocation_helper(size_t word_size,
-                                                            AllocationContext_t context,
                                                             bool do_gc,
                                                             bool clear_all_soft_refs,
                                                             bool expect_null_mutator_alloc_region,
@@ -1279,7 +1270,6 @@
   // Let's attempt the allocation first.
   HeapWord* result =
     attempt_allocation_at_safepoint(word_size,
-                                    context,
                                     expect_null_mutator_alloc_region);
   if (result != NULL) {
     return result;
@@ -1289,7 +1279,7 @@
   // incremental pauses.  Therefore, at least for now, we'll favor
   // expansion over collection.  (This might change in the future if we can
   // do something smarter than full collection to satisfy a failed alloc.)
-  result = expand_and_allocate(word_size, context);
+  result = expand_and_allocate(word_size);
   if (result != NULL) {
     return result;
   }
@@ -1304,14 +1294,12 @@
 }
 
 HeapWord* G1CollectedHeap::satisfy_failed_allocation(size_t word_size,
-                                                     AllocationContext_t context,
                                                      bool* succeeded) {
   assert_at_safepoint(true /* should_be_vm_thread */);
 
   // Attempts to allocate followed by Full GC.
   HeapWord* result =
     satisfy_failed_allocation_helper(word_size,
-                                     context,
                                      true,  /* do_gc */
                                      false, /* clear_all_soft_refs */
                                      false, /* expect_null_mutator_alloc_region */
@@ -1323,7 +1311,6 @@
 
   // Attempts to allocate followed by Full GC that will collect all soft references.
   result = satisfy_failed_allocation_helper(word_size,
-                                            context,
                                             true, /* do_gc */
                                             true, /* clear_all_soft_refs */
                                             true, /* expect_null_mutator_alloc_region */
@@ -1335,7 +1322,6 @@
 
   // Attempts to allocate, no GC
   result = satisfy_failed_allocation_helper(word_size,
-                                            context,
                                             false, /* do_gc */
                                             false, /* clear_all_soft_refs */
                                             true,  /* expect_null_mutator_alloc_region */
@@ -1360,7 +1346,7 @@
 // successful, perform the allocation and return the address of the
 // allocated block, or else "NULL".
 
-HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size, AllocationContext_t context) {
+HeapWord* G1CollectedHeap::expand_and_allocate(size_t word_size) {
   assert_at_safepoint(true /* should_be_vm_thread */);
 
   _verifier->verify_region_sets_optional();
@@ -1374,7 +1360,6 @@
     _hrm.verify_optional();
     _verifier->verify_region_sets_optional();
     return attempt_allocation_at_safepoint(word_size,
-                                           context,
                                            false /* expect_null_mutator_alloc_region */);
   }
   return NULL;
@@ -2025,8 +2010,7 @@
 
   for (uintx i = 0; i < G1DummyRegionsPerGC; ++i) {
     // Let's use the existing mechanism for the allocation
-    HeapWord* dummy_obj = humongous_obj_allocate(word_size,
-                                                 AllocationContext::system());
+    HeapWord* dummy_obj = humongous_obj_allocate(word_size);
     if (dummy_obj != NULL) {
       MemRegion mr(dummy_obj, word_size);
       CollectedHeap::fill_with_object(mr);
@@ -2124,8 +2108,7 @@
                                    gc_count_before,
                                    cause,
                                    true,  /* should_initiate_conc_mark */
-                                   g1_policy()->max_pause_time_ms(),
-                                   AllocationContext::current());
+                                   g1_policy()->max_pause_time_ms());
       VMThread::execute(&op);
       if (!op.pause_succeeded()) {
         if (old_marking_count_before == _old_marking_cycles_started) {
@@ -2152,8 +2135,7 @@
                                      gc_count_before,
                                      cause,
                                      false, /* should_initiate_conc_mark */
-                                     g1_policy()->max_pause_time_ms(),
-                                     AllocationContext::current());
+                                     g1_policy()->max_pause_time_ms());
         VMThread::execute(&op);
       } else {
         // Schedule a Full GC.
@@ -2266,8 +2248,7 @@
 }
 
 size_t G1CollectedHeap::unsafe_max_tlab_alloc(Thread* ignored) const {
-  AllocationContext_t context = AllocationContext::current();
-  return _allocator->unsafe_max_tlab_alloc(context);
+  return _allocator->unsafe_max_tlab_alloc();
 }
 
 size_t G1CollectedHeap::max_capacity() const {
@@ -2371,7 +2352,6 @@
   st->print_cr("Heap Regions: E=young(eden), S=young(survivor), O=old, "
                "HS=humongous(starts), HC=humongous(continues), "
                "CS=collection set, F=free, A=archive, TS=gc time stamp, "
-               "AC=allocation context, "
                "TAMS=top-at-mark-start (previous, next)");
   PrintRegionClosure blk(st);
   heap_region_iterate(&blk);
@@ -2566,8 +2546,7 @@
                                gc_count_before,
                                gc_cause,
                                false, /* should_initiate_conc_mark */
-                               g1_policy()->max_pause_time_ms(),
-                               AllocationContext::current());
+                               g1_policy()->max_pause_time_ms());
   VMThread::execute(&op);
 
   HeapWord* result = op.result();
@@ -5075,7 +5054,6 @@
     if (r->is_empty()) {
       // Add free regions to the free list
       r->set_free();
-      r->set_allocation_context(AllocationContext::system());
       _hrm->insert_into_free_list(r);
     } else if (!_free_list_only) {
 
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -26,7 +26,6 @@
 #define SHARE_VM_GC_G1_G1COLLECTEDHEAP_HPP
 
 #include "gc/g1/evacuationInfo.hpp"
-#include "gc/g1/g1AllocationContext.hpp"
 #include "gc/g1/g1BiasedArray.hpp"
 #include "gc/g1/g1CardTable.hpp"
 #include "gc/g1/g1CollectionSet.hpp"
@@ -413,12 +412,11 @@
   // humongous region.
   HeapWord* humongous_obj_allocate_initialize_regions(uint first,
                                                       uint num_regions,
-                                                      size_t word_size,
-                                                      AllocationContext_t context);
+                                                      size_t word_size);
 
   // Attempt to allocate a humongous object of the given size. Return
   // NULL if unsuccessful.
-  HeapWord* humongous_obj_allocate(size_t word_size, AllocationContext_t context);
+  HeapWord* humongous_obj_allocate(size_t word_size);
 
   // The following two methods, allocate_new_tlab() and
   // mem_allocate(), are the two main entry points from the runtime
@@ -462,8 +460,7 @@
   // Second-level mutator allocation attempt: take the Heap_lock and
   // retry the allocation attempt, potentially scheduling a GC
   // pause. This should only be used for non-humongous allocations.
-  HeapWord* attempt_allocation_slow(size_t word_size,
-                                    AllocationContext_t context);
+  HeapWord* attempt_allocation_slow(size_t word_size);
 
   // Takes the Heap_lock and attempts a humongous allocation. It can
   // potentially schedule a GC pause.
@@ -474,7 +471,6 @@
   // specifies whether the mutator alloc region is expected to be NULL
   // or not.
   HeapWord* attempt_allocation_at_safepoint(size_t word_size,
-                                            AllocationContext_t context,
                                             bool expect_null_mutator_alloc_region);
 
   // These methods are the "callbacks" from the G1AllocRegion class.
@@ -509,7 +505,6 @@
   // This function does everything necessary/possible to satisfy a
   // failed allocation request (including collection, expansion, etc.)
   HeapWord* satisfy_failed_allocation(size_t word_size,
-                                      AllocationContext_t context,
                                       bool* succeeded);
 private:
   // Internal helpers used during full GC to split it up to
@@ -524,7 +519,6 @@
 
   // Helper method for satisfy_failed_allocation()
   HeapWord* satisfy_failed_allocation_helper(size_t word_size,
-                                             AllocationContext_t context,
                                              bool do_gc,
                                              bool clear_all_soft_refs,
                                              bool expect_null_mutator_alloc_region,
@@ -535,7 +529,7 @@
   // to support an allocation of the given "word_size".  If
   // successful, perform the allocation and return the address of the
   // allocated block, or else "NULL".
-  HeapWord* expand_and_allocate(size_t word_size, AllocationContext_t context);
+  HeapWord* expand_and_allocate(size_t word_size);
 
   // Preserve any referents discovered by concurrent marking that have not yet been
   // copied by the STW pause.
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -153,7 +153,6 @@
 HeapWord* G1ParScanThreadState::allocate_in_next_plab(InCSetState const state,
                                                       InCSetState* dest,
                                                       size_t word_sz,
-                                                      AllocationContext_t const context,
                                                       bool previous_plab_refill_failed) {
   assert(state.is_in_cset_or_humongous(), "Unexpected state: " CSETSTATE_FORMAT, state.value());
   assert(dest->is_in_cset_or_humongous(), "Unexpected dest: " CSETSTATE_FORMAT, dest->value());
@@ -164,7 +163,6 @@
     bool plab_refill_in_old_failed = false;
     HeapWord* const obj_ptr = _plab_allocator->allocate(InCSetState::Old,
                                                         word_sz,
-                                                        context,
                                                         &plab_refill_in_old_failed);
     // Make sure that we won't attempt to copy any other objects out
     // of a survivor region (given that apparently we cannot allocate
@@ -204,9 +202,8 @@
 
 void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
                                                   oop const old, size_t word_sz, uint age,
-                                                  HeapWord * const obj_ptr,
-                                                  const AllocationContext_t context) const {
-  PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
+                                                  HeapWord * const obj_ptr) const {
+  PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state);
   if (alloc_buf->contains(obj_ptr)) {
     _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
                                                              dest_state.value() == InCSetState::Old,
@@ -226,7 +223,6 @@
   const int young_index = from_region->young_index_in_cset()+1;
   assert( (from_region->is_young() && young_index >  0) ||
          (!from_region->is_young() && young_index == 0), "invariant" );
-  const AllocationContext_t context = from_region->allocation_context();
 
   uint age = 0;
   InCSetState dest_state = next_state(state, old_mark, age);
@@ -235,15 +231,15 @@
   if (_old_gen_is_full && dest_state.is_old()) {
     return handle_evacuation_failure_par(old, old_mark);
   }
-  HeapWord* obj_ptr = _plab_allocator->plab_allocate(dest_state, word_sz, context);
+  HeapWord* obj_ptr = _plab_allocator->plab_allocate(dest_state, word_sz);
 
   // PLAB allocations should succeed most of the time, so we'll
   // normally check against NULL once and that's it.
   if (obj_ptr == NULL) {
     bool plab_refill_failed = false;
-    obj_ptr = _plab_allocator->allocate_direct_or_new_plab(dest_state, word_sz, context, &plab_refill_failed);
+    obj_ptr = _plab_allocator->allocate_direct_or_new_plab(dest_state, word_sz, &plab_refill_failed);
     if (obj_ptr == NULL) {
-      obj_ptr = allocate_in_next_plab(state, &dest_state, word_sz, context, plab_refill_failed);
+      obj_ptr = allocate_in_next_plab(state, &dest_state, word_sz, plab_refill_failed);
       if (obj_ptr == NULL) {
         // This will either forward-to-self, or detect that someone else has
         // installed a forwarding pointer.
@@ -252,7 +248,7 @@
     }
     if (_g1h->_gc_tracer_stw->should_report_promotion_events()) {
       // The events are checked individually as part of the actual commit
-      report_promotion_event(dest_state, old, word_sz, age, obj_ptr, context);
+      report_promotion_event(dest_state, old, word_sz, age, obj_ptr);
     }
   }
 
@@ -264,7 +260,7 @@
   if (_g1h->evacuation_should_fail()) {
     // Doing this after all the allocation attempts also tests the
     // undo_allocation() method too.
-    _plab_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
+    _plab_allocator->undo_allocation(dest_state, obj_ptr, word_sz);
     return handle_evacuation_failure_par(old, old_mark);
   }
 #endif // !PRODUCT
@@ -325,7 +321,7 @@
     }
     return obj;
   } else {
-    _plab_allocator->undo_allocation(dest_state, obj_ptr, word_sz, context);
+    _plab_allocator->undo_allocation(dest_state, obj_ptr, word_sz);
     return forward_ptr;
   }
 }
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -175,14 +175,13 @@
   HeapWord* allocate_in_next_plab(InCSetState const state,
                                   InCSetState* dest,
                                   size_t word_sz,
-                                  AllocationContext_t const context,
                                   bool previous_plab_refill_failed);
 
   inline InCSetState next_state(InCSetState const state, markOop const m, uint& age);
 
   void report_promotion_event(InCSetState const dest_state,
                               oop const old, size_t word_sz, uint age,
-                              HeapWord * const obj_ptr, const AllocationContext_t context) const;
+                              HeapWord * const obj_ptr) const;
  public:
 
   oop copy_to_survivor_space(InCSetState const state, oop const obj, markOop const old_mark);
--- a/src/hotspot/share/gc/g1/heapRegion.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -113,7 +113,6 @@
   assert(!in_collection_set(),
          "Should not clear heap region %u in the collection set", hrm_index());
 
-  set_allocation_context(AllocationContext::system());
   set_young_index_in_cset(-1);
   uninstall_surv_rate_group();
   set_free();
@@ -235,7 +234,6 @@
                        MemRegion mr) :
     G1ContiguousSpace(bot),
     _hrm_index(hrm_index),
-    _allocation_context(AllocationContext::system()),
     _humongous_start_region(NULL),
     _evacuation_failed(false),
     _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0),
@@ -266,8 +264,7 @@
                                             get_trace_type(),
                                             to,
                                             (uintptr_t)bottom(),
-                                            used(),
-                                            (uint)allocation_context());
+                                            used());
 }
 
 void HeapRegion::note_self_forwarding_removal_start(bool during_initial_mark,
@@ -454,7 +451,6 @@
     st->print("|  ");
   }
   st->print("|TS%3u", _gc_time_stamp);
-  st->print("|AC%3u", allocation_context());
   st->print_cr("|TAMS " PTR_FORMAT ", " PTR_FORMAT "|",
                p2i(prev_top_at_mark_start()), p2i(next_top_at_mark_start()));
 }
--- a/src/hotspot/share/gc/g1/heapRegion.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/heapRegion.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_GC_G1_HEAPREGION_HPP
 #define SHARE_VM_GC_G1_HEAPREGION_HPP
 
-#include "gc/g1/g1AllocationContext.hpp"
 #include "gc/g1/g1BlockOffsetTable.hpp"
 #include "gc/g1/g1HeapRegionTraceType.hpp"
 #include "gc/g1/heapRegionTracer.hpp"
@@ -233,8 +232,6 @@
   // The index of this region in the heap region sequence.
   uint  _hrm_index;
 
-  AllocationContext_t _allocation_context;
-
   HeapRegionType _type;
 
   // For a humongous region, region in which it starts.
@@ -473,14 +470,6 @@
 
   inline bool in_collection_set() const;
 
-  void set_allocation_context(AllocationContext_t context) {
-    _allocation_context = context;
-  }
-
-  AllocationContext_t  allocation_context() const {
-    return _allocation_context;
-  }
-
   // Methods used by the HeapRegionSetBase class and subclasses.
 
   // Getter and setter for the next and prev fields used to link regions into
--- a/src/hotspot/share/gc/g1/heapRegionTracer.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/heapRegionTracer.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -30,8 +30,7 @@
                                                G1HeapRegionTraceType::Type from,
                                                G1HeapRegionTraceType::Type to,
                                                uintptr_t start,
-                                               size_t used,
-                                               uint allocationContext) {
+                                               size_t used) {
   EventG1HeapRegionTypeChange e;
   if (e.should_commit()) {
     e.set_index(index);
@@ -39,7 +38,6 @@
     e.set_to(to);
     e.set_start(start);
     e.set_used(used);
-    e.set_allocationContext(allocationContext);
     e.commit();
   }
 }
--- a/src/hotspot/share/gc/g1/heapRegionTracer.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/heapRegionTracer.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -34,8 +34,7 @@
                                         G1HeapRegionTraceType::Type from,
                                         G1HeapRegionTraceType::Type to,
                                         uintptr_t start,
-                                        size_t used,
-                                        uint allocationContext);
+                                        size_t used);
 };
 
 #endif // SHARE_VM_GC_G1_HEAPREGIONTRACER_HPP
--- a/src/hotspot/share/gc/g1/vm_operations_g1.cpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/vm_operations_g1.cpp	Fri Mar 02 10:09:08 2018 +0100
@@ -43,11 +43,9 @@
                                                      uint           gc_count_before,
                                                      GCCause::Cause gc_cause,
                                                      bool           should_initiate_conc_mark,
-                                                     double         target_pause_time_ms,
-                                                     AllocationContext_t allocation_context)
+                                                     double         target_pause_time_ms)
   : VM_CollectForAllocation(word_size, gc_count_before, gc_cause),
     _pause_succeeded(false),
-    _allocation_context(allocation_context),
     _should_initiate_conc_mark(should_initiate_conc_mark),
     _target_pause_time_ms(target_pause_time_ms),
     _should_retry_gc(false),
@@ -82,7 +80,6 @@
   if (_word_size > 0) {
     // An allocation has been requested. So, try to do that first.
     _result = g1h->attempt_allocation_at_safepoint(_word_size,
-                                                   _allocation_context,
                                                    false /* expect_null_cur_alloc_region */);
     if (_result != NULL) {
       // If we can successfully allocate before we actually do the
@@ -138,7 +135,7 @@
     if (_word_size > 0) {
       // An allocation had been requested. Do it, eventually trying a stronger
       // kind of GC.
-      _result = g1h->satisfy_failed_allocation(_word_size, _allocation_context, &_pause_succeeded);
+      _result = g1h->satisfy_failed_allocation(_word_size, &_pause_succeeded);
     } else {
       bool should_upgrade_to_full = !g1h->should_do_concurrent_full_gc(_gc_cause) &&
                                     !g1h->has_regions_left_for_allocation();
--- a/src/hotspot/share/gc/g1/vm_operations_g1.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/gc/g1/vm_operations_g1.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -25,7 +25,6 @@
 #ifndef SHARE_VM_GC_G1_VM_OPERATIONS_G1_HPP
 #define SHARE_VM_GC_G1_VM_OPERATIONS_G1_HPP
 
-#include "gc/g1/g1AllocationContext.hpp"
 #include "gc/shared/gcId.hpp"
 #include "gc/shared/vmGCOperations.hpp"
 
@@ -51,7 +50,6 @@
 class VM_G1CollectForAllocation: public VM_CollectForAllocation {
 private:
   bool      _pause_succeeded;
-  AllocationContext_t _allocation_context;
 
   bool         _should_initiate_conc_mark;
   bool         _should_retry_gc;
@@ -62,8 +60,7 @@
                             uint           gc_count_before,
                             GCCause::Cause gc_cause,
                             bool           should_initiate_conc_mark,
-                            double         target_pause_time_ms,
-                            AllocationContext_t allocation_context);
+                            double         target_pause_time_ms);
   virtual VMOp_Type type() const { return VMOp_G1CollectForAllocation; }
   virtual bool doit_prologue();
   virtual void doit();
--- a/src/hotspot/share/runtime/vm_operations.hpp	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/runtime/vm_operations.hpp	Fri Mar 02 10:09:08 2018 +0100
@@ -72,7 +72,6 @@
   template(HandshakeOneThread)                    \
   template(HandshakeAllThreads)                   \
   template(HandshakeFallback)                     \
-  template(DestroyAllocationContext)              \
   template(EnableBiasedLocking)                   \
   template(RevokeBias)                            \
   template(BulkRevokeBias)                        \
--- a/src/hotspot/share/trace/traceevents.xml	Fri Mar 02 10:09:05 2018 +0100
+++ b/src/hotspot/share/trace/traceevents.xml	Fri Mar 02 10:09:08 2018 +0100
@@ -512,7 +512,6 @@
     <value type="G1HEAPREGIONTYPE" field="to" label="To" />
     <value type="ADDRESS" field="start" label="Start" />
     <value type="BYTES64" field="used" label="Used" />
-    <value type="UINT" field="allocationContext" label="Allocation Context" />
   </event>
 
   <!-- Compiler events -->