Merge
This commit is contained in:
commit
56a354eb55
@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -474,7 +474,7 @@ $(eval $(call SetupApiDocsGeneration, REFERENCE_API, \
|
|||||||
SHORT_NAME := $(JAVASE_SHORT_NAME), \
|
SHORT_NAME := $(JAVASE_SHORT_NAME), \
|
||||||
LONG_NAME := $(JAVASE_LONG_NAME), \
|
LONG_NAME := $(JAVASE_LONG_NAME), \
|
||||||
TARGET_DIR := $(DOCS_REFERENCE_IMAGE_DIR)/api, \
|
TARGET_DIR := $(DOCS_REFERENCE_IMAGE_DIR)/api, \
|
||||||
JAVADOC_CMD := $(JAVADOC), \
|
JAVADOC_CMD := $(DOCS_REFERENCE_JAVADOC), \
|
||||||
OPTIONS := $(REFERENCE_OPTIONS), \
|
OPTIONS := $(REFERENCE_OPTIONS), \
|
||||||
TAGS := $(REFERENCE_TAGS), \
|
TAGS := $(REFERENCE_TAGS), \
|
||||||
))
|
))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -606,3 +606,28 @@ AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK],
|
|||||||
AC_SUBST(BUILD_JDK)
|
AC_SUBST(BUILD_JDK)
|
||||||
AC_SUBST(EXTERNAL_BUILDJDK)
|
AC_SUBST(EXTERNAL_BUILDJDK)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
# The docs-reference JDK is used to run javadoc for the docs-reference targets.
|
||||||
|
# If not set, the reference docs will be built using the interim javadoc.
|
||||||
|
AC_DEFUN([BOOTJDK_SETUP_DOCS_REFERENCE_JDK],
|
||||||
|
[
|
||||||
|
AC_ARG_WITH(docs-reference-jdk, [AS_HELP_STRING([--with-docs-reference-jdk],
|
||||||
|
[path to JDK to use for building the reference documentation])])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for docs-reference JDK])
|
||||||
|
if test "x$with_docs_reference_jdk" != "x"; then
|
||||||
|
DOCS_REFERENCE_JDK="$with_docs_reference_jdk"
|
||||||
|
AC_MSG_RESULT([$DOCS_REFERENCE_JDK])
|
||||||
|
DOCS_REFERENCE_JAVADOC="$DOCS_REFERENCE_JDK/bin/javadoc"
|
||||||
|
if test ! -x "$DOCS_REFERENCE_JAVADOC"; then
|
||||||
|
AC_MSG_ERROR([docs-reference JDK found at $DOCS_REFERENCE_JDK did not contain bin/javadoc])
|
||||||
|
fi
|
||||||
|
UTIL_FIXUP_EXECUTABLE(DOCS_REFERENCE_JAVADOC)
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT([no, using interim javadoc for the docs-reference targets])
|
||||||
|
# By leaving this empty, Docs.gmk will revert to the default interim javadoc
|
||||||
|
DOCS_REFERENCE_JAVADOC=
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST(DOCS_REFERENCE_JAVADOC)
|
||||||
|
])
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -144,6 +144,7 @@ JDKVER_SETUP_JDK_VERSION_NUMBERS
|
|||||||
|
|
||||||
BOOTJDK_SETUP_BOOT_JDK
|
BOOTJDK_SETUP_BOOT_JDK
|
||||||
BOOTJDK_SETUP_BUILD_JDK
|
BOOTJDK_SETUP_BUILD_JDK
|
||||||
|
BOOTJDK_SETUP_DOCS_REFERENCE_JDK
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
|
# Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
#
|
#
|
||||||
# This code is free software; you can redistribute it and/or modify it
|
# This code is free software; you can redistribute it and/or modify it
|
||||||
@ -648,6 +648,8 @@ BUILD_JAVA=@FIXPATH@ $(BUILD_JDK)/bin/java $(BUILD_JAVA_FLAGS)
|
|||||||
BUILD_JAVAC=@FIXPATH@ $(BUILD_JDK)/bin/javac
|
BUILD_JAVAC=@FIXPATH@ $(BUILD_JDK)/bin/javac
|
||||||
BUILD_JAR=@FIXPATH@ $(BUILD_JDK)/bin/jar
|
BUILD_JAR=@FIXPATH@ $(BUILD_JDK)/bin/jar
|
||||||
|
|
||||||
|
DOCS_REFERENCE_JAVADOC := @DOCS_REFERENCE_JAVADOC@
|
||||||
|
|
||||||
# Interim langtools modules and arguments
|
# Interim langtools modules and arguments
|
||||||
INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.javadoc
|
INTERIM_LANGTOOLS_BASE_MODULES := java.compiler jdk.compiler jdk.javadoc
|
||||||
INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
|
INTERIM_LANGTOOLS_MODULES := $(addsuffix .interim, $(INTERIM_LANGTOOLS_BASE_MODULES))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -723,8 +723,11 @@ var getJibProfilesProfiles = function (input, common, data) {
|
|||||||
configure_args: concat(
|
configure_args: concat(
|
||||||
"--enable-full-docs",
|
"--enable-full-docs",
|
||||||
versionArgs(input, common),
|
versionArgs(input, common),
|
||||||
"--with-build-jdk=" + input.get(buildJdkDep, "home_path")
|
"--with-build-jdk=" + input.get(buildJdkDep, "home_path"),
|
||||||
+ (input.build_os == "macosx" ? "/Contents/Home" : "")
|
// Provide an explicit JDK for the docs-reference target to
|
||||||
|
// mimic the running conditions of when it's run for real as
|
||||||
|
// closely as possible.
|
||||||
|
"--with-docs-reference-jdk=" + input.get(buildJdkDep, "home_path")
|
||||||
),
|
),
|
||||||
default_make_targets: ["all-docs-bundles"],
|
default_make_targets: ["all-docs-bundles"],
|
||||||
artifacts: {
|
artifacts: {
|
||||||
|
@ -1477,14 +1477,16 @@ Node* IfNode::dominated_by(Node* prev_dom, PhaseIterGVN *igvn) {
|
|||||||
// Loop ends when projection has no more uses.
|
// Loop ends when projection has no more uses.
|
||||||
for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) {
|
for (DUIterator_Last jmin, j = ifp->last_outs(jmin); j >= jmin; --j) {
|
||||||
Node* s = ifp->last_out(j); // Get child of IfTrue/IfFalse
|
Node* s = ifp->last_out(j); // Get child of IfTrue/IfFalse
|
||||||
if( !s->depends_only_on_test() ) {
|
if (s->depends_only_on_test() && igvn->no_dependent_zero_check(s)) {
|
||||||
|
// For control producers.
|
||||||
|
// Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check.
|
||||||
|
igvn->replace_input_of(s, 0, data_target); // Move child to data-target
|
||||||
|
} else {
|
||||||
// Find the control input matching this def-use edge.
|
// Find the control input matching this def-use edge.
|
||||||
// For Regions it may not be in slot 0.
|
// For Regions it may not be in slot 0.
|
||||||
uint l;
|
uint l;
|
||||||
for (l = 0; s->in(l) != ifp; l++) { }
|
for (l = 0; s->in(l) != ifp; l++) { }
|
||||||
igvn->replace_input_of(s, l, ctrl_target);
|
igvn->replace_input_of(s, l, ctrl_target);
|
||||||
} else { // Else, for control producers,
|
|
||||||
igvn->replace_input_of(s, 0, data_target); // Move child to data-target
|
|
||||||
}
|
}
|
||||||
} // End for each child of a projection
|
} // End for each child of a projection
|
||||||
|
|
||||||
|
@ -1451,7 +1451,6 @@ public:
|
|||||||
// Mark an IfNode as being dominated by a prior test,
|
// Mark an IfNode as being dominated by a prior test,
|
||||||
// without actually altering the CFG (and hence IDOM info).
|
// without actually altering the CFG (and hence IDOM info).
|
||||||
void dominated_by( Node *prevdom, Node *iff, bool flip = false, bool exclude_loop_predicate = false );
|
void dominated_by( Node *prevdom, Node *iff, bool flip = false, bool exclude_loop_predicate = false );
|
||||||
bool no_dependent_zero_check(Node* n) const;
|
|
||||||
|
|
||||||
// Split Node 'n' through merge point
|
// Split Node 'n' through merge point
|
||||||
Node *split_thru_region( Node *n, Node *region );
|
Node *split_thru_region( Node *n, Node *region );
|
||||||
|
@ -283,7 +283,7 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exc
|
|||||||
for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
|
for (DUIterator_Fast imax, i = dp->fast_outs(imax); i < imax; i++) {
|
||||||
Node* cd = dp->fast_out(i); // Control-dependent node
|
Node* cd = dp->fast_out(i); // Control-dependent node
|
||||||
// Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check.
|
// Do not rewire Div and Mod nodes which could have a zero divisor to avoid skipping their zero check.
|
||||||
if (cd->depends_only_on_test() && no_dependent_zero_check(cd)) {
|
if (cd->depends_only_on_test() && _igvn.no_dependent_zero_check(cd)) {
|
||||||
assert(cd->in(0) == dp, "");
|
assert(cd->in(0) == dp, "");
|
||||||
_igvn.replace_input_of(cd, 0, prevdom);
|
_igvn.replace_input_of(cd, 0, prevdom);
|
||||||
set_early_ctrl(cd, false);
|
set_early_ctrl(cd, false);
|
||||||
@ -302,25 +302,6 @@ void PhaseIdealLoop::dominated_by( Node *prevdom, Node *iff, bool flip, bool exc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if the type of a divisor of a Div or Mod node includes zero.
|
|
||||||
bool PhaseIdealLoop::no_dependent_zero_check(Node* n) const {
|
|
||||||
switch (n->Opcode()) {
|
|
||||||
case Op_DivI:
|
|
||||||
case Op_ModI: {
|
|
||||||
// Type of divisor includes 0?
|
|
||||||
const TypeInt* type_divisor = _igvn.type(n->in(2))->is_int();
|
|
||||||
return (type_divisor->_hi < 0 || type_divisor->_lo > 0);
|
|
||||||
}
|
|
||||||
case Op_DivL:
|
|
||||||
case Op_ModL: {
|
|
||||||
// Type of divisor includes 0?
|
|
||||||
const TypeLong* type_divisor = _igvn.type(n->in(2))->is_long();
|
|
||||||
return (type_divisor->_hi < 0 || type_divisor->_lo > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------has_local_phi_input----------------------------
|
//------------------------------has_local_phi_input----------------------------
|
||||||
// Return TRUE if 'n' has Phi inputs from its local block and no other
|
// Return TRUE if 'n' has Phi inputs from its local block and no other
|
||||||
// block-local inputs (all non-local-phi inputs come from earlier blocks)
|
// block-local inputs (all non-local-phi inputs come from earlier blocks)
|
||||||
|
@ -1659,6 +1659,25 @@ void PhaseIterGVN::remove_speculative_types() {
|
|||||||
_table.check_no_speculative_types();
|
_table.check_no_speculative_types();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the type of a divisor of a Div or Mod node includes zero.
|
||||||
|
bool PhaseIterGVN::no_dependent_zero_check(Node* n) const {
|
||||||
|
switch (n->Opcode()) {
|
||||||
|
case Op_DivI:
|
||||||
|
case Op_ModI: {
|
||||||
|
// Type of divisor includes 0?
|
||||||
|
const TypeInt* type_divisor = type(n->in(2))->is_int();
|
||||||
|
return (type_divisor->_hi < 0 || type_divisor->_lo > 0);
|
||||||
|
}
|
||||||
|
case Op_DivL:
|
||||||
|
case Op_ModL: {
|
||||||
|
// Type of divisor includes 0?
|
||||||
|
const TypeLong* type_divisor = type(n->in(2))->is_long();
|
||||||
|
return (type_divisor->_hi < 0 || type_divisor->_lo > 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
uint PhaseCCP::_total_invokes = 0;
|
uint PhaseCCP::_total_invokes = 0;
|
||||||
|
@ -546,6 +546,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_dominator(Node *d, Node *n) { return is_dominator_helper(d, n, false); }
|
bool is_dominator(Node *d, Node *n) { return is_dominator_helper(d, n, false); }
|
||||||
|
bool no_dependent_zero_check(Node* n) const;
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
protected:
|
protected:
|
||||||
|
@ -1667,11 +1667,11 @@ public class Types {
|
|||||||
}
|
}
|
||||||
// where
|
// where
|
||||||
private boolean areDisjoint(ClassSymbol ts, ClassSymbol ss) {
|
private boolean areDisjoint(ClassSymbol ts, ClassSymbol ss) {
|
||||||
if (isSubtype(ts.type, ss.type)) {
|
if (isSubtype(erasure(ts.type), erasure(ss.type))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if both are classes or both are interfaces, shortcut
|
// if both are classes or both are interfaces, shortcut
|
||||||
if (ts.isInterface() == ss.isInterface() && isSubtype(ss.type, ts.type)) {
|
if (ts.isInterface() == ss.isInterface() && isSubtype(erasure(ss.type), erasure(ts.type))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (ts.isInterface() && !ss.isInterface()) {
|
if (ts.isInterface() && !ss.isInterface()) {
|
||||||
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, 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 stress randomness
|
||||||
|
* @bug 8259227
|
||||||
|
* @summary Verify that zero check is executed before division/modulo operation.
|
||||||
|
* @requires vm.compiler2.enabled
|
||||||
|
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroDominatedBy::test
|
||||||
|
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=917280111 compiler.loopopts.TestDivZeroDominatedBy
|
||||||
|
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroDominatedBy::test
|
||||||
|
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM compiler.loopopts.TestDivZeroDominatedBy
|
||||||
|
*/
|
||||||
|
|
||||||
|
package compiler.loopopts;
|
||||||
|
|
||||||
|
public class TestDivZeroDominatedBy {
|
||||||
|
|
||||||
|
public static int iFld = 1;
|
||||||
|
public static int iFld1 = 2;
|
||||||
|
public static int iFld2 = 3;
|
||||||
|
public static int iArrFld[] = new int[10];
|
||||||
|
public static double dFld = 1.0;
|
||||||
|
|
||||||
|
public static void test() {
|
||||||
|
int x = 1;
|
||||||
|
int y = 2;
|
||||||
|
int z = 3;
|
||||||
|
|
||||||
|
iFld = y;
|
||||||
|
iArrFld[5] += iFld1;
|
||||||
|
int i = 1;
|
||||||
|
do {
|
||||||
|
for (int j = 0; j < 10; j++) {
|
||||||
|
iFld2 += iFld2;
|
||||||
|
iFld1 = iFld2;
|
||||||
|
int k = 1;
|
||||||
|
do {
|
||||||
|
iArrFld[k] = y;
|
||||||
|
z = iFld2;
|
||||||
|
dFld = x;
|
||||||
|
try {
|
||||||
|
y = iArrFld[k];
|
||||||
|
iArrFld[8] = 5;
|
||||||
|
iFld = (100 / z);
|
||||||
|
} catch (ArithmeticException a_e) {}
|
||||||
|
} while (++k < 2);
|
||||||
|
}
|
||||||
|
} while (++i < 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] strArr) {
|
||||||
|
test();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,11 +24,14 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
|
* @key stress randomness
|
||||||
* @bug 8257822
|
* @bug 8257822
|
||||||
* @summary Verify that zero check is executed before division/modulo operation.
|
* @summary Verify that zero check is executed before division/modulo operation.
|
||||||
* @requires vm.compiler2.enabled
|
* @requires vm.compiler2.enabled
|
||||||
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test
|
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test
|
||||||
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf
|
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM -XX:StressSeed=873732072 compiler.loopopts.TestDivZeroWithSplitIf
|
||||||
|
* @run main/othervm -Xcomp -XX:-TieredCompilation -XX:CompileOnly=compiler/loopopts/TestDivZeroWithSplitIf::test
|
||||||
|
* -XX:+UnlockDiagnosticVMOptions -XX:+StressGCM compiler.loopopts.TestDivZeroWithSplitIf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package compiler.loopopts;
|
package compiler.loopopts;
|
||||||
|
@ -35,12 +35,10 @@ import jdk.jfr.consumer.RecordingFile;
|
|||||||
import jdk.test.lib.Asserts;
|
import jdk.test.lib.Asserts;
|
||||||
import jdk.test.lib.jfr.EventNames;
|
import jdk.test.lib.jfr.EventNames;
|
||||||
|
|
||||||
// Java agent that emits in multiple threads
|
// Java agent that emits events
|
||||||
public class EventEmitterAgent {
|
public class EventEmitterAgent {
|
||||||
|
|
||||||
private static final int THREADS = 5;
|
private static final long EVENTS = 150_000;
|
||||||
private static final int EVENTS_PER_THREAD = 150_000;
|
|
||||||
private static final int EXPECTED_COUNT = THREADS * EVENTS_PER_THREAD;
|
|
||||||
private static final Path DUMP_PATH = Paths.get("dump.jfr").toAbsolutePath();
|
private static final Path DUMP_PATH = Paths.get("dump.jfr").toAbsolutePath();
|
||||||
|
|
||||||
// Called when agent is loaded from command line
|
// Called when agent is loaded from command line
|
||||||
@ -58,20 +56,13 @@ public class EventEmitterAgent {
|
|||||||
r.enable(EventNames.JavaExceptionThrow);
|
r.enable(EventNames.JavaExceptionThrow);
|
||||||
r.setDestination(DUMP_PATH);
|
r.setDestination(DUMP_PATH);
|
||||||
r.start();
|
r.start();
|
||||||
Thread[] threads = new Thread[THREADS];
|
emitEvents();
|
||||||
for (int i = 0; i < THREADS; i++) {
|
|
||||||
threads[i] = new Thread(EventEmitterAgent::emitEvents);
|
|
||||||
threads[i].start();
|
|
||||||
}
|
|
||||||
for (int i = 0; i < THREADS; i++) {
|
|
||||||
threads[i].join();
|
|
||||||
}
|
|
||||||
r.stop();
|
r.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void emitEvents() {
|
public static void emitEvents() {
|
||||||
for (int i = 0; i < EVENTS_PER_THREAD; i++) {
|
for (int i = 0; i < EVENTS; i++) {
|
||||||
TestEvent e = new TestEvent();
|
TestEvent e = new TestEvent();
|
||||||
e.msg = "Long message that puts pressure on the string pool " + i % 100;
|
e.msg = "Long message that puts pressure on the string pool " + i % 100;
|
||||||
e.count = i;
|
e.count = i;
|
||||||
@ -80,7 +71,7 @@ public class EventEmitterAgent {
|
|||||||
e.commit();
|
e.commit();
|
||||||
if (i % 10000 == 0) {
|
if (i % 10000 == 0) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1);
|
Thread.sleep(10);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ie) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
@ -101,6 +92,6 @@ public class EventEmitterAgent {
|
|||||||
.stream()
|
.stream()
|
||||||
.filter(e -> e.getEventType().getName().equals("Test"))
|
.filter(e -> e.getEventType().getName().equals("Test"))
|
||||||
.count();
|
.count();
|
||||||
Asserts.assertTrue(testEventCount == EXPECTED_COUNT, "Mismatch in TestEvent count");
|
Asserts.assertEquals(testEventCount, EVENTS, "Mismatch in TestEvent count");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1247,6 +1247,17 @@ public class SealedCompilationTests extends CompilationTestCase {
|
|||||||
a = (A)c;
|
a = (A)c;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
""",
|
||||||
|
"""
|
||||||
|
sealed interface A<T> {
|
||||||
|
final class B implements A<Object> { }
|
||||||
|
}
|
||||||
|
|
||||||
|
class Test {
|
||||||
|
void f(A.B a, A<Object> b) {
|
||||||
|
a = (A.B)b;
|
||||||
|
}
|
||||||
|
}
|
||||||
"""
|
"""
|
||||||
)) {
|
)) {
|
||||||
assertOK(s);
|
assertOK(s);
|
||||||
|
Loading…
Reference in New Issue
Block a user