< prev index next >
src/jdk.hotspot.agent/solaris/native/libsaproc/saproc.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2002, 2016, 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.
--- 1,7 ----
/*
! * Copyright (c) 2002, 2018, 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.
*** 494,526 ****
// FileMapHeader describes the shared space data in the file to be
// mapped. This structure gets written to a file. It is not a class, so
// that the compilers don't add any compiler-private data to it.
! const int NUM_SHARED_MAPS = 4;
// Refer to FileMapInfo::_current_version in filemap.hpp
! const int CURRENT_ARCHIVE_VERSION = 1;
struct FileMapHeader {
int _magic; // identify file type.
int _version; // (from enum, above.)
size_t _alignment; // how shared archive should be aligned
struct space_info {
! int _file_offset; // sizeof(this) rounded to vm page size
char* _base; // copy-on-write base address
! size_t _capacity; // for validity checking
size_t _used; // for setting space top on read
!
! bool _read_only; // read only space?
! bool _allow_exec; // executable code in space?
!
} _space[NUM_SHARED_MAPS];
! // Ignore the rest of the FileMapHeader. We don't need those fields here.
};
static bool
read_jboolean(struct ps_prochandle* ph, psaddr_t addr, jboolean* pvalue) {
jboolean i;
--- 494,551 ----
// FileMapHeader describes the shared space data in the file to be
// mapped. This structure gets written to a file. It is not a class, so
// that the compilers don't add any compiler-private data to it.
! const int NUM_SHARED_MAPS = 9;
// Refer to FileMapInfo::_current_version in filemap.hpp
! const int CURRENT_ARCHIVE_VERSION = 3;
!
! typedef unsigned char* address;
! typedef uintptr_t uintx;
! typedef intptr_t intx;
struct FileMapHeader {
int _magic; // identify file type.
+ int _crc; // header crc checksum.
int _version; // (from enum, above.)
size_t _alignment; // how shared archive should be aligned
+ int _obj_alignment; // value of ObjectAlignmentInBytes
+ address _narrow_oop_base; // compressed oop encoding base
+ int _narrow_oop_shift; // compressed oop encoding shift
+ bool _compact_strings; // value of CompactStrings
+ uintx _max_heap_size; // java max heap size during dumping
+ int _narrow_oop_mode; // compressed oop encoding mode
+ int _narrow_klass_shift; // save narrow klass base and shift
+ address _narrow_klass_base;
+ char* _misc_data_patching_start;
+ char* _read_only_tables_start;
+ address _cds_i2i_entry_code_buffers;
+ size_t _cds_i2i_entry_code_buffers_size;
+ size_t _core_spaces_size; // number of bytes allocated by the core spaces
+ // (mc, md, ro, rw and od).
struct space_info {
! 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
! intx _offset; // offset from the compressed oop encoding base, only used
! // by archive heap space
! } _addr;
size_t _used; // for setting space top on read
! // 4991491 NOTICE These are C++ bool's in filemap.hpp and must match up with
! // the C type matching the C++ bool type on any given platform.
! // We assume the corresponding C type is char but licensees
! // may need to adjust the type of these fields.
! char _read_only; // read only space?
! char _allow_exec; // executable code in space?
} _space[NUM_SHARED_MAPS];
! // Ignore the rest of the FileMapHeader. We don't need those fields here.
};
static bool
read_jboolean(struct ps_prochandle* ph, psaddr_t addr, jboolean* pvalue) {
jboolean i;
*** 675,685 ****
}
if (_libsaproc_debug) {
for (int m = 0; m < NUM_SHARED_MAPS; m++) {
print_debug("shared file offset %d mapped at 0x%lx, size = %ld, read only? = %d\n",
! pheader->_space[m]._file_offset, pheader->_space[m]._base,
pheader->_space[m]._used, pheader->_space[m]._read_only);
}
}
// FIXME: For now, omitting other checks such as VM version etc.
--- 700,710 ----
}
if (_libsaproc_debug) {
for (int m = 0; m < NUM_SHARED_MAPS; m++) {
print_debug("shared file offset %d mapped at 0x%lx, size = %ld, read only? = %d\n",
! pheader->_space[m]._file_offset, pheader->_space[m]._addr._base,
pheader->_space[m]._used, pheader->_space[m]._read_only);
}
}
// FIXME: For now, omitting other checks such as VM version etc.
*** 1056,1074 ****
int classes_jsa_fd = env->GetIntField(this_obj, classes_jsa_fd_ID);
if (classes_jsa_fd != -1 && address != (jlong)0) {
print_debug("read failed at 0x%lx, attempting shared heap area\n", (long) address);
struct FileMapHeader* pheader = (struct FileMapHeader*) env->GetLongField(this_obj, p_file_map_header_ID);
! // walk through the shared mappings -- we just have 4 of them.
// so, linear walking is okay.
for (int m = 0; m < NUM_SHARED_MAPS; m++) {
// We can skip the non-read-only maps. These are mapped as MAP_PRIVATE
// and hence will be read by libproc. Besides, the file copy may be
// stale because the process might have modified those pages.
if (pheader->_space[m]._read_only) {
! jlong baseAddress = (jlong) (uintptr_t) pheader->_space[m]._base;
size_t usedSize = pheader->_space[m]._used;
if (address >= baseAddress && address < (baseAddress + usedSize)) {
// the given address falls in this shared heap area
print_debug("found shared map at 0x%lx\n", (long) baseAddress);
--- 1081,1099 ----
int classes_jsa_fd = env->GetIntField(this_obj, classes_jsa_fd_ID);
if (classes_jsa_fd != -1 && address != (jlong)0) {
print_debug("read failed at 0x%lx, attempting shared heap area\n", (long) address);
struct FileMapHeader* pheader = (struct FileMapHeader*) env->GetLongField(this_obj, p_file_map_header_ID);
! // walk through the shared mappings -- we just have 9 of them.
// so, linear walking is okay.
for (int m = 0; m < NUM_SHARED_MAPS; m++) {
// We can skip the non-read-only maps. These are mapped as MAP_PRIVATE
// and hence will be read by libproc. Besides, the file copy may be
// stale because the process might have modified those pages.
if (pheader->_space[m]._read_only) {
! jlong baseAddress = (jlong) (uintptr_t) pheader->_space[m]._addr._base;
size_t usedSize = pheader->_space[m]._used;
if (address >= baseAddress && address < (baseAddress + usedSize)) {
// the given address falls in this shared heap area
print_debug("found shared map at 0x%lx\n", (long) baseAddress);
< prev index next >