Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperIRL committed Jul 6, 2021
2 parents e8206db + 0d1cd3a commit 7a4f08a
Show file tree
Hide file tree
Showing 51 changed files with 3,315 additions and 839 deletions.
26 changes: 23 additions & 3 deletions src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,14 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
} else { // NEON
// Special cases
switch (opcode) {
case Op_VectorMaskCmp:
// We don't have VectorReinterpret with bit_size less than 64 support for
// now, even for byte type. To be refined with fully VectorCast support.
case Op_VectorReinterpret:
if (vlen < 2 || bit_size < 64) {
return false;
}
break;
case Op_MulAddVS2VI:
if (bit_size < 128) {
return false;
Expand All @@ -2413,9 +2421,21 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
return false;
}
break;
case Op_VectorMaskCmp:
if (vlen < 2 || bit_size < 64) {
return false;
// Some types of VectorCast are not implemented for now.
case Op_VectorCastI2X:
if (bt == T_BYTE) {
return false;
}
break;
case Op_VectorCastS2X:
if (vlen < 4 || bit_size < 64) {
return false;
}
break;
case Op_VectorCastF2X:
case Op_VectorCastD2X:
if (bt == T_INT || bt == T_SHORT || bt == T_BYTE || bt == T_LONG) {
return false;
}
break;
default:
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3859,6 +3859,9 @@ void C2_MacroAssembler::vector_mask_operation(int opc, Register dst, XMMRegister
vpxor(xtmp, xtmp, xtmp, vec_enc);
vpsubb(xtmp, xtmp, mask, vec_enc);
vpmovmskb(tmp, xtmp, vec_enc);
if (masklen < 64) {
andq(tmp, (((jlong)1 << masklen) - 1));
}
switch(opc) {
case Op_VectorMaskTrueCount:
popcntq(dst, tmp);
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/cpu/x86/globals_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ define_pd_global(intx, InitArrayShortSize, 8*BytesPerLong);
"Highest supported AVX instructions set on x86/x64") \
range(0, 99) \
\
product(bool, UseKNLSetting, false, DIAGNOSTIC, \
"Control whether Knights platform setting should be used") \
\
product(bool, UseCLMUL, false, \
"Control whether CLMUL instructions can be used on x86/x64") \
\
Expand Down
9 changes: 9 additions & 0 deletions src/hotspot/cpu/x86/vm_version_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,15 @@ void VM_Version::get_processor_features() {
_features &= ~CPU_VZEROUPPER;
_features &= ~CPU_AVX512BW;
_features &= ~CPU_AVX512VL;
_features &= ~CPU_AVX512DQ;
_features &= ~CPU_AVX512_VNNI;
_features &= ~CPU_AVX512_VAES;
_features &= ~CPU_AVX512_VPOPCNTDQ;
_features &= ~CPU_AVX512_VPCLMULQDQ;
_features &= ~CPU_AVX512_VBMI;
_features &= ~CPU_AVX512_VBMI2;
_features &= ~CPU_CLWB;
_features &= ~CPU_FLUSHOPT;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/vm_version_x86.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ enum Extended_Family {
static bool is_intel() { assert_is_initialized(); return _cpuid_info.std_vendor_name_0 == 0x756e6547; } // 'uneG'
static bool is_zx() { assert_is_initialized(); return (_cpuid_info.std_vendor_name_0 == 0x746e6543) || (_cpuid_info.std_vendor_name_0 == 0x68532020); } // 'tneC'||'hS '
static bool is_atom_family() { return ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x36) || (extended_cpu_model() == 0x37) || (extended_cpu_model() == 0x4D))); } //Silvermont and Centerton
static bool is_knights_family() { return ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x57) || (extended_cpu_model() == 0x85))); } // Xeon Phi 3200/5200/7200 and Future Xeon Phi
static bool is_knights_family() { return UseKNLSetting || ((cpu_family() == 0x06) && ((extended_cpu_model() == 0x57) || (extended_cpu_model() == 0x85))); } // Xeon Phi 3200/5200/7200 and Future Xeon Phi

