src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp

changeset 3328
6d7d0790074d
parent 3294
bca17e38de00
child 3900
d2a62e0f25eb
     1.1 --- a/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Fri Dec 09 06:46:57 2011 -0800
     1.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp	Fri Dec 09 19:28:34 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2002, 2011, 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 @@ -53,6 +53,9 @@
    1.11    case noop_task:
    1.12      result = "noop task";
    1.13      break;
    1.14 +  case idle_task:
    1.15 +    result = "idle task";
    1.16 +    break;
    1.17    }
    1.18    return result;
    1.19  };
    1.20 @@ -782,6 +785,12 @@
    1.21  void GCTaskManager::execute_and_wait(GCTaskQueue* list) {
    1.22    WaitForBarrierGCTask* fin = WaitForBarrierGCTask::create();
    1.23    list->enqueue(fin);
    1.24 +  // The barrier task will be read by one of the GC
    1.25 +  // workers once it is added to the list of tasks.
    1.26 +  // Be sure that is globally visible before the
    1.27 +  // GC worker reads it (which is after the task is added
    1.28 +  // to the list of tasks below).
    1.29 +  OrderAccess::storestore();
    1.30    add_list(list);
    1.31    fin->wait_for(true /* reset */);
    1.32    // We have to release the barrier tasks!
    1.33 @@ -833,11 +842,15 @@
    1.34  
    1.35  IdleGCTask* IdleGCTask::create() {
    1.36    IdleGCTask* result = new IdleGCTask(false);
    1.37 +  assert(UseDynamicNumberOfGCThreads,
    1.38 +    "Should only be used with dynamic GC thread");
    1.39    return result;
    1.40  }
    1.41  
    1.42  IdleGCTask* IdleGCTask::create_on_c_heap() {
    1.43    IdleGCTask* result = new(ResourceObj::C_HEAP) IdleGCTask(true);
    1.44 +  assert(UseDynamicNumberOfGCThreads,
    1.45 +    "Should only be used with dynamic GC thread");
    1.46    return result;
    1.47  }
    1.48  

mercurial