Compare commits

...

3 Commits

Author SHA1 Message Date
Vitaly Provodin
c86c32c8b5 Revert "JBR-4363 Changes in fonts rendering between JBR11 and JBR17"
This reverts commit bfa7a36237.
2022-04-17 07:05:41 +07:00
Vladimir Dvorak
d13b075e7e JBR-4392 - use only loaded classes when collecting affected classes 2022-04-17 03:44:06 +07:00
Vladimir Dvorak
86b7feb77a JBR-4386 - disable AllowEnhancedClassRedefinition in jfr 2022-04-17 03:42:12 +07:00
8 changed files with 26 additions and 31 deletions

View File

@@ -335,16 +335,6 @@ void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
}
}
void ClassLoaderData::initialized_classes_do(KlassClosure* klass_closure) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {
if (k->is_instance_klass() && InstanceKlass::cast(k)->is_initialized()) {
klass_closure->do_klass(k);
}
assert(k != k->next_link(), "no loops!");
}
}
void ClassLoaderData::classes_do(void f(Klass * const)) {
// Lock-free access requires load_acquire
for (Klass* k = Atomic::load_acquire(&_klasses); k != NULL; k = k->next_link()) {

View File

@@ -272,7 +272,6 @@ class ClassLoaderData : public CHeapObj<mtClass> {
void oops_do(OopClosure* f, int claim_value, bool clear_modified_oops = false);
void classes_do(KlassClosure* klass_closure);
void initialized_classes_do(KlassClosure* klass_closure);
Klass* klasses() { return _klasses; }
JNIMethodBlock* jmethod_ids() const { return _jmethod_ids; }

View File

@@ -361,13 +361,6 @@ void ClassLoaderDataGraph::classes_do(KlassClosure* klass_closure) {
}
}
void ClassLoaderDataGraph::initialized_classes_do(KlassClosure* klass_closure) {
ClassLoaderDataGraphIterator iter;
while (ClassLoaderData* cld = iter.get_next()) {
cld->initialized_classes_do(klass_closure);
}
}
void ClassLoaderDataGraph::classes_do(void f(Klass* const)) {
ClassLoaderDataGraphIterator iter;
while (ClassLoaderData* cld = iter.get_next()) {

View File

@@ -79,9 +79,6 @@ class ClassLoaderDataGraph : public AllStatic {
// Walking the ClassLoaderDataGraph also includes hidden classes.
static void classes_do(KlassClosure* klass_closure);
// Enhanced class redefinition
static void initialized_classes_do(KlassClosure* klass_closure);
static void classes_do(void f(Klass* const));
static void methods_do(void f(Method*));
static void modules_do(void f(ModuleEntry*));

View File

@@ -68,6 +68,7 @@ static bool enable() {
}
_enabled = FlightRecorder;
assert(_enabled, "invariant");
AllowEnhancedClassRedefinition = false;
return _enabled;
}

View File

@@ -2129,6 +2129,11 @@ class AffectedKlassClosure : public KlassClosure {
void do_klass(Klass* klass) {
assert(!_affected_klasses->contains(klass), "must not occur more than once!");
// allow only loaded classes
if (!klass->is_instance_klass() || !InstanceKlass::cast(klass)->is_loaded()) {
return;
}
if (klass->new_version() != NULL) {
return;
}
@@ -2185,12 +2190,8 @@ jvmtiError VM_EnhancedRedefineClasses::find_sorted_affected_classes(TRAPS) {
{
MutexLocker mcld(ClassLoaderDataGraph_lock);
// We can't use ClassLoaderDataGraph::classes_do since classes can be uninitialized in cld,
// fully initialized class is in system dictionary, but hidden classes are excluded. Therefore
// we use special method iterating over initialized classes only
// ClassLoaderDataGraph::classes_do(&closure);
ClassLoaderDataGraph::initialized_classes_do(&closure);
// Hidden classes are not in SystemDictionary, so we have to iterate ClassLoaderDataGraph
ClassLoaderDataGraph::classes_do(&closure);
}
log_trace(redefine, class, load)("%d classes affected", _affected_klasses->length());

View File

@@ -4036,7 +4036,7 @@ jint Arguments::parse(const JavaVMInitArgs* initial_cmd_args) {
#if INCLUDE_JFR
if (FlightRecorder) {
if (AllowEnhancedClassRedefinition) {
if (AllowEnhancedClassRedefinition || StartFlightRecording != NULL) {
warning("EnhancedClassRedefinition was disabled, it is not allowed in FlightRecorder.");
AllowEnhancedClassRedefinition = false;
}

View File

@@ -1643,6 +1643,7 @@ static jlong
int error, imageSize;
UInt16 width, height, rowBytes;
GlyphInfo *glyphInfo;
int target;
FT_GlyphSlot ftglyph;
FT_Library library;
@@ -1719,7 +1720,21 @@ static jlong
and apply it explicitly after hinting is performed.
Or we can disable hinting. */
if (FT_Load_Glyph(scalerInfo->face, glyphCode, context->loadFlags)) {
/* select appropriate hinting mode */
if (context->aaType == TEXT_AA_ON || context->colorFont) {
target = FT_LOAD_TARGET_NORMAL;
} else if (context->aaType == TEXT_AA_OFF) {
target = FT_LOAD_TARGET_MONO;
} else if (context->aaType == TEXT_AA_LCD_HRGB ||
context->aaType == TEXT_AA_LCD_HBGR) {
target = FT_LOAD_TARGET_LCD;
} else {
target = FT_LOAD_TARGET_LCD_V;
}
context->loadFlags |= target;
error = FT_Load_Glyph(scalerInfo->face, glyphCode, context->loadFlags);
if (error) {
//do not destroy scaler yet.
//this can be problem of particular context (e.g. with bad transform)
return ptr_to_jlong(getNullGlyphImage());
@@ -2063,7 +2078,6 @@ Java_sun_font_FreetypeFontScaler_getGlyphCodeNative(
static FT_Outline* getFTOutline(JNIEnv* env, jobject font2D,
FTScalerContext *context, FTScalerInfo* scalerInfo,
jint glyphCode, jfloat xpos, jfloat ypos) {
FT_Error error;
FT_GlyphSlot ftglyph;
FT_Int32 loadFlags;
@@ -2079,7 +2093,7 @@ static FT_Outline* getFTOutline(JNIEnv* env, jobject font2D,
}
// We cannot get an outline from bitmap version of glyph
loadFlags = context->loadFlags | FT_LOAD_NO_BITMAP;
loadFlags = FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP;
error = FT_Load_Glyph(scalerInfo->face, glyphCode, loadFlags);
if (error) {