Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JesperIRL committed Jul 1, 2021
2 parents 85262c7 + 9ac63a6 commit 9def3b0
Show file tree
Hide file tree
Showing 29 changed files with 368 additions and 114 deletions.
5 changes: 5 additions & 0 deletions src/hotspot/cpu/aarch64/aarch64.ad
Expand Up @@ -2413,6 +2413,11 @@ 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;
}
break;
default:
break;
}
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/cpu/s390/templateTable_s390.cpp
Expand Up @@ -3768,9 +3768,8 @@ void TemplateTable::_new() {

// Get instance_size in InstanceKlass (scaled to a count of bytes).
Register Rsize = offset;
const int mask = 1 << Klass::_lh_instance_slow_path_bit;
__ z_llgf(Rsize, Address(iklass, Klass::layout_helper_offset()));
__ z_tmll(Rsize, mask);
__ z_tmll(Rsize, Klass::_lh_instance_slow_path_bit);
__ z_btrue(slow_case);

// Allocate the instance
Expand Down
13 changes: 10 additions & 3 deletions src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
Expand Up @@ -1427,7 +1427,7 @@ void C2_MacroAssembler::evscatter(BasicType typ, Register base, XMMRegister idx,
}
}

void C2_MacroAssembler::load_vector_mask(XMMRegister dst, XMMRegister src, int vlen_in_bytes, BasicType elem_bt) {
void C2_MacroAssembler::load_vector_mask(XMMRegister dst, XMMRegister src, int vlen_in_bytes, BasicType elem_bt, bool is_legacy) {
if (vlen_in_bytes <= 16) {
pxor (dst, dst);
psubb(dst, src);
Expand All @@ -1442,10 +1442,12 @@ void C2_MacroAssembler::load_vector_mask(XMMRegister dst, XMMRegister src, int v
default: assert(false, "%s", type2name(elem_bt));
}
} else {
assert(!is_legacy || !is_subword_type(elem_bt) || vlen_in_bytes < 64, "");
int vlen_enc = vector_length_encoding(vlen_in_bytes);

vpxor (dst, dst, dst, vlen_enc);
vpsubb(dst, dst, src, vlen_enc);
vpsubb(dst, dst, src, is_legacy ? AVX_256bit : vlen_enc);

switch (elem_bt) {
case T_BYTE: /* nothing to do */ break;
case T_SHORT: vpmovsxbw(dst, dst, vlen_enc); break;
Expand All @@ -1461,7 +1463,11 @@ void C2_MacroAssembler::load_vector_mask(XMMRegister dst, XMMRegister src, int v

void C2_MacroAssembler::load_iota_indices(XMMRegister dst, Register scratch, int vlen_in_bytes) {
ExternalAddress addr(StubRoutines::x86::vector_iota_indices());
if (vlen_in_bytes <= 16) {
if (vlen_in_bytes == 4) {
movdl(dst, addr);
} else if (vlen_in_bytes == 8) {
movq(dst, addr);
} else if (vlen_in_bytes == 16) {
movdqu(dst, addr, scratch);
} else if (vlen_in_bytes == 32) {
vmovdqu(dst, addr, scratch);
Expand All @@ -1470,6 +1476,7 @@ void C2_MacroAssembler::load_iota_indices(XMMRegister dst, Register scratch, int
evmovdqub(dst, k0, addr, false /*merge*/, Assembler::AVX_512bit, scratch);
}
}

// Reductions for vectors of bytes, shorts, ints, longs, floats, and doubles.

void C2_MacroAssembler::reduce_operation_128(BasicType typ, int opcode, XMMRegister dst, XMMRegister src) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/c2_MacroAssembler_x86.hpp
Expand Up @@ -141,7 +141,7 @@
void evpcmp(BasicType typ, KRegister kdmask, KRegister ksmask, XMMRegister src1, XMMRegister src2, int comparison, int vector_len);
void evpblend(BasicType typ, XMMRegister dst, KRegister kmask, XMMRegister src1, XMMRegister src2, bool merge, int vector_len);

void load_vector_mask(XMMRegister dst, XMMRegister src, int vlen_in_bytes, BasicType elem_bt);
void load_vector_mask(XMMRegister dst, XMMRegister src, int vlen_in_bytes, BasicType elem_bt, bool is_legacy);
void load_iota_indices(XMMRegister dst, Register scratch, int vlen_in_bytes);

// vector compare
Expand Down
26 changes: 23 additions & 3 deletions src/hotspot/cpu/x86/x86.ad
Expand Up @@ -1835,6 +1835,11 @@ const bool Matcher::match_rule_supported_vector(int opcode, int vlen, BasicType
return false;
}
break;
case Op_VectorMaskCmp:
if (vlen < 2 || size_in_bits < 32) {
return false;
}
break;
}
return true; // Per default match rules are supported.
}
Expand Down Expand Up @@ -6906,7 +6911,7 @@ instruct evcmpFD(vec dst, vec src1, vec src2, immI8 cond, rRegP scratch, kReg kt
instruct vcmp(legVec dst, legVec src1, legVec src2, immI8 cond, rRegP scratch) %{
predicate((UseAVX <= 2 || !VM_Version::supports_avx512vl()) &&
!is_unsigned_booltest_pred(n->in(2)->get_int()) &&
vector_length_in_bytes(n->in(1)->in(1)) >= 8 && // src1
vector_length_in_bytes(n->in(1)->in(1)) >= 4 && // src1
vector_length_in_bytes(n->in(1)->in(1)) <= 32 && // src1
is_integral_type(vector_element_basic_type(n->in(1)->in(1)))); // src1
match(Set dst (VectorMaskCmp (Binary src1 src2) cond));
Expand Down Expand Up @@ -7442,15 +7447,30 @@ instruct cmpvptest_anytrue_evex(rFlagsReg cr, legVec src1, legVec src2, immI_0 z

//------------------------------------- LoadMask --------------------------------------------

instruct loadMask(vec dst, vec src) %{
instruct loadMask(legVec dst, legVec src) %{
predicate(!VM_Version::supports_avx512vlbw());
match(Set dst (VectorLoadMask src));
effect(TEMP dst);
format %{ "vector_loadmask_byte $dst,$src\n\t" %}
ins_encode %{
int vlen_in_bytes = vector_length_in_bytes(this);
BasicType elem_bt = vector_element_basic_type(this);

__ load_vector_mask($dst$$XMMRegister, $src$$XMMRegister, vlen_in_bytes, elem_bt, true);
%}
ins_pipe( pipe_slow );
%}

instruct loadMask_evex(vec dst, vec src) %{
predicate(VM_Version::supports_avx512vlbw());
match(Set dst (VectorLoadMask src));
effect(TEMP dst);
format %{ "vector_loadmask_byte $dst,$src\n\t" %}
ins_encode %{
int vlen_in_bytes = vector_length_in_bytes(this);
BasicType elem_bt = vector_element_basic_type(this);

__ load_vector_mask($dst$$XMMRegister, $src$$XMMRegister, vlen_in_bytes, elem_bt);
__ load_vector_mask($dst$$XMMRegister, $src$$XMMRegister, vlen_in_bytes, elem_bt, false);
%}
ins_pipe( pipe_slow );
%}
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/parallel/parallelArguments.cpp
Expand Up @@ -87,7 +87,7 @@ void ParallelArguments::initialize() {
}

if (FLAG_IS_DEFAULT(ParallelRefProcEnabled) && ParallelGCThreads > 1) {
//FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
FLAG_SET_DEFAULT(ParallelRefProcEnabled, true);
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/hotspot/share/gc/shared/copyFailedInfo.hpp
Expand Up @@ -71,12 +71,7 @@ class PromotionFailedInfo : public CopyFailedInfo {

void register_copy_failure(size_t size) {
CopyFailedInfo::register_copy_failure(size);
if (_thread_trace_id == 0) {
_thread_trace_id = JFR_THREAD_ID(Thread::current());
} else {
assert(JFR_THREAD_ID(Thread::current()) == _thread_trace_id,
"The PromotionFailedInfo should be thread local.");
}
_thread_trace_id = JFR_THREAD_ID(Thread::current());
}

void reset() {
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/opto/vectorIntrinsics.cpp
Expand Up @@ -411,9 +411,6 @@ bool LibraryCallKit::inline_vector_shuffle_iota() {
int num_elem = vlen->get_con();
BasicType elem_bt = T_BYTE;

if (num_elem < 4)
return false;

if (!arch_supports_vector(VectorNode::replicate_opcode(elem_bt), num_elem, elem_bt, VecMaskNotUsed)) {
return false;
}
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/safepoint.cpp
Expand Up @@ -928,6 +928,7 @@ void ThreadSafepointState::handle_polling_page_exception() {
if( nm->is_at_poll_return(real_return_addr) ) {
// See if return type is an oop.
bool return_oop = nm->method()->is_returning_oop();
HandleMark hm(self);
Handle return_value;
if (return_oop) {
// The oop result has been saved on the stack together with all
Expand Down
Expand Up @@ -43,6 +43,8 @@
* <p> In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
* The {@link #refersTo(Object) refersTo} method can be used to test
* whether some object is the referent of a phantom reference.
*
* @author Mark Reinhold
* @since 1.2
Expand Down Expand Up @@ -75,9 +77,7 @@ public T get() {
* is registered with the given queue.
*
* <p> It is possible to create a phantom reference with a {@code null}
* queue, but such a reference is completely useless: Its {@code get}
* method will always return {@code null} and, since it does not have a queue,
* it will never be enqueued.
* queue. Such a reference will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
Expand Down
8 changes: 5 additions & 3 deletions src/java.base/share/classes/java/util/Locale.java
Expand Up @@ -455,9 +455,11 @@
*
* <p>For the backward compatible behavior, the system property
* {@systemProperty java.locale.useOldISOCodes} reverts the behavior
* back to prior to Java SE 17 one. If the system property is set
* to {@code true}, those three current language codes are mapped to their
* backward compatible forms.
* back to that of before Java SE 17. If the system property is set to
* {@code true}, those three current language codes are mapped to their
* backward compatible forms. The property is only read at Java runtime
* startup and subsequent calls to {@code System.setProperty()} will
* have no effect.
*
* <p>The APIs added in 1.7 map between the old and new language codes,
* maintaining the mapped codes internal to Locale (so that
Expand Down
26 changes: 20 additions & 6 deletions src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
Expand Up @@ -169,6 +169,8 @@ protected Attr(Context context) {
allowStaticInterfaceMethods = Feature.STATIC_INTERFACE_METHODS.allowedInSource(source);
allowReifiableTypesInInstanceof = Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source);
allowRecords = Feature.RECORDS.allowedInSource(source);
allowPatternSwitch = (preview.isEnabled() || !preview.isPreview(Feature.PATTERN_SWITCH)) &&
Feature.PATTERN_SWITCH.allowedInSource(source);
sourceName = source.name;
useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");

Expand Down Expand Up @@ -209,6 +211,10 @@ protected Attr(Context context) {
*/
private final boolean allowRecords;

/** Are patterns in switch allowed
*/
private final boolean allowPatternSwitch;

/**
* Switch: warn about use of variable before declaration?
* RFE: 6425594
Expand Down Expand Up @@ -1724,14 +1730,22 @@ private void handleSwitch(JCTree switchTree,
rs.basicLogResolveHelper = prevResolveHelper;
}
} else {
Type pattype = attribExpr(expr, switchEnv, seltype);
ResultInfo valTypInfo = new ResultInfo(KindSelector.VAL_TYP,
!seltype.hasTag(ERROR) ? seltype
: Type.noType);
Type pattype = attribTree(expr, switchEnv, valTypInfo);
if (!pattype.hasTag(ERROR)) {
if (!stringSwitch && !types.isAssignable(seltype, syms.intType)) {
log.error(pat.pos(), Errors.ConstantLabelNotCompatible(pattype, seltype));
}
if (pattype.constValue() == null) {
log.error(expr.pos(),
(stringSwitch ? Errors.StringConstReq : Errors.ConstExprReq));
Symbol s = TreeInfo.symbol(expr);
if (s != null && s.kind == TYP && allowPatternSwitch) {
log.error(expr.pos(),
Errors.PatternExpected);
} else {
log.error(expr.pos(),
(stringSwitch ? Errors.StringConstReq : Errors.ConstExprReq));
}
} else if (!stringSwitch && !types.isAssignable(seltype, syms.intType)) {
log.error(pat.pos(), Errors.ConstantLabelNotCompatible(pattype, seltype));
} else if (!labels.add(pattype.constValue())) {
log.error(c.pos(), Errors.DuplicateCaseLabel);
} else {
Expand Down
Expand Up @@ -1375,8 +1375,7 @@ private void handleSwitch(JCTree swtch, JCExpression selector, List<JCCase> case

if (switchEnv.info.cont != null) {
Assert.check(patternSwitch);
code.resolve(switchEnv.info.cont);
code.resolve(code.branch(goto_), switchStart);
code.resolve(switchEnv.info.cont, switchStart);
}

// Resolve all breaks.
Expand Down
Expand Up @@ -1189,6 +1189,9 @@ compiler.err.static.imp.only.classes.and.interfaces=\
compiler.err.string.const.req=\
constant string expression required

compiler.err.pattern.expected=\
type pattern expected

# 0: symbol, 1: fragment
compiler.err.cannot.generate.class=\
error while generating class {0}\n\
Expand Down
Expand Up @@ -350,14 +350,12 @@ ul.see-list-long li:not(:last-child):after {
/*
* Styles for tables.
*/
.summary-table {
.summary-table, .details-table {
width:100%;
border-spacing:0;
border-left:1px solid #EEE;
border-right:1px solid #EEE;
border-bottom:1px solid #EEE;
}
.summary-table {
padding:0;
}
.caption {
Expand Down Expand Up @@ -445,7 +443,7 @@ div.table-tabs > button.table-tab {
grid-template-columns: minmax(15%, max-content) minmax(15%, auto);
}
}
.summary-table > div {
.summary-table > div, .details-table > div {
text-align:left;
padding: 8px 3px 3px 7px;
}
Expand Down
2 changes: 2 additions & 0 deletions test/hotspot/jtreg/ProblemList-Xcomp.txt
Expand Up @@ -32,3 +32,5 @@ compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java 8268033 generic-x64
vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java 8205957 generic-all

vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8265295 linux-x64,windows-x64

vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/TestDescription.java 8245680 windows-x64
Expand Up @@ -72,7 +72,9 @@ public static AbstractTestBase generateRandomTest(boolean validOnly) {

Executable exec = Utils.getRandomElement(METHODS).first;
MethodDescriptor md;
if (validOnly) {

// Command.quiet discards the method descriptor - can never fail on the method descriptor
if (validOnly || cmd == Command.QUIET) {
md = AbstractTestBase.getValidMethodDescriptor(exec);
} else {
md = AbstractTestBase.METHOD_GEN.generateRandomDescriptor(exec);
Expand Down
58 changes: 58 additions & 0 deletions test/hotspot/jtreg/compiler/vectorapi/TestVectorShuffleIota.java
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2021, Huawei Technologies Co. Ltd. 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.
*/

package compiler.vectorapi;

import jdk.incubator.vector.IntVector;
import jdk.incubator.vector.VectorSpecies;
import jdk.incubator.vector.VectorShuffle;

/*
* @test
* @bug 8265907
* @modules jdk.incubator.vector
* @run main/othervm compiler.vectorapi.TestVectorShuffleIota
*/

public class TestVectorShuffleIota {
static final VectorSpecies<Integer> SPECIESi = IntVector.SPECIES_128;

static final int INVOC_COUNT = 50000;

static int[] ai = {87, 65, 78, 71};

static void testShuffleI() {
IntVector iv = (IntVector) VectorShuffle.iota(SPECIESi, 0, 2, false).toVector();
iv.intoArray(ai, 0);
}

public static void main(String[] args) {
for (int i = 0; i < INVOC_COUNT; i++) {
testShuffleI();
}
for (int i = 0; i < ai.length; i++) {
System.out.print(ai[i] + ", ");
}
System.out.println();
}
}
2 changes: 1 addition & 1 deletion test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
Expand Up @@ -51,7 +51,7 @@ public static void main(String args[]) throws Exception {
}
if (GC.Parallel.isSupported()) {
noneGCSupported = false;
testFlag(new String[] { "-XX:+UseParallelGC" }, false);
testFlag(new String[] { "-XX:+UseParallelGC" }, true);
}
if (GC.G1.isSupported()) {
noneGCSupported = false;
Expand Down

1 comment on commit 9def3b0

@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.