8080511: Refresh of jimage support

Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: alanb, mchung, psandoz, acorn, lfoltan, ctornqvi
This commit is contained in:
Jean-Francois Denise 2015-06-25 18:25:19 +02:00
parent 6684a41c5d
commit aaac2cbb54
40 changed files with 2815 additions and 322 deletions

View file

@ -32,9 +32,14 @@
// The VM class loader.
#include <sys/stat.h>
// Name of boot module image
#define BOOT_IMAGE_NAME "bootmodules.jimage"
// Class path entry (directory or zip file)
class ImageFileReader;
class ImageModuleData;
class ClassPathEntry: public CHeapObj<mtClass> {
private:
ClassPathEntry* _next;
@ -47,6 +52,7 @@ class ClassPathEntry: public CHeapObj<mtClass> {
}
virtual bool is_jar_file() = 0;
virtual const char* name() = 0;
virtual ImageFileReader* image() = 0;
virtual bool is_lazy();
// Constructor
ClassPathEntry();
@ -63,8 +69,9 @@ class ClassPathDirEntry: public ClassPathEntry {
private:
const char* _dir; // Name of directory
public:
bool is_jar_file() { return false; }
const char* name() { return _dir; }
bool is_jar_file() { return false; }
const char* name() { return _dir; }
ImageFileReader* image() { return NULL; }
ClassPathDirEntry(const char* dir);
ClassFileStream* open_stream(const char* name, TRAPS);
// Debugging
@ -92,8 +99,9 @@ class ClassPathZipEntry: public ClassPathEntry {
jzfile* _zip; // The zip archive
const char* _zip_name; // Name of zip archive
public:
bool is_jar_file() { return true; }
const char* name() { return _zip_name; }
bool is_jar_file() { return true; }
const char* name() { return _zip_name; }
ImageFileReader* image() { return NULL; }
ClassPathZipEntry(jzfile* zip, const char* zip_name);
~ClassPathZipEntry();
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
@ -116,7 +124,8 @@ class LazyClassPathEntry: public ClassPathEntry {
ClassPathEntry* resolve_entry(TRAPS);
public:
bool is_jar_file();
const char* name() { return _path; }
const char* name() { return _path; }
ImageFileReader* image() { return NULL; }
LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception);
virtual ~LazyClassPathEntry();
u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS);
@ -129,15 +138,17 @@ class LazyClassPathEntry: public ClassPathEntry {
};
// For java image files
class ImageFile;
class ClassPathImageEntry: public ClassPathEntry {
private:
ImageFile *_image;
ImageFileReader* _image;
ImageModuleData* _module_data;
public:
bool is_jar_file() { return false; }
bool is_open() { return _image != NULL; }
const char* name();
ClassPathImageEntry(char* name);
ImageFileReader* image() { return _image; }
ImageModuleData* module_data() { return _module_data; }
ClassPathImageEntry(ImageFileReader* image);
~ClassPathImageEntry();
ClassFileStream* open_stream(const char* name, TRAPS);