2007-12-01 00:00:00 +00:00
|
|
|
/*
|
2020-02-11 12:48:25 +01:00
|
|
|
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
|
2007-12-01 00:00:00 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2010-05-27 19:08:38 -07:00
|
|
|
* 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.
|
2007-12-01 00:00:00 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#ifndef SHARE_GC_PARALLEL_PSPROMOTIONMANAGER_HPP
|
|
|
|
#define SHARE_GC_PARALLEL_PSPROMOTIONMANAGER_HPP
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2015-05-13 15:16:06 +02:00
|
|
|
#include "gc/parallel/psPromotionLAB.hpp"
|
|
|
|
#include "gc/shared/copyFailedInfo.hpp"
|
|
|
|
#include "gc/shared/gcTrace.hpp"
|
2016-03-09 09:45:47 +01:00
|
|
|
#include "gc/shared/preservedMarks.hpp"
|
2015-05-13 15:16:06 +02:00
|
|
|
#include "gc/shared/taskqueue.hpp"
|
2013-05-31 14:32:44 +02:00
|
|
|
#include "memory/padded.hpp"
|
|
|
|
#include "utilities/globalDefinitions.hpp"
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
//
|
|
|
|
// psPromotionManager is used by a single thread to manage object survival
|
|
|
|
// during a scavenge. The promotion manager contains thread local data only.
|
|
|
|
//
|
2013-06-10 11:30:51 +02:00
|
|
|
// NOTE! Be careful when allocating the stacks on cheap. If you are going
|
2007-12-01 00:00:00 +00:00
|
|
|
// to use a promotion manager in more than one thread, the stacks MUST be
|
|
|
|
// on cheap. This can lead to memory leaks, though, as they are not auto
|
|
|
|
// deallocated.
|
|
|
|
//
|
|
|
|
// FIX ME FIX ME Add a destructor, and don't rely on the user to drain/flush/deallocate!
|
|
|
|
//
|
|
|
|
|
|
|
|
class MutableSpace;
|
|
|
|
class PSOldGen;
|
|
|
|
class ParCompactionManager;
|
|
|
|
|
2018-03-14 07:27:19 -04:00
|
|
|
class PSPromotionManager {
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class PSScavenge;
|
2019-08-16 09:18:32 +02:00
|
|
|
friend class ScavengeRootsTask;
|
2007-12-01 00:00:00 +00:00
|
|
|
friend class PSRefProcTaskExecutor;
|
2019-08-16 09:18:35 +02:00
|
|
|
friend class PSRefProcTask;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
private:
|
2020-05-20 17:21:16 -04:00
|
|
|
typedef OverflowTaskQueue<ScannerTask, mtGC> PSScannerTasksQueue;
|
|
|
|
typedef GenericTaskQueueSet<PSScannerTasksQueue, mtGC> PSScannerTasksQueueSet;
|
2020-02-11 12:48:25 +01:00
|
|
|
|
2013-05-31 14:32:44 +02:00
|
|
|
static PaddedEnd<PSPromotionManager>* _manager_array;
|
2020-05-20 17:21:16 -04:00
|
|
|
static PSScannerTasksQueueSet* _stack_array_depth;
|
2016-03-09 09:45:47 +01:00
|
|
|
static PreservedMarksSet* _preserved_marks_set;
|
2013-05-31 14:32:44 +02:00
|
|
|
static PSOldGen* _old_gen;
|
|
|
|
static MutableSpace* _young_space;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2010-07-16 21:33:21 -07:00
|
|
|
#if TASKQUEUE_STATS
|
2020-05-20 17:21:16 -04:00
|
|
|
size_t _array_chunk_pushes;
|
|
|
|
size_t _array_chunk_steals;
|
2010-07-16 21:33:21 -07:00
|
|
|
size_t _arrays_chunked;
|
|
|
|
size_t _array_chunks_processed;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2014-10-14 20:58:43 +02:00
|
|
|
void print_local_stats(outputStream* const out, uint i) const;
|
2015-12-10 14:57:55 +01:00
|
|
|
static void print_taskqueue_stats();
|
2010-07-16 21:33:21 -07:00
|
|
|
|
|
|
|
void reset_stats();
|
|
|
|
#endif // TASKQUEUE_STATS
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
PSYoungPromotionLAB _young_lab;
|
|
|
|
PSOldPromotionLAB _old_lab;
|
|
|
|
bool _young_gen_is_full;
|
|
|
|
bool _old_gen_is_full;
|
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
PSScannerTasksQueue _claimed_stack_depth;
|
2012-06-28 17:03:16 -04:00
|
|
|
OverflowTaskQueue<oop, mtGC> _claimed_stack_breadth;
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
bool _totally_drain;
|
|
|
|
uint _target_stack_size;
|
|
|
|
|
|
|
|
uint _array_chunk_size;
|
|
|
|
uint _min_array_size_for_chunking;
|
|
|
|
|
2016-03-09 09:45:47 +01:00
|
|
|
PreservedMarks* _preserved_marks;
|
2013-06-10 11:30:51 +02:00
|
|
|
PromotionFailedInfo _promotion_failed_info;
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
// Accessors
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
static PSOldGen* old_gen() { return _old_gen; }
|
|
|
|
static MutableSpace* young_space() { return _young_space; }
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2015-06-05 09:50:09 +02:00
|
|
|
inline static PSPromotionManager* manager_array(uint index);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
template <class T> void process_array_chunk_work(oop obj,
|
|
|
|
int start, int end);
|
2020-05-20 17:21:16 -04:00
|
|
|
void process_array_chunk(PartialArrayScanTask task);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
void push_depth(ScannerTask task);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2014-12-10 10:10:43 -08:00
|
|
|
inline void promotion_trace_event(oop new_obj, oop old_obj, size_t obj_size,
|
|
|
|
uint age, bool tenured,
|
|
|
|
const PSPromotionLAB* lab);
|
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
static PSScannerTasksQueueSet* stack_array_depth() { return _stack_array_depth; }
|
|
|
|
|
2007-12-01 00:00:00 +00:00
|
|
|
public:
|
|
|
|
// Static
|
|
|
|
static void initialize();
|
|
|
|
|
|
|
|
static void pre_scavenge();
|
2013-06-10 11:30:51 +02:00
|
|
|
static bool post_scavenge(YoungGCTracer& gc_tracer);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2015-06-05 09:50:09 +02:00
|
|
|
static PSPromotionManager* gc_thread_promotion_manager(uint index);
|
2007-12-01 00:00:00 +00:00
|
|
|
static PSPromotionManager* vm_thread_promotion_manager();
|
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
static bool steal_depth(int queue_num, ScannerTask& t);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
PSPromotionManager();
|
|
|
|
|
|
|
|
// Accessors
|
2020-05-20 17:21:16 -04:00
|
|
|
PSScannerTasksQueue* claimed_stack_depth() {
|
2007-12-01 00:00:00 +00:00
|
|
|
return &_claimed_stack_depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool young_gen_is_full() { return _young_gen_is_full; }
|
|
|
|
|
|
|
|
bool old_gen_is_full() { return _old_gen_is_full; }
|
|
|
|
void set_old_gen_is_full(bool state) { _old_gen_is_full = state; }
|
|
|
|
|
|
|
|
// Promotion methods
|
2012-02-10 17:40:20 -08:00
|
|
|
template<bool promote_immediately> oop copy_to_survivor_space(oop o);
|
2019-08-06 10:48:21 +02:00
|
|
|
oop oop_promotion_failed(oop obj, markWord obj_mark);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
void reset();
|
2016-03-09 09:45:47 +01:00
|
|
|
void register_preserved_marks(PreservedMarks* preserved_marks);
|
2016-04-26 10:19:57 +02:00
|
|
|
static void restore_preserved_marks();
|
2007-12-01 00:00:00 +00:00
|
|
|
|
|
|
|
void flush_labs();
|
|
|
|
void drain_stacks(bool totally_drain) {
|
2010-07-22 10:27:41 -04:00
|
|
|
drain_stacks_depth(totally_drain);
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
public:
|
2007-12-01 00:00:00 +00:00
|
|
|
void drain_stacks_cond_depth() {
|
|
|
|
if (claimed_stack_depth()->size() > _target_stack_size) {
|
|
|
|
drain_stacks_depth(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void drain_stacks_depth(bool totally_drain);
|
|
|
|
|
|
|
|
bool stacks_empty() {
|
2010-07-22 10:27:41 -04:00
|
|
|
return claimed_stack_depth()->is_empty();
|
2007-12-01 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
inline void process_popped_location_depth(ScannerTask task);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2015-02-20 13:54:42 +01:00
|
|
|
static bool should_scavenge(oop* p, bool check_to_space = false);
|
|
|
|
static bool should_scavenge(narrowOop* p, bool check_to_space = false);
|
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
template <bool promote_immediately, class T>
|
2015-02-20 13:54:42 +01:00
|
|
|
void copy_and_push_safe_barrier(T* p);
|
|
|
|
|
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
2008-04-13 17:43:42 -04:00
|
|
|
template <class T> inline void claim_or_forward_depth(T* p);
|
2007-12-01 00:00:00 +00:00
|
|
|
|
2020-05-20 17:21:16 -04:00
|
|
|
TASKQUEUE_STATS_ONLY(inline void record_steal(ScannerTask task);)
|
2015-03-26 11:28:19 +01:00
|
|
|
|
|
|
|
void push_contents(oop obj);
|
2007-12-01 00:00:00 +00:00
|
|
|
};
|
2010-11-23 13:22:55 -08:00
|
|
|
|
2019-01-10 15:13:51 -05:00
|
|
|
#endif // SHARE_GC_PARALLEL_PSPROMOTIONMANAGER_HPP
|