static bool supports_processor_topology() {
return (_cpuid_info.std_max_function >= 0xB) &&
Expand Down
19 changes: 15 additions & 4 deletions src/hotspot/share/gc/shared/stringdedup/stringDedup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "oops/oopsHierarchy.hpp"
#include "runtime/globals.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/orderAccess.hpp"
#include "runtime/safepoint.hpp"
#include "runtime/thread.hpp"
#include "utilities/debug.hpp"
Expand Down Expand Up @@ -107,17 +108,27 @@ void StringDedup::threads_do(ThreadClosure* tc) {
tc->do_thread(_processor);
}

void StringDedup::forbid_deduplication(oop java_string) {
assert(is_enabled(), "precondition");
if (java_lang_String::deduplication_forbidden(java_string)) {
// DCLP - we don't want a caller's access to the value array to float
// before the check; string dedup could change the value and another
// thread could set the flag, and this thread uses a stale value.
OrderAccess::acquire();
} else {
MutexLocker ml(StringDedupIntern_lock, Mutex::_no_safepoint_check_flag);
java_lang_String::set_deduplication_forbidden(java_string);
}
}

void StringDedup::notify_intern(oop java_string) {
assert(is_enabled(), "precondition");
// A String that is interned in the StringTable must not later have its
// underlying byte array changed, so mark it as not deduplicatable. But we
// can still add the byte array to the dedup table for sharing, so add the
// string to the pending requests. Triggering request processing is left
// to the next GC.
{
MutexLocker ml(StringDedupIntern_lock, Mutex::_no_safepoint_check_flag);
java_lang_String::set_deduplication_forbidden(java_string);
}
forbid_deduplication(java_string);
StorageUse* requests = Processor::storage_for_requests();
oop* ref = requests->storage()->allocate();
if (ref != nullptr) {
Expand Down
10 changes: 10 additions & 0 deletions src/hotspot/share/gc/shared/stringdedup/stringDedup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,17 @@ class StringDedup : public AllStatic {
// precondition: is_enabled()
static void threads_do(ThreadClosure* tc);

// Marks the String as not being subject to deduplication. This can be
// used to prevent deduplication of Strings whose value array must remain
// stable and cannot be replaced by a shared duplicate. Must be called
// before obtaining the value array; this function provides an acquire
// barrier.
// precondition: is_enabled()
// precondition: java_string is a Java String object.
static void forbid_deduplication(oop java_string);

// Notify that a String is being added to the StringTable.
// Implicity forbids deduplication of the String.
// precondition: is_enabled()
// precondition: java_string is a Java String object.
static void notify_intern(oop java_string);
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/share/opto/cfgnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,11 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {

Node* opt = NULL;
int true_path = is_diamond_phi();
if( true_path != 0 ) {
if (true_path != 0 &&
// If one of the diamond's branch is in the process of dying then, the Phi's input for that branch might transform
// to top. If that happens replacing the Phi with an operation that consumes the Phi's inputs will cause the Phi
// to be replaced by top. To prevent that, delay the transformation until the branch has a chance to be removed.
!(can_reshape && wait_for_region_igvn(phase))) {
// Check for CMove'ing identity. If it would be unsafe,
// handle it here. In the safe case, let Identity handle it.
Node* unsafe_id = is_cmove_id(phase, true_path);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/lcm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void PhaseCFG::implicit_null_check(Block* block, Node *proj, Node *val, int allo
// Move the control dependence if it is pinned to not-null block.
// Don't change it in other cases: NULL or dominating control.
Node* ctrl = best->in(0);
if (get_block_for_node(ctrl) == not_null_block) {
if (ctrl != NULL && get_block_for_node(ctrl) == not_null_block) {
// Set it to control edge of null check.
best->set_req(0, proj->in(0)->in(0));
}
Expand Down
26 changes: 13 additions & 13 deletions src/hotspot/share/opto/loopnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5033,19 +5033,19 @@ Node* PhaseIdealLoop::get_late_ctrl_with_anti_dep(LoadNode* n, Node* early, Node
}
}
}
// For Phis only consider Region's inputs that were reached by following the memory edges
if (LCA != early) {
for (uint i = 0; i < worklist.size(); i++) {
Node* s = worklist.at(i);
if (s->is_Phi() && C->can_alias(s->adr_type(), load_alias_idx)) {
Node* r = s->in(0);
for (uint j = 1; j < s->req(); j++) {
Node* in = s->in(j);
Node* r_in = r->in(j);
// We can't reach any node from a Phi because we don't enqueue Phi's uses above
if (((worklist.member(in) && !in->is_Phi()) || in == mem) && is_dominator(early, r_in)) {
LCA = dom_lca_for_get_late_ctrl(LCA, r_in, n);
}
}
// For Phis only consider Region's inputs that were reached by following the memory edges
if (LCA != early) {
for (uint i = 0; i < worklist.size(); i++) {
Node* s = worklist.at(i);
if (s->is_Phi() && C->can_alias(s->adr_type(), load_alias_idx)) {
Node* r = s->in(0);
for (uint j = 1; j < s->req(); j++) {
Node* in = s->in(j);
Node* r_in = r->in(j);
// We can't reach any node from a Phi because we don't enqueue Phi's uses above
if (((worklist.member(in) && !in->is_Phi()) || in == mem) && is_dominator(early, r_in)) {
LCA = dom_lca_for_get_late_ctrl(LCA, r_in, n);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/opto/vectornode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ class VectorMaskOpNode : public TypeNode {
public:
VectorMaskOpNode(Node* mask, const Type* ty, int mopc):
TypeNode(ty, 2), _mopc(mopc) {
assert(mask->Opcode() == Op_VectorStoreMask, "");
assert(mask->bottom_type()->is_vect()->element_basic_type() == T_BOOLEAN, "");
init_req(1, mask);
}

Expand Down
47 changes: 38 additions & 9 deletions src/hotspot/share/prims/jni.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "compiler/compiler_globals.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/gcLocker.inline.hpp"
#include "gc/shared/stringdedup/stringDedup.hpp"
#include "interpreter/linkResolver.hpp"
#include "jfr/jfrEvents.hpp"
#include "jfr/support/jfrThreadId.hpp"
Expand Down Expand Up @@ -2837,19 +2838,45 @@ HOTSPOT_JNI_RELEASEPRIMITIVEARRAYCRITICAL_RETURN();
JNI_END


static typeArrayOop lock_gc_or_pin_string_value(JavaThread* thread, oop str) {
if (Universe::heap()->supports_object_pinning()) {
// Forbid deduplication before obtaining the value array, to prevent
// deduplication from replacing the value array while setting up or in
// the critical section. That would lead to the release operation
// unpinning the wrong object.
if (StringDedup::is_enabled()) {
NoSafepointVerifier nsv;
StringDedup::forbid_deduplication(str);
}
typeArrayOop s_value = java_lang_String::value(str);
return (typeArrayOop) Universe::heap()->pin_object(thread, s_value);
} else {
Handle h(thread, str); // Handlize across potential safepoint.
GCLocker::lock_critical(thread);
return java_lang_String::value(h());
}
}

static void unlock_gc_or_unpin_string_value(JavaThread* thread, oop str) {
if (Universe::heap()->supports_object_pinning()) {
typeArrayOop s_value = java_lang_String::value(str);
Universe::heap()->unpin_object(thread, s_value);
} else {
GCLocker::unlock_critical(thread);
}
}

JNI_ENTRY(const jchar*, jni_GetStringCritical(JNIEnv *env, jstring string, jboolean *isCopy))
HOTSPOT_JNI_GETSTRINGCRITICAL_ENTRY(env, string, (uintptr_t *) isCopy);
oop s = lock_gc_or_pin_object(thread, string);
typeArrayOop s_value = java_lang_String::value(s);
bool is_latin1 = java_lang_String::is_latin1(s);
if (isCopy != NULL) {
*isCopy = is_latin1 ? JNI_TRUE : JNI_FALSE;
}
oop s = JNIHandles::resolve_non_null(string);
jchar* ret;
if (!is_latin1) {
if (!java_lang_String::is_latin1(s)) {
typeArrayOop s_value = lock_gc_or_pin_string_value(thread, s);
ret = (jchar*) s_value->base(T_CHAR);
if (isCopy != NULL) *isCopy = JNI_FALSE;
} else {
// Inflate latin1 encoded string to UTF16
typeArrayOop s_value = java_lang_String::value(s);
int s_len = java_lang_String::length(s, s_value);
ret = NEW_C_HEAP_ARRAY_RETURN_NULL(jchar, s_len + 1, mtInternal); // add one for zero termination
/* JNI Specification states return NULL on OOM */
Expand All @@ -2859,6 +2886,7 @@ JNI_ENTRY(const jchar*, jni_GetStringCritical(JNIEnv *env, jstring string, jbool
}
ret[s_len] = 0;
}
if (isCopy != NULL) *isCopy = JNI_TRUE;
}
HOTSPOT_JNI_GETSTRINGCRITICAL_RETURN((uint16_t *) ret);
return ret;
Expand All @@ -2867,15 +2895,16 @@ JNI_END

JNI_ENTRY(void, jni_ReleaseStringCritical(JNIEnv *env, jstring str, const jchar *chars))
HOTSPOT_JNI_RELEASESTRINGCRITICAL_ENTRY(env, str, (uint16_t *) chars);
// The str and chars arguments are ignored for UTF16 strings
oop s = JNIHandles::resolve_non_null(str);
bool is_latin1 = java_lang_String::is_latin1(s);
if (is_latin1) {
// For latin1 string, free jchar array allocated by earlier call to GetStringCritical.
// This assumes that ReleaseStringCritical bookends GetStringCritical.
FREE_C_HEAP_ARRAY(jchar, chars);
} else {
// For non-latin1 string, drop the associated gc-locker/pin.
unlock_gc_or_unpin_string_value(thread, s);
}
unlock_gc_or_unpin_object(thread, str);
HOTSPOT_JNI_RELEASESTRINGCRITICAL_RETURN();
JNI_END

Expand Down
4 changes: 4 additions & 0 deletions src/java.base/share/classes/java/lang/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,10 @@ public Process exec(String[] cmdarray, String[] envp, File dir)
* There is no guarantee that this effort will recycle any particular
* number of unused objects, reclaim any particular amount of space, or
* complete at any particular time, if at all, before the method returns or ever.
* There is also no guarantee that this effort will determine
* the change of reachability in any particular number of objects,
* or that any particular number of {@link java.lang.ref.Reference Reference}
* objects will be cleared and enqueued.
* <p>
* The name {@code gc} stands for "garbage
* collector". The Java Virtual Machine performs this recycling
Expand Down
5 changes: 5 additions & 0 deletions src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -1872,6 +1872,11 @@ public static void exit(int status) {
* There is no guarantee that this effort will recycle any particular
* number of unused objects, reclaim any particular amount of space, or
* complete at any particular time, if at all, before the method returns or ever.
* There is also no guarantee that this effort will determine
* the change of reachability in any particular number of objects,
* or that any particular number of {@link java.lang.ref.Reference Reference}
* objects will be cleared and enqueued.
*
* <p>
* The call {@code System.gc()} is effectively equivalent to the
* call:
Expand Down
2 changes: 2 additions & 0 deletions test/hotspot/jtreg/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ compiler/whitebox/MakeMethodNotCompilableTest.java 8265360 macosx-aarch64

compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-x64

compiler/vectorapi/VectorCastShape128Test.java 8269952 generic-x64
compiler/vectorapi/VectorCastShape64Test.java 8269952 generic-x64

#############################################################################

Expand Down
Loading

1 comment on commit 7a4f08a

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.