Merge
This commit is contained in:
commit
a051e735cd
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 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
|
||||||
@ -27,6 +27,7 @@
|
|||||||
#include "asm/assembler.inline.hpp"
|
#include "asm/assembler.inline.hpp"
|
||||||
#include "opto/c2_MacroAssembler.hpp"
|
#include "opto/c2_MacroAssembler.hpp"
|
||||||
#include "opto/intrinsicnode.hpp"
|
#include "opto/intrinsicnode.hpp"
|
||||||
|
#include "opto/subnode.hpp"
|
||||||
#include "runtime/stubRoutines.hpp"
|
#include "runtime/stubRoutines.hpp"
|
||||||
|
|
||||||
#ifdef PRODUCT
|
#ifdef PRODUCT
|
||||||
@ -832,3 +833,45 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,
|
|||||||
|
|
||||||
BLOCK_COMMENT("} string_compare");
|
BLOCK_COMMENT("} string_compare");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void C2_MacroAssembler::neon_compare(FloatRegister dst, BasicType bt, FloatRegister src1,
|
||||||
|
FloatRegister src2, int cond, bool isQ) {
|
||||||
|
SIMD_Arrangement size = esize2arrangement(type2aelembytes(bt), isQ);
|
||||||
|
if (bt == T_FLOAT || bt == T_DOUBLE) {
|
||||||
|
switch (cond) {
|
||||||
|
case BoolTest::eq: fcmeq(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::ne: {
|
||||||
|
fcmeq(dst, size, src1, src2);
|
||||||
|
notr(dst, T16B, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BoolTest::ge: fcmge(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::gt: fcmgt(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::le: fcmge(dst, size, src2, src1); break;
|
||||||
|
case BoolTest::lt: fcmgt(dst, size, src2, src1); break;
|
||||||
|
default:
|
||||||
|
assert(false, "unsupported");
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
switch (cond) {
|
||||||
|
case BoolTest::eq: cmeq(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::ne: {
|
||||||
|
cmeq(dst, size, src1, src2);
|
||||||
|
notr(dst, T16B, dst);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BoolTest::ge: cmge(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::gt: cmgt(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::le: cmge(dst, size, src2, src1); break;
|
||||||
|
case BoolTest::lt: cmgt(dst, size, src2, src1); break;
|
||||||
|
case BoolTest::uge: cmhs(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::ugt: cmhi(dst, size, src1, src2); break;
|
||||||
|
case BoolTest::ult: cmhi(dst, size, src2, src1); break;
|
||||||
|
case BoolTest::ule: cmhs(dst, size, src2, src1); break;
|
||||||
|
default:
|
||||||
|
assert(false, "unsupported");
|
||||||
|
ShouldNotReachHere();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 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
|
||||||
@ -49,4 +49,8 @@
|
|||||||
Register ch, Register result,
|
Register ch, Register result,
|
||||||
Register tmp1, Register tmp2, Register tmp3);
|
Register tmp1, Register tmp2, Register tmp3);
|
||||||
|
|
||||||
|
// SIMD&FP comparison
|
||||||
|
void neon_compare(FloatRegister dst, BasicType bt, FloatRegister src1,
|
||||||
|
FloatRegister src2, int cond, bool isQ);
|
||||||
|
|
||||||
#endif // CPU_AARCH64_C2_MACROASSEMBLER_AARCH64_HPP
|
#endif // CPU_AARCH64_C2_MACROASSEMBLER_AARCH64_HPP
|
||||||
|
@ -5339,49 +5339,6 @@ void MacroAssembler::safepoint_isb() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::neon_compare(FloatRegister dst, BasicType bt, FloatRegister src1,
|
|
||||||
FloatRegister src2, int cond, bool isQ) {
|
|
||||||
SIMD_Arrangement size = esize2arrangement(type2aelembytes(bt), isQ);
|
|
||||||
if (bt == T_FLOAT || bt == T_DOUBLE) {
|
|
||||||
switch (cond) {
|
|
||||||
case BoolTest::eq: fcmeq(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::ne: {
|
|
||||||
fcmeq(dst, size, src1, src2);
|
|
||||||
notr(dst, T16B, dst);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BoolTest::ge: fcmge(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::gt: fcmgt(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::le: fcmge(dst, size, src2, src1); break;
|
|
||||||
case BoolTest::lt: fcmgt(dst, size, src2, src1); break;
|
|
||||||
default:
|
|
||||||
assert(false, "unsupported");
|
|
||||||
ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (cond) {
|
|
||||||
case BoolTest::eq: cmeq(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::ne: {
|
|
||||||
cmeq(dst, size, src1, src2);
|
|
||||||
notr(dst, T16B, dst);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case BoolTest::ge: cmge(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::gt: cmgt(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::le: cmge(dst, size, src2, src1); break;
|
|
||||||
case BoolTest::lt: cmgt(dst, size, src2, src1); break;
|
|
||||||
case BoolTest::uge: cmhs(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::ugt: cmhi(dst, size, src1, src2); break;
|
|
||||||
case BoolTest::ult: cmhi(dst, size, src2, src1); break;
|
|
||||||
case BoolTest::ule: cmhs(dst, size, src2, src1); break;
|
|
||||||
default:
|
|
||||||
assert(false, "unsupported");
|
|
||||||
ShouldNotReachHere();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef PRODUCT
|
#ifndef PRODUCT
|
||||||
void MacroAssembler::verify_cross_modify_fence_not_required() {
|
void MacroAssembler::verify_cross_modify_fence_not_required() {
|
||||||
if (VerifyCrossModifyFence) {
|
if (VerifyCrossModifyFence) {
|
||||||
|
@ -1058,8 +1058,6 @@ public:
|
|||||||
bool acquire, bool release, bool weak,
|
bool acquire, bool release, bool weak,
|
||||||
Register result);
|
Register result);
|
||||||
|
|
||||||
// SIMD&FP comparison
|
|
||||||
void neon_compare(FloatRegister dst, BasicType bt, FloatRegister src1, FloatRegister src2, int cond, bool isQ);
|
|
||||||
private:
|
private:
|
||||||
void compare_eq(Register rn, Register rm, enum operand_size size);
|
void compare_eq(Register rn, Register rm, enum operand_size size);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 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
|
||||||
@ -585,7 +585,7 @@ address ProgrammableUpcallHandler::generate_optimized_upcall_stub(jobject receiv
|
|||||||
const ABIDescriptor abi = ForeignGlobals::parse_abi_descriptor(jabi);
|
const ABIDescriptor abi = ForeignGlobals::parse_abi_descriptor(jabi);
|
||||||
const CallRegs conv = ForeignGlobals::parse_call_regs(jconv);
|
const CallRegs conv = ForeignGlobals::parse_call_regs(jconv);
|
||||||
assert(conv._rets_length <= 1, "no multi reg returns");
|
assert(conv._rets_length <= 1, "no multi reg returns");
|
||||||
CodeBuffer buffer("upcall_stub_linkToNative", /* code_size = */ 1024, /* locs_size = */ 1024);
|
CodeBuffer buffer("upcall_stub_linkToNative", /* code_size = */ 2048, /* locs_size = */ 1024);
|
||||||
|
|
||||||
int register_size = sizeof(uintptr_t);
|
int register_size = sizeof(uintptr_t);
|
||||||
int buffer_alignment = xmm_reg_size;
|
int buffer_alignment = xmm_reg_size;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 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
|
||||||
@ -26,6 +26,10 @@
|
|||||||
#include "gc/parallel/spaceCounters.hpp"
|
#include "gc/parallel/spaceCounters.hpp"
|
||||||
#include "memory/allocation.inline.hpp"
|
#include "memory/allocation.inline.hpp"
|
||||||
#include "memory/resourceArea.hpp"
|
#include "memory/resourceArea.hpp"
|
||||||
|
#include "runtime/atomic.hpp"
|
||||||
|
#include "runtime/mutex.hpp"
|
||||||
|
#include "runtime/mutexLocker.hpp"
|
||||||
|
#include "utilities/debug.hpp"
|
||||||
#include "utilities/macros.hpp"
|
#include "utilities/macros.hpp"
|
||||||
|
|
||||||
SpaceCounters::SpaceCounters(const char* name, int ordinal, size_t max_size,
|
SpaceCounters::SpaceCounters(const char* name, int ordinal, size_t max_size,
|
||||||
@ -68,3 +72,24 @@ SpaceCounters::SpaceCounters(const char* name, int ordinal, size_t max_size,
|
|||||||
SpaceCounters::~SpaceCounters() {
|
SpaceCounters::~SpaceCounters() {
|
||||||
FREE_C_HEAP_ARRAY(char, _name_space);
|
FREE_C_HEAP_ARRAY(char, _name_space);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static volatile size_t last_used_in_bytes = 0;
|
||||||
|
|
||||||
|
void SpaceCounters::update_used() {
|
||||||
|
size_t new_used = _object_space->used_in_bytes();
|
||||||
|
Atomic::store(&last_used_in_bytes, new_used);
|
||||||
|
_used->set_value(new_used);
|
||||||
|
}
|
||||||
|
|
||||||
|
jlong MutableSpaceUsedHelper::take_sample() {
|
||||||
|
// Sampling may occur during GC, possibly while GC is updating the space.
|
||||||
|
// The space can be in an inconsistent state during such an update. We
|
||||||
|
// don't want to block sampling for the duration of a GC. Instead, skip
|
||||||
|
// sampling in that case, using the last recorded value.
|
||||||
|
assert(!Heap_lock->owned_by_self(), "precondition");
|
||||||
|
if (Heap_lock->try_lock()) {
|
||||||
|
Atomic::store(&last_used_in_bytes, _m->used_in_bytes());
|
||||||
|
Heap_lock->unlock();
|
||||||
|
}
|
||||||
|
return Atomic::load(&last_used_in_bytes);
|
||||||
|
}
|
||||||
|
@ -58,9 +58,7 @@ class SpaceCounters: public CHeapObj<mtGC> {
|
|||||||
_capacity->set_value(_object_space->capacity_in_bytes());
|
_capacity->set_value(_object_space->capacity_in_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void update_used() {
|
void update_used();
|
||||||
_used->set_value(_object_space->used_in_bytes());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline void update_all() {
|
inline void update_all() {
|
||||||
update_used();
|
update_used();
|
||||||
@ -77,9 +75,7 @@ class MutableSpaceUsedHelper: public PerfLongSampleHelper {
|
|||||||
public:
|
public:
|
||||||
MutableSpaceUsedHelper(MutableSpace* m) : _m(m) { }
|
MutableSpaceUsedHelper(MutableSpace* m) : _m(m) { }
|
||||||
|
|
||||||
inline jlong take_sample() {
|
jlong take_sample() override;
|
||||||
return _m->used_in_bytes();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_GC_PARALLEL_SPACECOUNTERS_HPP
|
#endif // SHARE_GC_PARALLEL_SPACECOUNTERS_HPP
|
||||||
|
@ -72,8 +72,12 @@ void CSpaceCounters::update_capacity() {
|
|||||||
_capacity->set_value(_space->capacity());
|
_capacity->set_value(_space->capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static volatile size_t last_used_in_bytes = 0;
|
||||||
|
|
||||||
void CSpaceCounters::update_used() {
|
void CSpaceCounters::update_used() {
|
||||||
_used->set_value(_space->used());
|
size_t new_used = _space->used();
|
||||||
|
Atomic::store(&last_used_in_bytes, new_used);
|
||||||
|
_used->set_value(new_used);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSpaceCounters::update_all() {
|
void CSpaceCounters::update_all() {
|
||||||
@ -82,5 +86,14 @@ void CSpaceCounters::update_all() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
jlong ContiguousSpaceUsedHelper::take_sample(){
|
jlong ContiguousSpaceUsedHelper::take_sample(){
|
||||||
return _space->used();
|
// Sampling may occur during GC, possibly while GC is updating the space.
|
||||||
|
// The space can be in an inconsistent state during such an update. We
|
||||||
|
// don't want to block sampling for the duration of a GC. Instead, skip
|
||||||
|
// sampling in that case, using the last recorded value.
|
||||||
|
assert(!Heap_lock->owned_by_self(), "precondition");
|
||||||
|
if (Heap_lock->try_lock()) {
|
||||||
|
Atomic::store(&last_used_in_bytes, _space->used());
|
||||||
|
Heap_lock->unlock();
|
||||||
|
}
|
||||||
|
return Atomic::load(&last_used_in_bytes);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 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
|
||||||
@ -54,9 +54,9 @@ class CSpaceCounters: public CHeapObj<mtGC> {
|
|||||||
|
|
||||||
~CSpaceCounters();
|
~CSpaceCounters();
|
||||||
|
|
||||||
virtual void update_capacity();
|
void update_capacity();
|
||||||
virtual void update_used();
|
void update_used();
|
||||||
virtual void update_all();
|
void update_all();
|
||||||
|
|
||||||
const char* name_space() const { return _name_space; }
|
const char* name_space() const { return _name_space; }
|
||||||
};
|
};
|
||||||
@ -68,7 +68,7 @@ class ContiguousSpaceUsedHelper : public PerfLongSampleHelper {
|
|||||||
public:
|
public:
|
||||||
ContiguousSpaceUsedHelper(ContiguousSpace* space) : _space(space) { }
|
ContiguousSpaceUsedHelper(ContiguousSpace* space) : _space(space) { }
|
||||||
|
|
||||||
jlong take_sample();
|
jlong take_sample() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SHARE_GC_SERIAL_CSPACECOUNTERS_HPP
|
#endif // SHARE_GC_SERIAL_CSPACECOUNTERS_HPP
|
||||||
|
@ -196,8 +196,14 @@ Node* ArrayCopyNode::try_clone_instance(PhaseGVN *phase, bool can_reshape, int c
|
|||||||
|
|
||||||
if (!inst_src->klass_is_exact()) {
|
if (!inst_src->klass_is_exact()) {
|
||||||
ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
|
ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
|
||||||
assert(!ik->is_interface() && !ik->has_subklass(), "inconsistent klass hierarchy");
|
assert(!ik->is_interface(), "inconsistent klass hierarchy");
|
||||||
phase->C->dependencies()->assert_leaf_type(ik);
|
if (ik->has_subklass()) {
|
||||||
|
// Concurrent class loading.
|
||||||
|
// Fail fast and return NodeSentinel to indicate that the transform failed.
|
||||||
|
return NodeSentinel;
|
||||||
|
} else {
|
||||||
|
phase->C->dependencies()->assert_leaf_type(ik);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
|
ciInstanceKlass* ik = inst_src->klass()->as_instance_klass();
|
||||||
|
@ -2946,7 +2946,6 @@ Node* GraphKit::gen_subtype_check(Node* obj_or_subklass, Node* superklass) {
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TypePtr* adr_type = TypeKlassPtr::make(TypePtr::NotNull, C->env()->Object_klass(), Type::OffsetBot);
|
|
||||||
Node* check = _gvn.transform(new SubTypeCheckNode(C, obj_or_subklass, superklass));
|
Node* check = _gvn.transform(new SubTypeCheckNode(C, obj_or_subklass, superklass));
|
||||||
Node* bol = _gvn.transform(new BoolNode(check, BoolTest::eq));
|
Node* bol = _gvn.transform(new BoolNode(check, BoolTest::eq));
|
||||||
IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
|
IfNode* iff = create_and_xform_if(control(), bol, PROB_STATIC_FREQUENT, COUNT_UNKNOWN);
|
||||||
@ -2958,23 +2957,30 @@ Node* GraphKit::gen_subtype_check(Node* obj_or_subklass, Node* superklass) {
|
|||||||
Node* GraphKit::type_check_receiver(Node* receiver, ciKlass* klass,
|
Node* GraphKit::type_check_receiver(Node* receiver, ciKlass* klass,
|
||||||
float prob,
|
float prob,
|
||||||
Node* *casted_receiver) {
|
Node* *casted_receiver) {
|
||||||
|
assert(!klass->is_interface(), "no exact type check on interfaces");
|
||||||
|
|
||||||
const TypeKlassPtr* tklass = TypeKlassPtr::make(klass);
|
const TypeKlassPtr* tklass = TypeKlassPtr::make(klass);
|
||||||
Node* recv_klass = load_object_klass(receiver);
|
Node* recv_klass = load_object_klass(receiver);
|
||||||
Node* want_klass = makecon(tklass);
|
Node* want_klass = makecon(tklass);
|
||||||
Node* cmp = _gvn.transform( new CmpPNode(recv_klass, want_klass) );
|
Node* cmp = _gvn.transform(new CmpPNode(recv_klass, want_klass));
|
||||||
Node* bol = _gvn.transform( new BoolNode(cmp, BoolTest::eq) );
|
Node* bol = _gvn.transform(new BoolNode(cmp, BoolTest::eq));
|
||||||
IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN);
|
IfNode* iff = create_and_xform_if(control(), bol, prob, COUNT_UNKNOWN);
|
||||||
set_control( _gvn.transform( new IfTrueNode (iff) ));
|
set_control( _gvn.transform(new IfTrueNode (iff)));
|
||||||
Node* fail = _gvn.transform( new IfFalseNode(iff) );
|
Node* fail = _gvn.transform(new IfFalseNode(iff));
|
||||||
|
|
||||||
const TypeOopPtr* recv_xtype = tklass->as_instance_type();
|
if (!stopped()) {
|
||||||
assert(recv_xtype->klass_is_exact(), "");
|
const TypeOopPtr* receiver_type = _gvn.type(receiver)->isa_oopptr();
|
||||||
|
const TypeOopPtr* recvx_type = tklass->as_instance_type();
|
||||||
|
assert(recvx_type->klass_is_exact(), "");
|
||||||
|
|
||||||
// Subsume downstream occurrences of receiver with a cast to
|
if (!receiver_type->higher_equal(recvx_type)) { // ignore redundant casts
|
||||||
// recv_xtype, since now we know what the type will be.
|
// Subsume downstream occurrences of receiver with a cast to
|
||||||
Node* cast = new CheckCastPPNode(control(), receiver, recv_xtype);
|
// recv_xtype, since now we know what the type will be.
|
||||||
(*casted_receiver) = _gvn.transform(cast);
|
Node* cast = new CheckCastPPNode(control(), receiver, recvx_type);
|
||||||
// (User must make the replace_in_map call.)
|
(*casted_receiver) = _gvn.transform(cast);
|
||||||
|
// (User must make the replace_in_map call.)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return fail;
|
return fail;
|
||||||
}
|
}
|
||||||
@ -2987,10 +2993,15 @@ Node* GraphKit::subtype_check_receiver(Node* receiver, ciKlass* klass,
|
|||||||
|
|
||||||
Node* slow_ctl = gen_subtype_check(receiver, want_klass);
|
Node* slow_ctl = gen_subtype_check(receiver, want_klass);
|
||||||
|
|
||||||
// Cast receiver after successful check
|
// Ignore interface type information until interface types are properly tracked.
|
||||||
const TypeOopPtr* recv_type = tklass->cast_to_exactness(false)->is_klassptr()->as_instance_type();
|
if (!stopped() && !klass->is_interface()) {
|
||||||
Node* cast = new CheckCastPPNode(control(), receiver, recv_type);
|
const TypeOopPtr* receiver_type = _gvn.type(receiver)->isa_oopptr();
|
||||||
(*casted_receiver) = _gvn.transform(cast);
|
const TypeOopPtr* recv_type = tklass->cast_to_exactness(false)->is_klassptr()->as_instance_type();
|
||||||
|
if (!receiver_type->higher_equal(recv_type)) { // ignore redundant casts
|
||||||
|
Node* cast = new CheckCastPPNode(control(), receiver, recv_type);
|
||||||
|
(*casted_receiver) = _gvn.transform(cast);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return slow_ctl;
|
return slow_ctl;
|
||||||
}
|
}
|
||||||
|
@ -383,11 +383,11 @@ public class Checker extends DocTreePathScanner<Void, Void> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// check for self closing tags, such as <a id="name"/>
|
// check for self closing tags, such as <a id="name"/>
|
||||||
if (tree.isSelfClosing() && !isSelfClosingAllowed(t)) {
|
if (tree.isSelfClosing() && !isSelfClosingAllowed(t)) {
|
||||||
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
|
env.messages.error(HTML, tree, "dc.tag.self.closing", treeName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
175
test/hotspot/jtreg/compiler/c2/UpcastTest.java
Normal file
175
test/hotspot/jtreg/compiler/c2/UpcastTest.java
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
* @requires vm.flavor == "server"
|
||||||
|
*
|
||||||
|
* @run main/othervm -Xbatch -XX:-TieredCompilation -XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining
|
||||||
|
* -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,*::test
|
||||||
|
* compiler.c2.UpcastTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
package compiler.c2;
|
||||||
|
|
||||||
|
public class UpcastTest {
|
||||||
|
static class Test1 {
|
||||||
|
interface I { void m(); }
|
||||||
|
|
||||||
|
static abstract class AC implements I {
|
||||||
|
public void m() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class T extends AC {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Run the test while T is not fully initialized yet.
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
test(new T(){});
|
||||||
|
test(new T(){});
|
||||||
|
test(new T(){});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test(T t) {
|
||||||
|
// Interface I has unique implementor AC.
|
||||||
|
// CHA reports AC::m and the callee is guarded by a type check against its holder (AC).
|
||||||
|
|
||||||
|
((I)t).m(); // invokeinterface I.m w/ polluted profile
|
||||||
|
|
||||||
|
// No upcasts (to class AC) on t after the call.
|
||||||
|
// Otherwise, field access fires an assert.
|
||||||
|
t.i = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Test2 {
|
||||||
|
interface I { void m(); }
|
||||||
|
interface J extends I {
|
||||||
|
default void m() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
static abstract class AC implements I {
|
||||||
|
}
|
||||||
|
|
||||||
|
static abstract class T extends AC {
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
static {
|
||||||
|
// Run the test while T is not fully initialized yet.
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
test(new T1(){});
|
||||||
|
test(new T2(){});
|
||||||
|
test(new T3(){});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class T1 extends T implements J {}
|
||||||
|
static class T2 extends T implements J {}
|
||||||
|
static class T3 extends T implements J {}
|
||||||
|
|
||||||
|
static void test(T t) {
|
||||||
|
// Interface I has unique implementor AC.
|
||||||
|
// CHA reports J::m and the callee is guarded by a type check against its holder (J).
|
||||||
|
|
||||||
|
((I)t).m(); // invokeinterface I.m w/ polluted profile
|
||||||
|
|
||||||
|
// No upcasts (to interface J) on t after the call.
|
||||||
|
// Otherwise, field access fires an assert.
|
||||||
|
t.i = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Test3 {
|
||||||
|
interface I {
|
||||||
|
default void m1() { m2(); }
|
||||||
|
void m2();
|
||||||
|
}
|
||||||
|
interface J extends I {
|
||||||
|
default void m2() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
static abstract class AC implements I {}
|
||||||
|
|
||||||
|
static class T extends AC implements J {
|
||||||
|
int i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test(T t) {
|
||||||
|
t.m1(); // invokeinterface I.m w/ polluted profile
|
||||||
|
|
||||||
|
// No upcasts (to interface J) on t after the call.
|
||||||
|
// Otherwise, field access fires an assert.
|
||||||
|
t.i = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void run() {
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
test(new T() {});
|
||||||
|
test(new T() {});
|
||||||
|
test(new T() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class Test4 {
|
||||||
|
interface I { default void m() {}}
|
||||||
|
|
||||||
|
static class T {
|
||||||
|
int i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class D extends T implements I {}
|
||||||
|
|
||||||
|
static void test(T t) {
|
||||||
|
if (t instanceof I) {
|
||||||
|
((I)t).m();
|
||||||
|
|
||||||
|
// No upcasts (to interface J) on t after the call.
|
||||||
|
// Otherwise, field access fires an assert.
|
||||||
|
|
||||||
|
t.i = 1;
|
||||||
|
} else {
|
||||||
|
throw new InternalError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void run() {
|
||||||
|
for (int i = 0; i < 20_000; i++) {
|
||||||
|
test(new D() {});
|
||||||
|
test(new D() {});
|
||||||
|
test(new D() {});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new Test1.T(); // trigger initialization of class T
|
||||||
|
new Test2.T1(); // trigger initialization of class T
|
||||||
|
Test3.run();
|
||||||
|
Test4.run();
|
||||||
|
}
|
||||||
|
}
|
@ -833,6 +833,8 @@ jdk/jfr/api/consumer/streaming/TestLatestEvent.java 8268297 windows-
|
|||||||
|
|
||||||
# jdk_jpackage
|
# jdk_jpackage
|
||||||
|
|
||||||
|
tools/jpackage/windows/WinInstallerIconTest.java 8268404 windows-x64
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
# Client manual tests
|
# Client manual tests
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
* @summary DatagramSocket should use a factory for its impl
|
* @summary DatagramSocket should use a factory for its impl
|
||||||
*
|
*
|
||||||
* @compile/module=java.base java/net/MyDatagramSocketImplFactory.java
|
* @compile/module=java.base java/net/MyDatagramSocketImplFactory.java
|
||||||
* @run main ADatagramSocket
|
* @run main/othervm ADatagramSocket
|
||||||
*/
|
*/
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 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
|
||||||
@ -38,6 +38,7 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
import java.util.concurrent.ForkJoinPool;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ public class AsyncShutdownNow {
|
|||||||
try {
|
try {
|
||||||
future.get();
|
future.get();
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException | RejectedExecutionException e) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -123,7 +124,7 @@ public class AsyncShutdownNow {
|
|||||||
try {
|
try {
|
||||||
future.get(1, TimeUnit.HOURS);
|
future.get(1, TimeUnit.HOURS);
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException | RejectedExecutionException e) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -167,7 +168,7 @@ public class AsyncShutdownNow {
|
|||||||
// execute long running tasks
|
// execute long running tasks
|
||||||
executor.invokeAny(List.of(SLEEP_FOR_A_DAY, SLEEP_FOR_A_DAY));
|
executor.invokeAny(List.of(SLEEP_FOR_A_DAY, SLEEP_FOR_A_DAY));
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException | RejectedExecutionException e) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2020, 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
|
||||||
@ -36,6 +36,7 @@ import java.util.concurrent.ExecutorService;
|
|||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
import java.util.concurrent.ForkJoinPool;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.concurrent.RejectedExecutionException;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ public class AsyncShutdownNowInvokeAny {
|
|||||||
// execute long running tasks
|
// execute long running tasks
|
||||||
pool.invokeAny(List.of(SLEEP_FOR_A_DAY, SLEEP_FOR_A_DAY));
|
pool.invokeAny(List.of(SLEEP_FOR_A_DAY, SLEEP_FOR_A_DAY));
|
||||||
assertTrue(false);
|
assertTrue(false);
|
||||||
} catch (ExecutionException e) {
|
} catch (ExecutionException | RejectedExecutionException e) {
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
* @author Ram Marti
|
* @author Ram Marti
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -136,13 +137,13 @@ public class TestEnabledProtocols extends SSLSocketTemplate {
|
|||||||
e.printStackTrace(System.out);
|
e.printStackTrace(System.out);
|
||||||
System.out.println("** Success **");
|
System.out.println("** Success **");
|
||||||
}
|
}
|
||||||
} catch (SSLException ssle) {
|
} catch (SSLException | SocketException se) {
|
||||||
// The server side may have closed the socket.
|
// The server side may have closed the socket.
|
||||||
if (isConnectionReset(ssle)) {
|
if (isConnectionReset(se)) {
|
||||||
System.out.println("Client SSLException:");
|
System.out.println("Client SocketException:");
|
||||||
ssle.printStackTrace(System.out);
|
se.printStackTrace(System.out);
|
||||||
} else {
|
} else {
|
||||||
failTest(ssle, "Client got UNEXPECTED SSLException:");
|
failTest(se, "Client got UNEXPECTED Exception:");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -150,8 +151,8 @@ public class TestEnabledProtocols extends SSLSocketTemplate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isConnectionReset(SSLException ssle) {
|
private boolean isConnectionReset(IOException ioe) {
|
||||||
Throwable cause = ssle.getCause();
|
Throwable cause = ioe instanceof SSLException se ? se.getCause() : ioe;
|
||||||
return cause instanceof SocketException
|
return cause instanceof SocketException
|
||||||
&& "Connection reset".equals(cause.getMessage());
|
&& "Connection reset".equals(cause.getMessage());
|
||||||
}
|
}
|
||||||
|
88
test/jdk/jdk/incubator/vector/ImageTest.java
Normal file
88
test/jdk/jdk/incubator/vector/ImageTest.java
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.spi.ToolProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @summary Tests that the SVML shared library is present in an image only when jdk.incubator.vector is present
|
||||||
|
* @requires vm.compiler2.enabled
|
||||||
|
* @requires os.arch == "x86_64" | os.arch == "amd64"
|
||||||
|
* @requires os.family == "linux" | os.family == "windows"
|
||||||
|
* @modules jdk.incubator.vector jdk.jlink
|
||||||
|
* @library /test/lib
|
||||||
|
* @run testng ImageTest
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class ImageTest {
|
||||||
|
static final ToolProvider JLINK_TOOL = ToolProvider.findFirst("jlink")
|
||||||
|
.orElseThrow(() ->
|
||||||
|
new RuntimeException("jlink tool not found")
|
||||||
|
);
|
||||||
|
|
||||||
|
static final String SVML_LIBRARY_NAME = Platform.isWindows()
|
||||||
|
? "svml.dll"
|
||||||
|
: "libsvml.so";
|
||||||
|
|
||||||
|
static void link(String module, Path output) {
|
||||||
|
int e = JLINK_TOOL.run(System.out, System.err,
|
||||||
|
"--add-modules", module,
|
||||||
|
"--output", output.toString()
|
||||||
|
);
|
||||||
|
if (e != 0) {
|
||||||
|
throw new RuntimeException("Error running jlink");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void checkSVML(Path image, boolean shouldBepresent) {
|
||||||
|
Path libsvml = Platform.libDir(image).resolve(SVML_LIBRARY_NAME);
|
||||||
|
|
||||||
|
boolean exists = Files.exists(libsvml);
|
||||||
|
if (shouldBepresent) {
|
||||||
|
Assert.assertTrue(exists, libsvml + " should be present");
|
||||||
|
} else {
|
||||||
|
Assert.assertFalse(exists, libsvml + "should be absent");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void withVectorModule() {
|
||||||
|
Path output = Path.of("withVectorModuleImage");
|
||||||
|
link("jdk.incubator.vector", output);
|
||||||
|
checkSVML(output, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void withoutVectorModule() {
|
||||||
|
Path output = Path.of("withoutVectorModuleImage");
|
||||||
|
link("java.base", output);
|
||||||
|
checkSVML(output, false);
|
||||||
|
}
|
||||||
|
}
|
@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2008, 2015, 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
|
|
||||||
* @bug 6176978
|
|
||||||
* @summary current Javadoc's invocation and extension (Doclet) mechanisms are problematic
|
|
||||||
* @modules jdk.javadoc
|
|
||||||
* @ignore no longer applicable, should delete
|
|
||||||
* @build T6176978
|
|
||||||
* @run main T6176978
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.net.*;
|
|
||||||
|
|
||||||
public class T6176978
|
|
||||||
{
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
// create and use a temp dir that will not be on jtreg's
|
|
||||||
// default class path
|
|
||||||
File tmpDir = new File("tmp");
|
|
||||||
tmpDir.mkdirs();
|
|
||||||
|
|
||||||
File testSrc = new File(System.getProperty("test.src", "."));
|
|
||||||
String[] javac_args = {
|
|
||||||
"-d",
|
|
||||||
"tmp",
|
|
||||||
new File(testSrc, "X.java").getPath()
|
|
||||||
};
|
|
||||||
|
|
||||||
int rc = com.sun.tools.javac.Main.compile(javac_args);
|
|
||||||
if (rc != 0)
|
|
||||||
throw new Error("javac exit code: " + rc);
|
|
||||||
|
|
||||||
String[] jdoc_args = {
|
|
||||||
"-doclet",
|
|
||||||
"X",
|
|
||||||
new File(testSrc, "T6176978.java").getPath()
|
|
||||||
};
|
|
||||||
|
|
||||||
rc = jdk.javadoc.internal.tool.Main.execute(jdoc_args);
|
|
||||||
if (rc == 0)
|
|
||||||
throw new Error("javadoc unexpectedly succeeded");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Thread currThread = Thread.currentThread();
|
|
||||||
ClassLoader saveClassLoader = currThread.getContextClassLoader();
|
|
||||||
URLClassLoader urlCL = new URLClassLoader(new URL[] { tmpDir.toURL() });
|
|
||||||
currThread.setContextClassLoader(urlCL);
|
|
||||||
|
|
||||||
try {
|
|
||||||
rc = jdk.javadoc.internal.tool.Main.execute(jdoc_args);
|
|
||||||
if (rc != 0)
|
|
||||||
throw new Error("javadoc exit: " + rc);
|
|
||||||
} finally {
|
|
||||||
currThread.setContextClassLoader(saveClassLoader);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2008, 2015, 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import jdk.javadoc.doclet.Doclet;
|
|
||||||
import jdk.javadoc.doclet.Reporter;
|
|
||||||
import jdk.javadoc.doclet.DocletEnvironment;
|
|
||||||
|
|
||||||
public class X {
|
|
||||||
public static boolean run(DocletEnvironment root) {
|
|
||||||
System.out.println("X.start");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
public Set<Doclet.Option> getSupportedOptions() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init(Locale locale, Reporter reporter) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003, 2016, 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
|
|
||||||
* @bug 4965490
|
|
||||||
* @summary Verify that matching braces can appear within inline tags.
|
|
||||||
* @ignore API, re-evaluate @bold, @maybe causes doclint to throw up.
|
|
||||||
* @modules jdk.javadoc
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.lang.model.SourceVersion;
|
|
||||||
import javax.lang.model.element.TypeElement;
|
|
||||||
|
|
||||||
import com.sun.source.doctree.DocCommentTree;
|
|
||||||
import com.sun.source.doctree.DocTree;
|
|
||||||
import com.sun.source.util.DocTrees;
|
|
||||||
import jdk.javadoc.doclet.Doclet;
|
|
||||||
import jdk.javadoc.doclet.DocletEnvironment;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a {@code test} comment.
|
|
||||||
* It is {@bold {@underline only} a test}.
|
|
||||||
* We would like some code
|
|
||||||
* {@code for (int i : nums) { doit(i); } return; }
|
|
||||||
* to be embedded {@maybe {even {a couple {of levels}}} deep}.
|
|
||||||
*/
|
|
||||||
public class InlineTagsWithBraces implements Doclet {
|
|
||||||
|
|
||||||
private static String[] expectedTags = {
|
|
||||||
"Text", "@code", "Text",
|
|
||||||
"@bold", "Text", "@code", "Text",
|
|
||||||
"@maybe", "Text"
|
|
||||||
};
|
|
||||||
private static String[] expectedText = {
|
|
||||||
"This is a ", "test", " comment.\n" +
|
|
||||||
" It is ", "{@underline only} a test", ".\n" +
|
|
||||||
" We would like some code\n" +
|
|
||||||
" ", "for (int i : nums) { doit(i); } return; ", "\n" +
|
|
||||||
" to be embedded ", "{even {a couple {of levels}}} deep", "."
|
|
||||||
};
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String thisFile = "" +
|
|
||||||
new File(System.getProperty("test.src", "."), "InlineTagsWithBraces.java");
|
|
||||||
|
|
||||||
String[] argarray = {
|
|
||||||
"InlineTagsWithBraces",
|
|
||||||
"-Xwerror",
|
|
||||||
thisFile
|
|
||||||
};
|
|
||||||
if (jdk.javadoc.internal.tool.Main.execute(argarray) != 0)
|
|
||||||
throw new Error("Javadoc encountered warnings or errors.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean run(DocletEnvironment root) {
|
|
||||||
DocTrees trees = root.getDocTrees();
|
|
||||||
TypeElement cd = ElementFilter.typesIn(root.getIncludedElements()).iterator().next();
|
|
||||||
DocCommentTree docCommentTree = trees.getDocCommentTree(cd);
|
|
||||||
List<? extends DocTree> tags = docCommentTree.getBody();
|
|
||||||
|
|
||||||
for (int i = 0; i < tags.size(); i++) {
|
|
||||||
System.out.println(tags.get(0).getKind());
|
|
||||||
// if (!tags[i].name().equals(expectedTags[i]) ||
|
|
||||||
// !tags[i].text().equals(expectedText[i])) {
|
|
||||||
// throw new Error("Tag \"" + tags[i] + "\" not as expected");
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Test";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Option> getSupportedOptions() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SourceVersion getSupportedSourceVersion() {
|
|
||||||
return SourceVersion.latest();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2003, 2015, 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
|
|
||||||
* @bug 4909767
|
|
||||||
* @summary Verify that omitting Doclet.languageVersion() hides 1.5 language
|
|
||||||
* features from the doclet.
|
|
||||||
* @ignore API, re-evaluate, unsure of this test.
|
|
||||||
* @modules jdk.javadoc
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.lang.model.SourceVersion;
|
|
||||||
|
|
||||||
import jdk.javadoc.doclet.Doclet;
|
|
||||||
import jdk.javadoc.doclet.DocletEnvironment;
|
|
||||||
|
|
||||||
public class LangVers implements Doclet {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
String thisFile = "" +
|
|
||||||
new java.io.File(System.getProperty("test.src", "."),
|
|
||||||
"LangVers.java");
|
|
||||||
|
|
||||||
String[] toolargs = {
|
|
||||||
"-doclet", "LangVers",
|
|
||||||
"-docletpath", System.getProperty("test.classes", "."),
|
|
||||||
};
|
|
||||||
if (jdk.javadoc.internal.tool.Main.execute(toolargs) != 0)
|
|
||||||
throw new Error("Javadoc encountered warnings or errors.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean run(DocletEnvironment root) {
|
|
||||||
ClassDoc fishdoc = root.classNamed("LangVers.Fish");
|
|
||||||
System.out.println(fishdoc);
|
|
||||||
if (fishdoc.isEnum()) {
|
|
||||||
throw new Error("Enums are not hidden.");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MethodDoc meth : fishdoc.methods()) {
|
|
||||||
System.out.println(meth);
|
|
||||||
if (meth.flatSignature().indexOf('<') >= 0) {
|
|
||||||
throw new Error("Type parameters are not hidden.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum Fish {
|
|
||||||
One, Two, Red, Blue;
|
|
||||||
|
|
||||||
public void enroll(List<? super Fish> school) {
|
|
||||||
school.add(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Test";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<Option> getSupportedOptions() {
|
|
||||||
return Collections.emptySet();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public SourceVersion getSupportedSourceVersion() {
|
|
||||||
return SourceVersion.latest();
|
|
||||||
}
|
|
||||||
}
|
|
17
test/langtools/tools/doclint/html/UnknownTagTest.java
Normal file
17
test/langtools/tools/doclint/html/UnknownTagTest.java
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* @test /nodynamiccopyright/
|
||||||
|
* @bug 8264843
|
||||||
|
* @summary Javac crashes with NullPointerException when finding unencoded XML in <pre> tag
|
||||||
|
* @library ..
|
||||||
|
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
|
||||||
|
* @build DocLintTester
|
||||||
|
* @run main DocLintTester -Xmsgs -ref UnknownTagTest.out UnknownTagTest.java
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is an <unknown> tag.
|
||||||
|
* This is an <unknown a=b> tag with attributes.
|
||||||
|
* This is an <unknown/> self-closing tag.
|
||||||
|
*/
|
||||||
|
public class UnknownTagTest {
|
||||||
|
}
|
10
test/langtools/tools/doclint/html/UnknownTagTest.out
Normal file
10
test/langtools/tools/doclint/html/UnknownTagTest.out
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
UnknownTagTest.java:12: error: unknown tag: unknown
|
||||||
|
* This is an <unknown> tag.
|
||||||
|
^
|
||||||
|
UnknownTagTest.java:13: error: unknown tag: unknown
|
||||||
|
* This is an <unknown a=b> tag with attributes.
|
||||||
|
^
|
||||||
|
UnknownTagTest.java:14: error: unknown tag: unknown
|
||||||
|
* This is an <unknown/> self-closing tag.
|
||||||
|
^
|
||||||
|
3 errors
|
@ -333,11 +333,20 @@ public class Platform {
|
|||||||
* Returns absolute path to directory containing shared libraries in the tested JDK.
|
* Returns absolute path to directory containing shared libraries in the tested JDK.
|
||||||
*/
|
*/
|
||||||
public static Path libDir() {
|
public static Path libDir() {
|
||||||
Path dir = Paths.get(testJdk);
|
return libDir(Paths.get(testJdk)).toAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolves a given path, to a JDK image, to the directory containing shared libraries.
|
||||||
|
*
|
||||||
|
* @param image the path to a JDK image
|
||||||
|
* @return the resolved path to the directory containing shared libraries
|
||||||
|
*/
|
||||||
|
public static Path libDir(Path image) {
|
||||||
if (Platform.isWindows()) {
|
if (Platform.isWindows()) {
|
||||||
return dir.resolve("bin").toAbsolutePath();
|
return image.resolve("bin");
|
||||||
} else {
|
} else {
|
||||||
return dir.resolve("lib").toAbsolutePath();
|
return image.resolve("lib");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user