8148944: CollectorPolicy methods for memory allocations are specific to GenCollectorPolicy

Reviewed-by: jwilhelm, kbarrett
This commit is contained in:
Mikael Gerdin 2016-02-03 11:33:33 +01:00
parent ba3a7addac
commit bbbbfdbf3f
4 changed files with 14 additions and 54 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -736,22 +736,6 @@ void G1CollectorPolicy::update_rs_lengths_prediction(size_t prediction) {
} }
} }
HeapWord* G1CollectorPolicy::mem_allocate_work(size_t size,
bool is_tlab,
bool* gc_overhead_limit_was_exceeded) {
guarantee(false, "Not using this policy feature yet.");
return NULL;
}
// This method controls how a collector handles one or more
// of its generations being fully allocated.
HeapWord* G1CollectorPolicy::satisfy_failed_allocation(size_t size,
bool is_tlab) {
guarantee(false, "Not using this policy feature yet.");
return NULL;
}
#ifndef PRODUCT #ifndef PRODUCT
bool G1CollectorPolicy::verify_young_ages() { bool G1CollectorPolicy::verify_young_ages() {
HeapRegion* head = _g1->young_list()->first_region(); HeapRegion* head = _g1->young_list()->first_region();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -621,15 +621,6 @@ public:
// Create jstat counters for the policy. // Create jstat counters for the policy.
virtual void initialize_gc_policy_counters(); virtual void initialize_gc_policy_counters();
virtual HeapWord* mem_allocate_work(size_t size,
bool is_tlab,
bool* gc_overhead_limit_was_exceeded);
// This method controls how a collector handles one or more
// of its generations being fully allocated.
virtual HeapWord* satisfy_failed_allocation(size_t size,
bool is_tlab);
bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0); bool need_to_start_conc_mark(const char* source, size_t alloc_word_size = 0);
bool about_to_start_mixed_phase() const; bool about_to_start_mixed_phase() const;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,24 +145,9 @@ class CollectorPolicy : public CHeapObj<mtGC> {
virtual CardTableRS* create_rem_set(MemRegion reserved); virtual CardTableRS* create_rem_set(MemRegion reserved);
// This method controls how a collector satisfies a request MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
// for a block of memory. "gc_time_limit_was_exceeded" will size_t size,
// be set to true if the adaptive size policy determine that Metaspace::MetadataType mdtype);
// an excessive amount of time is being spent doing collections
// and caused a NULL to be returned. If a NULL is not returned,
// "gc_time_limit_was_exceeded" has an undefined meaning.
virtual HeapWord* mem_allocate_work(size_t size,
bool is_tlab,
bool* gc_overhead_limit_was_exceeded) = 0;
// This method controls how a collector handles one or more
// of its generations being fully allocated.
virtual HeapWord *satisfy_failed_allocation(size_t size, bool is_tlab) = 0;
// This method controls how a collector handles a metadata allocation
// failure.
virtual MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
size_t size,
Metaspace::MetadataType mdtype);
// Performance Counter support // Performance Counter support
GCPolicyCounters* counters() { return _gc_policy_counters; } GCPolicyCounters* counters() { return _gc_policy_counters; }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -289,9 +289,9 @@ HeapWord* GenCollectedHeap::attempt_allocation(size_t size,
HeapWord* GenCollectedHeap::mem_allocate(size_t size, HeapWord* GenCollectedHeap::mem_allocate(size_t size,
bool* gc_overhead_limit_was_exceeded) { bool* gc_overhead_limit_was_exceeded) {
return collector_policy()->mem_allocate_work(size, return gen_policy()->mem_allocate_work(size,
false /* is_tlab */, false /* is_tlab */,
gc_overhead_limit_was_exceeded); gc_overhead_limit_was_exceeded);
} }
bool GenCollectedHeap::must_clear_all_soft_refs() { bool GenCollectedHeap::must_clear_all_soft_refs() {
@ -551,7 +551,7 @@ void GenCollectedHeap::do_collection(bool full,
} }
HeapWord* GenCollectedHeap::satisfy_failed_allocation(size_t size, bool is_tlab) { HeapWord* GenCollectedHeap::satisfy_failed_allocation(size_t size, bool is_tlab) {
return collector_policy()->satisfy_failed_allocation(size, is_tlab); return gen_policy()->satisfy_failed_allocation(size, is_tlab);
} }
#ifdef ASSERT #ifdef ASSERT
@ -988,9 +988,9 @@ size_t GenCollectedHeap::unsafe_max_tlab_alloc(Thread* thr) const {
HeapWord* GenCollectedHeap::allocate_new_tlab(size_t size) { HeapWord* GenCollectedHeap::allocate_new_tlab(size_t size) {
bool gc_overhead_limit_was_exceeded; bool gc_overhead_limit_was_exceeded;
return collector_policy()->mem_allocate_work(size /* size */, return gen_policy()->mem_allocate_work(size /* size */,
true /* is_tlab */, true /* is_tlab */,
&gc_overhead_limit_was_exceeded); &gc_overhead_limit_was_exceeded);
} }
// Requires "*prev_ptr" to be non-NULL. Deletes and a block of minimal size // Requires "*prev_ptr" to be non-NULL. Deletes and a block of minimal size