Merge

Fri, 09 Aug 2013 14:30:08 +0100

author
chegar
date
Fri, 09 Aug 2013 14:30:08 +0100
changeset 5875
ee7a7aa7c6bb
parent 5874
38f9393d1847
parent 5469
b9a927798f12
child 5876
8f3c59225a5c

Merge

     1.1 --- a/.hgtags	Fri Aug 09 11:03:33 2013 +0400
     1.2 +++ b/.hgtags	Fri Aug 09 14:30:08 2013 +0100
     1.3 @@ -364,3 +364,5 @@
     1.4  5787fac72e760c6a5fd9efa113b0c75caf554136 jdk8-b100
     1.5  46487ba40ff225654d0c51787ed3839bafcbd9f3 hs25-b43
     1.6  f6921c876db192bba389cec062855a66372da01c jdk8-b101
     1.7 +530fe88b3b2c710f42810b3580d86a0d83ad6c1c hs25-b44
     1.8 +c4697c1c448416108743b59118b4a2498b339d0c jdk8-b102
     2.1 --- a/make/bsd/makefiles/minimal1.make	Fri Aug 09 11:03:33 2013 +0400
     2.2 +++ b/make/bsd/makefiles/minimal1.make	Fri Aug 09 14:30:08 2013 +0100
     2.3 @@ -24,16 +24,20 @@
     2.4  
     2.5  TYPE=MINIMAL1
     2.6  
     2.7 -INCLUDE_JVMTI ?= false
     2.8 -INCLUDE_FPROF ?= false
     2.9 -INCLUDE_VM_STRUCTS ?= false
    2.10 -INCLUDE_JNI_CHECK ?= false
    2.11 -INCLUDE_SERVICES ?= false
    2.12 -INCLUDE_MANAGEMENT ?= false
    2.13 -INCLUDE_ALL_GCS ?= false
    2.14 -INCLUDE_NMT ?= false
    2.15 -INCLUDE_TRACE ?= false
    2.16 -INCLUDE_CDS ?= false
    2.17 +# Force all variables to false, overriding any other
    2.18 +# setting that may have occurred in the makefiles. These
    2.19 +# can still be overridden by passing the variable as an
    2.20 +# argument to 'make'
    2.21 +INCLUDE_JVMTI := false
    2.22 +INCLUDE_FPROF := false
    2.23 +INCLUDE_VM_STRUCTS := false
    2.24 +INCLUDE_JNI_CHECK := false
    2.25 +INCLUDE_SERVICES := false
    2.26 +INCLUDE_MANAGEMENT := false
    2.27 +INCLUDE_ALL_GCS := false
    2.28 +INCLUDE_NMT := false
    2.29 +INCLUDE_TRACE := false
    2.30 +INCLUDE_CDS := false
    2.31  
    2.32  CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
    2.33  CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
     3.1 --- a/make/hotspot_version	Fri Aug 09 11:03:33 2013 +0400
     3.2 +++ b/make/hotspot_version	Fri Aug 09 14:30:08 2013 +0100
     3.3 @@ -35,7 +35,7 @@
     3.4  
     3.5  HS_MAJOR_VER=25
     3.6  HS_MINOR_VER=0
     3.7 -HS_BUILD_NUMBER=43
     3.8 +HS_BUILD_NUMBER=44
     3.9  
    3.10  JDK_MAJOR_VER=1
    3.11  JDK_MINOR_VER=8
     4.1 --- a/make/linux/makefiles/minimal1.make	Fri Aug 09 11:03:33 2013 +0400
     4.2 +++ b/make/linux/makefiles/minimal1.make	Fri Aug 09 14:30:08 2013 +0100
     4.3 @@ -24,16 +24,20 @@
     4.4  
     4.5  TYPE=MINIMAL1
     4.6  
     4.7 -INCLUDE_JVMTI ?= false
     4.8 -INCLUDE_FPROF ?= false
     4.9 -INCLUDE_VM_STRUCTS ?= false
    4.10 -INCLUDE_JNI_CHECK ?= false
    4.11 -INCLUDE_SERVICES ?= false
    4.12 -INCLUDE_MANAGEMENT ?= false
    4.13 -INCLUDE_ALL_GCS ?= false
    4.14 -INCLUDE_NMT ?= false
    4.15 -INCLUDE_TRACE ?= false
    4.16 -INCLUDE_CDS ?= false
    4.17 +# Force all variables to false, overriding any other
    4.18 +# setting that may have occurred in the makefiles. These
    4.19 +# can still be overridden by passing the variable as an
    4.20 +# argument to 'make'
    4.21 +INCLUDE_JVMTI := false
    4.22 +INCLUDE_FPROF := false
    4.23 +INCLUDE_VM_STRUCTS := false
    4.24 +INCLUDE_JNI_CHECK := false
    4.25 +INCLUDE_SERVICES := false
    4.26 +INCLUDE_MANAGEMENT := false
    4.27 +INCLUDE_ALL_GCS := false
    4.28 +INCLUDE_NMT := false
    4.29 +INCLUDE_TRACE := false
    4.30 +INCLUDE_CDS := false
    4.31  
    4.32  CXXFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
    4.33  CFLAGS += -DMINIMAL_JVM -DCOMPILER1 -DVMTYPE=\"Minimal\"
     5.1 --- a/src/cpu/sparc/vm/c2_globals_sparc.hpp	Fri Aug 09 11:03:33 2013 +0400
     5.2 +++ b/src/cpu/sparc/vm/c2_globals_sparc.hpp	Fri Aug 09 14:30:08 2013 +0100
     5.3 @@ -42,7 +42,7 @@
     5.4  #else
     5.5  define_pd_global(bool, ProfileInterpreter,           true);
     5.6  #endif // CC_INTERP
     5.7 -define_pd_global(bool, TieredCompilation,            false);
     5.8 +define_pd_global(bool, TieredCompilation,            trueInTiered);
     5.9  define_pd_global(intx, CompileThreshold,             10000);
    5.10  define_pd_global(intx, BackEdgeThreshold,            140000);
    5.11  
     6.1 --- a/src/cpu/x86/vm/c2_globals_x86.hpp	Fri Aug 09 11:03:33 2013 +0400
     6.2 +++ b/src/cpu/x86/vm/c2_globals_x86.hpp	Fri Aug 09 14:30:08 2013 +0100
     6.3 @@ -44,7 +44,7 @@
     6.4  #else
     6.5  define_pd_global(bool, ProfileInterpreter,           true);
     6.6  #endif // CC_INTERP
     6.7 -define_pd_global(bool, TieredCompilation,            false);
     6.8 +define_pd_global(bool, TieredCompilation,            trueInTiered);
     6.9  define_pd_global(intx, CompileThreshold,             10000);
    6.10  define_pd_global(intx, BackEdgeThreshold,            100000);
    6.11  
     7.1 --- a/src/share/vm/ci/ciReplay.cpp	Fri Aug 09 11:03:33 2013 +0400
     7.2 +++ b/src/share/vm/ci/ciReplay.cpp	Fri Aug 09 14:30:08 2013 +0100
     7.3 @@ -299,7 +299,7 @@
     7.4      Symbol* method_signature = parse_symbol(CHECK_NULL);
     7.5      Method* m = k->find_method(method_name, method_signature);
     7.6      if (m == NULL) {
     7.7 -      report_error("can't find method");
     7.8 +      report_error("Can't find method");
     7.9      }
    7.10      return m;
    7.11    }
    7.12 @@ -398,8 +398,8 @@
    7.13  
    7.14    // compile <klass> <name> <signature> <entry_bci> <comp_level>
    7.15    void process_compile(TRAPS) {
    7.16 -    // methodHandle method;
    7.17      Method* method = parse_method(CHECK);
    7.18 +    if (had_error()) return;
    7.19      int entry_bci = parse_int("entry_bci");
    7.20      const char* comp_level_label = "comp_level";
    7.21      int comp_level = parse_int(comp_level_label);
    7.22 @@ -440,6 +440,7 @@
    7.23    //
    7.24    void process_ciMethod(TRAPS) {
    7.25      Method* method = parse_method(CHECK);
    7.26 +    if (had_error()) return;
    7.27      ciMethodRecord* rec = new_ciMethod(method);
    7.28      rec->invocation_counter = parse_int("invocation_counter");
    7.29      rec->backedge_counter = parse_int("backedge_counter");
    7.30 @@ -451,6 +452,7 @@
    7.31    // ciMethodData <klass> <name> <signature> <state> <current mileage> orig <length> # # ... data <length> # # ... oops <length>
    7.32    void process_ciMethodData(TRAPS) {
    7.33      Method* method = parse_method(CHECK);
    7.34 +    if (had_error()) return;
    7.35      /* jsut copied from Method, to build interpret data*/
    7.36      if (InstanceRefKlass::owns_pending_list_lock((JavaThread*)THREAD)) {
    7.37        return;
     8.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp	Fri Aug 09 11:03:33 2013 +0400
     8.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp	Fri Aug 09 14:30:08 2013 +0100
     8.3 @@ -122,6 +122,22 @@
     8.4    }
     8.5  };
     8.6  
     8.7 +class Par_MarkRefsIntoClosure: public CMSOopsInGenClosure {
     8.8 + private:
     8.9 +  const MemRegion _span;
    8.10 +  CMSBitMap*      _bitMap;
    8.11 + protected:
    8.12 +  DO_OOP_WORK_DEFN
    8.13 + public:
    8.14 +  Par_MarkRefsIntoClosure(MemRegion span, CMSBitMap* bitMap);
    8.15 +  virtual void do_oop(oop* p);
    8.16 +  virtual void do_oop(narrowOop* p);
    8.17 +
    8.18 +  Prefetch::style prefetch_style() {
    8.19 +    return Prefetch::do_read;
    8.20 +  }
    8.21 +};
    8.22 +
    8.23  // A variant of the above used in certain kinds of CMS
    8.24  // marking verification.
    8.25  class MarkRefsIntoVerifyClosure: public CMSOopsInGenClosure {
     9.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Aug 09 11:03:33 2013 +0400
     9.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Aug 09 14:30:08 2013 +0100
     9.3 @@ -569,6 +569,7 @@
     9.4    _restart_addr(NULL),
     9.5    _overflow_list(NULL),
     9.6    _stats(cmsGen),
     9.7 +  _eden_chunk_lock(new Mutex(Mutex::leaf + 1, "CMS_eden_chunk_lock", true)),
     9.8    _eden_chunk_array(NULL),     // may be set in ctor body
     9.9    _eden_chunk_capacity(0),     // -- ditto --
    9.10    _eden_chunk_index(0),        // -- ditto --
    9.11 @@ -732,7 +733,7 @@
    9.12    assert(_eden_chunk_array != NULL || _eden_chunk_capacity == 0, "Error");
    9.13  
    9.14    // Support for parallelizing survivor space rescan
    9.15 -  if (CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) {
    9.16 +  if ((CMSParallelRemarkEnabled && CMSParallelSurvivorRemarkEnabled) || CMSParallelInitialMarkEnabled) {
    9.17      const size_t max_plab_samples =
    9.18        ((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
    9.19  
    9.20 @@ -2137,6 +2138,39 @@
    9.21  }
    9.22  
    9.23  
    9.24 +void CMSCollector::print_eden_and_survivor_chunk_arrays() {
    9.25 +  DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
    9.26 +  EdenSpace* eden_space = dng->eden();
    9.27 +  ContiguousSpace* from_space = dng->from();
    9.28 +  ContiguousSpace* to_space   = dng->to();
    9.29 +  // Eden
    9.30 +  if (_eden_chunk_array != NULL) {
    9.31 +    gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
    9.32 +                           eden_space->bottom(), eden_space->top(),
    9.33 +                           eden_space->end(), eden_space->capacity());
    9.34 +    gclog_or_tty->print_cr("_eden_chunk_index=" SIZE_FORMAT ", "
    9.35 +                           "_eden_chunk_capacity=" SIZE_FORMAT,
    9.36 +                           _eden_chunk_index, _eden_chunk_capacity);
    9.37 +    for (size_t i = 0; i < _eden_chunk_index; i++) {
    9.38 +      gclog_or_tty->print_cr("_eden_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
    9.39 +                             i, _eden_chunk_array[i]);
    9.40 +    }
    9.41 +  }
    9.42 +  // Survivor
    9.43 +  if (_survivor_chunk_array != NULL) {
    9.44 +    gclog_or_tty->print_cr("survivor " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
    9.45 +                           from_space->bottom(), from_space->top(),
    9.46 +                           from_space->end(), from_space->capacity());
    9.47 +    gclog_or_tty->print_cr("_survivor_chunk_index=" SIZE_FORMAT ", "
    9.48 +                           "_survivor_chunk_capacity=" SIZE_FORMAT,
    9.49 +                           _survivor_chunk_index, _survivor_chunk_capacity);
    9.50 +    for (size_t i = 0; i < _survivor_chunk_index; i++) {
    9.51 +      gclog_or_tty->print_cr("_survivor_chunk_array[" SIZE_FORMAT "]=" PTR_FORMAT,
    9.52 +                             i, _survivor_chunk_array[i]);
    9.53 +    }
    9.54 +  }
    9.55 +}
    9.56 +
    9.57  void CMSCollector::getFreelistLocks() const {
    9.58    // Get locks for all free lists in all generations that this
    9.59    // collector is responsible for
    9.60 @@ -3549,6 +3583,31 @@
    9.61  
    9.62  // CMS work
    9.63  
    9.64 +// The common parts of CMSParInitialMarkTask and CMSParRemarkTask.
    9.65 +class CMSParMarkTask : public AbstractGangTask {
    9.66 + protected:
    9.67 +  CMSCollector*     _collector;
    9.68 +  int               _n_workers;
    9.69 +  CMSParMarkTask(const char* name, CMSCollector* collector, int n_workers) :
    9.70 +      AbstractGangTask(name),
    9.71 +      _collector(collector),
    9.72 +      _n_workers(n_workers) {}
    9.73 +  // Work method in support of parallel rescan ... of young gen spaces
    9.74 +  void do_young_space_rescan(uint worker_id, OopsInGenClosure* cl,
    9.75 +                             ContiguousSpace* space,
    9.76 +                             HeapWord** chunk_array, size_t chunk_top);
    9.77 +  void work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl);
    9.78 +};
    9.79 +
    9.80 +// Parallel initial mark task
    9.81 +class CMSParInitialMarkTask: public CMSParMarkTask {
    9.82 + public:
    9.83 +  CMSParInitialMarkTask(CMSCollector* collector, int n_workers) :
    9.84 +      CMSParMarkTask("Scan roots and young gen for initial mark in parallel",
    9.85 +                     collector, n_workers) {}
    9.86 +  void work(uint worker_id);
    9.87 +};
    9.88 +
    9.89  // Checkpoint the roots into this generation from outside
    9.90  // this generation. [Note this initial checkpoint need only
    9.91  // be approximate -- we'll do a catch up phase subsequently.]
    9.92 @@ -3646,19 +3705,42 @@
    9.93    // the klasses. The claimed marks need to be cleared before marking starts.
    9.94    ClassLoaderDataGraph::clear_claimed_marks();
    9.95  
    9.96 -  CMKlassClosure klass_closure(&notOlder);
    9.97 +  if (CMSPrintEdenSurvivorChunks) {
    9.98 +    print_eden_and_survivor_chunk_arrays();
    9.99 +  }
   9.100 +
   9.101    {
   9.102      COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
   9.103 -    gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
   9.104 -    gch->gen_process_strong_roots(_cmsGen->level(),
   9.105 -                                  true,   // younger gens are roots
   9.106 -                                  true,   // activate StrongRootsScope
   9.107 -                                  false,  // not scavenging
   9.108 -                                  SharedHeap::ScanningOption(roots_scanning_options()),
   9.109 -                                  &notOlder,
   9.110 -                                  true,   // walk all of code cache if (so & SO_CodeCache)
   9.111 -                                  NULL,
   9.112 -                                  &klass_closure);
   9.113 +    if (CMSParallelInitialMarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
   9.114 +      // The parallel version.
   9.115 +      FlexibleWorkGang* workers = gch->workers();
   9.116 +      assert(workers != NULL, "Need parallel worker threads.");
   9.117 +      int n_workers = workers->active_workers();
   9.118 +      CMSParInitialMarkTask tsk(this, n_workers);
   9.119 +      gch->set_par_threads(n_workers);
   9.120 +      initialize_sequential_subtasks_for_young_gen_rescan(n_workers);
   9.121 +      if (n_workers > 1) {
   9.122 +        GenCollectedHeap::StrongRootsScope srs(gch);
   9.123 +        workers->run_task(&tsk);
   9.124 +      } else {
   9.125 +        GenCollectedHeap::StrongRootsScope srs(gch);
   9.126 +        tsk.work(0);
   9.127 +      }
   9.128 +      gch->set_par_threads(0);
   9.129 +    } else {
   9.130 +      // The serial version.
   9.131 +      CMKlassClosure klass_closure(&notOlder);
   9.132 +      gch->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
   9.133 +      gch->gen_process_strong_roots(_cmsGen->level(),
   9.134 +                                    true,   // younger gens are roots
   9.135 +                                    true,   // activate StrongRootsScope
   9.136 +                                    false,  // not scavenging
   9.137 +                                    SharedHeap::ScanningOption(roots_scanning_options()),
   9.138 +                                    &notOlder,
   9.139 +                                    true,   // walk all of code cache if (so & SO_CodeCache)
   9.140 +                                    NULL,
   9.141 +                                    &klass_closure);
   9.142 +    }
   9.143    }
   9.144  
   9.145    // Clear mod-union table; it will be dirtied in the prologue of
   9.146 @@ -4417,7 +4499,9 @@
   9.147    verify_overflow_empty();
   9.148    _abort_preclean = false;
   9.149    if (CMSPrecleaningEnabled) {
   9.150 -    _eden_chunk_index = 0;
   9.151 +    if (!CMSEdenChunksRecordAlways) {
   9.152 +      _eden_chunk_index = 0;
   9.153 +    }
   9.154      size_t used = get_eden_used();
   9.155      size_t capacity = get_eden_capacity();
   9.156      // Don't start sampling unless we will get sufficiently
   9.157 @@ -4526,7 +4610,9 @@
   9.158    if (!_start_sampling) {
   9.159      return;
   9.160    }
   9.161 -  if (_eden_chunk_array) {
   9.162 +  // When CMSEdenChunksRecordAlways is true, the eden chunk array
   9.163 +  // is populated by the young generation.
   9.164 +  if (_eden_chunk_array != NULL && !CMSEdenChunksRecordAlways) {
   9.165      if (_eden_chunk_index < _eden_chunk_capacity) {
   9.166        _eden_chunk_array[_eden_chunk_index] = *_top_addr;   // take sample
   9.167        assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
   9.168 @@ -5010,6 +5096,10 @@
   9.169      // Update the saved marks which may affect the root scans.
   9.170      gch->save_marks();
   9.171  
   9.172 +    if (CMSPrintEdenSurvivorChunks) {
   9.173 +      print_eden_and_survivor_chunk_arrays();
   9.174 +    }
   9.175 +
   9.176      {
   9.177        COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
   9.178  
   9.179 @@ -5116,10 +5206,53 @@
   9.180    }
   9.181  }
   9.182  
   9.183 +void CMSParInitialMarkTask::work(uint worker_id) {
   9.184 +  elapsedTimer _timer;
   9.185 +  ResourceMark rm;
   9.186 +  HandleMark   hm;
   9.187 +
   9.188 +  // ---------- scan from roots --------------
   9.189 +  _timer.start();
   9.190 +  GenCollectedHeap* gch = GenCollectedHeap::heap();
   9.191 +  Par_MarkRefsIntoClosure par_mri_cl(_collector->_span, &(_collector->_markBitMap));
   9.192 +  CMKlassClosure klass_closure(&par_mri_cl);
   9.193 +
   9.194 +  // ---------- young gen roots --------------
   9.195 +  {
   9.196 +    work_on_young_gen_roots(worker_id, &par_mri_cl);
   9.197 +    _timer.stop();
   9.198 +    if (PrintCMSStatistics != 0) {
   9.199 +      gclog_or_tty->print_cr(
   9.200 +        "Finished young gen initial mark scan work in %dth thread: %3.3f sec",
   9.201 +        worker_id, _timer.seconds());
   9.202 +    }
   9.203 +  }
   9.204 +
   9.205 +  // ---------- remaining roots --------------
   9.206 +  _timer.reset();
   9.207 +  _timer.start();
   9.208 +  gch->gen_process_strong_roots(_collector->_cmsGen->level(),
   9.209 +                                false,     // yg was scanned above
   9.210 +                                false,     // this is parallel code
   9.211 +                                false,     // not scavenging
   9.212 +                                SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
   9.213 +                                &par_mri_cl,
   9.214 +                                true,   // walk all of code cache if (so & SO_CodeCache)
   9.215 +                                NULL,
   9.216 +                                &klass_closure);
   9.217 +  assert(_collector->should_unload_classes()
   9.218 +         || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_CodeCache),
   9.219 +         "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
   9.220 +  _timer.stop();
   9.221 +  if (PrintCMSStatistics != 0) {
   9.222 +    gclog_or_tty->print_cr(
   9.223 +      "Finished remaining root initial mark scan work in %dth thread: %3.3f sec",
   9.224 +      worker_id, _timer.seconds());
   9.225 +  }
   9.226 +}
   9.227 +
   9.228  // Parallel remark task
   9.229 -class CMSParRemarkTask: public AbstractGangTask {
   9.230 -  CMSCollector* _collector;
   9.231 -  int           _n_workers;
   9.232 +class CMSParRemarkTask: public CMSParMarkTask {
   9.233    CompactibleFreeListSpace* _cms_space;
   9.234  
   9.235    // The per-thread work queues, available here for stealing.
   9.236 @@ -5133,10 +5266,9 @@
   9.237                     CompactibleFreeListSpace* cms_space,
   9.238                     int n_workers, FlexibleWorkGang* workers,
   9.239                     OopTaskQueueSet* task_queues):
   9.240 -    AbstractGangTask("Rescan roots and grey objects in parallel"),
   9.241 -    _collector(collector),
   9.242 +    CMSParMarkTask("Rescan roots and grey objects in parallel",
   9.243 +                   collector, n_workers),
   9.244      _cms_space(cms_space),
   9.245 -    _n_workers(n_workers),
   9.246      _task_queues(task_queues),
   9.247      _term(n_workers, task_queues) { }
   9.248  
   9.249 @@ -5150,11 +5282,6 @@
   9.250    void work(uint worker_id);
   9.251  
   9.252   private:
   9.253 -  // Work method in support of parallel rescan ... of young gen spaces
   9.254 -  void do_young_space_rescan(int i, Par_MarkRefsIntoAndScanClosure* cl,
   9.255 -                             ContiguousSpace* space,
   9.256 -                             HeapWord** chunk_array, size_t chunk_top);
   9.257 -
   9.258    // ... of  dirty cards in old space
   9.259    void do_dirty_card_rescan_tasks(CompactibleFreeListSpace* sp, int i,
   9.260                                    Par_MarkRefsIntoAndScanClosure* cl);
   9.261 @@ -5186,6 +5313,25 @@
   9.262    }
   9.263  };
   9.264  
   9.265 +void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
   9.266 +  DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
   9.267 +  EdenSpace* eden_space = dng->eden();
   9.268 +  ContiguousSpace* from_space = dng->from();
   9.269 +  ContiguousSpace* to_space   = dng->to();
   9.270 +
   9.271 +  HeapWord** eca = _collector->_eden_chunk_array;
   9.272 +  size_t     ect = _collector->_eden_chunk_index;
   9.273 +  HeapWord** sca = _collector->_survivor_chunk_array;
   9.274 +  size_t     sct = _collector->_survivor_chunk_index;
   9.275 +
   9.276 +  assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
   9.277 +  assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
   9.278 +
   9.279 +  do_young_space_rescan(worker_id, cl, to_space, NULL, 0);
   9.280 +  do_young_space_rescan(worker_id, cl, from_space, sca, sct);
   9.281 +  do_young_space_rescan(worker_id, cl, eden_space, eca, ect);
   9.282 +}
   9.283 +
   9.284  // work_queue(i) is passed to the closure
   9.285  // Par_MarkRefsIntoAndScanClosure.  The "i" parameter
   9.286  // also is passed to do_dirty_card_rescan_tasks() and to
   9.287 @@ -5210,23 +5356,7 @@
   9.288    // work first.
   9.289    // ---------- young gen roots --------------
   9.290    {
   9.291 -    DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
   9.292 -    EdenSpace* eden_space = dng->eden();
   9.293 -    ContiguousSpace* from_space = dng->from();
   9.294 -    ContiguousSpace* to_space   = dng->to();
   9.295 -
   9.296 -    HeapWord** eca = _collector->_eden_chunk_array;
   9.297 -    size_t     ect = _collector->_eden_chunk_index;
   9.298 -    HeapWord** sca = _collector->_survivor_chunk_array;
   9.299 -    size_t     sct = _collector->_survivor_chunk_index;
   9.300 -
   9.301 -    assert(ect <= _collector->_eden_chunk_capacity, "out of bounds");
   9.302 -    assert(sct <= _collector->_survivor_chunk_capacity, "out of bounds");
   9.303 -
   9.304 -    do_young_space_rescan(worker_id, &par_mrias_cl, to_space, NULL, 0);
   9.305 -    do_young_space_rescan(worker_id, &par_mrias_cl, from_space, sca, sct);
   9.306 -    do_young_space_rescan(worker_id, &par_mrias_cl, eden_space, eca, ect);
   9.307 -
   9.308 +    work_on_young_gen_roots(worker_id, &par_mrias_cl);
   9.309      _timer.stop();
   9.310      if (PrintCMSStatistics != 0) {
   9.311        gclog_or_tty->print_cr(
   9.312 @@ -5334,8 +5464,8 @@
   9.313  
   9.314  // Note that parameter "i" is not used.
   9.315  void
   9.316 -CMSParRemarkTask::do_young_space_rescan(int i,
   9.317 -  Par_MarkRefsIntoAndScanClosure* cl, ContiguousSpace* space,
   9.318 +CMSParMarkTask::do_young_space_rescan(uint worker_id,
   9.319 +  OopsInGenClosure* cl, ContiguousSpace* space,
   9.320    HeapWord** chunk_array, size_t chunk_top) {
   9.321    // Until all tasks completed:
   9.322    // . claim an unclaimed task
   9.323 @@ -5530,6 +5660,32 @@
   9.324           "Else our work is not yet done");
   9.325  }
   9.326  
   9.327 +// Record object boundaries in _eden_chunk_array by sampling the eden
   9.328 +// top in the slow-path eden object allocation code path and record
   9.329 +// the boundaries, if CMSEdenChunksRecordAlways is true. If
   9.330 +// CMSEdenChunksRecordAlways is false, we use the other asynchronous
   9.331 +// sampling in sample_eden() that activates during the part of the
   9.332 +// preclean phase.
   9.333 +void CMSCollector::sample_eden_chunk() {
   9.334 +  if (CMSEdenChunksRecordAlways && _eden_chunk_array != NULL) {
   9.335 +    if (_eden_chunk_lock->try_lock()) {
   9.336 +      // Record a sample. This is the critical section. The contents
   9.337 +      // of the _eden_chunk_array have to be non-decreasing in the
   9.338 +      // address order.
   9.339 +      _eden_chunk_array[_eden_chunk_index] = *_top_addr;
   9.340 +      assert(_eden_chunk_array[_eden_chunk_index] <= *_end_addr,
   9.341 +             "Unexpected state of Eden");
   9.342 +      if (_eden_chunk_index == 0 ||
   9.343 +          ((_eden_chunk_array[_eden_chunk_index] > _eden_chunk_array[_eden_chunk_index-1]) &&
   9.344 +           (pointer_delta(_eden_chunk_array[_eden_chunk_index],
   9.345 +                          _eden_chunk_array[_eden_chunk_index-1]) >= CMSSamplingGrain))) {
   9.346 +        _eden_chunk_index++;  // commit sample
   9.347 +      }
   9.348 +      _eden_chunk_lock->unlock();
   9.349 +    }
   9.350 +  }
   9.351 +}
   9.352 +
   9.353  // Return a thread-local PLAB recording array, as appropriate.
   9.354  void* CMSCollector::get_data_recorder(int thr_num) {
   9.355    if (_survivor_plab_array != NULL &&
   9.356 @@ -5553,12 +5709,13 @@
   9.357  
   9.358  // Merge the per-thread plab arrays into the global survivor chunk
   9.359  // array which will provide the partitioning of the survivor space
   9.360 -// for CMS rescan.
   9.361 +// for CMS initial scan and rescan.
   9.362  void CMSCollector::merge_survivor_plab_arrays(ContiguousSpace* surv,
   9.363                                                int no_of_gc_threads) {
   9.364    assert(_survivor_plab_array  != NULL, "Error");
   9.365    assert(_survivor_chunk_array != NULL, "Error");
   9.366 -  assert(_collectorState == FinalMarking, "Error");
   9.367 +  assert(_collectorState == FinalMarking ||
   9.368 +         (CMSParallelInitialMarkEnabled && _collectorState == InitialMarking), "Error");
   9.369    for (int j = 0; j < no_of_gc_threads; j++) {
   9.370      _cursor[j] = 0;
   9.371    }
   9.372 @@ -5621,7 +5778,7 @@
   9.373  }
   9.374  
   9.375  // Set up the space's par_seq_tasks structure for work claiming
   9.376 -// for parallel rescan of young gen.
   9.377 +// for parallel initial scan and rescan of young gen.
   9.378  // See ParRescanTask where this is currently used.
   9.379  void
   9.380  CMSCollector::
   9.381 @@ -6748,6 +6905,28 @@
   9.382  void MarkRefsIntoClosure::do_oop(oop* p)       { MarkRefsIntoClosure::do_oop_work(p); }
   9.383  void MarkRefsIntoClosure::do_oop(narrowOop* p) { MarkRefsIntoClosure::do_oop_work(p); }
   9.384  
   9.385 +Par_MarkRefsIntoClosure::Par_MarkRefsIntoClosure(
   9.386 +  MemRegion span, CMSBitMap* bitMap):
   9.387 +    _span(span),
   9.388 +    _bitMap(bitMap)
   9.389 +{
   9.390 +    assert(_ref_processor == NULL, "deliberately left NULL");
   9.391 +    assert(_bitMap->covers(_span), "_bitMap/_span mismatch");
   9.392 +}
   9.393 +
   9.394 +void Par_MarkRefsIntoClosure::do_oop(oop obj) {
   9.395 +  // if p points into _span, then mark corresponding bit in _markBitMap
   9.396 +  assert(obj->is_oop(), "expected an oop");
   9.397 +  HeapWord* addr = (HeapWord*)obj;
   9.398 +  if (_span.contains(addr)) {
   9.399 +    // this should be made more efficient
   9.400 +    _bitMap->par_mark(addr);
   9.401 +  }
   9.402 +}
   9.403 +
   9.404 +void Par_MarkRefsIntoClosure::do_oop(oop* p)       { Par_MarkRefsIntoClosure::do_oop_work(p); }
   9.405 +void Par_MarkRefsIntoClosure::do_oop(narrowOop* p) { Par_MarkRefsIntoClosure::do_oop_work(p); }
   9.406 +
   9.407  // A variant of the above, used for CMS marking verification.
   9.408  MarkRefsIntoVerifyClosure::MarkRefsIntoVerifyClosure(
   9.409    MemRegion span, CMSBitMap* verification_bm, CMSBitMap* cms_bm):
   9.410 @@ -9305,7 +9484,6 @@
   9.411      return;
   9.412    }
   9.413  }
   9.414 -
   9.415  // Transfer some number of overflown objects to usual marking
   9.416  // stack. Return true if some objects were transferred.
   9.417  bool MarkRefsIntoAndScanClosure::take_from_overflow_list() {
   9.418 @@ -9377,4 +9555,3 @@
   9.419        ShouldNotReachHere();
   9.420    }
   9.421  }
   9.422 -
    10.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Fri Aug 09 11:03:33 2013 +0400
    10.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Fri Aug 09 14:30:08 2013 +0100
    10.3 @@ -515,6 +515,8 @@
    10.4    friend class ConcurrentMarkSweepThread;
    10.5    friend class ConcurrentMarkSweepGeneration;
    10.6    friend class CompactibleFreeListSpace;
    10.7 +  friend class CMSParMarkTask;
    10.8 +  friend class CMSParInitialMarkTask;
    10.9    friend class CMSParRemarkTask;
   10.10    friend class CMSConcMarkingTask;
   10.11    friend class CMSRefProcTaskProxy;
   10.12 @@ -749,6 +751,7 @@
   10.13    Generation* _young_gen;  // the younger gen
   10.14    HeapWord** _top_addr;    // ... Top of Eden
   10.15    HeapWord** _end_addr;    // ... End of Eden
   10.16 +  Mutex*     _eden_chunk_lock;
   10.17    HeapWord** _eden_chunk_array; // ... Eden partitioning array
   10.18    size_t     _eden_chunk_index; // ... top (exclusive) of array
   10.19    size_t     _eden_chunk_capacity;  // ... max entries in array
   10.20 @@ -950,6 +953,7 @@
   10.21  
   10.22    // Support for parallel remark of survivor space
   10.23    void* get_data_recorder(int thr_num);
   10.24 +  void sample_eden_chunk();
   10.25  
   10.26    CMSBitMap* markBitMap()  { return &_markBitMap; }
   10.27    void directAllocated(HeapWord* start, size_t size);
   10.28 @@ -1027,6 +1031,8 @@
   10.29  
   10.30    // Initialization errors
   10.31    bool completed_initialization() { return _completed_initialization; }
   10.32 +
   10.33 +  void print_eden_and_survivor_chunk_arrays();
   10.34  };
   10.35  
   10.36  class CMSExpansionCause : public AllStatic  {
   10.37 @@ -1317,6 +1323,10 @@
   10.38      //Delegate to collector
   10.39      return collector()->get_data_recorder(thr_num);
   10.40    }
   10.41 +  void sample_eden_chunk() {
   10.42 +    //Delegate to collector
   10.43 +    return collector()->sample_eden_chunk();
   10.44 +  }
   10.45  
   10.46    // Printing
   10.47    const char* name() const;
    11.1 --- a/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Aug 09 11:03:33 2013 +0400
    11.2 +++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp	Fri Aug 09 14:30:08 2013 +0100
    11.3 @@ -96,11 +96,6 @@
    11.4            "the buffer will be enqueued for processing. A value of 0 "       \
    11.5            "specifies that mutator threads should not do such filtering.")   \
    11.6                                                                              \
    11.7 -  develop(intx, G1ExtraRegionSurvRate, 33,                                  \
    11.8 -          "If the young survival rate is S, and there's room left in "      \
    11.9 -          "to-space, we will allow regions whose survival rate is up to "   \
   11.10 -          "S + (1 - S)*X, where X is this parameter (as a fraction.)")      \
   11.11 -                                                                            \
   11.12    develop(bool, G1SATBPrintStubs, false,                                    \
   11.13            "If true, print generated stubs for the SATB barrier")            \
   11.14                                                                              \
   11.15 @@ -110,9 +105,6 @@
   11.16    develop(bool, G1RSBarrierRegionFilter, true,                              \
   11.17            "If true, generate region filtering code in RS barrier")          \
   11.18                                                                              \
   11.19 -  develop(bool, G1RSBarrierNullFilter, true,                                \
   11.20 -          "If true, generate null-pointer filtering code in RS barrier")    \
   11.21 -                                                                            \
   11.22    develop(bool, G1DeferredRSUpdate, true,                                   \
   11.23            "If true, use deferred RS updates")                               \
   11.24                                                                              \
   11.25 @@ -120,9 +112,6 @@
   11.26            "If true, verify that no dirty cards remain after RS log "        \
   11.27            "processing.")                                                    \
   11.28                                                                              \
   11.29 -  develop(bool, G1RSCountHisto, false,                                      \
   11.30 -          "If true, print a histogram of RS occupancies after each pause")  \
   11.31 -                                                                            \
   11.32    diagnostic(bool, G1PrintRegionLivenessInfo, false,                        \
   11.33              "Prints the liveness information for all regions in the heap "  \
   11.34              "at the end of a marking cycle.")                               \
   11.35 @@ -169,9 +158,6 @@
   11.36    product(uintx, G1ConcRSHotCardLimit, 4,                                   \
   11.37            "The threshold that defines (>=) a hot card.")                    \
   11.38                                                                              \
   11.39 -  develop(bool, G1PrintOopAppls, false,                                     \
   11.40 -          "When true, print applications of closures to external locs.")    \
   11.41 -                                                                            \
   11.42    develop(intx, G1RSetRegionEntriesBase, 256,                               \
   11.43            "Max number of regions in a fine-grain table per MB.")            \
   11.44                                                                              \
    12.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Aug 09 11:03:33 2013 +0400
    12.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp	Fri Aug 09 14:30:08 2013 +0100
    12.3 @@ -314,6 +314,11 @@
    12.4      region_size = MAX_REGION_SIZE;
    12.5    }
    12.6  
    12.7 +  if (region_size != G1HeapRegionSize) {
    12.8 +    // Update the flag to make sure that PrintFlagsFinal logs the correct value
    12.9 +    FLAG_SET_ERGO(uintx, G1HeapRegionSize, region_size);
   12.10 +  }
   12.11 +
   12.12    // And recalculate the log.
   12.13    region_size_log = log2_long((jlong) region_size);
   12.14  
    13.1 --- a/src/share/vm/memory/defNewGeneration.cpp	Fri Aug 09 11:03:33 2013 +0400
    13.2 +++ b/src/share/vm/memory/defNewGeneration.cpp	Fri Aug 09 14:30:08 2013 +0100
    13.3 @@ -1033,6 +1033,9 @@
    13.4    // have to use it here, as well.
    13.5    HeapWord* result = eden()->par_allocate(word_size);
    13.6    if (result != NULL) {
    13.7 +    if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
    13.8 +      _next_gen->sample_eden_chunk();
    13.9 +    }
   13.10      return result;
   13.11    }
   13.12    do {
   13.13 @@ -1063,13 +1066,19 @@
   13.14    // circular dependency at compile time.
   13.15    if (result == NULL) {
   13.16      result = allocate_from_space(word_size);
   13.17 +  } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
   13.18 +    _next_gen->sample_eden_chunk();
   13.19    }
   13.20    return result;
   13.21  }
   13.22  
   13.23  HeapWord* DefNewGeneration::par_allocate(size_t word_size,
   13.24                                           bool is_tlab) {
   13.25 -  return eden()->par_allocate(word_size);
   13.26 +  HeapWord* res = eden()->par_allocate(word_size);
   13.27 +  if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
   13.28 +    _next_gen->sample_eden_chunk();
   13.29 +  }
   13.30 +  return res;
   13.31  }
   13.32  
   13.33  void DefNewGeneration::gc_prologue(bool full) {
    14.1 --- a/src/share/vm/memory/generation.hpp	Fri Aug 09 11:03:33 2013 +0400
    14.2 +++ b/src/share/vm/memory/generation.hpp	Fri Aug 09 14:30:08 2013 +0100
    14.3 @@ -455,6 +455,7 @@
    14.4    // expected to be GC worker thread-local, with the worker index
    14.5    // indicated by "thr_num".
    14.6    virtual void* get_data_recorder(int thr_num) { return NULL; }
    14.7 +  virtual void sample_eden_chunk() {}
    14.8  
    14.9    // Some generations may require some cleanup actions before allowing
   14.10    // a verification.
    15.1 --- a/src/share/vm/memory/metaspace.cpp	Fri Aug 09 11:03:33 2013 +0400
    15.2 +++ b/src/share/vm/memory/metaspace.cpp	Fri Aug 09 14:30:08 2013 +0100
    15.3 @@ -2254,10 +2254,11 @@
    15.4  
    15.5  void SpaceManager::deallocate(MetaWord* p, size_t word_size) {
    15.6    assert_lock_strong(_lock);
    15.7 +  size_t raw_word_size = get_raw_word_size(word_size);
    15.8    size_t min_size = TreeChunk<Metablock, FreeList>::min_size();
    15.9 -  assert(word_size >= min_size,
   15.10 +  assert(raw_word_size >= min_size,
   15.11      err_msg("Should not deallocate dark matter " SIZE_FORMAT, word_size));
   15.12 -  block_freelists()->return_block(p, word_size);
   15.13 +  block_freelists()->return_block(p, raw_word_size);
   15.14  }
   15.15  
   15.16  // Adds a chunk to the list of chunks in use.
    16.1 --- a/src/share/vm/memory/sharedHeap.cpp	Fri Aug 09 11:03:33 2013 +0400
    16.2 +++ b/src/share/vm/memory/sharedHeap.cpp	Fri Aug 09 14:30:08 2013 +0100
    16.3 @@ -65,7 +65,8 @@
    16.4    }
    16.5    _sh = this;  // ch is static, should be set only once.
    16.6    if ((UseParNewGC ||
    16.7 -      (UseConcMarkSweepGC && CMSParallelRemarkEnabled) ||
    16.8 +      (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled ||
    16.9 +                              CMSParallelRemarkEnabled)) ||
   16.10         UseG1GC) &&
   16.11        ParallelGCThreads > 0) {
   16.12      _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
    17.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Aug 09 11:03:33 2013 +0400
    17.2 +++ b/src/share/vm/runtime/arguments.cpp	Fri Aug 09 14:30:08 2013 +0100
    17.3 @@ -1891,6 +1891,10 @@
    17.4      warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
    17.5              "and will likely be removed in future release");
    17.6    }
    17.7 +  if (FLAG_IS_CMDLINE(DefaultMaxRAMFraction)) {
    17.8 +    warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
    17.9 +        "Use MaxRAMFraction instead.");
   17.10 +  }
   17.11  }
   17.12  
   17.13  // Check stack pages settings
    18.1 --- a/src/share/vm/runtime/globals.hpp	Fri Aug 09 11:03:33 2013 +0400
    18.2 +++ b/src/share/vm/runtime/globals.hpp	Fri Aug 09 14:30:08 2013 +0100
    18.3 @@ -1689,6 +1689,9 @@
    18.4    product(bool, CMSAbortSemantics, false,                                   \
    18.5            "Whether abort-on-overflow semantics is implemented")             \
    18.6                                                                              \
    18.7 +  product(bool, CMSParallelInitialMarkEnabled, true,                        \
    18.8 +          "Use the parallel initial mark.")                                 \
    18.9 +                                                                            \
   18.10    product(bool, CMSParallelRemarkEnabled, true,                             \
   18.11            "Whether parallel remark enabled (only if ParNewGC)")             \
   18.12                                                                              \
   18.13 @@ -1700,6 +1703,14 @@
   18.14            "Whether to always record survivor space PLAB bdries"             \
   18.15            " (effective only if CMSParallelSurvivorRemarkEnabled)")          \
   18.16                                                                              \
   18.17 +  product(bool, CMSEdenChunksRecordAlways, true,                            \
   18.18 +          "Whether to always record eden chunks used for "                  \
   18.19 +          "the parallel initial mark or remark of eden" )                   \
   18.20 +                                                                            \
   18.21 +  product(bool, CMSPrintEdenSurvivorChunks, false,                          \
   18.22 +          "Print the eden and the survivor chunks used for the parallel "   \
   18.23 +          "initial mark or remark of the eden/survivor spaces")             \
   18.24 +                                                                            \
   18.25    product(bool, CMSConcurrentMTEnabled, true,                               \
   18.26            "Whether multi-threaded concurrent work enabled (if ParNewGC)")   \
   18.27                                                                              \
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/gc/arguments/TestG1HeapRegionSize.java	Fri Aug 09 14:30:08 2013 +0100
    19.3 @@ -0,0 +1,64 @@
    19.4 +/*
    19.5 +* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    19.6 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 +*
    19.8 +* This code is free software; you can redistribute it and/or modify it
    19.9 +* under the terms of the GNU General Public License version 2 only, as
   19.10 +* published by the Free Software Foundation.
   19.11 +*
   19.12 +* This code is distributed in the hope that it will be useful, but WITHOUT
   19.13 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.14 +* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.15 +* version 2 for more details (a copy is included in the LICENSE file that
   19.16 +* accompanied this code).
   19.17 +*
   19.18 +* You should have received a copy of the GNU General Public License version
   19.19 +* 2 along with this work; if not, write to the Free Software Foundation,
   19.20 +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.21 +*
   19.22 +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   19.23 +* or visit www.oracle.com if you need additional information or have any
   19.24 +* questions.
   19.25 +*/
   19.26 +
   19.27 +/*
   19.28 + * @test TestG1HeapRegionSize
   19.29 + * @key gc
   19.30 + * @bug 8021879
   19.31 + * @summary Verify that the flag G1HeapRegionSize is updated properly
   19.32 + * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
   19.33 + * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
   19.34 + * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
   19.35 + * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
   19.36 + */
   19.37 +
   19.38 +import sun.management.ManagementFactoryHelper;
   19.39 +import com.sun.management.HotSpotDiagnosticMXBean;
   19.40 +import com.sun.management.VMOption;
   19.41 +
   19.42 +public class TestG1HeapRegionSize {
   19.43 +
   19.44 +  public static void main(String[] args) {
   19.45 +    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
   19.46 +
   19.47 +    VMOption option = diagnostic.getVMOption("UseG1GC");
   19.48 +    if (option.getValue().equals("false")) {
   19.49 +      System.out.println("Skipping this test. It is only a G1 test.");
   19.50 +      return;
   19.51 +    }
   19.52 +
   19.53 +    String expectedValue = getExpectedValue(args);
   19.54 +    option = diagnostic.getVMOption("G1HeapRegionSize");
   19.55 +    if (!expectedValue.equals(option.getValue())) {
   19.56 +      throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
   19.57 +    }
   19.58 +  }
   19.59 +
   19.60 +  private static String getExpectedValue(String[] args) {
   19.61 +    if (args.length != 1) {
   19.62 +      throw new RuntimeException("Wrong number of arguments. Expected 1 but got " + args.length);
   19.63 +    }
   19.64 +    return args[0];
   19.65 +  }
   19.66 +
   19.67 +}
    20.1 --- a/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Fri Aug 09 11:03:33 2013 +0400
    20.2 +++ b/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Fri Aug 09 14:30:08 2013 +0100
    20.3 @@ -27,7 +27,7 @@
    20.4   * @bug 8014240
    20.5   * @summary Test output of G1PrintRegionRememberedSetInfo
    20.6   * @library /testlibrary
    20.7 - * @build TestPrintRegionRememberedSetInfo
    20.8 + * @run main TestPrintRegionRememberedSetInfo
    20.9   * @author thomas.schatzl@oracle.com
   20.10   */
   20.11  
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java	Fri Aug 09 14:30:08 2013 +0100
    21.3 @@ -0,0 +1,44 @@
    21.4 +/*
    21.5 +* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    21.6 +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 +*
    21.8 +* This code is free software; you can redistribute it and/or modify it
    21.9 +* under the terms of the GNU General Public License version 2 only, as
   21.10 +* published by the Free Software Foundation.
   21.11 +*
   21.12 +* This code is distributed in the hope that it will be useful, but WITHOUT
   21.13 +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.14 +* FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.15 +* version 2 for more details (a copy is included in the LICENSE file that
   21.16 +* accompanied this code).
   21.17 +*
   21.18 +* You should have received a copy of the GNU General Public License version
   21.19 +* 2 along with this work; if not, write to the Free Software Foundation,
   21.20 +* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.21 +*
   21.22 +* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.23 +* or visit www.oracle.com if you need additional information or have any
   21.24 +* questions.
   21.25 +*/
   21.26 +
   21.27 +/*
   21.28 +* @test TestDefaultMaxRAMFraction
   21.29 +* @key gc
   21.30 +* @bug 8021967
   21.31 +* @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message
   21.32 +* @library /testlibrary
   21.33 +*/
   21.34 +
   21.35 +import com.oracle.java.testlibrary.OutputAnalyzer;
   21.36 +import com.oracle.java.testlibrary.ProcessTools;
   21.37 +
   21.38 +public class TestDefaultMaxRAMFraction {
   21.39 +  public static void main(String[] args) throws Exception {
   21.40 +    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:DefaultMaxRAMFraction=4", "-version");
   21.41 +    OutputAnalyzer output = new OutputAnalyzer(pb.start());
   21.42 +    output.shouldContain("warning: DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. Use MaxRAMFraction instead.");
   21.43 +    output.shouldNotContain("error");
   21.44 +    output.shouldHaveExitValue(0);
   21.45 +  }
   21.46 +
   21.47 +}
    22.1 --- a/test/runtime/6929067/Test6929067.sh	Fri Aug 09 11:03:33 2013 +0400
    22.2 +++ b/test/runtime/6929067/Test6929067.sh	Fri Aug 09 14:30:08 2013 +0100
    22.3 @@ -3,6 +3,7 @@
    22.4  ##
    22.5  ## @test Test6929067.sh
    22.6  ## @bug 6929067
    22.7 +## @bug 8021296
    22.8  ## @summary Stack guard pages should be removed when thread is detached
    22.9  ## @compile T.java
   22.10  ## @run shell Test6929067.sh
   22.11 @@ -21,6 +22,11 @@
   22.12  OS=`uname -s`
   22.13  case "$OS" in
   22.14    Linux)
   22.15 +    gcc_cmd=`which gcc`
   22.16 +    if [ "x$gcc_cmd" == "x" ]; then
   22.17 +        echo "WARNING: gcc not found. Cannot execute test." 2>&1
   22.18 +        exit 0;
   22.19 +    fi
   22.20      NULL=/dev/null
   22.21      PS=":"
   22.22      FS="/"
   22.23 @@ -119,10 +125,10 @@
   22.24  # Check to ensure you have a /usr/lib/libpthread.so if you don't please look
   22.25  # for /usr/lib/`uname -m`-linux-gnu version ensure to add that path to below compilation.
   22.26  
   22.27 -gcc -DLINUX ${COMP_FLAG} -o invoke \
   22.28 -  -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
   22.29 -  -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
   22.30 -  -ljvm -lpthread invoke.c
   22.31 +$gcc_cmd -DLINUX ${COMP_FLAG} -o invoke \
   22.32 +    -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \
   22.33 +    -L${COMPILEJAVA}/jre/lib/${ARCH}/${VMTYPE} \
   22.34 +    -ljvm -lpthread invoke.c
   22.35  
   22.36  ./invoke
   22.37  exit $?
    23.1 --- a/test/runtime/7107135/Test7107135.sh	Fri Aug 09 11:03:33 2013 +0400
    23.2 +++ b/test/runtime/7107135/Test7107135.sh	Fri Aug 09 14:30:08 2013 +0100
    23.3 @@ -27,6 +27,7 @@
    23.4  ##
    23.5  ## @test Test7107135.sh
    23.6  ## @bug 7107135
    23.7 +## @bug 8021296
    23.8  ## @summary Stack guard pages lost after loading library with executable stack.
    23.9  ## @run shell Test7107135.sh
   23.10  ##
   23.11 @@ -45,6 +46,11 @@
   23.12  case "$OS" in
   23.13    Linux)
   23.14      echo "Testing on Linux"
   23.15 +    gcc_cmd=`which gcc`
   23.16 +    if [ "x$gcc_cmd" == "x" ]; then
   23.17 +        echo "WARNING: gcc not found. Cannot execute test." 2>&1
   23.18 +        exit 0;
   23.19 +    fi
   23.20      ;;
   23.21    *)
   23.22      NULL=NUL
   23.23 @@ -62,7 +68,10 @@
   23.24  cp ${TESTSRC}${FS}*.java ${THIS_DIR}
   23.25  ${TESTJAVA}${FS}bin${FS}javac *.java
   23.26  
   23.27 -gcc -fPIC -shared -c -o test.o -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux ${TESTSRC}${FS}test.c
   23.28 +$gcc_cmd -fPIC -shared -c -o test.o \
   23.29 +    -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \
   23.30 +    ${TESTSRC}${FS}test.c
   23.31 +
   23.32  ld -shared -z   execstack -o libtest-rwx.so test.o
   23.33  ld -shared -z noexecstack -o libtest-rw.so  test.o
   23.34  
    24.1 --- a/test/runtime/jsig/Test8017498.sh	Fri Aug 09 11:03:33 2013 +0400
    24.2 +++ b/test/runtime/jsig/Test8017498.sh	Fri Aug 09 14:30:08 2013 +0100
    24.3 @@ -27,6 +27,7 @@
    24.4  ## @test Test8017498.sh
    24.5  ## @bug 8017498
    24.6  ## @bug 8020791
    24.7 +## @bug 8021296
    24.8  ## @summary sigaction(sig) results in process hang/timed-out if sig is much greater than SIGRTMAX
    24.9  ## @run shell/timeout=30 Test8017498.sh
   24.10  ##
   24.11 @@ -45,6 +46,11 @@
   24.12  case "$OS" in
   24.13    Linux)
   24.14      echo "Testing on Linux"
   24.15 +    gcc_cmd=`which gcc`
   24.16 +    if [ "x$gcc_cmd" == "x" ]; then
   24.17 +        echo "WARNING: gcc not found. Cannot execute test." 2>&1
   24.18 +        exit 0;
   24.19 +    fi
   24.20      if [ "$VM_BITS" = "64" ]
   24.21      then
   24.22          MY_LD_PRELOAD=${TESTJAVA}${FS}jre${FS}lib${FS}amd64${FS}libjsig.so
   24.23 @@ -64,15 +70,11 @@
   24.24  cp ${TESTSRC}${FS}*.java ${THIS_DIR}
   24.25  ${TESTJAVA}${FS}bin${FS}javac *.java
   24.26  
   24.27 -gcc -DLINUX -fPIC -shared \
   24.28 +$gcc_cmd -DLINUX -fPIC -shared \
   24.29      -o ${TESTSRC}${FS}libTestJNI.so \
   24.30      -I${TESTJAVA}${FS}include \
   24.31      -I${TESTJAVA}${FS}include${FS}linux \
   24.32      ${TESTSRC}${FS}TestJNI.c
   24.33 -if [ $? != 0 ]
   24.34 -then
   24.35 -    echo "WARNING: the gcc command failed." 2>&1
   24.36 -fi
   24.37  
   24.38  # run the java test in the background
   24.39  cmd="LD_PRELOAD=$MY_LD_PRELOAD \
    25.1 --- a/test/runtime/jsig/TestJNI.c	Fri Aug 09 11:03:33 2013 +0400
    25.2 +++ b/test/runtime/jsig/TestJNI.c	Fri Aug 09 14:30:08 2013 +0100
    25.3 @@ -21,7 +21,6 @@
    25.4   * questions.
    25.5   */
    25.6  
    25.7 -#define _GNU_SOURCE // for the definition of REG_RIP in ucontext.h
    25.8  #include <stdio.h>
    25.9  #include <jni.h>
   25.10  #include <signal.h>
   25.11 @@ -32,11 +31,8 @@
   25.12  #endif
   25.13  
   25.14  void sig_handler(int sig, siginfo_t *info, ucontext_t *context) {
   25.15 -    int thrNum;
   25.16  
   25.17      printf( " HANDLER (1) " );
   25.18 -    // Move forward RIP to skip failing instruction
   25.19 -    context->uc_mcontext.gregs[REG_RIP] += 6;
   25.20  }
   25.21  
   25.22  JNIEXPORT void JNICALL Java_TestJNI_doSomething(JNIEnv *env, jclass klass, jint val) {

mercurial