8152120: TLAB compute_size() should not allow any size larger than max_size
authorsangheki
Mon, 21 Mar 2016 13:04:10 -0700
changeset 37168 088adaf734f4
parent 37165 ed7da23aaa16
child 37169 71b449c33033
8152120: TLAB compute_size() should not allow any size larger than max_size Summary: Limit TLAB compute_size() to be less than or equal to TLAB max Reviewed-by: sjohanss, jmasa
hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.inline.hpp
--- a/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.inline.hpp	Mon Mar 07 11:28:06 2016 -0800
+++ b/hotspot/src/share/vm/gc/shared/threadLocalAllocBuffer.inline.hpp	Mon Mar 21 13:04:10 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -61,7 +61,7 @@
   // unsafe_max_tlab_alloc is just a hint.
   const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /
                                                   HeapWordSize;
-  size_t new_tlab_size = MIN2(available_size, desired_size() + aligned_obj_size);
+  size_t new_tlab_size = MIN3(available_size, desired_size() + aligned_obj_size, max_size());
 
   // Make sure there's enough room for object and filler int[].
   const size_t obj_plus_filler_size = aligned_obj_size + alignment_reserve();