After removing those two parameters, we can do some further clean up.
- We can remove the large_typearray_limit() method and all its implementations, given that it was only used to determine whether is_noref should be set to true or not.
- We can remove the is_noref parameter from the CollectedHeap::common_mem_allocate_init() and CollectedHeap::commit_mem_allocate_noinit() methods.
In GenCollectedHeaop allocate_new_tlab() actually calls mem_allocate() with is_tlab set to true. This can be changed so that allocate_new_tlab() calls collector_policy()->mem_allocate_work() instead with is_tlab set to true (what mem_allocate() ultimately calls anyway).
The changes for 6974966 already ensured that G1 ignores the is_tlab parameter and it has never used the is_noref parameter (it checks explicitly in mem_allocate() to identify humongous objects). So, the changes in G1 are minimal.
ParallelScavenge (PS) has more opportunities to remove dead code / parameters than the other two. It looks as if the is_tlab parameter is passed from method to method without actually being used. In fact, it can be assumed that the parameter is always false given that the calls to all the methods that accept an is_tlab parameter start from mem_allocate() which can never be used to allocate TLABs (ParallelScavengeHeap::allocate_new_tlab() just does an allocation attempt in the eden space). Here's where an is_tlab parameter is used in PS and why it can be removed from all these places:
- VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t size, bool is_tlab,
unsigned int gc_count)
(the VM_ParallelGCFailedAllocation class also has an _is_tlab field) This VM operation can only be scheduled from the mem_allocate() method which cannot be used for non-TLAB allocation requests. So, is_tlab can only be false and any allocation attempts within the VM operation will not be for a TLAB allocation.
- HeapWord* ParallelScavengeHeap::failed_mem_allocate(size_t size, bool is_tlab)
Only called from VM_ParallelGCFailedAllocation::doit() which, as shown earlier, is only initiated from mem_allocate() for non-TLAB allocation requests. This is the only place where _is_tlab is used.
- HeapWord* PSYoungGen::allocate(size_t word_size, bool is_tlab)
The parameter is ignored in the body of the method.
- HeapWord* PSOldGen::allocate_noexpand(size_t word_size, bool is_tlab)
- HeapWord* PSOldGen::expand_and_allocate(size_t word_size, bool is_tlab)
- HeapWord* PSOldGen::allocate(size_t word_size, bool is_tlab)
allocate() calls allocate_noexpand() and/or expand_and_allocate(). Both
allocate_noexpand() and expand_and_allocate() assert !is_tlab claiming that TLAB allocations are not support in the old gen (and correctly so).
- HeapWord* PSPermGen::allocate_permanent(size_t size)
It calls PSOldGen::allocate_noexpand() and/or PSOldGen::expand_and_allocate() with is_tlab == false.