comparison src/share/vm/classfile/classLoader.cpp @ 20527:8cb56c8cb30d

Merge
author jiangli
date Mon, 15 Sep 2014 16:39:00 -0400
parents bb239308be67 ca6d25be853b
children f0bedf980c65
comparison
equal deleted inserted replaced
20411:fe1f65b0a2d8 20527:8cb56c8cb30d
88 typedef void (JNICALL *ZipClose_t)(jzfile *zip); 88 typedef void (JNICALL *ZipClose_t)(jzfile *zip);
89 typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint *nameLen); 89 typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *sizeP, jint *nameLen);
90 typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf); 90 typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
91 typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf); 91 typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
92 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n); 92 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
93 typedef jint (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
93 94
94 static ZipOpen_t ZipOpen = NULL; 95 static ZipOpen_t ZipOpen = NULL;
95 static ZipClose_t ZipClose = NULL; 96 static ZipClose_t ZipClose = NULL;
96 static FindEntry_t FindEntry = NULL; 97 static FindEntry_t FindEntry = NULL;
97 static ReadEntry_t ReadEntry = NULL; 98 static ReadEntry_t ReadEntry = NULL;
98 static ReadMappedEntry_t ReadMappedEntry = NULL; 99 static ReadMappedEntry_t ReadMappedEntry = NULL;
99 static GetNextEntry_t GetNextEntry = NULL; 100 static GetNextEntry_t GetNextEntry = NULL;
100 static canonicalize_fn_t CanonicalizeEntry = NULL; 101 static canonicalize_fn_t CanonicalizeEntry = NULL;
102 static Crc32_t Crc32 = NULL;
101 103
102 // Globals 104 // Globals
103 105
104 PerfCounter* ClassLoader::_perf_accumulated_time = NULL; 106 PerfCounter* ClassLoader::_perf_accumulated_time = NULL;
105 PerfCounter* ClassLoader::_perf_classes_inited = NULL; 107 PerfCounter* ClassLoader::_perf_classes_inited = NULL;
808 ZipClose = CAST_TO_FN_PTR(ZipClose_t, os::dll_lookup(handle, "ZIP_Close")); 810 ZipClose = CAST_TO_FN_PTR(ZipClose_t, os::dll_lookup(handle, "ZIP_Close"));
809 FindEntry = CAST_TO_FN_PTR(FindEntry_t, os::dll_lookup(handle, "ZIP_FindEntry")); 811 FindEntry = CAST_TO_FN_PTR(FindEntry_t, os::dll_lookup(handle, "ZIP_FindEntry"));
810 ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry")); 812 ReadEntry = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
811 ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry")); 813 ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
812 GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry")); 814 GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
815 Crc32 = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
813 816
814 // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL 817 // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
815 if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL || GetNextEntry == NULL) { 818 if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL ||
819 GetNextEntry == NULL || Crc32 == NULL) {
816 vm_exit_during_initialization("Corrupted ZIP library", path); 820 vm_exit_during_initialization("Corrupted ZIP library", path);
817 } 821 }
818 822
819 // Lookup canonicalize entry in libjava.dll 823 // Lookup canonicalize entry in libjava.dll
820 void *javalib_handle = os::native_java_library(); 824 void *javalib_handle = os::native_java_library();
821 CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize")); 825 CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
822 // This lookup only works on 1.3. Do not check for non-null here 826 // This lookup only works on 1.3. Do not check for non-null here
827 }
828
829 int ClassLoader::crc32(int crc, const char* buf, int len) {
830 assert(Crc32 != NULL, "ZIP_CRC32 is not found");
831 return (*Crc32)(crc, (const jbyte*)buf, len);
823 } 832 }
824 833
825 // PackageInfo data exists in order to support the java.lang.Package 834 // PackageInfo data exists in order to support the java.lang.Package
826 // class. A Package object provides information about a java package 835 // class. A Package object provides information about a java package
827 // (version, vendor, etc.) which originates in the manifest of the jar 836 // (version, vendor, etc.) which originates in the manifest of the jar