src/hotspot/share/include/cds.h
author iklam
Tue, 27 Aug 2019 22:14:52 -0700
changeset 57898 5ddb746d45e0
parent 55698 284ac8027efa
child 58096 0d97bf7cf8a4
permissions -rw-r--r--
8227370: Remove SharedPathsMiscInfo Reviewed-by: ccheung, jiangli

/*
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 *
 */

#ifndef SHARE_INCLUDE_CDS_H
#define SHARE_INCLUDE_CDS_H

// This file declares the CDS data structures that are used by the HotSpot Serviceability Agent
// (see C sources inside src/jdk.hotspot.agent).
//
// We should use only standard C types. Do not use custom types such as bool, intx,
// etc, to avoid introducing unnecessary dependencies to other HotSpot type declarations.
//
// Also, this is a C header file. Do not use C++ here.

#define NUM_CDS_REGIONS 8 // this must be the same as MetaspaceShared::n_regions
#define CDS_ARCHIVE_MAGIC 0xf00baba2
#define CDS_DYNAMIC_ARCHIVE_MAGIC 0xf00baba8
#define CURRENT_CDS_ARCHIVE_VERSION 7
#define INVALID_CDS_ARCHIVE_VERSION -1

struct CDSFileMapRegion {
  int        _crc;           // crc checksum of the current space
  size_t     _file_offset;   // sizeof(this) rounded to vm page size
  union {
    char*    _base;          // copy-on-write base address
    size_t   _offset;        // offset from the compressed oop encoding base, only used
                             // by archive heap space
  } _addr;
  size_t     _used;          // for setting space top on read
  int        _read_only;     // read only space?
  int        _allow_exec;    // executable code in space?
  void*      _oopmap;        // bitmap for relocating embedded oops
  size_t     _oopmap_size_in_bits;
};

struct CDSFileMapHeaderBase {
  unsigned int _magic;           // identify file type
  int          _crc;             // header crc checksum
  int          _version;         // must be CURRENT_CDS_ARCHIVE_VERSION
  struct CDSFileMapRegion _space[NUM_CDS_REGIONS];
};

typedef struct CDSFileMapHeaderBase CDSFileMapHeaderBase;

#endif // SHARE_INCLUDE_CDS_H