Mercurial > hg > truffle
diff src/share/vm/memory/filemap.hpp @ 20730:8210e5f2e21b
8044269: Analysis of archive files.
Summary: Add checksum verification.
Reviewed-by: iklam, dholmes, mschoene
author | jiangli |
---|---|
date | Tue, 12 Aug 2014 17:46:16 -0400 |
parents | 85c1ca43713f |
children | 8cb56c8cb30d |
line wrap: on
line diff
--- a/src/share/vm/memory/filemap.hpp Fri Aug 08 15:15:52 2014 -0700 +++ b/src/share/vm/memory/filemap.hpp Tue Aug 12 17:46:16 2014 -0400 @@ -54,7 +54,7 @@ bool _file_open; int _fd; - long _file_offset; + size_t _file_offset; // 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 @@ -62,12 +62,14 @@ 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 struct space_info { - int _file_offset; // sizeof(this) rounded to vm page size + int _crc; // crc checksum of the current space + size_t _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 @@ -104,6 +106,8 @@ } static int current_version() { return _current_version; } + int compute_header_crc(); + void set_header_crc(int crc) { _header._crc = crc; } void populate_header(size_t alignment); bool validate(); void invalidate(); @@ -136,6 +140,7 @@ void write_bytes_aligned(const void* buffer, int count); char* map_region(int i); void unmap_region(int i); + bool verify_region_checksum(int i); void close(); bool is_open() { return _file_open; } ReservedSpace reserve_shared_memory();