< prev index next >

src/share/vm/memory/filemap.cpp

Print this page




 133   if (version_len < (JVM_IDENT_MAX-1)) {
 134     strcpy(header_version, vm_version);
 135 
 136   } else {
 137     // Get the hash value.  Use a static seed because the hash needs to return the same
 138     // value over multiple jvm invocations.
 139     unsigned int hash = AltHashing::murmur3_32(8191, (const jbyte*)vm_version, version_len);
 140 
 141     // Truncate the ident, saving room for the 8 hex character hash value.
 142     strncpy(header_version, vm_version, JVM_IDENT_MAX-9);
 143 
 144     // Append the hash code as eight hex digits.
 145     sprintf(&header_version[JVM_IDENT_MAX-9], "%08x", hash);
 146     header_version[JVM_IDENT_MAX-1] = 0;  // Null terminate.
 147   }
 148 }
 149 
 150 FileMapInfo::FileMapInfo() {
 151   assert(_current_info == NULL, "must be singleton"); // not thread safe
 152   _current_info = this;
 153   memset(this, 0, sizeof(FileMapInfo));
 154   _file_offset = 0;
 155   _file_open = false;
 156   _header = SharedClassUtil::allocate_file_map_header();
 157   _header->_version = _invalid_version;
 158 }
 159 
 160 FileMapInfo::~FileMapInfo() {
 161   assert(_current_info == this, "must be singleton"); // not thread safe
 162   _current_info = NULL;
 163 }
 164 
 165 void FileMapInfo::populate_header(size_t alignment) {
 166   _header->populate(this, alignment);
 167 }
 168 
 169 size_t FileMapInfo::FileMapHeader::data_size() {
 170   return SharedClassUtil::file_map_header_size() - sizeof(FileMapInfo::FileMapHeaderBase);
 171 }
 172 
 173 void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) {




 133   if (version_len < (JVM_IDENT_MAX-1)) {
 134     strcpy(header_version, vm_version);
 135 
 136   } else {
 137     // Get the hash value.  Use a static seed because the hash needs to return the same
 138     // value over multiple jvm invocations.
 139     unsigned int hash = AltHashing::murmur3_32(8191, (const jbyte*)vm_version, version_len);
 140 
 141     // Truncate the ident, saving room for the 8 hex character hash value.
 142     strncpy(header_version, vm_version, JVM_IDENT_MAX-9);
 143 
 144     // Append the hash code as eight hex digits.
 145     sprintf(&header_version[JVM_IDENT_MAX-9], "%08x", hash);
 146     header_version[JVM_IDENT_MAX-1] = 0;  // Null terminate.
 147   }
 148 }
 149 
 150 FileMapInfo::FileMapInfo() {
 151   assert(_current_info == NULL, "must be singleton"); // not thread safe
 152   _current_info = this;
 153   memset((void*)this, 0, sizeof(FileMapInfo));
 154   _file_offset = 0;
 155   _file_open = false;
 156   _header = SharedClassUtil::allocate_file_map_header();
 157   _header->_version = _invalid_version;
 158 }
 159 
 160 FileMapInfo::~FileMapInfo() {
 161   assert(_current_info == this, "must be singleton"); // not thread safe
 162   _current_info = NULL;
 163 }
 164 
 165 void FileMapInfo::populate_header(size_t alignment) {
 166   _header->populate(this, alignment);
 167 }
 168 
 169 size_t FileMapInfo::FileMapHeader::data_size() {
 170   return SharedClassUtil::file_map_header_size() - sizeof(FileMapInfo::FileMapHeaderBase);
 171 }
 172 
 173 void FileMapInfo::FileMapHeader::populate(FileMapInfo* mapinfo, size_t alignment) {


< prev index next >