Compare commits

...

8 Commits

Author SHA1 Message Date
Eugene Petrenko
199d2b6e9e Support AppCDS on Windows via a variation of the older JDK fix 8185145
8185145: AppCDS custom loader support on Mac OS X
2019-10-03 14:43:38 +02:00
Eugene Petrenko
76383719c3 cds - more detailed error logging from the Xshare:dump phase 2019-10-03 01:01:37 +02:00
Eugene Petrenko
52abb8ecaa cds - advanced debug logging to diagnose listed class was not defined error from -Xshare:dump 2019-10-02 23:34:35 +02:00
Eugene Petrenko
dc83381ec0 add section for building on macOS 2019-10-02 23:34:35 +02:00
Eugene Petrenko
8d4b35841e cds - log exception along with "Preload Warning: Verification failed" warning messages 2019-10-02 23:34:34 +02:00
Eugene Petrenko
7656f2fc44 make configure script unix executable to support ./configure runs 2019-10-01 11:07:39 +02:00
Eugene Petrenko
55ba058094 git ignore .idea and cmake build folders folder under /jb 2019-10-01 11:01:01 +02:00
Calvin Cheung
f6e6b0a4ba 8185145: AppCDS custom loader support on Mac OS X
Reviewed-by: dholmes, gziemski
2019-10-01 10:58:37 +02:00
7 changed files with 48 additions and 14 deletions

View File

@@ -54,7 +54,15 @@ $ make images
#### TBD
## OSX
#### TBD
install Xcode console tools, autoconf (via homebrew)
run
```
sh ./configure --prefix=$(pwd)/build --disable-warnings-as-errors
make images
```
## Contribution
We will be happy to receive your pull requests. Before you submit one, please sign our Contributor License Agreement (CLA) https://www.jetbrains.com/agreements/cla/

0
configure vendored Normal file → Executable file
View File

2
jb/project/jdk-cmake/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
.idea
cmake-build-*

View File

@@ -274,9 +274,9 @@ void ClassListParser::error(const char *msg, ...) {
// This function is used for loading classes for customized class loaders
// during archive dumping.
InstanceKlass* ClassListParser::load_class_from_source(Symbol* class_name, TRAPS) {
#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS)))
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit
//
#if !(defined(_LP64) && (defined(LINUX)|| defined(SOLARIS) || defined(__APPLE__) || defined(_WINDOWS) ))
// The only supported platforms are: (1) Linux/64-bit and (2) Solaris/64-bit and
// (3) MacOSX/64-bit and (4) Windows/64-bit
// This #if condition should be in sync with the areCustomLoadersSupportedForCDS
// method in test/lib/jdk/test/lib/Platform.java.
error("AppCDS custom class loaders not supported on this platform");
@@ -364,7 +364,11 @@ Klass* ClassListParser::load_current_class(TRAPS) {
if (!HAS_PENDING_EXCEPTION && (obj != NULL)) {
klass = java_lang_Class::as_Klass(obj);
} else { // load classes in bootclasspath/a
tty->print_cr("Class %s was not loaded from the system classloader", this->current_class_name());
if (HAS_PENDING_EXCEPTION) {
oop throwable = PENDING_EXCEPTION;
java_lang_Throwable::print(throwable, tty);
tty->cr();
CLEAR_PENDING_EXCEPTION;
}
@@ -373,6 +377,7 @@ Klass* ClassListParser::load_current_class(TRAPS) {
if (k != NULL) {
klass = k;
} else {
tty->print_cr("Class %s is not found from SystemDictionary::resolve_or_null(..) == null", this->current_class_name());
if (!HAS_PENDING_EXCEPTION) {
THROW_NULL(vmSymbols::java_lang_ClassNotFoundException());
}

View File

@@ -270,6 +270,7 @@ InstanceKlass* ClassLoaderExt::load_class(Symbol* name, const char* path, TRAPS)
ClassFileStream* stream = NULL;
ClassPathEntry* e = find_classpath_entry_from_cache(path, CHECK_NULL);
if (e == NULL) {
tty->print_cr("Preload Warning: ClassPathEntry is not found for class %s and path %s", class_name, path);
return NULL;
}
{
@@ -336,12 +337,14 @@ ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path
struct stat st;
if (os::stat(path, &st) != 0) {
// File or directory not found
tty->print_cr("Preload Warning: Source path %s is not found", path);
return NULL;
}
ClassPathEntry* new_entry = NULL;
new_entry = create_class_path_entry(path, &st, false, false, CHECK_NULL);
if (new_entry == NULL) {
tty->print_cr("Preload Warning: The create_class_path_entry() call for path %s returned NULL", path);
return NULL;
}
ccpe._path = strdup(path);
@@ -351,5 +354,14 @@ ClassPathEntry* ClassLoaderExt::find_classpath_entry_from_cache(const char* path
}
Klass* ClassLoaderExt::load_one_class(ClassListParser* parser, TRAPS) {
return parser->load_current_class(THREAD);
Klass* result = parser->load_current_class(THREAD);
if (result == NULL) {
tty->print_cr("Preload Warning: Class %s was not loaded", parser->current_class_name());
if (HAS_PENDING_EXCEPTION) {
oop throwable = PENDING_EXCEPTION;
java_lang_Throwable::print(throwable, tty);
tty->cr();
}
}
return result;
}

View File

@@ -1736,10 +1736,16 @@ int MetaspaceShared::preload_classes(const char* class_list_path, TRAPS) {
while (parser.parse_one_line()) {
Klass* klass = ClassLoaderExt::load_one_class(&parser, THREAD);
if (HAS_PENDING_EXCEPTION) {
if (klass == NULL &&
(PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException())) {
// print a warning only when the pending exception is class not found
tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name());
if (klass == NULL) {
if (PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException()) {
// print a warning only when the pending exception is class not found
tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name());
} else {
tty->print_cr("Preload Warning: Exception loading class %s", parser.current_class_name());
oop throwable = PENDING_EXCEPTION;
java_lang_Throwable::print(throwable, tty);
tty->cr();
}
}
CLEAR_PENDING_EXCEPTION;
}
@@ -1787,6 +1793,11 @@ bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) {
ResourceMark rm;
tty->print_cr("Preload Warning: Verification failed for %s",
ik->external_name());
oop throwable = PENDING_EXCEPTION;
java_lang_Throwable::print(throwable, tty);
tty->cr();
CLEAR_PENDING_EXCEPTION;
ik->set_in_error_state();
_has_error_classes = true;

View File

@@ -354,10 +354,6 @@ public class Platform {
* This should match the #if condition in ClassListParser::load_class_from_source().
*/
public static boolean areCustomLoadersSupportedForCDS() {
boolean isLinux = Platform.isLinux();
boolean is64 = Platform.is64bit();
boolean isSolaris = Platform.isSolaris();
return (is64 && (isLinux || isSolaris));
return (is64bit() && (isLinux() || isSolaris() || isOSX() || isWindows()));
}
}