src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp

changeset 1993
b2a00dd3117c
parent 1907
c18cbe5936b8
child 2191
894b1d7c7e01
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp	Wed Jun 30 11:52:10 2010 -0400
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psCompactionManager.hpp	Thu Jul 01 21:40:45 2010 -0700
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -59,10 +59,10 @@
    1.11  
    1.12   private:
    1.13    // 32-bit:  4K * 8 = 32KiB; 64-bit:  8K * 16 = 128KiB
    1.14 -  #define OBJARRAY_QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13))
    1.15 -  typedef GenericTaskQueue<ObjArrayTask, OBJARRAY_QUEUE_SIZE> ObjArrayTaskQueue;
    1.16 -  typedef GenericTaskQueueSet<ObjArrayTaskQueue> ObjArrayTaskQueueSet;
    1.17 -  #undef OBJARRAY_QUEUE_SIZE
    1.18 +  #define QUEUE_SIZE (1 << NOT_LP64(12) LP64_ONLY(13))
    1.19 +  typedef OverflowTaskQueue<ObjArrayTask, QUEUE_SIZE> ObjArrayTaskQueue;
    1.20 +  typedef GenericTaskQueueSet<ObjArrayTaskQueue>      ObjArrayTaskQueueSet;
    1.21 +  #undef QUEUE_SIZE
    1.22  
    1.23    static ParCompactionManager** _manager_array;
    1.24    static OopTaskQueueSet*       _stack_array;
    1.25 @@ -72,23 +72,13 @@
    1.26    static PSOldGen*              _old_gen;
    1.27  
    1.28  private:
    1.29 -  OopTaskQueue                  _marking_stack;
    1.30 -  GrowableArray<oop>*           _overflow_stack;
    1.31 -
    1.32 -  typedef GrowableArray<ObjArrayTask> ObjArrayOverflowStack;
    1.33 -  ObjArrayTaskQueue             _objarray_queue;
    1.34 -  ObjArrayOverflowStack*        _objarray_overflow_stack;
    1.35 +  OverflowTaskQueue<oop>        _marking_stack;
    1.36 +  ObjArrayTaskQueue             _objarray_stack;
    1.37  
    1.38    // Is there a way to reuse the _marking_stack for the
    1.39    // saving empty regions?  For now just create a different
    1.40    // type of TaskQueue.
    1.41 -
    1.42 -#ifdef USE_RegionTaskQueueWithOverflow
    1.43 -  RegionTaskQueueWithOverflow   _region_stack;
    1.44 -#else
    1.45    RegionTaskQueue               _region_stack;
    1.46 -  GrowableArray<size_t>*        _region_overflow_stack;
    1.47 -#endif
    1.48  
    1.49  #if 1  // does this happen enough to need a per thread stack?
    1.50    GrowableArray<Klass*>*        _revisit_klass_stack;
    1.51 @@ -107,16 +97,8 @@
    1.52   protected:
    1.53    // Array of tasks.  Needed by the ParallelTaskTerminator.
    1.54    static RegionTaskQueueSet* region_array()      { return _region_array; }
    1.55 -  OopTaskQueue*  marking_stack()                 { return &_marking_stack; }
    1.56 -  GrowableArray<oop>* overflow_stack()           { return _overflow_stack; }
    1.57 -#ifdef USE_RegionTaskQueueWithOverflow
    1.58 -  RegionTaskQueueWithOverflow* region_stack()    { return &_region_stack; }
    1.59 -#else
    1.60 -  RegionTaskQueue*  region_stack()               { return &_region_stack; }
    1.61 -  GrowableArray<size_t>* region_overflow_stack() {
    1.62 -    return _region_overflow_stack;
    1.63 -  }
    1.64 -#endif
    1.65 +  OverflowTaskQueue<oop>*  marking_stack()       { return &_marking_stack; }
    1.66 +  RegionTaskQueue* region_stack()                { return &_region_stack; }
    1.67  
    1.68    // Pushes onto the marking stack.  If the marking stack is full,
    1.69    // pushes onto the overflow stack.
    1.70 @@ -124,11 +106,7 @@
    1.71    // Do not implement an equivalent stack_pop.  Deal with the
    1.72    // marking stack and overflow stack directly.
    1.73  
    1.74 -  // Pushes onto the region stack.  If the region stack is full,
    1.75 -  // pushes onto the region overflow stack.
    1.76 -  void region_stack_push(size_t region_index);
    1.77 -
    1.78 -public:
    1.79 + public:
    1.80    Action action() { return _action; }
    1.81    void set_action(Action v) { _action = v; }
    1.82  
    1.83 @@ -157,22 +135,15 @@
    1.84    GrowableArray<DataLayout*>* revisit_mdo_stack() { return _revisit_mdo_stack; }
    1.85  #endif
    1.86  
    1.87 -  // Save oop for later processing.  Must not fail.
    1.88 -  void save_for_scanning(oop m);
    1.89 -  // Get a oop for scanning.  If returns null, no oop were found.
    1.90 -  oop retrieve_for_scanning();
    1.91 -
    1.92 -  inline void push_objarray(oop obj, size_t index);
    1.93 -
    1.94 -  // Save region for later processing.  Must not fail.
    1.95 -  void save_for_processing(size_t region_index);
    1.96 -  // Get a region for processing.  If returns null, no region were found.
    1.97 -  bool retrieve_for_processing(size_t& region_index);
    1.98 +  // Save for later processing.  Must not fail.
    1.99 +  inline void push(oop obj) { _marking_stack.push(obj); }
   1.100 +  inline void push_objarray(oop objarray, size_t index);
   1.101 +  inline void push_region(size_t index);
   1.102  
   1.103    // Access function for compaction managers
   1.104    static ParCompactionManager* gc_thread_compaction_manager(int index);
   1.105  
   1.106 -  static bool steal(int queue_num, int* seed, Task& t) {
   1.107 +  static bool steal(int queue_num, int* seed, oop& t) {
   1.108      return stack_array()->steal(queue_num, seed, t);
   1.109    }
   1.110  
   1.111 @@ -180,8 +151,8 @@
   1.112      return _objarray_queues->steal(queue_num, seed, t);
   1.113    }
   1.114  
   1.115 -  static bool steal(int queue_num, int* seed, RegionTask& t) {
   1.116 -    return region_array()->steal(queue_num, seed, t);
   1.117 +  static bool steal(int queue_num, int* seed, size_t& region) {
   1.118 +    return region_array()->steal(queue_num, seed, region);
   1.119    }
   1.120  
   1.121    // Process tasks remaining on any marking stack
   1.122 @@ -191,9 +162,6 @@
   1.123    // Process tasks remaining on any stack
   1.124    void drain_region_stacks();
   1.125  
   1.126 -  // Process tasks remaining on any stack
   1.127 -  void drain_region_overflow_stack();
   1.128 -
   1.129    // Debugging support
   1.130  #ifdef ASSERT
   1.131    bool stacks_have_been_allocated();
   1.132 @@ -208,6 +176,5 @@
   1.133  }
   1.134  
   1.135  bool ParCompactionManager::marking_stacks_empty() const {
   1.136 -  return _marking_stack.size() == 0 && _overflow_stack->is_empty() &&
   1.137 -    _objarray_queue.size() == 0 && _objarray_overflow_stack->is_empty();
   1.138 +  return _marking_stack.is_empty() && _objarray_stack.is_empty();
   1.139  }

mercurial