mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2026-01-10 10:31:39 +01:00
Compare commits
10 Commits
mono/2.303
...
jb11_0_9-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8dc40e82b8 | ||
|
|
37e82fc172 | ||
|
|
bfe29264dc | ||
|
|
3e0803b9f6 | ||
|
|
9545b7b53c | ||
|
|
889842216d | ||
|
|
237ed61c9f | ||
|
|
698ba448be | ||
|
|
5a1e4f75ae | ||
|
|
315068203c |
@@ -150,7 +150,7 @@ cp -a $JSDK/jdk-$JBSDK_VERSION_WITH_DOTS.jdk $BASE_DIR/$JBRSDK_BUNDLE || do_exit
|
||||
if [[ "${bundle_type}" == *jcef* ]] || [[ "${bundle_type}" == *dcevm* ]] || [[ "${bundle_type}" == fd ]]; then
|
||||
cp -a ${JCEF_PATH}/Frameworks $BASE_DIR/$JBRSDK_BUNDLE/Contents/
|
||||
fi
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "{$bundle_type}" == "fd" ]; then
|
||||
if [ "${bundle_type}" == "jcef" ] || [ "${bundle_type}" == "fd" ]; then
|
||||
echo Creating $JBSDK.tar.gz ...
|
||||
sed 's/JBR/JBRSDK/g' ${BASE_DIR}/${JBRSDK_BUNDLE}/Contents/Home/release > release
|
||||
mv release ${BASE_DIR}/${JBRSDK_BUNDLE}/Contents/Home/release
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 3b899c25e7ff58ce8b0e04e537507f64a5b1c87d Mon Sep 17 00:00:00 2001
|
||||
From b36887fca0b0b251c914567d0ee2871c6d786c09 Mon Sep 17 00:00:00 2001
|
||||
From: skybber <lada.dvorak7@gmail.com>
|
||||
Date: Wed, 14 Nov 2018 21:09:39 +0100
|
||||
Subject: [PATCH 01/13] Apply basic dcevm11 patch
|
||||
Subject: [PATCH 01/17] Apply basic dcevm11 patch
|
||||
|
||||
---
|
||||
src/hotspot/share/ci/ciObjectFactory.cpp | 25 +
|
||||
@@ -126,7 +126,7 @@ index 1063c9853e1..3e9d48c4cdc 100644
|
||||
|
||||
#endif // SHARE_VM_CI_CIOBJECTFACTORY_HPP
|
||||
diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp
|
||||
index bf8ac6f3b17..cd8f517e8be 100644
|
||||
index 6d65cca2101..e2b8c5793d0 100644
|
||||
--- a/src/hotspot/share/classfile/classFileParser.cpp
|
||||
+++ b/src/hotspot/share/classfile/classFileParser.cpp
|
||||
@@ -954,6 +954,8 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
|
||||
@@ -138,7 +138,7 @@ index bf8ac6f3b17..cd8f517e8be 100644
|
||||
if (!interf->is_interface()) {
|
||||
THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(),
|
||||
err_msg("class %s can not implement %s, because it is not an interface (%s)",
|
||||
@@ -3747,7 +3749,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
|
||||
@@ -3826,7 +3828,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
|
||||
// However, make sure it is not an array type.
|
||||
bool is_array = false;
|
||||
if (cp->tag_at(super_class_index).is_klass()) {
|
||||
@@ -147,7 +147,7 @@ index bf8ac6f3b17..cd8f517e8be 100644
|
||||
if (need_verify)
|
||||
is_array = super_klass->is_array_klass();
|
||||
} else if (need_verify) {
|
||||
@@ -4415,7 +4417,10 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
|
||||
@@ -4494,7 +4496,10 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
|
||||
if (!_has_empty_finalizer) {
|
||||
if (_has_finalizer ||
|
||||
(super != NULL && super->has_finalizer())) {
|
||||
@@ -159,7 +159,7 @@ index bf8ac6f3b17..cd8f517e8be 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5793,6 +5798,7 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
|
||||
@@ -5872,6 +5877,7 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
|
||||
const InstanceKlass* host_klass,
|
||||
GrowableArray<Handle>* cp_patches,
|
||||
Publicity pub_level,
|
||||
@@ -167,7 +167,7 @@ index bf8ac6f3b17..cd8f517e8be 100644
|
||||
TRAPS) :
|
||||
_stream(stream),
|
||||
_requested_name(name),
|
||||
@@ -5851,7 +5857,8 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
|
||||
@@ -5930,7 +5936,8 @@ ClassFileParser::ClassFileParser(ClassFileStream* stream,
|
||||
_has_finalizer(false),
|
||||
_has_empty_finalizer(false),
|
||||
_has_vanilla_constructor(false),
|
||||
@@ -177,7 +177,7 @@ index bf8ac6f3b17..cd8f517e8be 100644
|
||||
|
||||
_class_name = name != NULL ? name : vmSymbols::unknown_class_name();
|
||||
|
||||
@@ -6252,14 +6259,15 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
|
||||
@@ -6331,14 +6338,15 @@ void ClassFileParser::post_process_parsed_stream(const ClassFileStream* const st
|
||||
CHECK);
|
||||
}
|
||||
Handle loader(THREAD, _loader_data->class_loader());
|
||||
@@ -196,7 +196,7 @@ index bf8ac6f3b17..cd8f517e8be 100644
|
||||
if (_super_klass != NULL) {
|
||||
if (_super_klass->has_nonstatic_concrete_methods()) {
|
||||
diff --git a/src/hotspot/share/classfile/classFileParser.hpp b/src/hotspot/share/classfile/classFileParser.hpp
|
||||
index 9f7204be9b6..3db14b678f3 100644
|
||||
index 3bdfd34e39f..d792ab4bb3f 100644
|
||||
--- a/src/hotspot/share/classfile/classFileParser.hpp
|
||||
+++ b/src/hotspot/share/classfile/classFileParser.hpp
|
||||
@@ -115,6 +115,9 @@ class ClassFileParser {
|
||||
@@ -209,7 +209,7 @@ index 9f7204be9b6..3db14b678f3 100644
|
||||
enum { fixed_buffer_size = 128 };
|
||||
u_char _linenumbertable_buffer[fixed_buffer_size];
|
||||
|
||||
@@ -496,6 +499,9 @@ class ClassFileParser {
|
||||
@@ -500,6 +503,9 @@ class ClassFileParser {
|
||||
FieldLayoutInfo* info,
|
||||
TRAPS);
|
||||
|
||||
@@ -219,7 +219,7 @@ index 9f7204be9b6..3db14b678f3 100644
|
||||
public:
|
||||
ClassFileParser(ClassFileStream* stream,
|
||||
Symbol* name,
|
||||
@@ -504,6 +510,7 @@ class ClassFileParser {
|
||||
@@ -508,6 +514,7 @@ class ClassFileParser {
|
||||
const InstanceKlass* host_klass,
|
||||
GrowableArray<Handle>* cp_patches,
|
||||
Publicity pub_level,
|
||||
@@ -227,7 +227,7 @@ index 9f7204be9b6..3db14b678f3 100644
|
||||
TRAPS);
|
||||
|
||||
~ClassFileParser();
|
||||
@@ -532,6 +539,7 @@ class ClassFileParser {
|
||||
@@ -536,6 +543,7 @@ class ClassFileParser {
|
||||
ClassLoaderData* loader_data() const { return _loader_data; }
|
||||
const Symbol* class_name() const { return _class_name; }
|
||||
const InstanceKlass* super_klass() const { return _super_klass; }
|
||||
@@ -236,7 +236,7 @@ index 9f7204be9b6..3db14b678f3 100644
|
||||
ReferenceType reference_type() const { return _rt; }
|
||||
AccessFlags access_flags() const { return _access_flags; }
|
||||
diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp
|
||||
index d4f7d92b19c..599ce40a2c5 100644
|
||||
index f0cf1fb7cb1..5713bb9e98c 100644
|
||||
--- a/src/hotspot/share/classfile/classLoader.cpp
|
||||
+++ b/src/hotspot/share/classfile/classLoader.cpp
|
||||
@@ -1501,6 +1501,7 @@ InstanceKlass* ClassLoader::load_class(Symbol* name, bool search_append_only, TR
|
||||
@@ -449,10 +449,10 @@ index d26f1f11fb4..fd4b134d7a7 100644
|
||||
|
||||
// An entry in the class loader data dictionaries, this describes a class as
|
||||
diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp
|
||||
index 438e7aa4ec9..ea0588e5388 100644
|
||||
index 6d320fb0d30..1004f41b277 100644
|
||||
--- a/src/hotspot/share/classfile/javaClasses.cpp
|
||||
+++ b/src/hotspot/share/classfile/javaClasses.cpp
|
||||
@@ -2443,6 +2443,8 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand
|
||||
@@ -2444,6 +2444,8 @@ void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHand
|
||||
skip_throwableInit_check = true;
|
||||
}
|
||||
}
|
||||
@@ -461,7 +461,7 @@ index 438e7aa4ec9..ea0588e5388 100644
|
||||
if (method->is_hidden()) {
|
||||
if (skip_hidden) continue;
|
||||
}
|
||||
@@ -3625,6 +3627,62 @@ void java_lang_invoke_DirectMethodHandle::serialize_offsets(SerializeClosure* f)
|
||||
@@ -3626,6 +3628,62 @@ void java_lang_invoke_DirectMethodHandle::serialize_offsets(SerializeClosure* f)
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -524,7 +524,7 @@ index 438e7aa4ec9..ea0588e5388 100644
|
||||
// Support for java_lang_invoke_MethodHandle
|
||||
|
||||
int java_lang_invoke_MethodHandle::_type_offset;
|
||||
@@ -3811,6 +3869,11 @@ void java_lang_invoke_ResolvedMethodName::set_vmtarget(oop resolved_method, Meth
|
||||
@@ -3812,6 +3870,11 @@ void java_lang_invoke_ResolvedMethodName::set_vmtarget(oop resolved_method, Meth
|
||||
resolved_method->address_field_put(_vmtarget_offset, (address)m);
|
||||
}
|
||||
|
||||
@@ -732,7 +732,7 @@ index 8a7a1248e62..611e18aaf85 100644
|
||||
bool add_entry(Symbol* name, InstanceKlass* klass1, Handle loader1,
|
||||
InstanceKlass* klass2, Handle loader2);
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
index 5c8ff453823..669de5e56a5 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -201,6 +201,7 @@ Klass* SystemDictionary::resolve_or_fail(Symbol* class_name, Handle class_loader
|
||||
@@ -824,7 +824,7 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
} );
|
||||
|
||||
return k;
|
||||
@@ -1554,11 +1567,12 @@ static void post_class_define_event(InstanceKlass* k, const ClassLoaderData* def
|
||||
@@ -1553,11 +1566,12 @@ static void post_class_define_event(InstanceKlass* k, const ClassLoaderData* def
|
||||
}
|
||||
}
|
||||
|
||||
@@ -838,7 +838,7 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
|
||||
// for bootstrap and other parallel classloaders don't acquire lock,
|
||||
// use placeholder token
|
||||
@@ -1583,7 +1597,11 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, TRAPS) {
|
||||
@@ -1582,7 +1596,11 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, TRAPS) {
|
||||
Symbol* name_h = k->name();
|
||||
Dictionary* dictionary = loader_data->dictionary();
|
||||
unsigned int d_hash = dictionary->compute_hash(name_h);
|
||||
@@ -851,7 +851,7 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
|
||||
// Register class just loaded with class loader (placed in Vector)
|
||||
// Note we do this before updating the dictionary, as this can
|
||||
@@ -1617,7 +1635,7 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, TRAPS) {
|
||||
@@ -1616,7 +1634,7 @@ void SystemDictionary::define_instance_class(InstanceKlass* k, TRAPS) {
|
||||
k->eager_initialize(THREAD);
|
||||
|
||||
// notify jvmti
|
||||
@@ -860,7 +860,7 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
assert(THREAD->is_Java_thread(), "thread->is_Java_thread()");
|
||||
JvmtiExport::post_class_load((JavaThread *) THREAD, k);
|
||||
|
||||
@@ -1695,7 +1713,7 @@ InstanceKlass* SystemDictionary::find_or_define_instance_class(Symbol* class_nam
|
||||
@@ -1694,7 +1712,7 @@ InstanceKlass* SystemDictionary::find_or_define_instance_class(Symbol* class_nam
|
||||
}
|
||||
}
|
||||
|
||||
@@ -869,7 +869,7 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
|
||||
Handle linkage_exception = Handle(); // null handle
|
||||
|
||||
@@ -1818,6 +1836,18 @@ void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
|
||||
@@ -1817,6 +1835,18 @@ void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
|
||||
CodeCache::flush_dependents_on(k);
|
||||
}
|
||||
|
||||
@@ -888,7 +888,7 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
// ----------------------------------------------------------------------------
|
||||
// GC support
|
||||
|
||||
@@ -2089,7 +2119,7 @@ void SystemDictionary::check_constraints(unsigned int d_hash,
|
||||
@@ -2113,7 +2143,7 @@ void SystemDictionary::check_constraints(unsigned int d_hash,
|
||||
// also hold array classes.
|
||||
|
||||
assert(check->is_instance_klass(), "noninstance in systemdictionary");
|
||||
@@ -898,10 +898,10 @@ index 91dc9faeccb..9dbd6cc9c12 100644
|
||||
ss.print("loader %s", loader_data->loader_name_and_id());
|
||||
ss.print(" attempted duplicate %s definition for %s. (%s)",
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
index d38dd0fd003..717f34ce9a0 100644
|
||||
index 649b321a6a4..06f6c869d63 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
@@ -158,6 +158,8 @@ class OopStorage;
|
||||
@@ -161,6 +161,8 @@ class OopStorage;
|
||||
\
|
||||
/* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
|
||||
do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \
|
||||
@@ -910,7 +910,7 @@ index d38dd0fd003..717f34ce9a0 100644
|
||||
do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre ) \
|
||||
do_klass(VarHandle_klass, java_lang_invoke_VarHandle, Pre ) \
|
||||
do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre ) \
|
||||
@@ -315,6 +317,7 @@ public:
|
||||
@@ -318,6 +320,7 @@ public:
|
||||
Handle class_loader,
|
||||
Handle protection_domain,
|
||||
ClassFileStream* st,
|
||||
@@ -918,9 +918,9 @@ index d38dd0fd003..717f34ce9a0 100644
|
||||
TRAPS);
|
||||
|
||||
// Lookup an already loaded class. If not found NULL is returned.
|
||||
@@ -452,6 +455,10 @@ public:
|
||||
}
|
||||
static BasicType box_klass_type(Klass* k); // inverse of box_klass
|
||||
@@ -462,6 +465,10 @@ public:
|
||||
static bool is_well_known_klass(Symbol* class_name);
|
||||
#endif
|
||||
|
||||
+ // Enhanced class redefinition
|
||||
+ static void remove_from_hierarchy(InstanceKlass* k);
|
||||
@@ -929,7 +929,7 @@ index d38dd0fd003..717f34ce9a0 100644
|
||||
protected:
|
||||
// Returns the class loader data to be used when looking up/updating the
|
||||
// system dictionary.
|
||||
@@ -645,7 +652,7 @@ protected:
|
||||
@@ -655,7 +662,7 @@ protected:
|
||||
// after waiting, but before reentering SystemDictionary_lock
|
||||
// to preserve lock order semantics.
|
||||
static void double_lock_wait(Handle lockObject, TRAPS);
|
||||
@@ -977,7 +977,7 @@ index 05239c57866..c1357bde0ed 100644
|
||||
methodHandle _method; // current method being verified
|
||||
VerificationType _this_type; // the verification type of the current class
|
||||
diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
index 37b68a27962..6e0b95ef5e8 100644
|
||||
index 44cf2583eb9..41e9a84cd69 100644
|
||||
--- a/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
+++ b/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
@@ -286,6 +286,8 @@
|
||||
@@ -1003,7 +1003,7 @@ index 37b68a27962..6e0b95ef5e8 100644
|
||||
/* name symbols needed by intrinsics */ \
|
||||
VM_INTRINSICS_DO(VM_INTRINSIC_IGNORE, VM_SYMBOL_IGNORE, template, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE) \
|
||||
diff --git a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
|
||||
index 7b9096d73be..a93f764f1b9 100644
|
||||
index 17d563338b8..4c9918627a2 100644
|
||||
--- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
|
||||
+++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
|
||||
@@ -376,6 +376,12 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs, M
|
||||
@@ -1019,7 +1019,7 @@ index 7b9096d73be..a93f764f1b9 100644
|
||||
// Like CompactibleSpace forward() but always calls cross_threshold() to
|
||||
// update the block offset table. Removed initialize_threshold call because
|
||||
// CFLS does not use a block offset array for contiguous spaces.
|
||||
@@ -2190,7 +2196,8 @@ CompactibleFreeListSpace::refillLinearAllocBlock(LinearAllocBlock* blk) {
|
||||
@@ -2203,7 +2209,8 @@ CompactibleFreeListSpace::refillLinearAllocBlock(LinearAllocBlock* blk) {
|
||||
|
||||
// Support for compaction
|
||||
void CompactibleFreeListSpace::prepare_for_compaction(CompactPoint* cp) {
|
||||
@@ -1029,7 +1029,7 @@ index 7b9096d73be..a93f764f1b9 100644
|
||||
// Prepare_for_compaction() uses the space between live objects
|
||||
// so that later phase can skip dead space quickly. So verification
|
||||
// of the free lists doesn't work after.
|
||||
@@ -2208,7 +2215,7 @@ void CompactibleFreeListSpace::adjust_pointers() {
|
||||
@@ -2221,7 +2228,7 @@ void CompactibleFreeListSpace::adjust_pointers() {
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::compact() {
|
||||
@@ -1236,10 +1236,10 @@ index cf96ade0ef0..b6187dae4d0 100644
|
||||
|
||||
static void follow_klass(Klass* klass);
|
||||
diff --git a/src/hotspot/share/gc/shared/gcConfig.cpp b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
index ddc84c1d2a4..8aac2b39e1e 100644
|
||||
index 8c42e43b00d..9779df92447 100644
|
||||
--- a/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
@@ -101,7 +101,10 @@ void GCConfig::fail_if_unsupported_gc_is_selected() {
|
||||
@@ -106,7 +106,10 @@ void GCConfig::fail_if_unsupported_gc_is_selected() {
|
||||
}
|
||||
|
||||
void GCConfig::select_gc_ergonomically() {
|
||||
@@ -1919,7 +1919,7 @@ index 2a93500b794..2a9eb978b43 100644
|
||||
|
||||
// RedefineClasses support
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index d48d4bd6fb5..7e44092f39b 100644
|
||||
index c6752eb373f..e9c1d4e5226 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -832,7 +832,8 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
|
||||
@@ -2013,7 +2013,7 @@ index d48d4bd6fb5..7e44092f39b 100644
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
@@ -3532,7 +3582,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
@@ -3552,7 +3602,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
}
|
||||
|
||||
guarantee(sib->is_klass(), "should be klass");
|
||||
@@ -2260,10 +2260,10 @@ index f9a69ef0c8b..231ada3f0ab 100644
|
||||
|
||||
if (log_is_enabled(Debug, class, resolve) && k != NULL) {
|
||||
diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp
|
||||
index 797b022d5e5..eb4b7622820 100644
|
||||
index 24c66ab3918..82b359ee9a3 100644
|
||||
--- a/src/hotspot/share/prims/jvm.cpp
|
||||
+++ b/src/hotspot/share/prims/jvm.cpp
|
||||
@@ -927,6 +927,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name,
|
||||
@@ -935,6 +935,7 @@ static jclass jvm_define_class_common(JNIEnv *env, const char *name,
|
||||
class_loader,
|
||||
protection_domain,
|
||||
&st,
|
||||
@@ -2273,7 +2273,7 @@ index 797b022d5e5..eb4b7622820 100644
|
||||
if (log_is_enabled(Debug, class, resolve) && k != NULL) {
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
new file mode 100644
|
||||
index 00000000000..83c0952de37
|
||||
index 00000000000..80c31135487
|
||||
--- /dev/null
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -0,0 +1,2255 @@
|
||||
@@ -4534,7 +4534,7 @@ index 00000000000..83c0952de37
|
||||
+}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
new file mode 100644
|
||||
index 00000000000..b712d69a193
|
||||
index 00000000000..3f95cf42645
|
||||
--- /dev/null
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -0,0 +1,202 @@
|
||||
@@ -4806,10 +4806,10 @@ index 1dd911fd8d8..bc6ebb2d4af 100644
|
||||
VMThread::execute(&op);
|
||||
return (op.check_error());
|
||||
diff --git a/src/hotspot/share/prims/jvmtiExport.cpp b/src/hotspot/share/prims/jvmtiExport.cpp
|
||||
index c2e86c2406a..2463c1f7bdb 100644
|
||||
index 375aa5f54f8..08f910bd2ac 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiExport.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiExport.cpp
|
||||
@@ -2799,7 +2799,7 @@ JvmtiDynamicCodeEventCollector::JvmtiDynamicCodeEventCollector() : _code_blobs(N
|
||||
@@ -2813,7 +2813,7 @@ JvmtiDynamicCodeEventCollector::JvmtiDynamicCodeEventCollector() : _code_blobs(N
|
||||
// iterate over any code blob descriptors collected and post a
|
||||
// DYNAMIC_CODE_GENERATED event to the profiler.
|
||||
JvmtiDynamicCodeEventCollector::~JvmtiDynamicCodeEventCollector() {
|
||||
@@ -4819,7 +4819,7 @@ index c2e86c2406a..2463c1f7bdb 100644
|
||||
if (_code_blobs != NULL) {
|
||||
for (int i=0; i<_code_blobs->length(); i++) {
|
||||
diff --git a/src/hotspot/share/prims/jvmtiExport.hpp b/src/hotspot/share/prims/jvmtiExport.hpp
|
||||
index 99288f7590c..bb58ad9432c 100644
|
||||
index 557d10543c6..ef8c266bc6e 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiExport.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiExport.hpp
|
||||
@@ -178,6 +178,7 @@ class JvmtiExport : public AllStatic {
|
||||
@@ -4997,10 +4997,10 @@ index bd439aab073..cc7f71a4404 100644
|
||||
static size_t max_heap_for_compressed_oops();
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index 1e2408b4ba7..ab5d08390ff 100644
|
||||
index 3cd51a1ac95..7b061359c1d 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -2671,7 +2671,11 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
@@ -2674,7 +2674,11 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
"Start flight recording with options")) \
|
||||
\
|
||||
experimental(bool, UseFastUnorderedTimeStamps, false, \
|
||||
@@ -5014,10 +5014,10 @@ index 1e2408b4ba7..ab5d08390ff 100644
|
||||
#define VM_FLAGS(develop, \
|
||||
develop_pd, \
|
||||
diff --git a/src/hotspot/share/runtime/interfaceSupport.inline.hpp b/src/hotspot/share/runtime/interfaceSupport.inline.hpp
|
||||
index f5dac06750a..40a8bdd8e62 100644
|
||||
index 0267345b535..bcdd8e5d3e6 100644
|
||||
--- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp
|
||||
+++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp
|
||||
@@ -277,8 +277,8 @@ class ThreadToNativeFromVM : public ThreadStateTransition {
|
||||
@@ -276,8 +276,8 @@ class ThreadToNativeFromVM : public ThreadStateTransition {
|
||||
public:
|
||||
ThreadToNativeFromVM(JavaThread *thread) : ThreadStateTransition(thread) {
|
||||
// We are leaving the VM at this point and going directly to native code.
|
||||
@@ -5043,7 +5043,7 @@ index 32040586b36..0eb2fc1ec6b 100644
|
||||
_result = result;
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp
|
||||
index b258e347c94..0e60bb4b6bd 100644
|
||||
index b56b44eab69..2e1514cf750 100644
|
||||
--- a/src/hotspot/share/runtime/mutexLocker.cpp
|
||||
+++ b/src/hotspot/share/runtime/mutexLocker.cpp
|
||||
@@ -5,7 +5,7 @@
|
||||
@@ -5064,7 +5064,7 @@ index b258e347c94..0e60bb4b6bd 100644
|
||||
Monitor* GCTaskManager_lock = NULL;
|
||||
|
||||
Mutex* Management_lock = NULL;
|
||||
@@ -275,6 +277,7 @@ void mutex_init() {
|
||||
@@ -285,6 +287,7 @@ void mutex_init() {
|
||||
def(JNIGlobalActive_lock , PaddedMutex , nonleaf-1, true, Monitor::_safepoint_check_never);
|
||||
def(JNIWeakAlloc_lock , PaddedMutex , nonleaf, true, Monitor::_safepoint_check_never);
|
||||
def(JNIWeakActive_lock , PaddedMutex , nonleaf-1, true, Monitor::_safepoint_check_never);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 2deb53bed368c6a8e5c9dd719cd1fd2d51190095 Mon Sep 17 00:00:00 2001
|
||||
From 8ab0856ab3446eb08ad773b0225232a899527298 Mon Sep 17 00:00:00 2001
|
||||
From: skybber <lada.dvorak7@gmail.com>
|
||||
Date: Wed, 14 Nov 2018 21:18:22 +0100
|
||||
Subject: [PATCH 02/13] dcevm11 fixes
|
||||
Subject: [PATCH 02/17] dcevm11 fixes
|
||||
|
||||
1. We need to set classRedefinitionCount on new class, not old class.
|
||||
|
||||
@@ -82,7 +82,7 @@ dmh
|
||||
19 files changed, 324 insertions(+), 415 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp
|
||||
index cd8f517e8be..1741f8b1167 100644
|
||||
index e2b8c5793d0..5e1c740a3d2 100644
|
||||
--- a/src/hotspot/share/classfile/classFileParser.cpp
|
||||
+++ b/src/hotspot/share/classfile/classFileParser.cpp
|
||||
@@ -954,6 +954,7 @@ void ClassFileParser::parse_interfaces(const ClassFileStream* const stream,
|
||||
@@ -93,7 +93,7 @@ index cd8f517e8be..1741f8b1167 100644
|
||||
interf = (Klass *) maybe_newest(interf);
|
||||
|
||||
if (!interf->is_interface()) {
|
||||
@@ -3749,6 +3750,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
|
||||
@@ -3828,6 +3829,7 @@ const InstanceKlass* ClassFileParser::parse_super_class(ConstantPool* const cp,
|
||||
// However, make sure it is not an array type.
|
||||
bool is_array = false;
|
||||
if (cp->tag_at(super_class_index).is_klass()) {
|
||||
@@ -101,7 +101,7 @@ index cd8f517e8be..1741f8b1167 100644
|
||||
super_klass = InstanceKlass::cast(maybe_newest(cp->resolved_klass_at(super_class_index)));
|
||||
if (need_verify)
|
||||
is_array = super_klass->is_array_klass();
|
||||
@@ -4417,7 +4419,7 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
|
||||
@@ -4496,7 +4498,7 @@ void ClassFileParser::set_precomputed_flags(InstanceKlass* ik) {
|
||||
if (!_has_empty_finalizer) {
|
||||
if (_has_finalizer ||
|
||||
(super != NULL && super->has_finalizer())) {
|
||||
@@ -111,10 +111,10 @@ index cd8f517e8be..1741f8b1167 100644
|
||||
ik->set_has_finalizer();
|
||||
}
|
||||
diff --git a/src/hotspot/share/classfile/classFileParser.hpp b/src/hotspot/share/classfile/classFileParser.hpp
|
||||
index 3db14b678f3..93ed54d8f70 100644
|
||||
index d792ab4bb3f..de48092bde8 100644
|
||||
--- a/src/hotspot/share/classfile/classFileParser.hpp
|
||||
+++ b/src/hotspot/share/classfile/classFileParser.hpp
|
||||
@@ -499,7 +499,7 @@ class ClassFileParser {
|
||||
@@ -503,7 +503,7 @@ class ClassFileParser {
|
||||
FieldLayoutInfo* info,
|
||||
TRAPS);
|
||||
|
||||
@@ -244,7 +244,7 @@ index e4a23e8a27c..bca73b5e0dc 100644
|
||||
for (int index = 0; index < table_size(); index++) {
|
||||
LoaderConstraintEntry** p = bucket_addr(index);
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 9dbd6cc9c12..e70865109dd 100644
|
||||
index 669de5e56a5..e464b94b420 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -876,7 +876,8 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name,
|
||||
@@ -266,7 +266,7 @@ index 9dbd6cc9c12..e70865109dd 100644
|
||||
if (!DumpSharedSpaces) {
|
||||
k = SystemDictionaryShared::lookup_from_stream(class_name,
|
||||
class_loader,
|
||||
@@ -1836,7 +1837,7 @@ void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
|
||||
@@ -1835,7 +1836,7 @@ void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
|
||||
CodeCache::flush_dependents_on(k);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ index 9dbd6cc9c12..e70865109dd 100644
|
||||
void SystemDictionary::remove_from_hierarchy(InstanceKlass* k) {
|
||||
assert(k != NULL, "just checking");
|
||||
|
||||
@@ -1844,6 +1845,7 @@ void SystemDictionary::remove_from_hierarchy(InstanceKlass* k) {
|
||||
@@ -1843,6 +1844,7 @@ void SystemDictionary::remove_from_hierarchy(InstanceKlass* k) {
|
||||
k->remove_from_sibling_list();
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ index 47040d51f0c..4318df227d1 100644
|
||||
}
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index 7e44092f39b..cd5489955c8 100644
|
||||
index e9c1d4e5226..312d9af2527 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -178,6 +178,7 @@ bool InstanceKlass::has_nest_member(InstanceKlass* k, TRAPS) const {
|
||||
@@ -442,7 +442,7 @@ index 7e44092f39b..cd5489955c8 100644
|
||||
// if (this->old_version() != NULL) {
|
||||
// InstanceKlass::cast(this->old_version())->remove_dependent_nmethod(nm, true);
|
||||
// return;
|
||||
@@ -3582,6 +3593,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
@@ -3602,6 +3613,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
}
|
||||
|
||||
guarantee(sib->is_klass(), "should be klass");
|
||||
@@ -463,7 +463,7 @@ index 2cc98b636f1..e8107a39813 100644
|
||||
// link this class into the implementors list of every interface it implements
|
||||
void process_interfaces(Thread *thread);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 83c0952de37..92ce6c27b8a 100644
|
||||
index 80c31135487..43d761cdbb2 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -1,4 +1,4 @@
|
||||
@@ -1394,7 +1394,7 @@ index 83c0952de37..92ce6c27b8a 100644
|
||||
ResourceMark mark(THREAD);
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index b712d69a193..60b62c3170a 100644
|
||||
index 3f95cf42645..a48e07e3a6a 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 7fd25130005527d73d87ad0fe36b86795cfb1f4f Mon Sep 17 00:00:00 2001
|
||||
From dcf2c02f9ce950170b0e448b8ef3aceb19732a86 Mon Sep 17 00:00:00 2001
|
||||
From: skybber <lada.dvorak7@gmail.com>
|
||||
Date: Wed, 12 Dec 2018 19:38:28 +0100
|
||||
Subject: [PATCH 03/13] Support for Concurrent Mark Sweep (CMS) collector
|
||||
Subject: [PATCH 03/17] Support for Concurrent Mark Sweep (CMS) collector
|
||||
|
||||
---
|
||||
.../share/gc/cms/compactibleFreeListSpace.cpp | 139 ++++++++++++------
|
||||
@@ -17,7 +17,7 @@ Subject: [PATCH 03/13] Support for Concurrent Mark Sweep (CMS) collector
|
||||
10 files changed, 135 insertions(+), 79 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
|
||||
index a93f764f1b9..efaa09473a9 100644
|
||||
index 4c9918627a2..f335173576f 100644
|
||||
--- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
|
||||
+++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp
|
||||
@@ -376,55 +376,58 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs, M
|
||||
@@ -118,7 +118,7 @@ index a93f764f1b9..efaa09473a9 100644
|
||||
q->forward_to(oop(compact_top));
|
||||
assert(q->is_gc_marked(), "encoding the pointer should preserve the mark");
|
||||
} else {
|
||||
@@ -2196,13 +2199,60 @@ CompactibleFreeListSpace::refillLinearAllocBlock(LinearAllocBlock* blk) {
|
||||
@@ -2209,13 +2212,60 @@ CompactibleFreeListSpace::refillLinearAllocBlock(LinearAllocBlock* blk) {
|
||||
|
||||
// Support for compaction
|
||||
void CompactibleFreeListSpace::prepare_for_compaction(CompactPoint* cp) {
|
||||
@@ -181,7 +181,7 @@ index a93f764f1b9..efaa09473a9 100644
|
||||
void CompactibleFreeListSpace::adjust_pointers() {
|
||||
// In other versions of adjust_pointers(), a bail out
|
||||
// based on the amount of live data in the generation
|
||||
@@ -2215,7 +2265,12 @@ void CompactibleFreeListSpace::adjust_pointers() {
|
||||
@@ -2228,7 +2278,12 @@ void CompactibleFreeListSpace::adjust_pointers() {
|
||||
}
|
||||
|
||||
void CompactibleFreeListSpace::compact() {
|
||||
@@ -253,10 +253,10 @@ index d0ff86c8215..b4ed59f020c 100644
|
||||
}
|
||||
_rescued_oops->clear();
|
||||
diff --git a/src/hotspot/share/gc/shared/gcConfig.cpp b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
index 8aac2b39e1e..39364a64cb2 100644
|
||||
index 9779df92447..adb0f5dd25c 100644
|
||||
--- a/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
@@ -101,7 +101,7 @@ void GCConfig::fail_if_unsupported_gc_is_selected() {
|
||||
@@ -106,7 +106,7 @@ void GCConfig::fail_if_unsupported_gc_is_selected() {
|
||||
}
|
||||
|
||||
void GCConfig::select_gc_ergonomically() {
|
||||
@@ -422,7 +422,7 @@ index 6b109fcd2e5..8c255d6d428 100644
|
||||
Klass* new_version = oop(cur_obj)->klass()->new_version();
|
||||
if (new_version->update_information() == NULL) {
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 92ce6c27b8a..41e82ae7a69 100644
|
||||
index 43d761cdbb2..14af1aad21b 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 680002f81e4f143c8c4cbd36f9f6e20a0da007ae Mon Sep 17 00:00:00 2001
|
||||
From 663ccc831cc21ffddc5bc035de2c72666df00a4e Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <vladimir.dvorak@mailprofiler.com>
|
||||
Date: Wed, 11 Mar 2020 14:19:34 +0100
|
||||
Subject: [PATCH 04/13] Fix class cast exception on redefinition of class A,
|
||||
Subject: [PATCH 04/17] Fix class cast exception on redefinition of class A,
|
||||
that is superclass of B that has anonymous class C
|
||||
|
||||
---
|
||||
@@ -9,7 +9,7 @@ Subject: [PATCH 04/13] Fix class cast exception on redefinition of class A,
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index cd5489955c8..889f228d087 100644
|
||||
index 312d9af2527..4312c2c4ca9 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -788,7 +788,10 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 4b8bc521e3e494da9761f904d2dabbd5810a4461 Mon Sep 17 00:00:00 2001
|
||||
From 25cb9b5fa97749d3bc13dc6c848c7eb9cc1b66bb Mon Sep 17 00:00:00 2001
|
||||
From: skybber <lada.dvorak7@gmail.com>
|
||||
Date: Wed, 14 Nov 2018 21:20:08 +0100
|
||||
Subject: [PATCH 05/13] HotswapAgent integration
|
||||
Subject: [PATCH 05/17] HotswapAgent integration
|
||||
|
||||
It include:
|
||||
|
||||
@@ -259,16 +259,16 @@ index 7117fa78059..761a52d8466 100644
|
||||
|
||||
# Hook to include the corresponding custom file, if present.
|
||||
diff --git a/make/launcher/Launcher-jdk.jconsole.gmk b/make/launcher/Launcher-jdk.jconsole.gmk
|
||||
index 6205ae63d16..5ca6a0c123b 100644
|
||||
index 575b9e0595b..9b38683a489 100644
|
||||
--- a/make/launcher/Launcher-jdk.jconsole.gmk
|
||||
+++ b/make/launcher/Launcher-jdk.jconsole.gmk
|
||||
@@ -28,7 +28,8 @@ include LauncherCommon.gmk
|
||||
$(eval $(call SetupBuildLauncher, jconsole, \
|
||||
@@ -29,7 +29,8 @@ $(eval $(call SetupBuildLauncher, jconsole, \
|
||||
MAIN_CLASS := sun.tools.jconsole.JConsole, \
|
||||
JAVA_ARGS := --add-opens java.base/java.io=jdk.jconsole \
|
||||
- -Djconsole.showOutputViewer, \
|
||||
+ -Djconsole.showOutputViewer \
|
||||
+ -XX:+DisableHotswapAgent, \
|
||||
-Djconsole.showOutputViewer \
|
||||
- -Djdk.attach.allowAttachSelf=true, \
|
||||
+ -Djdk.attach.allowAttachSelf=true \
|
||||
+ -XX:+DisableHotswapAgent, \
|
||||
CFLAGS_windows := -DJAVAW, \
|
||||
LIBS_windows := user32.lib, \
|
||||
))
|
||||
@@ -392,7 +392,7 @@ index 82311e69fd6..bd39f8595b2 100644
|
||||
CFLAGS := -DENABLE_ARG_FILES, \
|
||||
))
|
||||
diff --git a/src/hotspot/share/classfile/vmSymbols.hpp b/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
index 6e0b95ef5e8..8e0f1610f31 100644
|
||||
index 41e9a84cd69..1f67eb202b5 100644
|
||||
--- a/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
+++ b/src/hotspot/share/classfile/vmSymbols.hpp
|
||||
@@ -342,6 +342,7 @@
|
||||
@@ -513,7 +513,7 @@ index cc7f71a4404..b2bab2e1f44 100644
|
||||
static size_t max_heap_for_compressed_oops();
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index ab5d08390ff..7720ceebc81 100644
|
||||
index 7b061359c1d..fc0405b5df2 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -32,6 +32,12 @@
|
||||
@@ -529,7 +529,7 @@ index ab5d08390ff..7720ceebc81 100644
|
||||
// The larger HeapWordSize for 64bit requires larger heaps
|
||||
// for the same application running in 64bit. See bug 4967770.
|
||||
// The minimum alignment to a heap word size is done. Other
|
||||
@@ -2675,8 +2681,10 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
@@ -2678,8 +2684,10 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
\
|
||||
product(bool, AllowEnhancedClassRedefinition, true, \
|
||||
"Allow enhanced class redefinition beyond swapping method " \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 1f0bf4680faa58c5d234cac5440da4cf671e6291 Mon Sep 17 00:00:00 2001
|
||||
From 28d352b4b7cda96a37f95d75cf576570271157e3 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sun, 4 Oct 2020 21:12:12 +0200
|
||||
Subject: [PATCH 06/13] Support for Lambda class redefinition
|
||||
Subject: [PATCH 06/17] Support for Lambda class redefinition
|
||||
|
||||
---
|
||||
.../share/classfile/classLoaderData.cpp | 9 +++
|
||||
@@ -47,7 +47,7 @@ index 7e357929971..00a84610b43 100644
|
||||
|
||||
void unload();
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index e70865109dd..cc9f1fa7831 100644
|
||||
index e464b94b420..791b49c68ad 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -971,12 +971,16 @@ InstanceKlass* SystemDictionary::parse_stream(Symbol* class_name,
|
||||
@@ -81,7 +81,7 @@ index e70865109dd..cc9f1fa7831 100644
|
||||
|
||||
if (host_klass != NULL && k != NULL) {
|
||||
// Anonymous classes must update ClassLoaderData holder (was host_klass loader)
|
||||
@@ -1845,7 +1853,7 @@ void SystemDictionary::remove_from_hierarchy(InstanceKlass* k) {
|
||||
@@ -1844,7 +1852,7 @@ void SystemDictionary::remove_from_hierarchy(InstanceKlass* k) {
|
||||
k->remove_from_sibling_list();
|
||||
}
|
||||
|
||||
@@ -91,10 +91,10 @@ index e70865109dd..cc9f1fa7831 100644
|
||||
constraints()->update_after_redefinition();
|
||||
}
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.hpp b/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
index 717f34ce9a0..dc111846c12 100644
|
||||
index 06f6c869d63..1dbbffa197f 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.hpp
|
||||
@@ -301,6 +301,7 @@ public:
|
||||
@@ -304,6 +304,7 @@ public:
|
||||
protection_domain,
|
||||
st,
|
||||
NULL, // host klass
|
||||
@@ -102,7 +102,7 @@ index 717f34ce9a0..dc111846c12 100644
|
||||
NULL, // cp_patches
|
||||
THREAD);
|
||||
}
|
||||
@@ -309,6 +310,7 @@ public:
|
||||
@@ -312,6 +313,7 @@ public:
|
||||
Handle protection_domain,
|
||||
ClassFileStream* st,
|
||||
const InstanceKlass* host_klass,
|
||||
@@ -111,7 +111,7 @@ index 717f34ce9a0..dc111846c12 100644
|
||||
TRAPS);
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 41e82ae7a69..b94caa39562 100644
|
||||
index 14af1aad21b..0b239b2ff6d 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -488,6 +488,8 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
@@ -208,7 +208,7 @@ index 41e82ae7a69..b94caa39562 100644
|
||||
|
||||
// Sort the affected klasses such that a supertype is always on a smaller array index than its subtype.
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 60b62c3170a..d8a11b51fe9 100644
|
||||
index a48e07e3a6a..3551b06ecde 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -116,6 +116,7 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 278abd7996ebb06b3a217b7c677ed947020bbeae Mon Sep 17 00:00:00 2001
|
||||
From 3b6c7d2f807857712df6fd51a36a5a906b705f57 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sat, 23 May 2020 10:02:15 +0200
|
||||
Subject: [PATCH 07/13] Fix "no original bytecode found" error if method with
|
||||
Subject: [PATCH 07/17] Fix "no original bytecode found" error if method with
|
||||
bkp is missing
|
||||
|
||||
Sometimes IDE can deploy class with erroneous method, such method has
|
||||
@@ -102,7 +102,7 @@ index 4533476ff8f..193e1845b23 100644
|
||||
void set_breakpoint(int bci);
|
||||
void clear_breakpoint(int bci);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index b94caa39562..1fbba406087 100644
|
||||
index 0b239b2ff6d..aba99bb60fa 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -1356,14 +1356,16 @@ void VM_EnhancedRedefineClasses::unpatch_bytecode(Method* method) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 198a6a93669a1957f472b25afa89b7fe354ceb8f Mon Sep 17 00:00:00 2001
|
||||
From 102b7a0ba69c1411ec926985c79a36a2fc1978dd Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sun, 24 May 2020 12:07:42 +0200
|
||||
Subject: [PATCH 08/13] Replace deleted method with
|
||||
Subject: [PATCH 08/17] Replace deleted method with
|
||||
Universe::throw_no_such_method_error
|
||||
|
||||
---
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 65ff0a93f95b86fe7a53c571d34c9cc478cb701a Mon Sep 17 00:00:00 2001
|
||||
From a89a7aad1d44b540e4704332939d639e66392bd5 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Fri, 12 Jun 2020 17:43:52 +0200
|
||||
Subject: [PATCH 09/13] Support for G1 gc
|
||||
Subject: [PATCH 09/17] Support for G1 gc
|
||||
|
||||
---
|
||||
src/hotspot/share/gc/g1/g1CollectedHeap.cpp | 20 +++
|
||||
@@ -990,10 +990,10 @@ index 00000000000..e2ef0171fb2
|
||||
+
|
||||
+#endif
|
||||
diff --git a/src/hotspot/share/gc/shared/gcConfig.cpp b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
index 39364a64cb2..945b06ad2a4 100644
|
||||
index adb0f5dd25c..20e0ef9ee8a 100644
|
||||
--- a/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
+++ b/src/hotspot/share/gc/shared/gcConfig.cpp
|
||||
@@ -101,7 +101,7 @@ void GCConfig::fail_if_unsupported_gc_is_selected() {
|
||||
@@ -106,7 +106,7 @@ void GCConfig::fail_if_unsupported_gc_is_selected() {
|
||||
}
|
||||
|
||||
void GCConfig::select_gc_ergonomically() {
|
||||
@@ -1040,7 +1040,7 @@ index d0a6d665aa0..3dc4cc1323c 100644
|
||||
SystemDictionary::oops_do(oopClosure);
|
||||
}
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index 1fbba406087..e67fc2dd58f 100644
|
||||
index aba99bb60fa..8b6fad2128e 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -36,7 +36,6 @@
|
||||
@@ -1244,7 +1244,7 @@ index 1fbba406087..e67fc2dd58f 100644
|
||||
ResourceMark mark(THREAD);
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index d8a11b51fe9..9755944d70b 100644
|
||||
index 3551b06ecde..62a0fbf54d4 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -86,9 +86,10 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From eaba630276969a0ebbb410716bae44875c6c75a2 Mon Sep 17 00:00:00 2001
|
||||
From 2c6512bb54400e3836a3c348c10c78557c1abbf5 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sat, 13 Jun 2020 18:50:59 +0200
|
||||
Subject: [PATCH 10/13] Change log level in advanced redefinition
|
||||
Subject: [PATCH 10/17] Change log level in advanced redefinition
|
||||
|
||||
- Change log level for "Comparing different class ver.." to debug
|
||||
- Fix adjust_method_entries_dcevm logging levels and severity
|
||||
@@ -11,7 +11,7 @@ Subject: [PATCH 10/13] Change log level in advanced redefinition
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index e67fc2dd58f..5be9bb74305 100644
|
||||
index 8b6fad2128e..a8adfa5af47 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -915,7 +915,7 @@ jvmtiError VM_EnhancedRedefineClasses::load_new_class_versions(TRAPS) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 5b4b2a8af787fed3cdaee5c603dd7fe99246dae2 Mon Sep 17 00:00:00 2001
|
||||
From 9c8d44a088bfd73f9be3678110a67a5ed8954c8a Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Tue, 6 Oct 2020 22:15:31 +0200
|
||||
Subject: [PATCH 11/13] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
Subject: [PATCH 11/17] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
default
|
||||
|
||||
---
|
||||
@@ -9,10 +9,10 @@ Subject: [PATCH 11/13] AllowEnhancedClassRedefinition is false (disabled) by
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
|
||||
index 7720ceebc81..f7e3fd04593 100644
|
||||
index fc0405b5df2..607a39449dc 100644
|
||||
--- a/src/hotspot/share/runtime/globals.hpp
|
||||
+++ b/src/hotspot/share/runtime/globals.hpp
|
||||
@@ -2679,7 +2679,7 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
@@ -2682,7 +2682,7 @@ define_pd_global(uint64_t,MaxRAM, 1ULL*G);
|
||||
experimental(bool, UseFastUnorderedTimeStamps, false, \
|
||||
"Use platform unstable time where supported for timestamps only") \
|
||||
\
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
From 27935fd012ac48b5b360cae224d2a9cc63012433 Mon Sep 17 00:00:00 2001
|
||||
From 69bc6c03ad25d485182d1b17f265a59ff98e3352 Mon Sep 17 00:00:00 2001
|
||||
From: Artem Khvastunov <artem.khvastunov@jetbrains.com>
|
||||
Date: Tue, 14 Apr 2020 19:11:35 +0200
|
||||
Subject: [PATCH 12/13] add jvmtiEnhancedRedefineClasses.* to CMakeLists.txt
|
||||
Subject: [PATCH 12/17] add jvmtiEnhancedRedefineClasses.* to CMakeLists.txt
|
||||
|
||||
---
|
||||
jb/project/hotspot-cmake/CMakeLists.txt | 2 ++
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
From 82c3c60345b38acd04e6f1aea7d43e9283a71b8f Mon Sep 17 00:00:00 2001
|
||||
From 5e66d1cd39dcae56adfa3a4785e8da47218d7b72 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Mon, 19 Oct 2020 20:00:04 +0200
|
||||
Subject: [PATCH 13/13] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
|
||||
Subject: [PATCH 13/17] Set HOTSPOT_VM_DISTRO=Dynamic Code Evolution
|
||||
|
||||
---
|
||||
make/autoconf/version-numbers | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/make/autoconf/version-numbers b/make/autoconf/version-numbers
|
||||
index 6e7a13956b2..47ec50e6d22 100644
|
||||
index bb9d863c992..e462ab57217 100644
|
||||
--- a/make/autoconf/version-numbers
|
||||
+++ b/make/autoconf/version-numbers
|
||||
@@ -44,7 +44,7 @@ PRODUCT_NAME=OpenJDK
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
From 5b1408b47bd86a5bd2a4aa1f39705687efc73223 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Sun, 11 Oct 2020 10:43:28 +0200
|
||||
Subject: [PATCH 14/17] Fix G1 nmethod registration
|
||||
|
||||
---
|
||||
.../prims/jvmtiEnhancedRedefineClasses.cpp | 19 ++++++++++++++++---
|
||||
.../prims/jvmtiEnhancedRedefineClasses.hpp | 3 ++-
|
||||
2 files changed, 18 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
index a8adfa5af47..4ee12b7021f 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.cpp
|
||||
@@ -217,7 +217,14 @@ void VM_EnhancedRedefineClasses::mark_as_scavengable(nmethod* nm) {
|
||||
}
|
||||
}
|
||||
|
||||
-void VM_EnhancedRedefineClasses::mark_as_scavengable_g1(nmethod* nm) {
|
||||
+void VM_EnhancedRedefineClasses::unregister_nmethod_g1(nmethod* nm) {
|
||||
+ // It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
+ if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
+ Universe::heap()->unregister_nmethod(nm);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void VM_EnhancedRedefineClasses::register_nmethod_g1(nmethod* nm) {
|
||||
// It should work not only for G1 but also for another GCs, but this way is safer now
|
||||
if (!nm->is_zombie() && !nm->is_unloaded()) {
|
||||
Universe::heap()->register_nmethod(nm);
|
||||
@@ -520,8 +527,9 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
// For now, mark all nmethod's as scavengable that are not scavengable already
|
||||
if (ScavengeRootsInCode) {
|
||||
if (UseG1GC) {
|
||||
- // this should work also for other GCs
|
||||
- CodeCache::nmethods_do(mark_as_scavengable_g1);
|
||||
+ // G1 holds references to nmethods in regions based on oops values. Since oops in nmethod can be changed in ChangePointers* closures
|
||||
+ // we unregister nmethods from G1 heap, then closures are processed (oops are changed) and finally we register nmethod to G1 again
|
||||
+ CodeCache::nmethods_do(unregister_nmethod_g1);
|
||||
} else {
|
||||
CodeCache::nmethods_do(mark_as_scavengable);
|
||||
}
|
||||
@@ -544,6 +552,11 @@ void VM_EnhancedRedefineClasses::doit() {
|
||||
|
||||
Universe::root_oops_do(&oopClosureNoBarrier);
|
||||
|
||||
+ if (UseG1GC) {
|
||||
+ // this should work also for other GCs
|
||||
+ CodeCache::nmethods_do(register_nmethod_g1);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
log_trace(redefine, class, obsolete, metadata)("After updating instances");
|
||||
|
||||
diff --git a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
index 62a0fbf54d4..d00109a0b92 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiEnhancedRedefineClasses.hpp
|
||||
@@ -116,7 +116,8 @@ class VM_EnhancedRedefineClasses: public VM_GC_Operation {
|
||||
|
||||
void rollback();
|
||||
static void mark_as_scavengable(nmethod* nm);
|
||||
- static void mark_as_scavengable_g1(nmethod* nm);
|
||||
+ static void unregister_nmethod_g1(nmethod* nm);
|
||||
+ static void register_nmethod_g1(nmethod* nm);
|
||||
static void unpatch_bytecode(Method* method);
|
||||
static void fix_invoke_method(Method* method);
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
From c5bae0e9c9c0b0a6e05a966648fb2ddaf9a16564 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Thu, 22 Oct 2020 20:15:20 +0200
|
||||
Subject: [PATCH 15/17] Initialize method's _new_version/_old_version to NULL
|
||||
|
||||
---
|
||||
src/hotspot/share/oops/method.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp
|
||||
index 031f255e632..a9556ecf0c4 100644
|
||||
--- a/src/hotspot/share/oops/method.cpp
|
||||
+++ b/src/hotspot/share/oops/method.cpp
|
||||
@@ -83,7 +83,8 @@ Method* Method::allocate(ClassLoaderData* loader_data,
|
||||
return new (loader_data, size, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags);
|
||||
}
|
||||
|
||||
-Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
|
||||
+Method::Method(ConstMethod* xconst, AccessFlags access_flags) : _new_version(NULL),
|
||||
+ _old_version(NULL) {
|
||||
NoSafepointVerifier no_safepoint;
|
||||
set_constMethod(xconst);
|
||||
set_access_flags(access_flags);
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
From 5504812403a0673c428fc5589cd94f2c3fea7616 Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Fri, 23 Oct 2020 10:20:26 +0200
|
||||
Subject: [PATCH 16/17] Clear dcevm code separation
|
||||
|
||||
---
|
||||
src/hotspot/share/classfile/systemDictionary.cpp | 4 ++--
|
||||
src/hotspot/share/gc/serial/genMarkSweep.cpp | 8 +++++---
|
||||
src/hotspot/share/interpreter/linkResolver.cpp | 14 ++++++++++----
|
||||
.../instrumentation/jfrEventClassTransformer.cpp | 2 +-
|
||||
src/hotspot/share/oops/instanceKlass.cpp | 10 ++++++----
|
||||
src/hotspot/share/oops/method.cpp | 2 +-
|
||||
src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp | 2 +-
|
||||
src/hotspot/share/runtime/reflection.cpp | 2 +-
|
||||
8 files changed, 27 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/systemDictionary.cpp b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
index 791b49c68ad..011a14eab32 100644
|
||||
--- a/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
+++ b/src/hotspot/share/classfile/systemDictionary.cpp
|
||||
@@ -1152,7 +1152,7 @@ InstanceKlass* SystemDictionary::resolve_from_stream(Symbol* class_name,
|
||||
MutexLocker mu(SystemDictionary_lock, THREAD);
|
||||
|
||||
Klass* check = find_class(h_name, k->class_loader_data());
|
||||
- assert((check == k && !k->is_redefining()) || (k->is_redefining() && check == k->old_version()), "should be present in the dictionary");
|
||||
+ assert(check == k && !k->is_redefining() || k->is_redefining() && check == k->old_version(), "should be present in the dictionary");
|
||||
} );
|
||||
|
||||
return k;
|
||||
@@ -2153,7 +2153,7 @@ void SystemDictionary::check_constraints(unsigned int d_hash,
|
||||
// also hold array classes.
|
||||
|
||||
assert(check->is_instance_klass(), "noninstance in systemdictionary");
|
||||
- if ((defining == true) || ((k != check) && k->old_version() != check)) {
|
||||
+ if ((defining == true) || (k != check && (!AllowEnhancedClassRedefinition || k->old_version() != check))) {
|
||||
throwException = true;
|
||||
ss.print("loader %s", loader_data->loader_name_and_id());
|
||||
ss.print(" attempted duplicate %s definition for %s. (%s)",
|
||||
diff --git a/src/hotspot/share/gc/serial/genMarkSweep.cpp b/src/hotspot/share/gc/serial/genMarkSweep.cpp
|
||||
index b18682f9a12..590b5389b4d 100644
|
||||
--- a/src/hotspot/share/gc/serial/genMarkSweep.cpp
|
||||
+++ b/src/hotspot/share/gc/serial/genMarkSweep.cpp
|
||||
@@ -343,7 +343,9 @@ void GenMarkSweep::mark_sweep_phase4() {
|
||||
|
||||
GenCompactClosure blk;
|
||||
gch->generation_iterate(&blk, true);
|
||||
- DcevmSharedGC::copy_rescued_objects_back(MarkSweep::_rescued_oops, true);
|
||||
- DcevmSharedGC::clear_rescued_objects_resource(MarkSweep::_rescued_oops);
|
||||
- MarkSweep::_rescued_oops = NULL;
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ DcevmSharedGC::copy_rescued_objects_back(MarkSweep::_rescued_oops, true);
|
||||
+ DcevmSharedGC::clear_rescued_objects_resource(MarkSweep::_rescued_oops);
|
||||
+ MarkSweep::_rescued_oops = NULL;
|
||||
+ }
|
||||
}
|
||||
diff --git a/src/hotspot/share/interpreter/linkResolver.cpp b/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
index 9dc184d02f5..bff1c3627b0 100644
|
||||
--- a/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
+++ b/src/hotspot/share/interpreter/linkResolver.cpp
|
||||
@@ -295,8 +295,13 @@ void LinkResolver::check_klass_accessability(Klass* ref_klass, Klass* sel_klass,
|
||||
return; // no relevant check to do
|
||||
}
|
||||
}
|
||||
- Reflection::VerifyClassAccessResults vca_result =
|
||||
- Reflection::verify_class_access(ref_klass->newest_version(), InstanceKlass::cast(base_klass->newest_version()), true);
|
||||
+ Klass* refKlassNewest = ref_klass;
|
||||
+ Klass* baseKlassNewest = base_klass;
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ refKlassNewest = ref_klass->newest_version();
|
||||
+ baseKlassNewest = base_klass->newest_version();
|
||||
+ }
|
||||
+ Reflection::VerifyClassAccessResults vca_result = Reflection::verify_class_access(refKlassNewest, InstanceKlass::cast(baseKlassNewest), true);
|
||||
if (vca_result != Reflection::ACCESS_OK) {
|
||||
ResourceMark rm(THREAD);
|
||||
char* msg = Reflection::verify_class_access_msg(ref_klass,
|
||||
@@ -572,7 +577,8 @@ void LinkResolver::check_method_accessability(Klass* ref_klass,
|
||||
// We'll check for the method name first, as that's most likely
|
||||
// to be false (so we'll short-circuit out of these tests).
|
||||
if (sel_method->name() == vmSymbols::clone_name() &&
|
||||
- sel_klass->newest_version() == SystemDictionary::Object_klass()->newest_version() &&
|
||||
+ ( !AllowEnhancedClassRedefinition && sel_klass == SystemDictionary::Object_klass() ||
|
||||
+ AllowEnhancedClassRedefinition && sel_klass->newest_version() == SystemDictionary::Object_klass()->newest_version()) &&
|
||||
resolved_klass->is_array_klass()) {
|
||||
// We need to change "protected" to "public".
|
||||
assert(flags.is_protected(), "clone not protected?");
|
||||
@@ -997,7 +1003,7 @@ void LinkResolver::resolve_field(fieldDescriptor& fd,
|
||||
ResourceMark rm(THREAD);
|
||||
stringStream ss;
|
||||
|
||||
- if (sel_klass != current_klass && sel_klass != current_klass->active_version()) {
|
||||
+ if (sel_klass != current_klass && (!AllowEnhancedClassRedefinition || sel_klass != current_klass->active_version())) {
|
||||
ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
|
||||
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
|
||||
current_klass->external_name());
|
||||
diff --git a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
|
||||
index 8afe8985026..4e7b39406fa 100644
|
||||
--- a/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
|
||||
+++ b/src/hotspot/share/jfr/instrumentation/jfrEventClassTransformer.cpp
|
||||
@@ -1467,7 +1467,7 @@ static InstanceKlass* create_new_instance_klass(InstanceKlass* ik, ClassFileStre
|
||||
NULL, // host klass
|
||||
NULL, // cp_patches
|
||||
ClassFileParser::INTERNAL, // internal visibility
|
||||
- false,
|
||||
+ false,
|
||||
THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
log_pending_exception(PENDING_EXCEPTION);
|
||||
diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
index 4312c2c4ca9..7335f0cffc9 100644
|
||||
--- a/src/hotspot/share/oops/instanceKlass.cpp
|
||||
+++ b/src/hotspot/share/oops/instanceKlass.cpp
|
||||
@@ -178,7 +178,9 @@ bool InstanceKlass::has_nest_member(InstanceKlass* k, TRAPS) const {
|
||||
}
|
||||
|
||||
Klass* k2 = _constants->klass_at(cp_index, CHECK_false);
|
||||
- k2 = k2->newest_version();
|
||||
+ if (AllowEnhancedClassRedefinition) {
|
||||
+ k2 = k2->newest_version();
|
||||
+ }
|
||||
if (k2 == k) {
|
||||
log_trace(class, nestmates)("- class is listed as a nest member");
|
||||
return true;
|
||||
@@ -837,7 +839,7 @@ bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
|
||||
#endif
|
||||
set_init_state(linked);
|
||||
// (DCEVM) Must check for old version in order to prevent infinite loops.
|
||||
- if (JvmtiExport::should_post_class_prepare() && old_version() == NULL /* JVMTI deadlock otherwise */) {
|
||||
+ if (JvmtiExport::should_post_class_prepare() && (!AllowEnhancedClassRedefinition || old_version() == NULL) /* JVMTI deadlock otherwise */) {
|
||||
Thread *thread = THREAD;
|
||||
assert(thread->is_Java_thread(), "thread->is_Java_thread()");
|
||||
JvmtiExport::post_class_prepare((JavaThread *) thread, this);
|
||||
@@ -919,7 +921,7 @@ void InstanceKlass::initialize_impl(TRAPS) {
|
||||
// that aren't expected to throw. This would wreak havoc. See 6320309.
|
||||
// (DCEVM) Wait also for the old class version to be fully initialized.
|
||||
while((is_being_initialized() && !is_reentrant_initialization(self))
|
||||
- || (old_version() != NULL && InstanceKlass::cast(old_version())->is_being_initialized())) {
|
||||
+ || (AllowEnhancedClassRedefinition && old_version() != NULL && InstanceKlass::cast(old_version())->is_being_initialized())) {
|
||||
wait = true;
|
||||
ol.waitUninterruptibly(CHECK);
|
||||
}
|
||||
@@ -3617,7 +3619,7 @@ void InstanceKlass::verify_on(outputStream* st) {
|
||||
|
||||
guarantee(sib->is_klass(), "should be klass");
|
||||
// TODO: (DCEVM) explain
|
||||
- guarantee(sib->super() == super || super->newest_version() == SystemDictionary::Object_klass(), "siblings should have same superklass");
|
||||
+ guarantee(sib->super() == super || AllowEnhancedClassRedefinition && super->newest_version() == SystemDictionary::Object_klass(), "siblings should have same superklass");
|
||||
}
|
||||
|
||||
// Verify implementor fields requires the Compile_lock, but this is sometimes
|
||||
diff --git a/src/hotspot/share/oops/method.cpp b/src/hotspot/share/oops/method.cpp
|
||||
index a9556ecf0c4..6c7edaca67e 100644
|
||||
--- a/src/hotspot/share/oops/method.cpp
|
||||
+++ b/src/hotspot/share/oops/method.cpp
|
||||
@@ -2100,7 +2100,7 @@ void Method::ensure_jmethod_ids(ClassLoaderData* loader_data, int capacity) {
|
||||
// Add a method id to the jmethod_ids
|
||||
jmethodID Method::make_jmethod_id(ClassLoaderData* loader_data, Method* m) {
|
||||
// FIXME: (DCEVM) ???
|
||||
- if (m != m->newest_version()) {
|
||||
+ if (AllowEnhancedClassRedefinition && m != m->newest_version()) {
|
||||
m = m->newest_version();
|
||||
}
|
||||
ClassLoaderData* cld = loader_data;
|
||||
diff --git a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
index 60604c645ff..325bffb7ad0 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
// the new version (SystemDictionary stores only new versions). But the LoadedClassesClosure's functionality was
|
||||
// changed in java8 where jvmtiLoadedClasses collects all classes from all classloaders, therefore we
|
||||
// must use new versions only.
|
||||
- if (k->new_version()==NULL) {
|
||||
+ if (AllowEnhancedClassRedefinition && k->new_version()==NULL) {
|
||||
_classStack.push((jclass) _env->jni_reference(Handle(_cur_thread, k->java_mirror())));
|
||||
}
|
||||
}
|
||||
diff --git a/src/hotspot/share/runtime/reflection.cpp b/src/hotspot/share/runtime/reflection.cpp
|
||||
index ed789b0bc2b..06f60855655 100644
|
||||
--- a/src/hotspot/share/runtime/reflection.cpp
|
||||
+++ b/src/hotspot/share/runtime/reflection.cpp
|
||||
@@ -660,7 +660,7 @@ bool Reflection::verify_member_access(const Klass* current_class,
|
||||
TRAPS) {
|
||||
|
||||
// (DCEVM) Decide accessibility based on active version
|
||||
- if (current_class != NULL) {
|
||||
+ if (AllowEnhancedClassRedefinition && current_class != NULL) {
|
||||
current_class = current_class->active_version();
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
From a9bc3c0b7acfe8432f4f50362df3d8f95d7b5d9d Mon Sep 17 00:00:00 2001
|
||||
From: Vladimir Dvorak <lada.dvorak7@gmail.com>
|
||||
Date: Fri, 23 Oct 2020 11:07:40 +0200
|
||||
Subject: [PATCH 17/17] Fix metadataOnStack bug
|
||||
|
||||
---
|
||||
.../share/classfile/classLoaderData.cpp | 7 +-
|
||||
.../share/classfile/metadataOnStackMark.cpp | 67 ++++++++++---------
|
||||
.../share/classfile/metadataOnStackMark.hpp | 3 +-
|
||||
.../share/prims/jvmtiRedefineClasses.cpp | 2 +-
|
||||
4 files changed, 41 insertions(+), 38 deletions(-)
|
||||
|
||||
diff --git a/src/hotspot/share/classfile/classLoaderData.cpp b/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
index 1bc67adf5a7..bba5ce0511f 100644
|
||||
--- a/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
+++ b/src/hotspot/share/classfile/classLoaderData.cpp
|
||||
@@ -1398,13 +1398,10 @@ bool ClassLoaderDataGraph::do_unloading(bool clean_previous_versions) {
|
||||
// Klassesoto delete.
|
||||
|
||||
// FIXME: dcevm - block asserts in MetadataOnStackMark
|
||||
- bool walk_all_metadata = false;
|
||||
- if (!AllowEnhancedClassRedefinition) {
|
||||
- walk_all_metadata = clean_previous_versions &&
|
||||
+ bool walk_all_metadata = clean_previous_versions &&
|
||||
JvmtiExport::has_redefined_a_class() &&
|
||||
InstanceKlass::has_previous_versions_and_reset();
|
||||
- MetadataOnStackMark md_on_stack(walk_all_metadata);
|
||||
- }
|
||||
+ MetadataOnStackMark md_on_stack(walk_all_metadata, AllowEnhancedClassRedefinition);
|
||||
|
||||
// Save previous _unloading pointer for CMS which may add to unloading list before
|
||||
// purging and we don't want to rewalk the previously unloaded class loader data.
|
||||
diff --git a/src/hotspot/share/classfile/metadataOnStackMark.cpp b/src/hotspot/share/classfile/metadataOnStackMark.cpp
|
||||
index 3a62c789702..9d7bdbde74b 100644
|
||||
--- a/src/hotspot/share/classfile/metadataOnStackMark.cpp
|
||||
+++ b/src/hotspot/share/classfile/metadataOnStackMark.cpp
|
||||
@@ -46,23 +46,25 @@ NOT_PRODUCT(bool MetadataOnStackMark::_is_active = false;)
|
||||
// it. Class unloading only deletes in-error class files, methods created by
|
||||
// the relocator and dummy constant pools. None of these appear anywhere except
|
||||
// in metadata Handles.
|
||||
-MetadataOnStackMark::MetadataOnStackMark(bool redefinition_walk) {
|
||||
+MetadataOnStackMark::MetadataOnStackMark(bool redefinition_walk, bool ignore) : _ignore(ignore) {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
|
||||
assert(_used_buffers == NULL, "sanity check");
|
||||
assert(!_is_active, "MetadataOnStackMarks do not nest");
|
||||
NOT_PRODUCT(_is_active = true;)
|
||||
|
||||
- Threads::metadata_handles_do(Metadata::mark_on_stack);
|
||||
+ if (!ignore) {
|
||||
+ Threads::metadata_handles_do(Metadata::mark_on_stack);
|
||||
|
||||
- if (redefinition_walk) {
|
||||
- Threads::metadata_do(Metadata::mark_on_stack);
|
||||
- CodeCache::metadata_do(Metadata::mark_on_stack);
|
||||
- CompileBroker::mark_on_stack();
|
||||
- JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
|
||||
- ThreadService::metadata_do(Metadata::mark_on_stack);
|
||||
+ if (redefinition_walk) {
|
||||
+ Threads::metadata_do(Metadata::mark_on_stack);
|
||||
+ CodeCache::metadata_do(Metadata::mark_on_stack);
|
||||
+ CompileBroker::mark_on_stack();
|
||||
+ JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
|
||||
+ ThreadService::metadata_do(Metadata::mark_on_stack);
|
||||
#if INCLUDE_JVMCI
|
||||
- JVMCIRuntime::metadata_do(Metadata::mark_on_stack);
|
||||
+ JVMCIRuntime::metadata_do(Metadata::mark_on_stack);
|
||||
#endif
|
||||
+ }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,32 +73,35 @@ MetadataOnStackMark::~MetadataOnStackMark() {
|
||||
// Unmark everything that was marked. Can't do the same walk because
|
||||
// redefine classes messes up the code cache so the set of methods
|
||||
// might not be the same.
|
||||
- retire_current_buffer();
|
||||
-
|
||||
- MetadataOnStackBuffer* buffer = _used_buffers;
|
||||
- while (buffer != NULL) {
|
||||
- // Clear on stack state for all metadata.
|
||||
- size_t size = buffer->size();
|
||||
- for (size_t i = 0; i < size; i++) {
|
||||
- Metadata* md = buffer->at(i);
|
||||
- md->set_on_stack(false);
|
||||
+ if (!_ignore)
|
||||
+ {
|
||||
+ retire_current_buffer();
|
||||
+
|
||||
+ MetadataOnStackBuffer* buffer = _used_buffers;
|
||||
+ while (buffer != NULL) {
|
||||
+ // Clear on stack state for all metadata.
|
||||
+ size_t size = buffer->size();
|
||||
+ for (size_t i = 0; i < size; i++) {
|
||||
+ Metadata* md = buffer->at(i);
|
||||
+ md->set_on_stack(false);
|
||||
+ }
|
||||
+
|
||||
+ MetadataOnStackBuffer* next = buffer->next_used();
|
||||
+
|
||||
+ // Move the buffer to the free list.
|
||||
+ buffer->clear();
|
||||
+ buffer->set_next_used(NULL);
|
||||
+ buffer->set_next_free(_free_buffers);
|
||||
+ _free_buffers = buffer;
|
||||
+
|
||||
+ // Step to next used buffer.
|
||||
+ buffer = next;
|
||||
}
|
||||
|
||||
- MetadataOnStackBuffer* next = buffer->next_used();
|
||||
-
|
||||
- // Move the buffer to the free list.
|
||||
- buffer->clear();
|
||||
- buffer->set_next_used(NULL);
|
||||
- buffer->set_next_free(_free_buffers);
|
||||
- _free_buffers = buffer;
|
||||
+ _used_buffers = NULL;
|
||||
|
||||
- // Step to next used buffer.
|
||||
- buffer = next;
|
||||
+ NOT_PRODUCT(_is_active = false;)
|
||||
}
|
||||
-
|
||||
- _used_buffers = NULL;
|
||||
-
|
||||
- NOT_PRODUCT(_is_active = false;)
|
||||
}
|
||||
|
||||
void MetadataOnStackMark::retire_buffer(MetadataOnStackBuffer* buffer) {
|
||||
diff --git a/src/hotspot/share/classfile/metadataOnStackMark.hpp b/src/hotspot/share/classfile/metadataOnStackMark.hpp
|
||||
index 8da4ac6f92b..6d327ab98f2 100644
|
||||
--- a/src/hotspot/share/classfile/metadataOnStackMark.hpp
|
||||
+++ b/src/hotspot/share/classfile/metadataOnStackMark.hpp
|
||||
@@ -47,8 +47,9 @@ class MetadataOnStackMark : public StackObj {
|
||||
static MetadataOnStackBuffer* allocate_buffer();
|
||||
static void retire_buffer(MetadataOnStackBuffer* buffer);
|
||||
|
||||
+ bool _ignore;
|
||||
public:
|
||||
- MetadataOnStackMark(bool redefinition_walk);
|
||||
+ MetadataOnStackMark(bool redefinition_walk, bool ignore);
|
||||
~MetadataOnStackMark();
|
||||
|
||||
static void record(Metadata* m);
|
||||
diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
|
||||
index 1b2070d686f..1178c863c30 100644
|
||||
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
|
||||
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
|
||||
@@ -199,7 +199,7 @@ void VM_RedefineClasses::doit() {
|
||||
|
||||
// Mark methods seen on stack and everywhere else so old methods are not
|
||||
// cleaned up if they're on the stack.
|
||||
- MetadataOnStackMark md_on_stack(true);
|
||||
+ MetadataOnStackMark md_on_stack(true, false);
|
||||
HandleMark hm(thread); // make sure any handles created are deleted
|
||||
// before the stack walk again.
|
||||
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -934,7 +934,7 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
|
||||
int result = LWKeyboardFocusManagerPeer.shouldNativelyFocusHeavyweight(
|
||||
getTarget(), lightweightChild, temporary,
|
||||
focusedWindowChangeAllowed, time, cause, false);
|
||||
focusedWindowChangeAllowed, time, cause);
|
||||
switch (result) {
|
||||
case LWKeyboardFocusManagerPeer.SNFH_FAILURE:
|
||||
return false;
|
||||
@@ -975,7 +975,9 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
|
||||
|
||||
Component focusOwner = kfmPeer.getCurrentFocusOwner();
|
||||
LWKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
|
||||
getTarget(), false, cause, focusOwner);
|
||||
getTarget(), temporary,
|
||||
focusedWindowChangeAllowed,
|
||||
time, cause, focusOwner);
|
||||
});
|
||||
|
||||
case LWKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
|
||||
|
||||
@@ -121,11 +121,10 @@ public abstract class KeyboardFocusManager
|
||||
boolean temporary,
|
||||
boolean focusedWindowChangeAllowed,
|
||||
long time,
|
||||
FocusEvent.Cause cause,
|
||||
boolean highPriorityEvents)
|
||||
FocusEvent.Cause cause)
|
||||
{
|
||||
return KeyboardFocusManager.shouldNativelyFocusHeavyweight(
|
||||
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause, highPriorityEvents);
|
||||
heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
|
||||
}
|
||||
public boolean processSynchronousLightweightTransfer(Component heavyweight,
|
||||
Component descendant,
|
||||
@@ -2393,8 +2392,7 @@ public abstract class KeyboardFocusManager
|
||||
*/
|
||||
static int shouldNativelyFocusHeavyweight
|
||||
(Component heavyweight, Component descendant, boolean temporary,
|
||||
boolean focusedWindowChangeAllowed, long time, FocusEvent.Cause cause,
|
||||
boolean highPriorityEvents)
|
||||
boolean focusedWindowChangeAllowed, long time, FocusEvent.Cause cause)
|
||||
{
|
||||
if (log.isLoggable(PlatformLogger.Level.FINE)) {
|
||||
if (heavyweight == null) {
|
||||
@@ -2463,22 +2461,17 @@ public abstract class KeyboardFocusManager
|
||||
new FocusEvent(currentFocusOwner,
|
||||
FocusEvent.FOCUS_LOST,
|
||||
temporary, descendant, cause);
|
||||
if (highPriorityEvents) {
|
||||
SunToolkit.postPriorityEvent(currentFocusOwnerEvent);
|
||||
} else {
|
||||
SunToolkit.postEvent(currentFocusOwner.appContext,
|
||||
currentFocusOwnerEvent);
|
||||
}
|
||||
// Fix 5028014. Rolled out.
|
||||
// SunToolkit.postPriorityEvent(currentFocusOwnerEvent);
|
||||
SunToolkit.postEvent(currentFocusOwner.appContext,
|
||||
currentFocusOwnerEvent);
|
||||
}
|
||||
FocusEvent newFocusOwnerEvent =
|
||||
new FocusEvent(descendant, FocusEvent.FOCUS_GAINED,
|
||||
temporary, currentFocusOwner, cause);
|
||||
if (highPriorityEvents) {
|
||||
SunToolkit.postPriorityEvent(newFocusOwnerEvent);
|
||||
} else {
|
||||
SunToolkit.postEvent(descendant.appContext,
|
||||
newFocusOwnerEvent);
|
||||
}
|
||||
// Fix 5028014. Rolled out.
|
||||
// SunToolkit.postPriorityEvent(newFocusOwnerEvent);
|
||||
SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
|
||||
|
||||
if (focusLog.isLoggable(PlatformLogger.Level.FINEST))
|
||||
focusLog.finest("2. SNFH_HANDLED for {0}", String.valueOf(descendant));
|
||||
|
||||
@@ -440,8 +440,7 @@ public final class AWTAccessor {
|
||||
boolean temporary,
|
||||
boolean focusedWindowChangeAllowed,
|
||||
long time,
|
||||
Cause cause,
|
||||
boolean highPriorityEvents);
|
||||
Cause cause);
|
||||
/**
|
||||
* Delivers focus for the lightweight descendant of the heavyweight
|
||||
* synchronously.
|
||||
|
||||
@@ -107,7 +107,9 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
|
||||
@SuppressWarnings("deprecation")
|
||||
public static boolean deliverFocus(Component lightweightChild,
|
||||
Component target,
|
||||
boolean highPriority,
|
||||
boolean temporary,
|
||||
boolean focusedWindowChangeAllowed,
|
||||
long time,
|
||||
FocusEvent.Cause cause,
|
||||
Component currentFocusOwner) // provided by the descendant peers
|
||||
{
|
||||
@@ -126,11 +128,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
|
||||
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
|
||||
focusLog.finer("Posting focus event: " + fl);
|
||||
}
|
||||
if (highPriority) {
|
||||
SunToolkit.postPriorityEvent(fl);
|
||||
} else {
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl);
|
||||
}
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl);
|
||||
}
|
||||
|
||||
FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
|
||||
@@ -139,11 +137,7 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
|
||||
if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
|
||||
focusLog.finer("Posting focus event: " + fg);
|
||||
}
|
||||
if (highPriority) {
|
||||
SunToolkit.postPriorityEvent(fg);
|
||||
} else {
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg);
|
||||
}
|
||||
SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -158,12 +152,11 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
|
||||
boolean temporary,
|
||||
boolean focusedWindowChangeAllowed,
|
||||
long time,
|
||||
FocusEvent.Cause cause,
|
||||
boolean highPriorityEvents)
|
||||
FocusEvent.Cause cause)
|
||||
{
|
||||
return KfmAccessor.instance.shouldNativelyFocusHeavyweight(
|
||||
heavyweight, descendant, temporary, focusedWindowChangeAllowed,
|
||||
time, cause, highPriorityEvents);
|
||||
time, cause);
|
||||
}
|
||||
|
||||
public static void removeLastFocusRequest(Component heavyweight) {
|
||||
|
||||
@@ -434,14 +434,6 @@ public abstract class SunToolkit extends Toolkit
|
||||
* Post AWTEvent of high priority.
|
||||
*/
|
||||
public static void postPriorityEvent(final AWTEvent e) {
|
||||
if (e.getID() == WindowEvent.WINDOW_LOST_FOCUS &&
|
||||
e instanceof TimedWindowEvent)
|
||||
{
|
||||
TimedWindowEvent twe = (TimedWindowEvent)e;
|
||||
((SunToolkit)Toolkit.getDefaultToolkit()).
|
||||
setWindowDeactivationTime((Window)twe.getSource(), twe.getWhen());
|
||||
}
|
||||
|
||||
PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -3,7 +3,6 @@ package sun.awt.event;
|
||||
import sun.font.FontUtilities;
|
||||
|
||||
import java.lang.annotation.Native;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
public class KeyEventProcessing {
|
||||
// This property is used to emulate old behavior
|
||||
@@ -12,17 +11,11 @@ public class KeyEventProcessing {
|
||||
public final static String useNationalLayoutsOption = "com.sun.awt.use.national.layouts";
|
||||
@Native
|
||||
public final static boolean useNationalLayouts = "true".equals(
|
||||
getProperty(useNationalLayoutsOption, FontUtilities.isMacOSX ? "true" : "false"));
|
||||
Util.getProperty(useNationalLayoutsOption, FontUtilities.isMacOSX ? "true" : "false"));
|
||||
|
||||
// Used on windows to emulate latin OEM keys on cyrillic keyboards
|
||||
public final static String useLatinNonAlphaNumKeycodesOption = "com.sun.awt.useLatinNonAlphaNumKeycodes";
|
||||
@Native
|
||||
public final static boolean useLatinNonAlphaNumKeycodes = "true".equals(
|
||||
getProperty(useLatinNonAlphaNumKeycodesOption, "false"));
|
||||
|
||||
private static String getProperty(String option, String dflt) {
|
||||
return java.security.AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty(option, dflt)
|
||||
);
|
||||
}
|
||||
Util.getProperty(useLatinNonAlphaNumKeycodesOption, "false"));
|
||||
}
|
||||
|
||||
@@ -18,4 +18,10 @@ public class TouchEvent {
|
||||
* in ms
|
||||
*/
|
||||
public static final long NO_UPDATE_TIMEOUT = 1000L;
|
||||
|
||||
public final static String defaultTouchHandlingOption = "com.jetbrains.default.touchscreen.mode";
|
||||
|
||||
@Native
|
||||
public final static boolean defaultTouchHandling = "true".equalsIgnoreCase(
|
||||
Util.getProperty(defaultTouchHandlingOption, "false"));
|
||||
}
|
||||
|
||||
11
src/java.desktop/share/classes/sun/awt/event/Util.java
Normal file
11
src/java.desktop/share/classes/sun/awt/event/Util.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package sun.awt.event;
|
||||
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
class Util {
|
||||
public static String getProperty(String option, String dflt) {
|
||||
return java.security.AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) () -> System.getProperty(option, dflt)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -259,7 +259,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
|
||||
int result = XKeyboardFocusManagerPeer.
|
||||
shouldNativelyFocusHeavyweight(target, lightweightChild,
|
||||
temporary, focusedWindowChangeAllowed,
|
||||
time, cause, false);
|
||||
time, cause);
|
||||
|
||||
switch (result) {
|
||||
case XKeyboardFocusManagerPeer.SNFH_FAILURE:
|
||||
|
||||
@@ -198,7 +198,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
|
||||
{
|
||||
int result = XKeyboardFocusManagerPeer
|
||||
.shouldNativelyFocusHeavyweight(proxy, lightweightChild,
|
||||
temporary, false, time, cause, false);
|
||||
temporary, false, time, cause);
|
||||
|
||||
switch (result) {
|
||||
case XKeyboardFocusManagerPeer.SNFH_FAILURE:
|
||||
|
||||
@@ -105,7 +105,9 @@ public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
|
||||
{
|
||||
return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
|
||||
target,
|
||||
false,
|
||||
temporary,
|
||||
focusedWindowChangeAllowed,
|
||||
time,
|
||||
cause,
|
||||
getInstance().getCurrentFocusOwner());
|
||||
}
|
||||
|
||||
@@ -701,7 +701,7 @@ public abstract class WComponentPeer extends WObjectPeer
|
||||
int result = WKeyboardFocusManagerPeer
|
||||
.shouldNativelyFocusHeavyweight((Component)target, lightweightChild,
|
||||
temporary, focusedWindowChangeAllowed,
|
||||
time, cause, true);
|
||||
time, cause);
|
||||
|
||||
switch (result) {
|
||||
case WKeyboardFocusManagerPeer.SNFH_FAILURE:
|
||||
|
||||
@@ -80,7 +80,9 @@ final class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
|
||||
// TODO: do something to eliminate this forwarding
|
||||
return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
|
||||
target,
|
||||
true,
|
||||
temporary,
|
||||
focusedWindowChangeAllowed,
|
||||
time,
|
||||
cause,
|
||||
getNativeFocusOwner());
|
||||
}
|
||||
|
||||
@@ -139,9 +139,6 @@ public final class WToolkit extends SunToolkit implements Runnable {
|
||||
{
|
||||
@Override
|
||||
public Void run() {
|
||||
// temporary measure, until corresponding code is disabled in IntelliJ platform
|
||||
System.setProperty("action.aware.typeAhead", "false");
|
||||
|
||||
String browserProp = System.getProperty("browser");
|
||||
if (browserProp != null && browserProp.equals("sun.plugin")) {
|
||||
disableCustomPalette();
|
||||
|
||||
@@ -103,7 +103,6 @@ HWND AwtComponent::sm_focusOwner = NULL;
|
||||
HWND AwtComponent::sm_focusedWindow = NULL;
|
||||
BOOL AwtComponent::sm_bMenuLoop = FALSE;
|
||||
BOOL AwtComponent::sm_inSynthesizeFocus = FALSE;
|
||||
BOOL AwtComponent::sm_priorityFocusEvents = FALSE;
|
||||
|
||||
/************************************************************************/
|
||||
// Struct for _Reshape() and ReshapeNoCheck() methods
|
||||
@@ -1344,7 +1343,6 @@ void SpyWinMessage(HWND hwnd, UINT message, LPCTSTR szComment) {
|
||||
WIN_MSG(WM_AWT_COMPONENT_HIDE)
|
||||
WIN_MSG(WM_AWT_COMPONENT_SETFOCUS)
|
||||
WIN_MSG(WM_AWT_WINDOW_SETACTIVE)
|
||||
WIN_MSG(WM_AWT_WINDOW_TOFRONT)
|
||||
WIN_MSG(WM_AWT_LIST_SETMULTISELECT)
|
||||
WIN_MSG(WM_AWT_HANDLE_EVENT)
|
||||
WIN_MSG(WM_AWT_PRINT_COMPONENT)
|
||||
@@ -1402,6 +1400,19 @@ static BOOL IsMouseEventFromTouch()
|
||||
{
|
||||
return (::GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH_MASK) == MOUSEEVENTF_FROMTOUCH;
|
||||
}
|
||||
|
||||
// consider making general function
|
||||
// T getClassStaticField(cls, field, default_val)
|
||||
static BOOL IsDefaultTouch()
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
jclass cls = env->FindClass("sun/awt/event/TouchEvent");
|
||||
CHECK_NULL_RETURN(cls, FALSE);
|
||||
jfieldID fieldID = env->GetStaticFieldID(cls, "defaultTouchHandling", "Z");
|
||||
CHECK_NULL_RETURN(fieldID, FALSE);
|
||||
return static_cast<BOOL>(env->GetStaticBooleanField(cls, fieldID));
|
||||
}
|
||||
|
||||
/*
|
||||
* Dispatch messages for this window class--general component
|
||||
*/
|
||||
@@ -1427,6 +1438,8 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
return (LRESULT)TRUE;
|
||||
}
|
||||
|
||||
static const BOOL PROCESS_TOUCH_EVENTS = !IsDefaultTouch();
|
||||
|
||||
DWORD curPos = 0;
|
||||
|
||||
UINT switchMessage = message;
|
||||
@@ -1718,7 +1731,7 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
case WM_MOUSEHWHEEL:
|
||||
case WM_AWT_MOUSEENTER:
|
||||
case WM_AWT_MOUSEEXIT:
|
||||
if (IsMouseEventFromTouch()) {
|
||||
if (IsMouseEventFromTouch() && PROCESS_TOUCH_EVENTS) {
|
||||
break;
|
||||
}
|
||||
curPos = ::GetMessagePos();
|
||||
@@ -1798,8 +1811,10 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
break;
|
||||
case WM_TOUCH:
|
||||
WmTouch(wParam, lParam);
|
||||
break;
|
||||
if (PROCESS_TOUCH_EVENTS) {
|
||||
WmTouch(wParam, lParam);
|
||||
break;
|
||||
}
|
||||
case WM_SETCURSOR:
|
||||
mr = mrDoDefault;
|
||||
if (LOWORD(lParam) == HTCLIENT) {
|
||||
@@ -2023,38 +2038,24 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
* there.
|
||||
*/
|
||||
case WM_AWT_COMPONENT_SHOW:
|
||||
sm_priorityFocusEvents = TRUE;
|
||||
Show();
|
||||
sm_priorityFocusEvents = FALSE;
|
||||
mr = mrConsume;
|
||||
break;
|
||||
case WM_AWT_COMPONENT_HIDE:
|
||||
sm_priorityFocusEvents = TRUE;
|
||||
Hide();
|
||||
sm_priorityFocusEvents = FALSE;
|
||||
mr = mrConsume;
|
||||
break;
|
||||
|
||||
case WM_AWT_COMPONENT_SETFOCUS:
|
||||
sm_priorityFocusEvents = TRUE;
|
||||
if ((BOOL)wParam) {
|
||||
retValue = SynthesizeWmSetFocus(GetHWnd(), NULL);
|
||||
} else {
|
||||
retValue = SynthesizeWmKillFocus(GetHWnd(), NULL);
|
||||
}
|
||||
sm_priorityFocusEvents = FALSE;
|
||||
mr = mrConsume;
|
||||
break;
|
||||
case WM_AWT_WINDOW_SETACTIVE:
|
||||
sm_priorityFocusEvents = TRUE;
|
||||
retValue = (LRESULT)((AwtWindow*)this)->AwtSetActiveWindow((BOOL)wParam);
|
||||
sm_priorityFocusEvents = FALSE;
|
||||
mr = mrConsume;
|
||||
break;
|
||||
case WM_AWT_WINDOW_TOFRONT:
|
||||
sm_priorityFocusEvents = TRUE;
|
||||
((AwtWindow*)this)->ToFront();
|
||||
sm_priorityFocusEvents = FALSE;
|
||||
mr = mrConsume;
|
||||
break;
|
||||
|
||||
|
||||
@@ -699,7 +699,6 @@ public:
|
||||
static void *GetNativeFocusOwner();
|
||||
|
||||
static BOOL sm_inSynthesizeFocus;
|
||||
static BOOL sm_priorityFocusEvents;
|
||||
|
||||
// Execute on Toolkit only.
|
||||
INLINE static LRESULT SynthesizeWmSetFocus(HWND targetHWnd, HWND oppositeHWnd) {
|
||||
|
||||
@@ -304,7 +304,7 @@ AwtWindow::Grab() {
|
||||
// we shouldn't perform grab in this case (see 4841881 & 6539458)
|
||||
Ungrab();
|
||||
} else if (GetHWnd() != AwtComponent::GetFocusedWindow()) {
|
||||
_ToFront(env->NewGlobalRef(GetPeer(env)), FALSE);
|
||||
_ToFront(env->NewGlobalRef(GetPeer(env)));
|
||||
// Global ref was deleted in _ToFront
|
||||
}
|
||||
}
|
||||
@@ -1615,34 +1615,6 @@ void AwtWindow::SendComponentEvent(jint eventId)
|
||||
env->DeleteLocalRef(event);
|
||||
}
|
||||
|
||||
static void SendPriorityEvent(jobject event) {
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
static jclass toolkitClass;
|
||||
if (toolkitClass == NULL) {
|
||||
toolkitClass = env->FindClass("sun/awt/SunToolkit");
|
||||
if (toolkitClass != NULL) {
|
||||
toolkitClass = (jclass)env->NewGlobalRef(toolkitClass);
|
||||
}
|
||||
if (toolkitClass == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static jmethodID postPriorityEventMID;
|
||||
if (postPriorityEventMID == NULL) {
|
||||
postPriorityEventMID =
|
||||
env->GetStaticMethodID(toolkitClass, "postPriorityEvent",
|
||||
"(Ljava/awt/AWTEvent;)V");
|
||||
DASSERT(postPriorityEventMID);
|
||||
if (postPriorityEventMID == NULL) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
env->CallStaticVoidMethod(toolkitClass, postPriorityEventMID, event);
|
||||
}
|
||||
|
||||
void AwtWindow::SendWindowEvent(jint id, HWND opposite,
|
||||
jint oldState, jint newState)
|
||||
{
|
||||
@@ -1673,6 +1645,25 @@ void AwtWindow::SendWindowEvent(jint id, HWND opposite,
|
||||
}
|
||||
}
|
||||
|
||||
static jclass sequencedEventCls;
|
||||
if (sequencedEventCls == NULL) {
|
||||
jclass sequencedEventClsLocal
|
||||
= env->FindClass("java/awt/SequencedEvent");
|
||||
DASSERT(sequencedEventClsLocal);
|
||||
CHECK_NULL(sequencedEventClsLocal);
|
||||
sequencedEventCls =
|
||||
(jclass)env->NewGlobalRef(sequencedEventClsLocal);
|
||||
env->DeleteLocalRef(sequencedEventClsLocal);
|
||||
}
|
||||
|
||||
static jmethodID sequencedEventConst;
|
||||
if (sequencedEventConst == NULL) {
|
||||
sequencedEventConst =
|
||||
env->GetMethodID(sequencedEventCls, "<init>",
|
||||
"(Ljava/awt/AWTEvent;)V");
|
||||
CHECK_NULL(sequencedEventConst);
|
||||
}
|
||||
|
||||
static jclass windowCls = NULL;
|
||||
if (windowCls == NULL) {
|
||||
jclass windowClsLocal = env->FindClass("java/awt/Window");
|
||||
@@ -1726,15 +1717,20 @@ void AwtWindow::SendWindowEvent(jint id, HWND opposite,
|
||||
env->DeleteLocalRef(target); target = NULL;
|
||||
CHECK_NULL(event);
|
||||
|
||||
if (AwtComponent::sm_priorityFocusEvents &&
|
||||
(id == java_awt_event_WindowEvent_WINDOW_GAINED_FOCUS ||
|
||||
id == java_awt_event_WindowEvent_WINDOW_LOST_FOCUS))
|
||||
if (id == java_awt_event_WindowEvent_WINDOW_GAINED_FOCUS ||
|
||||
id == java_awt_event_WindowEvent_WINDOW_LOST_FOCUS)
|
||||
{
|
||||
SendPriorityEvent(event);
|
||||
} else {
|
||||
SendEvent(event);
|
||||
jobject sequencedEvent = env->NewObject(sequencedEventCls,
|
||||
sequencedEventConst,
|
||||
event);
|
||||
DASSERT(!safe_ExceptionOccurred(env));
|
||||
DASSERT(sequencedEvent != NULL);
|
||||
env->DeleteLocalRef(event);
|
||||
event = sequencedEvent;
|
||||
}
|
||||
|
||||
SendEvent(event);
|
||||
|
||||
env->DeleteLocalRef(event);
|
||||
}
|
||||
|
||||
@@ -2451,25 +2447,7 @@ ret:
|
||||
return result;
|
||||
}
|
||||
|
||||
void AwtWindow::ToFront() {
|
||||
if (::IsWindow(GetHWnd())) {
|
||||
UINT flags = SWP_NOMOVE|SWP_NOSIZE;
|
||||
BOOL focusable = IsFocusableWindow();
|
||||
BOOL autoRequestFocus = IsAutoRequestFocus();
|
||||
|
||||
if (!focusable || !autoRequestFocus)
|
||||
{
|
||||
flags = flags|SWP_NOACTIVATE;
|
||||
}
|
||||
::SetWindowPos(GetHWnd(), HWND_TOP, 0, 0, 0, 0, flags);
|
||||
if (focusable && autoRequestFocus)
|
||||
{
|
||||
::SetForegroundWindow(GetHWnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AwtWindow::_ToFront(void *param, BOOL wait)
|
||||
void AwtWindow::_ToFront(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
|
||||
@@ -2482,20 +2460,24 @@ void AwtWindow::_ToFront(void *param, BOOL wait)
|
||||
w = (AwtWindow *)pData;
|
||||
if (::IsWindow(w->GetHWnd()))
|
||||
{
|
||||
if (wait) {
|
||||
w->SendMessage(WM_AWT_WINDOW_TOFRONT, 0, 0);
|
||||
} else {
|
||||
w->ToFront();
|
||||
UINT flags = SWP_NOMOVE|SWP_NOSIZE;
|
||||
BOOL focusable = w->IsFocusableWindow();
|
||||
BOOL autoRequestFocus = w->IsAutoRequestFocus();
|
||||
|
||||
if (!focusable || !autoRequestFocus)
|
||||
{
|
||||
flags = flags|SWP_NOACTIVATE;
|
||||
}
|
||||
::SetWindowPos(w->GetHWnd(), HWND_TOP, 0, 0, 0, 0, flags);
|
||||
if (focusable && autoRequestFocus)
|
||||
{
|
||||
::SetForegroundWindow(w->GetHWnd());
|
||||
}
|
||||
}
|
||||
ret:
|
||||
env->DeleteGlobalRef(self);
|
||||
}
|
||||
|
||||
static void _ToFrontWait(void *param) {
|
||||
AwtWindow::_ToFront(param, TRUE);
|
||||
}
|
||||
|
||||
void AwtWindow::_ToBack(void *param)
|
||||
{
|
||||
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
|
||||
@@ -3519,7 +3501,7 @@ Java_sun_awt_windows_WWindowPeer__1toFront(JNIEnv *env, jobject self)
|
||||
{
|
||||
TRY;
|
||||
|
||||
AwtToolkit::GetInstance().SyncCall(_ToFrontWait,
|
||||
AwtToolkit::GetInstance().SyncCall(AwtWindow::_ToFront,
|
||||
env->NewGlobalRef(self));
|
||||
// global ref is deleted in _ToFront()
|
||||
|
||||
|
||||
@@ -221,15 +221,13 @@ public:
|
||||
void UpdateWindow(JNIEnv* env, jintArray data, int width, int height,
|
||||
HBITMAP hNewBitmap = NULL);
|
||||
|
||||
void ToFront();
|
||||
|
||||
INLINE virtual BOOL IsTopLevel() { return TRUE; }
|
||||
static AwtWindow * GetGrabbedWindow() { return m_grabbedWindow; }
|
||||
|
||||
static void FlashWindowEx(HWND hWnd, UINT count, DWORD timeout, DWORD flags);
|
||||
|
||||
// some methods invoked on Toolkit thread
|
||||
static void _ToFront(void *param, BOOL wait);
|
||||
static void _ToFront(void *param);
|
||||
static void _ToBack(void *param);
|
||||
static void _Grab(void *param);
|
||||
static void _Ungrab(void *param);
|
||||
|
||||
@@ -203,7 +203,6 @@ enum {
|
||||
WM_AWT_COMPONENT_HIDE,
|
||||
WM_AWT_COMPONENT_SETFOCUS,
|
||||
WM_AWT_WINDOW_SETACTIVE,
|
||||
WM_AWT_WINDOW_TOFRONT,
|
||||
WM_AWT_LIST_SETMULTISELECT,
|
||||
WM_AWT_HANDLE_EVENT,
|
||||
WM_AWT_PRINT_COMPONENT,
|
||||
|
||||
@@ -293,16 +293,15 @@ public class EventQueueMonitor
|
||||
case MouseEvent.MOUSE_MOVED:
|
||||
case MouseEvent.MOUSE_DRAGGED:
|
||||
case FocusEvent.FOCUS_GAINED:
|
||||
case WindowEvent.WINDOW_ACTIVATED:
|
||||
case WindowEvent.WINDOW_DEACTIVATED:
|
||||
queueComponentEvent((ComponentEvent) theEvent);
|
||||
break;
|
||||
|
||||
case WindowEvent.WINDOW_GAINED_FOCUS:
|
||||
// WINDOW_GAINED_FOCUS, WINDOW_ACTIVATED and FOCUS_GAINED events
|
||||
// are fired before WINDOW_OPENED so we need to add topLevelListeners
|
||||
// for the window when it is first focused to get a
|
||||
// focus gained event for the focus component in it.
|
||||
case WindowEvent.WINDOW_ACTIVATED:
|
||||
// Dialogs fire WINDOW_ACTIVATED and FOCUS_GAINED events
|
||||
// before WINDOW_OPENED so we need to add topLevelListeners
|
||||
// for the dialog when it is first activated to get a
|
||||
// focus gained event for the focus component in the dialog.
|
||||
if (theEvent instanceof ComponentEvent) {
|
||||
ComponentEvent ce = (ComponentEvent)theEvent;
|
||||
if (ce.getComponent() instanceof Window) {
|
||||
@@ -313,6 +312,7 @@ public class EventQueueMonitor
|
||||
EventQueueMonitor.addTopLevelWindow(ce.getComponent());
|
||||
}
|
||||
}
|
||||
queueComponentEvent((ComponentEvent) theEvent);
|
||||
break;
|
||||
|
||||
// handle WINDOW_OPENED and WINDOW_CLOSED events synchronously
|
||||
|
||||
@@ -43,6 +43,7 @@ applications/jcstress/acqrel/Test.java - generic-all
|
||||
# :hotspot_compiler
|
||||
|
||||
compiler/aot/cli/jaotc/AtFileTest.java JBR-2365 windows-all
|
||||
compiler/aot/TestHeapBase.java JBR-2840 windows-all
|
||||
compiler/ciReplay/TestSAServer.java 8029528 generic-all
|
||||
compiler/codecache/stress/OverloadCompileQueueTest.java 8166554 generic-all
|
||||
compiler/codegen/Test6896617.java 8193479 generic-all
|
||||
|
||||
117
test/jdk/java/awt/Focus/6981400/Test2.java
Normal file
117
test/jdk/java/awt/Focus/6981400/Test2.java
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @key headful
|
||||
* @bug 6981400
|
||||
* @summary Tabbing between textfiled do not work properly when ALT+TAB
|
||||
* @author anton.tarasov
|
||||
* @library ../../regtesthelpers
|
||||
* @build Util
|
||||
* @run main Test2
|
||||
*/
|
||||
|
||||
// A focus request made after a char is typed ahead shouldn't affect the char's target component.
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import test.java.awt.regtesthelpers.Util;
|
||||
|
||||
public class Test2 {
|
||||
static Frame f = new Frame("frame");
|
||||
static TextArea t0 = new TextArea(1, 10) { public String toString() { return "[TA-0]";} };
|
||||
static TextArea t1 = new TextArea(1, 10) { public String toString() { return "[TA-1]";} };
|
||||
static TextArea t2 = new TextArea(1, 10) { public String toString() { return "[TA-2]";} };
|
||||
|
||||
static volatile boolean passed = true;
|
||||
|
||||
static Robot robot;
|
||||
|
||||
public static void main(String[] args) {
|
||||
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
|
||||
public void eventDispatched(AWTEvent e) {
|
||||
System.out.println(e);
|
||||
if (e.getID() == KeyEvent.KEY_TYPED) {
|
||||
if (e.getSource() != t1) {
|
||||
passed = false;
|
||||
throw new RuntimeException("Test failed: the key event has wrong source: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, FocusEvent.FOCUS_EVENT_MASK | KeyEvent.KEY_EVENT_MASK);
|
||||
|
||||
try {
|
||||
robot = new Robot();
|
||||
} catch (AWTException ex) {
|
||||
throw new RuntimeException("Error: can't create Robot");
|
||||
}
|
||||
|
||||
f.add(t0);
|
||||
f.add(t1);
|
||||
f.add(t2);
|
||||
|
||||
f.setLayout(new FlowLayout());
|
||||
f.pack();
|
||||
|
||||
t0.addFocusListener(new FocusAdapter() {
|
||||
public void focusLost(FocusEvent e) {
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (Exception ex) {}
|
||||
}
|
||||
});
|
||||
|
||||
// The request shouldn't affect the key event delivery.
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (Exception ex) {}
|
||||
System.out.println("requesting focus to " + t2);
|
||||
t2.requestFocus();
|
||||
}
|
||||
}).start();
|
||||
|
||||
|
||||
f.setVisible(true);
|
||||
Util.waitForIdle(robot);
|
||||
|
||||
test();
|
||||
|
||||
if (passed) System.out.println("\nTest passed.");
|
||||
}
|
||||
|
||||
static void test() {
|
||||
Util.clickOnComp(t1, robot);
|
||||
|
||||
// The key event should be eventually delivered to t1.
|
||||
robot.delay(50);
|
||||
robot.keyPress(KeyEvent.VK_A);
|
||||
robot.delay(50);
|
||||
robot.keyRelease(KeyEvent.VK_A);
|
||||
|
||||
Util.waitForIdle(robot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2020 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Test for the case which was broken during development for JBR-2712 (Typeahead mechanism doesn't work on Windows)
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class ModalDialogFromMenuTest {
|
||||
private static final CompletableFuture<Boolean> initFinished = new CompletableFuture<>();
|
||||
private static final CompletableFuture<Boolean> menuItemShown = new CompletableFuture<>();
|
||||
private static final CompletableFuture<Boolean> typedInDialog = new CompletableFuture<>();
|
||||
private static Robot robot;
|
||||
private static JFrame frame;
|
||||
private static JTextField frameField;
|
||||
private static JMenuItem menuItem;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(ModalDialogFromMenuTest::initUI);
|
||||
initFinished.get(10, TimeUnit.SECONDS);
|
||||
rightClickOn(frameField);
|
||||
menuItemShown.get(10, TimeUnit.SECONDS);
|
||||
clickOn(menuItem);
|
||||
pressAndRelease(KeyEvent.VK_A);
|
||||
typedInDialog.get(10, TimeUnit.SECONDS);
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(ModalDialogFromMenuTest::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new JFrame("ModalDialogFromMenuTest");
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
initFinished.complete(true);
|
||||
}
|
||||
});
|
||||
frameField = new JTextField(20);
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
menuItem = new JMenuItem(new AbstractAction("open dialog") {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
JDialog d = new JDialog(frame, true);
|
||||
JTextField dialogField = new JTextField(10);
|
||||
dialogField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
typedInDialog.complete(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {}
|
||||
});
|
||||
d.add(dialogField);
|
||||
d.pack();
|
||||
d.setVisible(true);
|
||||
}
|
||||
});
|
||||
menuItem.addHierarchyListener(e -> {
|
||||
if (menuItem.isShowing()) menuItemShown.complete(true);
|
||||
});
|
||||
menu.add(menuItem);
|
||||
frameField.setComponentPopupMenu(menu);
|
||||
frame.add(frameField);
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
}
|
||||
|
||||
private static void pressAndRelease(int keyCode) {
|
||||
robot.keyPress(keyCode);
|
||||
robot.keyRelease(keyCode);
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y, int buttons) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(buttons);
|
||||
robot.mouseRelease(buttons);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component, int buttons) {
|
||||
Point location = component.getLocationOnScreen();
|
||||
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2, buttons);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component) {
|
||||
clickOn(component, InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
|
||||
private static void rightClickOn(Component component) {
|
||||
clickOn(component, InputEvent.BUTTON3_DOWN_MASK);
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2020 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-2712 Typeahead mechanism doesn't work on Windows
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class TypeaheadRequestFocusTest {
|
||||
private static final CompletableFuture<Boolean> initFinished = new CompletableFuture<>();
|
||||
private static final CompletableFuture<Boolean> typedInPopup = new CompletableFuture<>();
|
||||
private static Robot robot;
|
||||
private static JFrame frame;
|
||||
private static JTextField frameField;
|
||||
private static JTextField windowField;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(TypeaheadRequestFocusTest::initUI);
|
||||
initFinished.get(10, TimeUnit.SECONDS);
|
||||
clickOn(frameField);
|
||||
SwingUtilities.invokeAndWait(TypeaheadRequestFocusTest::showPopup);
|
||||
pressAndRelease(KeyEvent.VK_ENTER);
|
||||
pressAndRelease(KeyEvent.VK_A);
|
||||
typedInPopup.get(10, TimeUnit.SECONDS);
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(TypeaheadRequestFocusTest::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new JFrame("TypeaheadRequestFocusTest");
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
initFinished.complete(true);
|
||||
}
|
||||
});
|
||||
frameField = new JTextField(20);
|
||||
frameField.addActionListener(e -> {
|
||||
LockSupport.parkNanos(1_000_000_000L);
|
||||
windowField.requestFocus();
|
||||
});
|
||||
frame.add(frameField);
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void showPopup() {
|
||||
JWindow window = new JWindow(frame);
|
||||
windowField = new JTextField(20);
|
||||
windowField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
typedInPopup.complete(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {}
|
||||
});
|
||||
window.add(windowField);
|
||||
window.pack();
|
||||
window.setAutoRequestFocus(false);
|
||||
window.setVisible(true);
|
||||
window.setAutoRequestFocus(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
}
|
||||
|
||||
private static void pressAndRelease(int keyCode) {
|
||||
robot.keyPress(keyCode);
|
||||
robot.keyRelease(keyCode);
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component) {
|
||||
Point location = component.getLocationOnScreen();
|
||||
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2020 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-2712 Typeahead mechanism doesn't work on Windows
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class TypeaheadSetVisibleTest {
|
||||
private static final CompletableFuture<Boolean> initFinished = new CompletableFuture<>();
|
||||
private static final CompletableFuture<Boolean> typedInPopup = new CompletableFuture<>();
|
||||
private static Robot robot;
|
||||
private static JFrame frame;
|
||||
private static JTextField frameField;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(TypeaheadSetVisibleTest::initUI);
|
||||
initFinished.get(10, TimeUnit.SECONDS);
|
||||
clickOn(frameField);
|
||||
pressAndRelease(KeyEvent.VK_ENTER);
|
||||
pressAndRelease(KeyEvent.VK_A);
|
||||
typedInPopup.get(10, TimeUnit.SECONDS);
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(TypeaheadSetVisibleTest::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new JFrame("TypeaheadSetVisibleTest");
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
initFinished.complete(true);
|
||||
}
|
||||
});
|
||||
frameField = new JTextField(20);
|
||||
frameField.addActionListener(e -> {
|
||||
LockSupport.parkNanos(1_000_000_000L);
|
||||
JWindow window = new JWindow(frame);
|
||||
JTextField windowField = new JTextField(20);
|
||||
windowField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
typedInPopup.complete(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {}
|
||||
});
|
||||
window.add(windowField);
|
||||
window.pack();
|
||||
window.setVisible(true);
|
||||
});
|
||||
frame.add(frameField);
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
}
|
||||
|
||||
private static void pressAndRelease(int keyCode) {
|
||||
robot.keyPress(keyCode);
|
||||
robot.keyRelease(keyCode);
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component) {
|
||||
Point location = component.getLocationOnScreen();
|
||||
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2020 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.DocumentEvent;
|
||||
import javax.swing.event.DocumentListener;
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @summary Regression test for JBR-2712 Typeahead mechanism doesn't work on Windows
|
||||
* @key headful
|
||||
*/
|
||||
|
||||
public class TypeaheadToFrontTest {
|
||||
private static final CompletableFuture<Boolean> initFinished = new CompletableFuture<>();
|
||||
private static final CompletableFuture<Boolean> typedInPopup = new CompletableFuture<>();
|
||||
private static Robot robot;
|
||||
private static JFrame frame;
|
||||
private static JTextField frameField;
|
||||
private static JWindow window;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
robot = new Robot();
|
||||
robot.setAutoDelay(50);
|
||||
try {
|
||||
SwingUtilities.invokeAndWait(TypeaheadToFrontTest::initUI);
|
||||
initFinished.get(10, TimeUnit.SECONDS);
|
||||
clickOn(frameField);
|
||||
SwingUtilities.invokeAndWait(TypeaheadToFrontTest::showPopup);
|
||||
pressAndRelease(KeyEvent.VK_ENTER);
|
||||
pressAndRelease(KeyEvent.VK_A);
|
||||
typedInPopup.get(10, TimeUnit.SECONDS);
|
||||
} finally {
|
||||
SwingUtilities.invokeAndWait(TypeaheadToFrontTest::disposeUI);
|
||||
}
|
||||
}
|
||||
|
||||
private static void initUI() {
|
||||
frame = new JFrame("TypeaheadToFrontTest");
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
initFinished.complete(true);
|
||||
}
|
||||
});
|
||||
frameField = new JTextField(20);
|
||||
frameField.addActionListener(e -> {
|
||||
LockSupport.parkNanos(1_000_000_000L);
|
||||
window.toFront();
|
||||
});
|
||||
frame.add(frameField);
|
||||
frame.pack();
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
private static void showPopup() {
|
||||
window = new JWindow(frame);
|
||||
JTextField windowField = new JTextField(20);
|
||||
windowField.getDocument().addDocumentListener(new DocumentListener() {
|
||||
@Override
|
||||
public void insertUpdate(DocumentEvent e) {
|
||||
typedInPopup.complete(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeUpdate(DocumentEvent e) {}
|
||||
|
||||
@Override
|
||||
public void changedUpdate(DocumentEvent e) {}
|
||||
});
|
||||
window.add(windowField);
|
||||
window.pack();
|
||||
window.setAutoRequestFocus(false);
|
||||
window.setVisible(true);
|
||||
window.setAutoRequestFocus(true);
|
||||
}
|
||||
|
||||
private static void disposeUI() {
|
||||
if (frame != null) frame.dispose();
|
||||
}
|
||||
|
||||
private static void pressAndRelease(int keyCode) {
|
||||
robot.keyPress(keyCode);
|
||||
robot.keyRelease(keyCode);
|
||||
}
|
||||
|
||||
private static void clickAt(int x, int y) {
|
||||
robot.mouseMove(x, y);
|
||||
robot.mousePress(InputEvent.BUTTON1_DOWN_MASK);
|
||||
robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
|
||||
}
|
||||
|
||||
private static void clickOn(Component component) {
|
||||
Point location = component.getLocationOnScreen();
|
||||
clickAt(location.x + component.getWidth() / 2, location.y + component.getHeight() / 2);
|
||||
}
|
||||
}
|
||||
@@ -1058,7 +1058,6 @@ javax/swing/text/html/HTMLEditorKit/5043626/bug5043626.java
|
||||
javax/swing/text/html/StyleSheet/BackgroundImage/BackgroundImagePosition.java 8198409 generic-all
|
||||
javax/swing/text/html/StyleSheet/bug4936917.java 8208569 macosx-all
|
||||
javax/swing/text/html/parser/Parser/6836089/bug6836089.java 8198401 generic-all
|
||||
javax/swing/text/html/parser/Test8017492.java 8022535 generic-all
|
||||
javax/swing/text/html/parser/Parser/6990651/bug6990651.java 8199060 generic-all
|
||||
javax/swing/text/html/parser/Parser/8078268/bug8078268.java 8199092 generic-all
|
||||
javax/swing/text/html/parser/Parser/HtmlCommentTagParseTest/HtmlCommentTagParseTest.java 8199073 generic-all
|
||||
@@ -1269,4 +1268,5 @@ jb/java/jcef/JCEFStartupTest.java
|
||||
jb/java/awt/event/TouchScreenEvent/TouchScreenEventsTest.java JBR-2585 linux-all,windows-all nobug windows-6.1 not supported on Windows 7
|
||||
jb/java/awt/event/TouchScreenEvent/TouchScreenEventsTestLinux.sh JBR-2585 linux-all
|
||||
jb/java/awt/Focus/ChainOfPopupsFocusTest.java JBR-2657 windows-all,linux-all
|
||||
jb/java/awt/Focus/ModalDialogFromMenuTest.java JBR-2768 macosx-all
|
||||
jb/java/awt/Focus/ModalDialogFromMenuTest.java JBR-2768 macosx-all
|
||||
java/time/tck/java/time/format/TCKDateTimeFormatterBuilder.java JBR-2842 macosx-10.14,macosx-10.15,macosx-10.16
|
||||
Reference in New Issue
Block a user