1 /*
2 * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
306 class ParNewGeneration: public DefNewGeneration {
307 friend class ParNewGenTask;
308 friend class ParNewRefProcTask;
309 friend class ParNewRefProcTaskExecutor;
310 friend class ParScanThreadStateSet;
311 friend class ParEvacuateFollowersClosure;
312
313 private:
314 // The per-worker-thread work queues
315 ObjToScanQueueSet* _task_queues;
316
317 // Per-worker-thread local overflow stacks
318 Stack<oop, mtGC>* _overflow_stacks;
319
320 // Desired size of survivor space plab's
321 PLABStats _plab_stats;
322
323 // A list of from-space images of to-be-scanned objects, threaded through
324 // klass-pointers (klass information already copied to the forwarded
325 // image.) Manipulated with CAS.
326 oop _overflow_list;
327 NOT_PRODUCT(ssize_t _num_par_pushes;)
328
329 // This closure is used by the reference processor to filter out
330 // references to live referent.
331 DefNewGeneration::IsAliveClosure _is_alive_closure;
332
333 // GC tracer that should be used during collection.
334 ParNewTracer _gc_tracer;
335
336 static oop real_forwardee_slow(oop obj);
337 static void waste_some_time();
338
339 void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set);
340
341 protected:
342
343 bool _survivor_overflow;
344
345 bool survivor_overflow() { return _survivor_overflow; }
346 void set_survivor_overflow(bool v) { _survivor_overflow = v; }
366 }
367
368 // Make the collection virtual.
369 virtual void collect(bool full,
370 bool clear_all_soft_refs,
371 size_t size,
372 bool is_tlab);
373
374 // This needs to be visible to the closure function.
375 // "obj" is the object to be copied, "m" is a recent value of its mark
376 // that must not contain a forwarding pointer (though one might be
377 // inserted in "obj"s mark word by a parallel thread).
378 oop copy_to_survivor_space(ParScanThreadState* par_scan_state,
379 oop obj, size_t obj_sz, markOop m);
380
381 // in support of testing overflow code
382 NOT_PRODUCT(int _overflow_counter;)
383 NOT_PRODUCT(bool should_simulate_overflow();)
384
385 // Accessor for overflow list
386 oop overflow_list() { return _overflow_list; }
387
388 // Push the given (from-space) object on the global overflow list.
389 void push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state);
390
391 // If the global overflow list is non-empty, move some tasks from it
392 // onto "work_q" (which need not be empty). No more than 1/4 of the
393 // available space on "work_q" is used.
394 bool take_from_overflow_list(ParScanThreadState* par_scan_state);
395 bool take_from_overflow_list_work(ParScanThreadState* par_scan_state);
396
397 // The task queues to be used by parallel GC threads.
398 ObjToScanQueueSet* task_queues() {
399 return _task_queues;
400 }
401
402 PLABStats* plab_stats() {
403 return &_plab_stats;
404 }
405
406 size_t desired_plab_sz();
|
1 /*
2 * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
306 class ParNewGeneration: public DefNewGeneration {
307 friend class ParNewGenTask;
308 friend class ParNewRefProcTask;
309 friend class ParNewRefProcTaskExecutor;
310 friend class ParScanThreadStateSet;
311 friend class ParEvacuateFollowersClosure;
312
313 private:
314 // The per-worker-thread work queues
315 ObjToScanQueueSet* _task_queues;
316
317 // Per-worker-thread local overflow stacks
318 Stack<oop, mtGC>* _overflow_stacks;
319
320 // Desired size of survivor space plab's
321 PLABStats _plab_stats;
322
323 // A list of from-space images of to-be-scanned objects, threaded through
324 // klass-pointers (klass information already copied to the forwarded
325 // image.) Manipulated with CAS.
326 oopDesc* volatile _overflow_list;
327 NOT_PRODUCT(ssize_t _num_par_pushes;)
328
329 // This closure is used by the reference processor to filter out
330 // references to live referent.
331 DefNewGeneration::IsAliveClosure _is_alive_closure;
332
333 // GC tracer that should be used during collection.
334 ParNewTracer _gc_tracer;
335
336 static oop real_forwardee_slow(oop obj);
337 static void waste_some_time();
338
339 void handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set);
340
341 protected:
342
343 bool _survivor_overflow;
344
345 bool survivor_overflow() { return _survivor_overflow; }
346 void set_survivor_overflow(bool v) { _survivor_overflow = v; }
366 }
367
368 // Make the collection virtual.
369 virtual void collect(bool full,
370 bool clear_all_soft_refs,
371 size_t size,
372 bool is_tlab);
373
374 // This needs to be visible to the closure function.
375 // "obj" is the object to be copied, "m" is a recent value of its mark
376 // that must not contain a forwarding pointer (though one might be
377 // inserted in "obj"s mark word by a parallel thread).
378 oop copy_to_survivor_space(ParScanThreadState* par_scan_state,
379 oop obj, size_t obj_sz, markOop m);
380
381 // in support of testing overflow code
382 NOT_PRODUCT(int _overflow_counter;)
383 NOT_PRODUCT(bool should_simulate_overflow();)
384
385 // Accessor for overflow list
386 oop overflow_list() { return oop(_overflow_list); }
387
388 // Push the given (from-space) object on the global overflow list.
389 void push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state);
390
391 // If the global overflow list is non-empty, move some tasks from it
392 // onto "work_q" (which need not be empty). No more than 1/4 of the
393 // available space on "work_q" is used.
394 bool take_from_overflow_list(ParScanThreadState* par_scan_state);
395 bool take_from_overflow_list_work(ParScanThreadState* par_scan_state);
396
397 // The task queues to be used by parallel GC threads.
398 ObjToScanQueueSet* task_queues() {
399 return _task_queues;
400 }
401
402 PLABStats* plab_stats() {
403 return &_plab_stats;
404 }
405
406 size_t desired_plab_sz();
|