1 /*
   2  * Copyright (c) 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  *
  23  */
  24 
  25 #include "gc/shared/collectedHeap.hpp"
  26 #include "gc/shared/gc.hpp"
  27 #include "logging/log.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "utilities/debug.hpp"
  30 #include "utilities/globalDefinitions.hpp"
  31 
  32 jint GC::initialize_heap() {
  33   jint status = JNI_ERR;
  34   _heap = create_heap();
  35   assert(_heap != NULL, "heap not created");
  36   status = _heap->initialize();
  37 
  38   log_info(gc)("Using %s", _heap->name());
  39 
  40   return status;
  41 
  42 }
  43 
  44 GC* GC::gc() {
  45   // assert(_gc != NULL, "GC not yet created");
  46   return _gc;
  47 }
  48 
  49 bool GC::is_initialized() {
  50   return _gc != NULL;
  51 }
  52 
  53 CollectedHeap* GC::heap() const {
  54   assert(_heap != NULL, "Heap not yet created");
  55   return _heap;
  56 }
  57 
  58 void GC::initialize_flags() {
  59   // Default does nothing.
  60 }
  61 
  62 GCServicabilitySupport* GC::servicability_support() {
  63   if (_servicability == NULL) {
  64     _servicability = create_servicability_support();
  65   }
  66   return _servicability;
  67 }
  68 
  69 void GC::synchronize_safepoint() {
  70   // No-op by default.
  71 }
  72 
  73 void GC::desynchronize_safepoint() {
  74   // No-op by default.
  75 }