Compare commits

..

11 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
Vitaly Provodin
380c17456c moving test/jdk/jb/java/awt/font/TextLayout to test/jdk/jb/java/awt/Font/TextLayout 2019-10-01 10:06:39 +07:00
Dmitry Batrak
ba7496606d JBR-1879 Wrong symbols in evaluate expression dialog
a better check that font used by GDI matches the font used by JRE
2019-09-30 14:47:16 +03:00
Dmitry Batrak
1ee493a1f9 JBR-1879 Wrong symbols in evaluate expression dialog
rollback fix for JBR-1777
2019-09-30 14:46:51 +03:00
13 changed files with 78 additions and 50 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

@@ -111,6 +111,10 @@ public abstract class FileFont extends PhysicalFont {
return 1; // DEFAULT_CHARSET
}
int getFontDataSize() {
return fileSize;
}
/*
* This is the public interface. The subclasses need to implement
* this. The returned block may be longer than the requested length.

View File

@@ -404,7 +404,8 @@ public class FileFontStrike extends PhysicalStrike {
int glyphCode,
boolean fracMetrics,
int rotation,
byte charset);
byte charset,
int fontDataSize);
private native long _getGlyphImageFromWindowsUsingDirectWrite(String family,
int style,
@@ -422,10 +423,6 @@ public class FileFontStrike extends PhysicalStrike {
long getGlyphImageFromWindows(int glyphCode) {
String family = fileFont.getFamilyName(null);
FontFamily fontFamily = FontFamily.getFamily(family);
if (fontFamily != null && fontFamily.hasMultipleCandidatesForSameStyle()) {
// we cannot unambiguously specify font by its family name and style
return 0;
}
int style = desc.style & Font.BOLD | desc.style & Font.ITALIC
| fileFont.getStyle();
if (fontFamily != null && fontFamily.getFont(style) != fileFont) {
@@ -445,7 +442,12 @@ public class FileFontStrike extends PhysicalStrike {
}
if (ptr == 0) {
boolean fm = desc.fmHint == INTVAL_FRACTIONALMETRICS_ON;
ptr = _getGlyphImageFromWindows(family, style, size, glyphCode, fm, rotation, charset);
ptr = _getGlyphImageFromWindows(family, style, size, glyphCode, fm, rotation, charset,
fileFont.getFontDataSize());
if (ptr == 0 && FontUtilities.isLogging()) {
FontUtilities.getLogger().warning("Failed to render glyph via GDI: code=" + glyphCode
+ ", fontFamily=" + family + ", style=" + style + ", size=" + size + ", rotation=" + rotation);
}
if (ptr != 0 && fm) {
Point2D.Float metrics = new Point2D.Float();
fileFont.getGlyphMetrics(pScalerContext, glyphCode, metrics);

View File

@@ -32,7 +32,6 @@ import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class FontFamily {
private static final byte CONFLICTING_STYLES = 0x10;
private static ConcurrentHashMap<String, FontFamily>
familyNameMap = new ConcurrentHashMap<String, FontFamily>();
@@ -47,7 +46,6 @@ public class FontFamily {
private boolean initialized = false;
protected boolean logicalFont = false;
protected int familyRank;
private byte stylesMask;
public static FontFamily getFamily(String name) {
return familyNameMap.get(name.toLowerCase(Locale.ENGLISH));
@@ -69,16 +67,6 @@ public class FontFamily {
return;
}
family.ensureFontsLoaded();
if (FontUtilities.isWindows) {
synchronized (family.fontSequence) {
if (family.stylesMask != CONFLICTING_STYLES &&
(family.plain == font2D || family.bold == font2D ||
family.italic == font2D || family.bolditalic == font2D)) {
byte styleBit = getWinFontStyleBit(font2D);
family.stylesMask = (byte) (family.stylesMask & ~styleBit);
}
}
}
if (family.plain == font2D) {
family.plain = null;
}
@@ -306,12 +294,6 @@ public class FontFamily {
return;
}
if (FontUtilities.isWindows && stylesMask != CONFLICTING_STYLES) {
byte styleBit = getWinFontStyleBit(font);
byte newMask = (byte) (stylesMask | styleBit);
stylesMask = newMask == stylesMask ? CONFLICTING_STYLES : newMask;
}
switch (style) {
case Font.PLAIN:
@@ -343,12 +325,6 @@ public class FontFamily {
}
}
private static byte getWinFontStyleBit(Font2D font) {
// Windows seems to ignore bold attribute from fsSelection field, and consider only font's weight
int winFontStyle = (font.getWeight() >= 410 ? 1 : 0) | (font.getStyle() & Font.ITALIC);
return (byte) (1 << winFontStyle);
}
public Font2D getFontWithExactStyleMatch(int style) {
ensureFontsLoaded();
switch (style) {
@@ -498,10 +474,6 @@ public class FontFamily {
return families.toArray(new FontFamily[0]);
}
boolean hasMultipleCandidatesForSameStyle() {
return stylesMask == CONFLICTING_STYLES;
}
public String toString() {
return
"Font family: " + familyName +

View File

@@ -181,6 +181,7 @@ public class TrueTypeFont extends FileFont {
private String localeFullName;
private Byte supportedCharset;
private int fontDataSize;
public TrueTypeFont(String platname, Object nativeNames, int fIndex,
boolean javaRasterizer)
@@ -539,11 +540,13 @@ public class TrueTypeFont extends FileFont {
fontIndex = fIndex;
buffer = readBlock(TTCHEADERSIZE+4*fIndex, 4);
headerOffset = buffer.getInt();
fontDataSize = Math.max(0, fileSize - headerOffset);
break;
case v1ttTag:
case trueTag:
case ottoTag:
fontDataSize = fileSize;
break;
default:
@@ -1780,6 +1783,11 @@ public class TrueTypeFont extends FileFont {
private static native void getSupportedCharsetsForFamily(String familyName, Map<String, Byte> supportedCharsets);
@Override
int getFontDataSize() {
return fontDataSize;
}
@Override
public String toString() {
return "** TrueType Font: Family="+familyName+ " Name="+fullName+

View File

@@ -171,8 +171,8 @@ JNIEXPORT jboolean JNICALL
JNIEXPORT jlong JNICALL
Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
(JNIEnv *env, jobject unused,
jstring fontFamily, jint style, jint size, jint glyphCode, jboolean fm, jint rotation, jbyte charset) {
(JNIEnv *env, jobject unused, jstring fontFamily, jint style, jint size,
jint glyphCode, jboolean fm, jint rotation, jbyte charset, jint fontDataSize) {
GLYPHMETRICS glyphMetrics;
LOGFONTW lf;
@@ -188,6 +188,7 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
LPWSTR name;
HFONT oldFont, hFont;
MAT2 mat2;
DWORD actualFontDataSize;
unsigned short width;
unsigned short height;
@@ -255,6 +256,13 @@ Java_sun_font_FileFontStrike__1getGlyphImageFromWindows
}
oldFont = SelectObject(hMemoryDC, hFont);
if (fontDataSize > 0) {
actualFontDataSize = GetFontData(hMemoryDC, 0, 0, NULL, 0);
if (actualFontDataSize != fontDataSize) {
FREE_AND_RETURN;
}
}
tmpBitmap = CreateCompatibleBitmap(hDesktopDC, 1, 1);
if (tmpBitmap == NULL) {
FREE_AND_RETURN;

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()));
}
}