8147634: Need a JImage API that given a JImageLocationRef returns class name

Reviewed-by: hseigel
This commit is contained in:
Jim Laskey 2016-04-25 09:59:43 -03:00
parent c95df8b9fe
commit ce076f3ab9
2 changed files with 26 additions and 6 deletions

View File

@ -98,12 +98,13 @@ static Crc32_t Crc32 = NULL;
// Entry points for jimage.dll for loading jimage file entries
static JImageOpen_t JImageOpen = NULL;
static JImageClose_t JImageClose = NULL;
static JImagePackageToModule_t JImagePackageToModule = NULL;
static JImageFindResource_t JImageFindResource = NULL;
static JImageGetResource_t JImageGetResource = NULL;
static JImageResourceIterator_t JImageResourceIterator = NULL;
static JImageOpen_t JImageOpen = NULL;
static JImageClose_t JImageClose = NULL;
static JImagePackageToModule_t JImagePackageToModule = NULL;
static JImageFindResource_t JImageFindResource = NULL;
static JImageGetResource_t JImageGetResource = NULL;
static JImageResourceIterator_t JImageResourceIterator = NULL;
static JImage_ResourcePath_t JImageResourcePath = NULL;
// Globals
@ -925,6 +926,8 @@ void ClassLoader::load_jimage_library() {
guarantee(JImageGetResource != NULL, "function JIMAGE_GetResource not found");
JImageResourceIterator = CAST_TO_FN_PTR(JImageResourceIterator_t, os::dll_lookup(handle, "JIMAGE_ResourceIterator"));
guarantee(JImageResourceIterator != NULL, "function JIMAGE_ResourceIterator not found");
JImageResourcePath = CAST_TO_FN_PTR(JImage_ResourcePath_t, os::dll_lookup(handle, "JIMAGE_ResourcePath"));
guarantee(JImageResourcePath != NULL, "function JIMAGE_ResourcePath not found");
}
jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {

View File

@ -179,3 +179,20 @@ extern "C" void JIMAGE_ResourceIterator(JImageFile* jimage,
typedef void (*JImageResourceIterator_t)(JImageFile* jimage,
JImageResourceVisitor_t visitor, void* arg);
/*
* JIMAGE_ResourcePath- Given an open image file, a location reference, a buffer
* and a maximum buffer size, copy the path of the resource into the buffer.
* Returns false if not a valid location reference.
*
* Ex.
* JImageLocationRef location = ...
* char path[JIMAGE_MAX_PATH];
* (*JImageResourcePath)(image, location, path, JIMAGE_MAX_PATH);
*/
extern "C" bool JIMAGE_ResourcePath(JImageFile* image, JImageLocationRef locationRef,
char* path, size_t max);
typedef bool (*JImage_ResourcePath_t)(JImageFile* jimage, JImageLocationRef location,
char* buffer, jlong size);