hotspot/src/share/vm/gc/g1/g1ConcurrentMark.hpp
changeset 46319 a587da3329a5
parent 42597 a9611bab7578
child 46328 6061df52d610
equal deleted inserted replaced
46318:7f0d7841839f 46319:a587da3329a5
     1 /*
     1 /*
     2  * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   190 
   190 
   191   // Allocate a new chunk from the reserved memory, using the high water mark. Returns
   191   // Allocate a new chunk from the reserved memory, using the high water mark. Returns
   192   // NULL if out of memory.
   192   // NULL if out of memory.
   193   OopChunk* allocate_new_chunk();
   193   OopChunk* allocate_new_chunk();
   194 
   194 
   195   volatile bool _out_of_memory;
       
   196 
       
   197   // Atomically add the given chunk to the list.
   195   // Atomically add the given chunk to the list.
   198   void add_chunk_to_list(OopChunk* volatile* list, OopChunk* elem);
   196   void add_chunk_to_list(OopChunk* volatile* list, OopChunk* elem);
   199   // Atomically remove and return a chunk from the given list. Returns NULL if the
   197   // Atomically remove and return a chunk from the given list. Returns NULL if the
   200   // list is empty.
   198   // list is empty.
   201   OopChunk* remove_chunk_from_list(OopChunk* volatile* list);
   199   OopChunk* remove_chunk_from_list(OopChunk* volatile* list);
   237   // Return whether the chunk list is empty. Racy due to unsynchronized access to
   235   // Return whether the chunk list is empty. Racy due to unsynchronized access to
   238   // _chunk_list.
   236   // _chunk_list.
   239   bool is_empty() const { return _chunk_list == NULL; }
   237   bool is_empty() const { return _chunk_list == NULL; }
   240 
   238 
   241   size_t capacity() const  { return _chunk_capacity; }
   239   size_t capacity() const  { return _chunk_capacity; }
   242 
       
   243   bool is_out_of_memory() const { return _out_of_memory; }
       
   244   void clear_out_of_memory() { _out_of_memory = false; }
       
   245 
   240 
   246   bool should_expand() const { return _should_expand; }
   241   bool should_expand() const { return _should_expand; }
   247   void set_should_expand(bool value) { _should_expand = value; }
   242   void set_should_expand(bool value) { _should_expand = value; }
   248 
   243 
   249   // Expand the stack, typically in response to an overflow condition
   244   // Expand the stack, typically in response to an overflow condition
   430   // task local ones; should be called during initial mark.
   425   // task local ones; should be called during initial mark.
   431   void reset();
   426   void reset();
   432 
   427 
   433   // Resets all the marking data structures. Called when we have to restart
   428   // Resets all the marking data structures. Called when we have to restart
   434   // marking or when marking completes (via set_non_marking_state below).
   429   // marking or when marking completes (via set_non_marking_state below).
   435   void reset_marking_state(bool clear_overflow = true);
   430   void reset_marking_state();
   436 
   431 
   437   // We do this after we're done with marking so that the marking data
   432   // We do this after we're done with marking so that the marking data
   438   // structures are initialized to a sensible and predictable state.
   433   // structures are initialized to a sensible and predictable state.
   439   void set_non_marking_state();
   434   void set_non_marking_state();
   440 
   435 
   541   bool mark_stack_pop(oop* arr) {
   536   bool mark_stack_pop(oop* arr) {
   542     return _global_mark_stack.par_pop_chunk(arr);
   537     return _global_mark_stack.par_pop_chunk(arr);
   543   }
   538   }
   544   size_t mark_stack_size()                { return _global_mark_stack.size(); }
   539   size_t mark_stack_size()                { return _global_mark_stack.size(); }
   545   size_t partial_mark_stack_size_target() { return _global_mark_stack.capacity()/3; }
   540   size_t partial_mark_stack_size_target() { return _global_mark_stack.capacity()/3; }
   546   bool mark_stack_overflow()              { return _global_mark_stack.is_out_of_memory(); }
       
   547   bool mark_stack_empty()                 { return _global_mark_stack.is_empty(); }
   541   bool mark_stack_empty()                 { return _global_mark_stack.is_empty(); }
   548 
   542 
   549   G1CMRootRegions* root_regions() { return &_root_regions; }
   543   G1CMRootRegions* root_regions() { return &_root_regions; }
   550 
   544 
   551   bool concurrent_marking_in_progress() {
   545   bool concurrent_marking_in_progress() {