1 /* |
1 /* |
2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
198 NULL, // top |
198 NULL, // top |
199 NULL); // end |
199 NULL); // end |
200 |
200 |
201 set_desired_size(initial_desired_size()); |
201 set_desired_size(initial_desired_size()); |
202 |
202 |
203 // Following check is needed because at startup the main (primordial) |
203 // Following check is needed because at startup the main |
204 // thread is initialized before the heap is. The initialization for |
204 // thread is initialized before the heap is. The initialization for |
205 // this thread is redone in startup_initialization below. |
205 // this thread is redone in startup_initialization below. |
206 if (Universe::heap() != NULL) { |
206 if (Universe::heap() != NULL) { |
207 size_t capacity = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize; |
207 size_t capacity = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize; |
208 double alloc_frac = desired_size() * target_refills() / (double) capacity; |
208 double alloc_frac = desired_size() * target_refills() / (double) capacity; |
221 _target_refills = 100 / (2 * TLABWasteTargetPercent); |
221 _target_refills = 100 / (2 * TLABWasteTargetPercent); |
222 _target_refills = MAX2(_target_refills, (unsigned)1U); |
222 _target_refills = MAX2(_target_refills, (unsigned)1U); |
223 |
223 |
224 _global_stats = new GlobalTLABStats(); |
224 _global_stats = new GlobalTLABStats(); |
225 |
225 |
226 // During jvm startup, the main (primordial) thread is initialized |
226 // During jvm startup, the main thread is initialized |
227 // before the heap is initialized. So reinitialize it now. |
227 // before the heap is initialized. So reinitialize it now. |
228 guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread"); |
228 guarantee(Thread::current()->is_Java_thread(), "tlab initialization thread not Java thread"); |
229 Thread::current()->tlab().initialize(); |
229 Thread::current()->tlab().initialize(); |
230 |
230 |
231 if (PrintTLAB && Verbose) { |
231 if (PrintTLAB && Verbose) { |