Merge
This commit is contained in:
commit
a3b1c6b036
@ -27,4 +27,5 @@ include LauncherCommon.gmk
|
||||
|
||||
$(eval $(call SetupBuildLauncher, rmiregistry, \
|
||||
MAIN_CLASS := sun.rmi.registry.RegistryImpl, \
|
||||
JAVA_ARGS := -Djava.security.manager=allow, \
|
||||
))
|
||||
|
@ -1601,6 +1601,16 @@ const bool Matcher::match_rule_supported(int opcode) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case Op_SqrtF:
|
||||
if (UseSSE < 1) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case Op_SqrtD:
|
||||
if (UseSSE < 2) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true; // Match rules are supported by default.
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ void CodeCache::nmethods_do(void f(nmethod* nm)) {
|
||||
|
||||
void CodeCache::metadata_do(MetadataClosure* f) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
NMethodIterator iter(NMethodIterator::only_alive_and_not_unloading);
|
||||
NMethodIterator iter(NMethodIterator::only_alive);
|
||||
while(iter.next()) {
|
||||
iter.method()->metadata_do(f);
|
||||
}
|
||||
@ -1032,7 +1032,7 @@ CompiledMethod* CodeCache::find_compiled(void* start) {
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMTI
|
||||
// RedefineClasses support for unloading nmethods that are dependent on "old" methods.
|
||||
// RedefineClasses support for saving nmethods that are dependent on "old" methods.
|
||||
// We don't really expect this table to grow very large. If it does, it can become a hashtable.
|
||||
static GrowableArray<CompiledMethod*>* old_compiled_method_table = NULL;
|
||||
|
||||
@ -1085,7 +1085,7 @@ int CodeCache::mark_dependents_for_evol_deoptimization() {
|
||||
reset_old_method_table();
|
||||
|
||||
int number_of_marked_CodeBlobs = 0;
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive);
|
||||
while(iter.next()) {
|
||||
CompiledMethod* nm = iter.method();
|
||||
// Walk all alive nmethods to check for old Methods.
|
||||
@ -1105,7 +1105,7 @@ int CodeCache::mark_dependents_for_evol_deoptimization() {
|
||||
|
||||
void CodeCache::mark_all_nmethods_for_evol_deoptimization() {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "Can only do this at a safepoint!");
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive_and_not_unloading);
|
||||
CompiledMethodIterator iter(CompiledMethodIterator::only_alive);
|
||||
while(iter.next()) {
|
||||
CompiledMethod* nm = iter.method();
|
||||
if (!nm->method()->is_method_handle_intrinsic()) {
|
||||
|
@ -47,6 +47,8 @@ static jlong nanos_now() {
|
||||
const jlong now = seconds * 1000000000 + nanos;
|
||||
if (now > last) {
|
||||
last = now;
|
||||
} else {
|
||||
++last;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
|
@ -1656,7 +1656,6 @@ AllocateNode::AllocateNode(Compile* C, const TypeFunc *atype,
|
||||
init_req( KlassNode , klass_node);
|
||||
init_req( InitialTest , initial_test);
|
||||
init_req( ALength , topnode);
|
||||
init_req( ValidLengthTest , topnode);
|
||||
C->add_macro_node(this);
|
||||
}
|
||||
|
||||
@ -1683,6 +1682,54 @@ Node *AllocateNode::make_ideal_mark(PhaseGVN *phase, Node* obj, Node* control, N
|
||||
return mark_node;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
Node* AllocateArrayNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
if (remove_dead_region(phase, can_reshape)) return this;
|
||||
// Don't bother trying to transform a dead node
|
||||
if (in(0) && in(0)->is_top()) return NULL;
|
||||
|
||||
const Type* type = phase->type(Ideal_length());
|
||||
if (type->isa_int() && type->is_int()->_hi < 0) {
|
||||
if (can_reshape) {
|
||||
PhaseIterGVN *igvn = phase->is_IterGVN();
|
||||
// Unreachable fall through path (negative array length),
|
||||
// the allocation can only throw so disconnect it.
|
||||
Node* proj = proj_out_or_null(TypeFunc::Control);
|
||||
Node* catchproj = NULL;
|
||||
if (proj != NULL) {
|
||||
for (DUIterator_Fast imax, i = proj->fast_outs(imax); i < imax; i++) {
|
||||
Node *cn = proj->fast_out(i);
|
||||
if (cn->is_Catch()) {
|
||||
catchproj = cn->as_Multi()->proj_out_or_null(CatchProjNode::fall_through_index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (catchproj != NULL && catchproj->outcnt() > 0 &&
|
||||
(catchproj->outcnt() > 1 ||
|
||||
catchproj->unique_out()->Opcode() != Op_Halt)) {
|
||||
assert(catchproj->is_CatchProj(), "must be a CatchProjNode");
|
||||
Node* nproj = catchproj->clone();
|
||||
igvn->register_new_node_with_optimizer(nproj);
|
||||
|
||||
Node *frame = new ParmNode( phase->C->start(), TypeFunc::FramePtr );
|
||||
frame = phase->transform(frame);
|
||||
// Halt & Catch Fire
|
||||
Node* halt = new HaltNode(nproj, frame, "unexpected negative array length");
|
||||
phase->C->root()->add_req(halt);
|
||||
phase->transform(halt);
|
||||
|
||||
igvn->replace_node(catchproj, phase->C->top());
|
||||
return this;
|
||||
}
|
||||
} else {
|
||||
// Can't correct it during regular GVN so register for IGVN
|
||||
phase->C->record_for_igvn(this);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Retrieve the length from the AllocateArrayNode. Narrow the type with a
|
||||
// CastII, if appropriate. If we are not allowed to create new nodes, and
|
||||
// a CastII is appropriate, return NULL.
|
||||
|
@ -913,7 +913,6 @@ public:
|
||||
KlassNode, // type (maybe dynamic) of the obj.
|
||||
InitialTest, // slow-path test (may be constant)
|
||||
ALength, // array length (or TOP if none)
|
||||
ValidLengthTest,
|
||||
ParmLimit
|
||||
};
|
||||
|
||||
@ -923,7 +922,6 @@ public:
|
||||
fields[KlassNode] = TypeInstPtr::NOTNULL;
|
||||
fields[InitialTest] = TypeInt::BOOL;
|
||||
fields[ALength] = t; // length (can be a bad length)
|
||||
fields[ValidLengthTest] = TypeInt::BOOL;
|
||||
|
||||
const TypeTuple *domain = TypeTuple::make(ParmLimit, fields);
|
||||
|
||||
@ -1018,16 +1016,18 @@ public:
|
||||
//
|
||||
class AllocateArrayNode : public AllocateNode {
|
||||
public:
|
||||
AllocateArrayNode(Compile* C, const TypeFunc* atype, Node* ctrl, Node* mem, Node* abio, Node* size, Node* klass_node,
|
||||
Node* initial_test, Node* count_val, Node* valid_length_test)
|
||||
AllocateArrayNode(Compile* C, const TypeFunc *atype, Node *ctrl, Node *mem, Node *abio,
|
||||
Node* size, Node* klass_node, Node* initial_test,
|
||||
Node* count_val
|
||||
)
|
||||
: AllocateNode(C, atype, ctrl, mem, abio, size, klass_node,
|
||||
initial_test)
|
||||
{
|
||||
init_class_id(Class_AllocateArray);
|
||||
set_req(AllocateNode::ALength, count_val);
|
||||
set_req(AllocateNode::ValidLengthTest, valid_length_test);
|
||||
}
|
||||
virtual int Opcode() const;
|
||||
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
|
||||
|
||||
// Dig the length operand out of a array allocation site.
|
||||
Node* Ideal_length() {
|
||||
|
@ -2687,20 +2687,6 @@ const Type* CatchNode::Value(PhaseGVN* phase) const {
|
||||
// Rethrows always throw exceptions, never return
|
||||
if (call->entry_point() == OptoRuntime::rethrow_stub()) {
|
||||
f[CatchProjNode::fall_through_index] = Type::TOP;
|
||||
} else if (call->is_AllocateArray()) {
|
||||
Node* klass_node = call->in(AllocateNode::KlassNode);
|
||||
Node *length = call->in(AllocateNode::ALength);
|
||||
const Type* length_type = phase->type(length);
|
||||
const Type* klass_type = phase->type(klass_node);
|
||||
if (length_type == Type::TOP || klass_type == Type::TOP) {
|
||||
f[CatchProjNode::fall_through_index] = Type::TOP;
|
||||
} else {
|
||||
Node* valid_length_test = call->in(AllocateNode::ValidLengthTest);
|
||||
const Type* valid_length_test_t = phase->type(valid_length_test);
|
||||
if (valid_length_test_t->isa_int() && valid_length_test_t->is_int()->is_con(0)) {
|
||||
f[CatchProjNode::fall_through_index] = Type::TOP;
|
||||
}
|
||||
}
|
||||
} else if( call->req() > TypeFunc::Parms ) {
|
||||
const Type *arg0 = phase->type( call->in(TypeFunc::Parms) );
|
||||
// Check for null receiver to virtual or interface calls
|
||||
|
@ -3772,20 +3772,17 @@ bool Compile::final_graph_reshaping() {
|
||||
arg0->as_Type()->type()->higher_equal(TypePtr::NULL_PTR)) {
|
||||
required_outcnt--;
|
||||
}
|
||||
} else if (call->entry_point() == OptoRuntime::new_array_Java() ||
|
||||
call->entry_point() == OptoRuntime::new_array_nozero_Java()) {
|
||||
} else if (call->entry_point() == OptoRuntime::new_array_Java() &&
|
||||
call->req() > TypeFunc::Parms+1 &&
|
||||
call->is_CallStaticJava()) {
|
||||
// Check for negative array length. In such case, the optimizer has
|
||||
// detected that the allocation attempt will always result in an
|
||||
// exception. There is no fall-through projection of this CatchNode .
|
||||
assert(call->is_CallStaticJava(), "static call expected");
|
||||
assert(call->len() > call->req() && call->in(call->req()) != NULL, "no precendent edge");
|
||||
Node* valid_length_test = call->in(call->req());
|
||||
call->rm_prec(call->req());
|
||||
if (valid_length_test->find_int_con(1) == 0) {
|
||||
Node *arg1 = call->in(TypeFunc::Parms+1);
|
||||
if (arg1->is_Type() &&
|
||||
arg1->as_Type()->type()->join(TypeInt::POS)->empty()) {
|
||||
required_outcnt--;
|
||||
}
|
||||
assert(n->outcnt() == required_outcnt, "malformed control flow");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3794,13 +3791,6 @@ bool Compile::final_graph_reshaping() {
|
||||
record_method_not_compilable("malformed control flow");
|
||||
return true; // Not all targets reachable!
|
||||
}
|
||||
} else if (n->is_PCTable() && n->in(0) && n->in(0)->in(0) && n->in(0)->in(0)->is_Call()) {
|
||||
CallNode* call = n->in(0)->in(0)->as_Call();
|
||||
if (call->entry_point() == OptoRuntime::new_array_Java() ||
|
||||
call->entry_point() == OptoRuntime::new_array_nozero_Java()) {
|
||||
assert(call->len() > call->req() && call->in(call->req()) != NULL, "precedent edge expected");
|
||||
call->rm_prec(call->req());
|
||||
}
|
||||
}
|
||||
// Check that I actually visited all kids. Unreached kids
|
||||
// must be infinite loops.
|
||||
|
@ -2742,9 +2742,7 @@ void GraphKit::make_slow_call_ex(Node* call, ciInstanceKlass* ex_klass, bool sep
|
||||
// Make a catch node with just two handlers: fall-through and catch-all
|
||||
Node* i_o = _gvn.transform( new ProjNode(call, TypeFunc::I_O, separate_io_proj) );
|
||||
Node* catc = _gvn.transform( new CatchNode(control(), i_o, 2) );
|
||||
Node* norm = new CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci);
|
||||
_gvn.set_type_bottom(norm);
|
||||
C->record_for_igvn(norm);
|
||||
Node* norm = _gvn.transform( new CatchProjNode(catc, CatchProjNode::fall_through_index, CatchProjNode::no_handler_bci) );
|
||||
Node* excp = _gvn.transform( new CatchProjNode(catc, CatchProjNode::catch_all_index, CatchProjNode::no_handler_bci) );
|
||||
|
||||
{ PreserveJVMState pjvms(this);
|
||||
@ -3985,28 +3983,20 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
|
||||
initial_slow_test = initial_slow_test->as_Bool()->as_int_value(&_gvn);
|
||||
}
|
||||
|
||||
const TypeOopPtr* ary_type = _gvn.type(klass_node)->is_klassptr()->as_instance_type();
|
||||
Node* valid_length_test = C->top();
|
||||
if (ary_type->klass()->is_array_klass()) {
|
||||
BasicType bt = ary_type->klass()->as_array_klass()->element_type()->basic_type();
|
||||
jint max = TypeAryPtr::max_array_length(bt);
|
||||
Node* valid_length_cmp = _gvn.transform(new CmpUNode(length, intcon(max)));
|
||||
valid_length_test = _gvn.transform(new BoolNode(valid_length_cmp, BoolTest::le));
|
||||
}
|
||||
|
||||
// Create the AllocateArrayNode and its result projections
|
||||
AllocateArrayNode* alloc
|
||||
= new AllocateArrayNode(C, AllocateArrayNode::alloc_type(TypeInt::INT),
|
||||
control(), mem, i_o(),
|
||||
size, klass_node,
|
||||
initial_slow_test,
|
||||
length, valid_length_test);
|
||||
length);
|
||||
|
||||
// Cast to correct type. Note that the klass_node may be constant or not,
|
||||
// and in the latter case the actual array type will be inexact also.
|
||||
// (This happens via a non-constant argument to inline_native_newArray.)
|
||||
// In any case, the value of klass_node provides the desired array type.
|
||||
const TypeInt* length_type = _gvn.find_int_type(length);
|
||||
const TypeOopPtr* ary_type = _gvn.type(klass_node)->is_klassptr()->as_instance_type();
|
||||
if (ary_type->isa_aryptr() && length_type != NULL) {
|
||||
// Try to get a better type than POS for the size
|
||||
ary_type = ary_type->is_aryptr()->cast_to_size(length_type);
|
||||
|
@ -1208,8 +1208,7 @@ void PhaseMacroExpand::expand_allocate_common(
|
||||
AllocateNode* alloc, // allocation node to be expanded
|
||||
Node* length, // array length for an array allocation
|
||||
const TypeFunc* slow_call_type, // Type of slow call
|
||||
address slow_call_address, // Address of slow call
|
||||
Node* valid_length_test // whether length is valid or not
|
||||
address slow_call_address // Address of slow call
|
||||
)
|
||||
{
|
||||
Node* ctrl = alloc->in(TypeFunc::Control);
|
||||
@ -1394,9 +1393,6 @@ void PhaseMacroExpand::expand_allocate_common(
|
||||
// Copy debug information and adjust JVMState information, then replace
|
||||
// allocate node with the call
|
||||
call->copy_call_debug_info(&_igvn, alloc);
|
||||
if (valid_length_test != NULL) {
|
||||
call->add_prec(valid_length_test);
|
||||
}
|
||||
if (expand_fast_path) {
|
||||
call->set_cnt(PROB_UNLIKELY_MAG(4)); // Same effect as RC_UNCOMMON.
|
||||
} else {
|
||||
@ -1879,12 +1875,11 @@ Node* PhaseMacroExpand::prefetch_allocation(Node* i_o, Node*& needgc_false,
|
||||
void PhaseMacroExpand::expand_allocate(AllocateNode *alloc) {
|
||||
expand_allocate_common(alloc, NULL,
|
||||
OptoRuntime::new_instance_Type(),
|
||||
OptoRuntime::new_instance_Java(), NULL);
|
||||
OptoRuntime::new_instance_Java());
|
||||
}
|
||||
|
||||
void PhaseMacroExpand::expand_allocate_array(AllocateArrayNode *alloc) {
|
||||
Node* length = alloc->in(AllocateNode::ALength);
|
||||
Node* valid_length_test = alloc->in(AllocateNode::ValidLengthTest);
|
||||
InitializeNode* init = alloc->initialization();
|
||||
Node* klass_node = alloc->in(AllocateNode::KlassNode);
|
||||
ciKlass* k = _igvn.type(klass_node)->is_klassptr()->klass();
|
||||
@ -1899,7 +1894,7 @@ void PhaseMacroExpand::expand_allocate_array(AllocateArrayNode *alloc) {
|
||||
}
|
||||
expand_allocate_common(alloc, length,
|
||||
OptoRuntime::new_array_Type(),
|
||||
slow_call_address, valid_length_test);
|
||||
slow_call_address);
|
||||
}
|
||||
|
||||
//-------------------mark_eliminated_box----------------------------------
|
||||
|
@ -92,8 +92,8 @@ private:
|
||||
void expand_allocate_common(AllocateNode* alloc,
|
||||
Node* length,
|
||||
const TypeFunc* slow_call_type,
|
||||
address slow_call_address,
|
||||
Node* valid_length_test);
|
||||
address slow_call_address);
|
||||
void yank_initalize_node(InitializeNode* node);
|
||||
void yank_alloc_node(AllocateNode* alloc);
|
||||
Node *value_from_mem(Node *mem, Node *ctl, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc);
|
||||
Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, AllocateNode *alloc, Node_Stack *value_phis, int level);
|
||||
|
@ -128,8 +128,8 @@ bool PhaseIdealLoop::split_up( Node *n, Node *blk1, Node *blk2 ) {
|
||||
}
|
||||
} else {
|
||||
// We might see an Opaque1 from a loop limit check here
|
||||
assert(use->is_If() || use->is_CMove() || use->Opcode() == Op_Opaque1 || use->is_AllocateArray(), "unexpected node type");
|
||||
Node *use_c = (use->is_If() || use->is_AllocateArray()) ? use->in(0) : get_ctrl(use);
|
||||
assert(use->is_If() || use->is_CMove() || use->Opcode() == Op_Opaque1, "unexpected node type");
|
||||
Node *use_c = use->is_If() ? use->in(0) : get_ctrl(use);
|
||||
if (use_c == blk1 || use_c == blk2) {
|
||||
assert(use->is_CMove(), "unexpected node type");
|
||||
continue;
|
||||
@ -166,15 +166,14 @@ bool PhaseIdealLoop::split_up( Node *n, Node *blk1, Node *blk2 ) {
|
||||
--j;
|
||||
} else {
|
||||
// We might see an Opaque1 from a loop limit check here
|
||||
assert(u->is_If() || u->is_CMove() || u->Opcode() == Op_Opaque1 || u->is_AllocateArray(), "unexpected node type");
|
||||
assert(u->is_AllocateArray() || u->in(1) == bol, "");
|
||||
assert(!u->is_AllocateArray() || u->in(AllocateNode::ValidLengthTest) == bol, "wrong input to AllocateArray");
|
||||
assert(u->is_If() || u->is_CMove() || u->Opcode() == Op_Opaque1, "unexpected node type");
|
||||
assert(u->in(1) == bol, "");
|
||||
// Get control block of either the CMove or the If input
|
||||
Node *u_ctrl = (u->is_If() || u->is_AllocateArray()) ? u->in(0) : get_ctrl(u);
|
||||
Node *u_ctrl = u->is_If() ? u->in(0) : get_ctrl(u);
|
||||
assert((u_ctrl != blk1 && u_ctrl != blk2) || u->is_CMove(), "won't converge");
|
||||
Node *x = bol->clone();
|
||||
register_new_node(x, u_ctrl);
|
||||
_igvn.replace_input_of(u, u->is_AllocateArray() ? AllocateNode::ValidLengthTest : 1, x);
|
||||
_igvn.replace_input_of(u, 1, x);
|
||||
--j;
|
||||
}
|
||||
}
|
||||
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Red Hat, Inc. 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
|
||||
* bug 8278413
|
||||
* @summary C2 crash when allocating array of size too large
|
||||
* @library /test/lib /
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -ea -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation TestFailedAllocationBadGraph
|
||||
*/
|
||||
|
||||
import sun.hotspot.WhiteBox;
|
||||
import java.lang.reflect.Method;
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
|
||||
public class TestFailedAllocationBadGraph {
|
||||
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
|
||||
|
||||
private static long[] array;
|
||||
private static int field;
|
||||
private static volatile int barrier;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run("test1");
|
||||
run("test2");
|
||||
}
|
||||
|
||||
private static void run(String method) throws Exception {
|
||||
Method m = TestFailedAllocationBadGraph.class.getDeclaredMethod(method);
|
||||
WHITE_BOX.enqueueMethodForCompilation(m, CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION);
|
||||
if (!WHITE_BOX.isMethodCompiled(m) || WHITE_BOX.getMethodCompilationLevel(m) != CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION) {
|
||||
throw new RuntimeException("should still be compiled");
|
||||
}
|
||||
}
|
||||
|
||||
private static int test1() {
|
||||
int length = Integer.MAX_VALUE;
|
||||
try {
|
||||
array = new long[length];
|
||||
} catch (OutOfMemoryError outOfMemoryError) {
|
||||
barrier = 0x42;
|
||||
length = field;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
private static int test2() {
|
||||
int length = -1;
|
||||
try {
|
||||
array = new long[length];
|
||||
} catch (OutOfMemoryError outOfMemoryError) {
|
||||
barrier = 0x42;
|
||||
length = field;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
}
|
54
test/hotspot/jtreg/compiler/c2/TestSqrt.java
Normal file
54
test/hotspot/jtreg/compiler/c2/TestSqrt.java
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Red Hat, Inc. 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.c2;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8279076
|
||||
* @summary SqrtD/SqrtF should be matched only on supported platforms
|
||||
* @requires vm.debug
|
||||
*
|
||||
* @run main/othervm -XX:-TieredCompilation -Xcomp
|
||||
* -XX:CompileOnly=compiler/c2/TestSqrt
|
||||
* -XX:CompileOnly=java/lang/Math
|
||||
* compiler.c2.TestSqrt
|
||||
*/
|
||||
public class TestSqrt {
|
||||
static float srcF = 42.0f;
|
||||
static double srcD = 42.0d;
|
||||
static float dstF;
|
||||
static double dstD;
|
||||
|
||||
public static void test() {
|
||||
dstF = (float)Math.sqrt((double)srcF);
|
||||
dstD = Math.sqrt(srcD);
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
for (int i = 0; i < 20_000; i++) {
|
||||
test();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -822,7 +822,6 @@ jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-
|
||||
jdk/jfr/event/os/TestThreadContextSwitches.java 8247776 windows-all
|
||||
jdk/jfr/startupargs/TestStartName.java 8214685 windows-x64
|
||||
jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64
|
||||
jdk/jfr/api/consumer/streaming/TestLatestEvent.java 8268297 windows-x64
|
||||
jdk/jfr/event/oldobject/TestLargeRootSet.java 8276333 macosx-x64,windows-x64
|
||||
|
||||
############################################################################
|
||||
|
@ -23,8 +23,12 @@
|
||||
|
||||
package jdk.jfr.api.consumer.streaming;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
@ -34,6 +38,7 @@ import jdk.jfr.FlightRecorder;
|
||||
import jdk.jfr.Name;
|
||||
import jdk.jfr.Recording;
|
||||
import jdk.jfr.consumer.EventStream;
|
||||
import jdk.jfr.consumer.RecordingFile;
|
||||
import jdk.jfr.consumer.RecordingStream;
|
||||
|
||||
/**
|
||||
@ -65,6 +70,7 @@ public class TestLatestEvent {
|
||||
CountDownLatch beginChunks = new CountDownLatch(1);
|
||||
|
||||
try (RecordingStream r = new RecordingStream()) {
|
||||
r.setMaxSize(1_000_000_000);
|
||||
r.onEvent("MakeChunks", event -> {
|
||||
System.out.println(event);
|
||||
beginChunks.countDown();
|
||||
@ -100,13 +106,25 @@ public class TestLatestEvent {
|
||||
// This latch ensures thatNotLatest has been
|
||||
// flushed and a new valid position has been written
|
||||
// to the chunk header
|
||||
notLatestEvent.await(80, TimeUnit.SECONDS);
|
||||
boolean timeout = notLatestEvent.await(80, TimeUnit.SECONDS);
|
||||
if (notLatestEvent.getCount() != 0) {
|
||||
System.out.println("timeout = " + timeout);
|
||||
Path repo = Path.of(System.getProperty("jdk.jfr.repository"));
|
||||
System.out.println("repo = " + repo);
|
||||
List<Path> files = new ArrayList<>(Files.list(repo).toList());
|
||||
files.sort(Comparator.comparing(Path::toString));
|
||||
for (Path f : files) {
|
||||
System.out.println("------------");
|
||||
System.out.println("File: " + f);
|
||||
for (var event : RecordingFile.readAllEvents(f)) {
|
||||
System.out.println(event);
|
||||
}
|
||||
}
|
||||
Recording rec = FlightRecorder.getFlightRecorder().takeSnapshot();
|
||||
Path p = Paths.get("error-not-latest.jfr").toAbsolutePath();
|
||||
rec.dump(p);
|
||||
System.out.println("Dumping repository as a file for inspection at " + p);
|
||||
throw new Exception("Timeout 80 s. Expected 6 event, but got " + notLatestEvent.getCount());
|
||||
throw new Exception("Timeout 80 s. Expected 6 event, but got " + (6 - notLatestEvent.getCount()));
|
||||
}
|
||||
|
||||
try (EventStream s = EventStream.openRepository()) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 6545058 6611182 8016209 8139986 8162746
|
||||
* @bug 6545058 6611182 8016209 8139986 8162746 8278967
|
||||
* @summary validate and test -version, -fullversion, and internal, as well as
|
||||
* sanity checks if a tool can be launched.
|
||||
* @modules jdk.compiler
|
||||
@ -126,9 +126,12 @@ public class VersionCheck extends TestHelper {
|
||||
static String getVersion0(boolean allLines, String... argv) {
|
||||
TestHelper.TestResult tr = doExec(argv);
|
||||
StringBuilder out = new StringBuilder();
|
||||
// remove the HotSpot line
|
||||
// remove the HotSpot line and security manager deprecation warnings
|
||||
for (String x : tr.testOutput) {
|
||||
if (allLines || !x.matches(".*Client.*VM.*|.*Server.*VM.*")) {
|
||||
if (allLines || !x.matches(".*Client.*VM.*|" +
|
||||
".*Server.*VM.*|" +
|
||||
"WARNING:.*terminally.*deprecated.*|" +
|
||||
"WARNING:.*System::setSecurityManager.*")) {
|
||||
out = out.append(x + "\n");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user