Merge
This commit is contained in:
commit
7039c6616a
@ -1165,30 +1165,30 @@ instruct vnotL(vReg dst, vReg src, immL_M1 m1) %{
|
||||
|
||||
// vector not - predicated
|
||||
|
||||
instruct vnotI_masked(vReg dst, vReg src, immI_M1 m1, pRegGov pg) %{
|
||||
instruct vnotI_masked(vReg dst_src, immI_M1 m1, pRegGov pg) %{
|
||||
predicate(UseSVE > 0);
|
||||
match(Set dst (XorV (Binary src (ReplicateB m1)) pg));
|
||||
match(Set dst (XorV (Binary src (ReplicateS m1)) pg));
|
||||
match(Set dst (XorV (Binary src (ReplicateI m1)) pg));
|
||||
match(Set dst_src (XorV (Binary dst_src (ReplicateB m1)) pg));
|
||||
match(Set dst_src (XorV (Binary dst_src (ReplicateS m1)) pg));
|
||||
match(Set dst_src (XorV (Binary dst_src (ReplicateI m1)) pg));
|
||||
ins_cost(SVE_COST);
|
||||
format %{ "sve_not $dst, $pg, $src\t# vector (sve) B/H/S" %}
|
||||
format %{ "sve_not $dst_src, $pg, $dst_src\t# vector (sve) B/H/S" %}
|
||||
ins_encode %{
|
||||
BasicType bt = Matcher::vector_element_basic_type(this);
|
||||
__ sve_not(as_FloatRegister($dst$$reg), __ elemType_to_regVariant(bt),
|
||||
as_PRegister($pg$$reg), as_FloatRegister($src$$reg));
|
||||
__ sve_not(as_FloatRegister($dst_src$$reg), __ elemType_to_regVariant(bt),
|
||||
as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct vnotL_masked(vReg dst, vReg src, immL_M1 m1, pRegGov pg) %{
|
||||
instruct vnotL_masked(vReg dst_src, immL_M1 m1, pRegGov pg) %{
|
||||
predicate(UseSVE > 0);
|
||||
match(Set dst (XorV (Binary src (ReplicateL m1)) pg));
|
||||
match(Set dst_src (XorV (Binary dst_src (ReplicateL m1)) pg));
|
||||
ins_cost(SVE_COST);
|
||||
format %{ "sve_not $dst, $pg, $src\t# vector (sve) D" %}
|
||||
format %{ "sve_not $dst_src, $pg, $dst_src\t# vector (sve) D" %}
|
||||
ins_encode %{
|
||||
BasicType bt = Matcher::vector_element_basic_type(this);
|
||||
__ sve_not(as_FloatRegister($dst$$reg), __ elemType_to_regVariant(bt),
|
||||
as_PRegister($pg$$reg), as_FloatRegister($src$$reg));
|
||||
__ sve_not(as_FloatRegister($dst_src$$reg), __ elemType_to_regVariant(bt),
|
||||
as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -5256,18 +5256,19 @@ instruct gatherI(vReg dst, indirect mem, vReg idx) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct gatherL(vReg dst, indirect mem, vReg idx) %{
|
||||
instruct gatherL(vReg dst, indirect mem, vReg idx, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_LoadVectorGather()->memory_size() == MaxVectorSize &&
|
||||
(n->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set dst (LoadVectorGather mem idx));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "load_vector_gather $dst, $mem, $idx\t# vector load gather (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_ld1d_gather(as_FloatRegister($dst$$reg), ptrue, as_Register($mem$$base),
|
||||
as_FloatRegister($idx$$reg));
|
||||
as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -5291,20 +5292,20 @@ instruct gatherI_partial(vReg dst, indirect mem, vReg idx, pRegGov ptmp, rFlagsR
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct gatherL_partial(vReg dst, indirect mem, vReg idx, pRegGov ptmp, rFlagsReg cr) %{
|
||||
instruct gatherL_partial(vReg dst, indirect mem, vReg idx, vReg vtmp, pRegGov ptmp, rFlagsReg cr) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_LoadVectorGather()->memory_size() < MaxVectorSize &&
|
||||
(n->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set dst (LoadVectorGather mem idx));
|
||||
effect(TEMP ptmp, KILL cr);
|
||||
effect(TEMP vtmp, TEMP ptmp, KILL cr);
|
||||
ins_cost(3 * SVE_COST + INSN_COST);
|
||||
format %{ "load_vector_gather $dst, $ptmp, $mem, $idx\t# vector load gather partial (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_ptrue_lanecnt(as_PRegister($ptmp$$reg), __ D, Matcher::vector_length(this));
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($vtmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_ld1d_gather(as_FloatRegister($dst$$reg), as_PRegister($ptmp$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($vtmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -5325,17 +5326,18 @@ instruct gatherI_masked(vReg dst, indirect mem, vReg idx, pRegGov pg) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct gatherL_masked(vReg dst, indirect mem, vReg idx, pRegGov pg) %{
|
||||
instruct gatherL_masked(vReg dst, indirect mem, vReg idx, pRegGov pg, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
(n->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set dst (LoadVectorGatherMasked mem (Binary idx pg)));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "load_vector_gather $dst, $pg, $mem, $idx\t# vector load gather predicated (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_ld1d_gather(as_FloatRegister($dst$$reg), as_PRegister($pg$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -5357,18 +5359,19 @@ instruct scatterI(indirect mem, vReg src, vReg idx) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct scatterL(indirect mem, vReg src, vReg idx) %{
|
||||
instruct scatterL(indirect mem, vReg src, vReg idx, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_StoreVectorScatter()->memory_size() == MaxVectorSize &&
|
||||
(n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set mem (StoreVectorScatter mem (Binary src idx)));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "store_vector_scatter $mem, $idx, $src\t# vector store scatter (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_st1d_scatter(as_FloatRegister($src$$reg), ptrue,
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -5392,20 +5395,20 @@ instruct scatterI_partial(indirect mem, vReg src, vReg idx, pRegGov ptmp, rFlags
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct scatterL_partial(indirect mem, vReg src, vReg idx, pRegGov ptmp, rFlagsReg cr) %{
|
||||
instruct scatterL_partial(indirect mem, vReg src, vReg idx, vReg vtmp, pRegGov ptmp, rFlagsReg cr) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_StoreVectorScatter()->memory_size() < MaxVectorSize &&
|
||||
(n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set mem (StoreVectorScatter mem (Binary src idx)));
|
||||
effect(TEMP ptmp, KILL cr);
|
||||
effect(TEMP vtmp, TEMP ptmp, KILL cr);
|
||||
ins_cost(3 * SVE_COST + INSN_COST);
|
||||
format %{ "store_vector_scatter $mem, $ptmp, $idx, $src\t# vector store scatter partial (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_ptrue_lanecnt(as_PRegister($ptmp$$reg), __ D, Matcher::vector_length(this, $src));
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($vtmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_st1d_scatter(as_FloatRegister($src$$reg), as_PRegister($ptmp$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($vtmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -5426,17 +5429,18 @@ instruct scatterI_masked(indirect mem, vReg src, vReg idx, pRegGov pg) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct scatterL_masked(indirect mem, vReg src, vReg idx, pRegGov pg) %{
|
||||
instruct scatterL_masked(indirect mem, vReg src, vReg idx, pRegGov pg, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
(n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set mem (StoreVectorScatterMasked mem (Binary src (Binary idx pg))));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "store_vector_scatter $mem, $pg, $idx, $src\t# vector store scatter predicated (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_st1d_scatter(as_FloatRegister($src$$reg), as_PRegister($pg$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
@ -659,21 +659,21 @@ dnl
|
||||
// vector not - predicated
|
||||
dnl
|
||||
define(`MATCH_RULE', `ifelse($1, I,
|
||||
`match(Set dst (XorV (Binary src (ReplicateB m1)) pg));
|
||||
match(Set dst (XorV (Binary src (ReplicateS m1)) pg));
|
||||
match(Set dst (XorV (Binary src (ReplicateI m1)) pg));',
|
||||
`match(Set dst (XorV (Binary src (ReplicateL m1)) pg));')')dnl
|
||||
`match(Set dst_src (XorV (Binary dst_src (ReplicateB m1)) pg));
|
||||
match(Set dst_src (XorV (Binary dst_src (ReplicateS m1)) pg));
|
||||
match(Set dst_src (XorV (Binary dst_src (ReplicateI m1)) pg));',
|
||||
`match(Set dst_src (XorV (Binary dst_src (ReplicateL m1)) pg));')')dnl
|
||||
dnl
|
||||
define(`VECTOR_NOT_PREDICATE', `
|
||||
instruct vnot$1_masked`'(vReg dst, vReg src, imm$1_M1 m1, pRegGov pg) %{
|
||||
instruct vnot$1_masked`'(vReg dst_src, imm$1_M1 m1, pRegGov pg) %{
|
||||
predicate(UseSVE > 0);
|
||||
MATCH_RULE($1)
|
||||
ins_cost(SVE_COST);
|
||||
format %{ "sve_not $dst, $pg, $src\t# vector (sve) $2" %}
|
||||
format %{ "sve_not $dst_src, $pg, $dst_src\t# vector (sve) $2" %}
|
||||
ins_encode %{
|
||||
BasicType bt = Matcher::vector_element_basic_type(this);
|
||||
__ sve_not(as_FloatRegister($dst$$reg), __ elemType_to_regVariant(bt),
|
||||
as_PRegister($pg$$reg), as_FloatRegister($src$$reg));
|
||||
__ sve_not(as_FloatRegister($dst_src$$reg), __ elemType_to_regVariant(bt),
|
||||
as_PRegister($pg$$reg), as_FloatRegister($dst_src$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}')dnl
|
||||
@ -2826,18 +2826,19 @@ instruct gatherI(vReg dst, indirect mem, vReg idx) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct gatherL(vReg dst, indirect mem, vReg idx) %{
|
||||
instruct gatherL(vReg dst, indirect mem, vReg idx, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_LoadVectorGather()->memory_size() == MaxVectorSize &&
|
||||
(n->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set dst (LoadVectorGather mem idx));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "load_vector_gather $dst, $mem, $idx\t# vector load gather (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_ld1d_gather(as_FloatRegister($dst$$reg), ptrue, as_Register($mem$$base),
|
||||
as_FloatRegister($idx$$reg));
|
||||
as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2861,20 +2862,20 @@ instruct gatherI_partial(vReg dst, indirect mem, vReg idx, pRegGov ptmp, rFlagsR
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct gatherL_partial(vReg dst, indirect mem, vReg idx, pRegGov ptmp, rFlagsReg cr) %{
|
||||
instruct gatherL_partial(vReg dst, indirect mem, vReg idx, vReg vtmp, pRegGov ptmp, rFlagsReg cr) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_LoadVectorGather()->memory_size() < MaxVectorSize &&
|
||||
(n->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set dst (LoadVectorGather mem idx));
|
||||
effect(TEMP ptmp, KILL cr);
|
||||
effect(TEMP vtmp, TEMP ptmp, KILL cr);
|
||||
ins_cost(3 * SVE_COST + INSN_COST);
|
||||
format %{ "load_vector_gather $dst, $ptmp, $mem, $idx\t# vector load gather partial (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_ptrue_lanecnt(as_PRegister($ptmp$$reg), __ D, Matcher::vector_length(this));
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($vtmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_ld1d_gather(as_FloatRegister($dst$$reg), as_PRegister($ptmp$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($vtmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2895,17 +2896,18 @@ instruct gatherI_masked(vReg dst, indirect mem, vReg idx, pRegGov pg) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct gatherL_masked(vReg dst, indirect mem, vReg idx, pRegGov pg) %{
|
||||
instruct gatherL_masked(vReg dst, indirect mem, vReg idx, pRegGov pg, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
(n->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set dst (LoadVectorGatherMasked mem (Binary idx pg)));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "load_vector_gather $dst, $pg, $mem, $idx\t# vector load gather predicated (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_ld1d_gather(as_FloatRegister($dst$$reg), as_PRegister($pg$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2927,18 +2929,19 @@ instruct scatterI(indirect mem, vReg src, vReg idx) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct scatterL(indirect mem, vReg src, vReg idx) %{
|
||||
instruct scatterL(indirect mem, vReg src, vReg idx, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_StoreVectorScatter()->memory_size() == MaxVectorSize &&
|
||||
(n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set mem (StoreVectorScatter mem (Binary src idx)));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "store_vector_scatter $mem, $idx, $src\t# vector store scatter (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_st1d_scatter(as_FloatRegister($src$$reg), ptrue,
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2962,20 +2965,20 @@ instruct scatterI_partial(indirect mem, vReg src, vReg idx, pRegGov ptmp, rFlags
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct scatterL_partial(indirect mem, vReg src, vReg idx, pRegGov ptmp, rFlagsReg cr) %{
|
||||
instruct scatterL_partial(indirect mem, vReg src, vReg idx, vReg vtmp, pRegGov ptmp, rFlagsReg cr) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
n->as_StoreVectorScatter()->memory_size() < MaxVectorSize &&
|
||||
(n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set mem (StoreVectorScatter mem (Binary src idx)));
|
||||
effect(TEMP ptmp, KILL cr);
|
||||
effect(TEMP vtmp, TEMP ptmp, KILL cr);
|
||||
ins_cost(3 * SVE_COST + INSN_COST);
|
||||
format %{ "store_vector_scatter $mem, $ptmp, $idx, $src\t# vector store scatter partial (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_ptrue_lanecnt(as_PRegister($ptmp$$reg), __ D, Matcher::vector_length(this, $src));
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($vtmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_st1d_scatter(as_FloatRegister($src$$reg), as_PRegister($ptmp$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($vtmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
@ -2996,17 +2999,18 @@ instruct scatterI_masked(indirect mem, vReg src, vReg idx, pRegGov pg) %{
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
||||
instruct scatterL_masked(indirect mem, vReg src, vReg idx, pRegGov pg) %{
|
||||
instruct scatterL_masked(indirect mem, vReg src, vReg idx, pRegGov pg, vReg tmp) %{
|
||||
predicate(UseSVE > 0 &&
|
||||
(n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_LONG ||
|
||||
n->in(3)->in(1)->bottom_type()->is_vect()->element_basic_type() == T_DOUBLE));
|
||||
match(Set mem (StoreVectorScatterMasked mem (Binary src (Binary idx pg))));
|
||||
effect(TEMP tmp);
|
||||
ins_cost(2 * SVE_COST);
|
||||
format %{ "store_vector_scatter $mem, $pg, $idx, $src\t# vector store scatter predicated (D)" %}
|
||||
ins_encode %{
|
||||
__ sve_uunpklo(as_FloatRegister($idx$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_uunpklo(as_FloatRegister($tmp$$reg), __ D, as_FloatRegister($idx$$reg));
|
||||
__ sve_st1d_scatter(as_FloatRegister($src$$reg), as_PRegister($pg$$reg),
|
||||
as_Register($mem$$base), as_FloatRegister($idx$$reg));
|
||||
as_Register($mem$$base), as_FloatRegister($tmp$$reg));
|
||||
%}
|
||||
ins_pipe(pipe_slow);
|
||||
%}
|
||||
|
@ -61,6 +61,10 @@
|
||||
#include "runtime/thread.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
|
||||
#ifdef LINUX
|
||||
#include "osContainer_linux.hpp"
|
||||
#endif
|
||||
|
||||
#define NO_TRANSITION(result_type, header) extern "C" { result_type JNICALL header {
|
||||
#define NO_TRANSITION_END } }
|
||||
|
||||
@ -381,3 +385,11 @@ JVM_END
|
||||
JVM_ENTRY_NO_ENV(jboolean, jfr_is_class_instrumented(JNIEnv* env, jobject jvm, jclass clazz))
|
||||
return JfrJavaSupport::is_instrumented(clazz, thread);
|
||||
JVM_END
|
||||
|
||||
JVM_ENTRY_NO_ENV(jboolean, jfr_is_containerized(JNIEnv* env, jobject jvm))
|
||||
#ifdef LINUX
|
||||
return OSContainer::is_containerized();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
JVM_END
|
||||
|
@ -158,9 +158,10 @@ jboolean JNICALL jfr_is_class_excluded(JNIEnv* env, jobject jvm, jclass clazz);
|
||||
|
||||
jboolean JNICALL jfr_is_class_instrumented(JNIEnv* env, jobject jvm, jclass clazz);
|
||||
|
||||
jboolean JNICALL jfr_is_containerized(JNIEnv* env, jobject jvm);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // SHARE_JFR_JNI_JFRJNIMETHOD_HPP
|
||||
|
||||
|
@ -93,7 +93,8 @@ JfrJniMethodRegistration::JfrJniMethodRegistration(JNIEnv* env) {
|
||||
(char*)"setConfiguration", (char*)"(Ljava/lang/Class;Ljdk/jfr/internal/event/EventConfiguration;)Z", (void*)jfr_set_configuration,
|
||||
(char*)"getTypeId", (char*)"(Ljava/lang/String;)J", (void*)jfr_get_type_id_from_string,
|
||||
(char*)"isExcluded", (char*)"(Ljava/lang/Class;)Z", (void*)jfr_is_class_excluded,
|
||||
(char*)"isInstrumented", (char*)"(Ljava/lang/Class;)Z", (void*) jfr_is_class_instrumented
|
||||
(char*)"isInstrumented", (char*)"(Ljava/lang/Class;)Z", (void*) jfr_is_class_instrumented,
|
||||
(char*)"isContainerized", (char*)"()Z", (void*) jfr_is_containerized
|
||||
};
|
||||
|
||||
const size_t method_array_length = sizeof(method) / sizeof(JNINativeMethod);
|
||||
|
@ -813,6 +813,8 @@ Node *LShiftINode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
// Left input is an add of the same number?
|
||||
if (add1->in(1) == add1->in(2)) {
|
||||
// Convert "(x + x) << c0" into "x << (c0 + 1)"
|
||||
// In general, this optimization cannot be applied for c0 == 31 since
|
||||
// 2x << 31 != x << 32 = x << 0 = x (e.g. x = 1: 2 << 31 = 0 != 1)
|
||||
return new LShiftINode(add1->in(1), phase->intcon(con + 1));
|
||||
}
|
||||
|
||||
@ -930,8 +932,13 @@ Node *LShiftLNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
assert( add1 != add1->in(1), "dead loop in LShiftLNode::Ideal" );
|
||||
|
||||
// Left input is an add of the same number?
|
||||
if (add1->in(1) == add1->in(2)) {
|
||||
if (con != (BitsPerJavaLong - 1) && add1->in(1) == add1->in(2)) {
|
||||
// Convert "(x + x) << c0" into "x << (c0 + 1)"
|
||||
// Can only be applied if c0 != 63 because:
|
||||
// (x + x) << 63 = 2x << 63, while
|
||||
// (x + x) << 63 --transform--> x << 64 = x << 0 = x (!= 2x << 63, for example for x = 1)
|
||||
// According to the Java spec, chapter 15.19, we only consider the six lowest-order bits of the right-hand operand
|
||||
// (i.e. "right-hand operand" & 0b111111). Therefore, x << 64 is the same as x << 0 (64 = 0b10000000 & 0b0111111 = 0).
|
||||
return new LShiftLNode(add1->in(1), phase->intcon(con + 1));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2022, 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
|
||||
@ -39,12 +39,12 @@
|
||||
* are based.
|
||||
* <li><a id="zip64">An implementation may optionally support the
|
||||
* ZIP64(tm) format extensions defined by the</a>
|
||||
* <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
|
||||
* <a href="https://support.pkware.com/home/pkzip/developer-tools/appnote">
|
||||
* PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format
|
||||
* extensions are used to overcome the size limitations of the
|
||||
* original ZIP format.
|
||||
* <li><a id="lang_encoding">APPENDIX D of</a>
|
||||
* <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
|
||||
* <a href="https://support.pkware.com/home/pkzip/developer-tools/appnote">
|
||||
* PKWARE ZIP File Format Specification</a> - Language Encoding Flag
|
||||
* to encode ZIP entry filename and comment fields using UTF-8.
|
||||
* <li><a href="http://www.ietf.org/rfc/rfc1950.txt">
|
||||
|
@ -978,11 +978,21 @@ public class HtmlDocletWriter {
|
||||
String tagName = ch.getTagName(see);
|
||||
|
||||
String seeText = utils.normalizeNewlines(ch.getText(see)).toString();
|
||||
String refText;
|
||||
List<? extends DocTree> label;
|
||||
switch (kind) {
|
||||
case LINK, LINK_PLAIN ->
|
||||
case LINK, LINK_PLAIN -> {
|
||||
// {@link[plain] reference label...}
|
||||
label = ((LinkTree) see).getLabel();
|
||||
LinkTree lt = (LinkTree) see;
|
||||
var linkRef = lt.getReference();
|
||||
if (linkRef == null) {
|
||||
messages.warning(ch.getDocTreePath(see),"doclet.link.no_reference");
|
||||
return invalidTagOutput(resources.getText("doclet.tag.invalid_input", lt.toString()),
|
||||
Optional.empty());
|
||||
}
|
||||
refText = linkRef.toString();
|
||||
label = lt.getLabel();
|
||||
}
|
||||
|
||||
case SEE -> {
|
||||
List<? extends DocTree> ref = ((SeeTree) see).getReference();
|
||||
@ -998,6 +1008,7 @@ public class HtmlDocletWriter {
|
||||
}
|
||||
case REFERENCE -> {
|
||||
// @see reference label...
|
||||
refText = ref.get(0).toString();
|
||||
label = ref.subList(1, ref.size());
|
||||
}
|
||||
case ERRONEOUS -> {
|
||||
@ -1058,7 +1069,7 @@ public class HtmlDocletWriter {
|
||||
messages.warning(ch.getDocTreePath(see),
|
||||
"doclet.see.class_or_package_not_found",
|
||||
"@" + tagName,
|
||||
seeText);
|
||||
refText);
|
||||
}
|
||||
return invalidTagOutput(resources.getText("doclet.tag.invalid", tagName),
|
||||
Optional.of(labelContent.isEmpty() ? text: labelContent));
|
||||
@ -1112,7 +1123,7 @@ public class HtmlDocletWriter {
|
||||
if (!configuration.isDocLintReferenceGroupEnabled()) {
|
||||
messages.warning(
|
||||
ch.getDocTreePath(see), "doclet.see.class_or_package_not_found",
|
||||
tagName, seeText);
|
||||
tagName, refText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ doclet.MalformedURL=Malformed URL: {0}
|
||||
doclet.File_error=Error reading file: {0}
|
||||
doclet.URL_error=Error fetching URL: {0}
|
||||
doclet.Resource_error=Error reading resource: {0}
|
||||
doclet.link.no_reference=no reference given
|
||||
doclet.see.class_or_package_not_found=Tag {0}: reference not found: {1}
|
||||
doclet.see.class_or_package_not_accessible=Tag {0}: reference not accessible: {1}
|
||||
doclet.see.nested_link=Tag {0}: nested link
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package example2;
|
||||
package jdk.jfr.snippets.consumer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
@ -620,4 +620,13 @@ public final class JVM {
|
||||
* @return the id, or a negative value if it does not exists.
|
||||
*/
|
||||
public native long getTypeId(String name);
|
||||
|
||||
/**
|
||||
* Returns {@code true}, if the JVM is running in a container, {@code false} otherwise.
|
||||
* <p>
|
||||
* If -XX:-UseContainerSupport has been specified, this method returns {@code false},
|
||||
* which is questionable, but Container.metrics() returns {@code null}, so events
|
||||
* can't be emitted anyway.
|
||||
*/
|
||||
public native boolean isContainerized();
|
||||
}
|
||||
|
@ -59,6 +59,10 @@ final class JVMUpcalls {
|
||||
static byte[] onRetransform(long traceId, boolean dummy1, boolean dummy2, Class<?> clazz, byte[] oldBytes) throws Throwable {
|
||||
try {
|
||||
if (jdk.internal.event.Event.class.isAssignableFrom(clazz) && !Modifier.isAbstract(clazz.getModifiers())) {
|
||||
if (!Utils.shouldInstrument(clazz.getClassLoader() == null, clazz.getName())) {
|
||||
Logger.log(LogTag.JFR_SYSTEM, LogLevel.INFO, "Skipping instrumentation for " + clazz.getName() + " since container support is missing");
|
||||
return oldBytes;
|
||||
}
|
||||
EventWriterKey.ensureEventWriterFactory();
|
||||
EventConfiguration configuration = Utils.getConfiguration(clazz.asSubclass(jdk.internal.event.Event.class));
|
||||
if (configuration == null) {
|
||||
@ -103,6 +107,10 @@ final class JVMUpcalls {
|
||||
try {
|
||||
EventInstrumentation ei = new EventInstrumentation(superClass, oldBytes, traceId, bootClassLoader, true);
|
||||
eventName = ei.getEventName();
|
||||
if (!Utils.shouldInstrument(bootClassLoader, ei.getEventName())) {
|
||||
Logger.log(LogTag.JFR_SYSTEM, LogLevel.INFO, "Skipping instrumentation for " + eventName + " since container support is missing");
|
||||
return oldBytes;
|
||||
}
|
||||
if (!forceInstrumentation) {
|
||||
// Assume we are recording
|
||||
MetadataRepository mr = MetadataRepository.getInstance();
|
||||
|
@ -218,7 +218,8 @@ public final class MetadataRepository {
|
||||
EventConfiguration configuration = newEventConfiguration(eventType, ec, settings);
|
||||
PlatformEventType pe = configuration.getPlatformEventType();
|
||||
pe.setRegistered(true);
|
||||
if (jvm.isInstrumented(eventClass)) {
|
||||
// If class is instrumented or should not be instrumented, mark as instrumented.
|
||||
if (jvm.isInstrumented(eventClass) || !Utils.shouldInstrument(pe.isJDK(), pe.getName())) {
|
||||
pe.setInstrumented();
|
||||
}
|
||||
Utils.setConfiguration(eventClass, configuration);
|
||||
|
@ -96,7 +96,6 @@ public final class Utils {
|
||||
* This field will be lazily initialized and the access is not synchronized.
|
||||
* The possible data race is benign and is worth of not introducing any contention here.
|
||||
*/
|
||||
private static Metrics[] metrics;
|
||||
private static Instant lastTimestamp;
|
||||
|
||||
public static void checkAccessFlightRecorder() throws SecurityException {
|
||||
@ -700,18 +699,15 @@ public final class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean shouldSkipBytecode(String eventName, Class<?> superClass) {
|
||||
if (superClass.getClassLoader() != null || !superClass.getName().equals("jdk.jfr.events.AbstractJDKEvent")) {
|
||||
return false;
|
||||
public static boolean shouldInstrument(boolean isJDK, String name) {
|
||||
if (!isJDK) {
|
||||
return true;
|
||||
}
|
||||
return eventName.startsWith("jdk.Container") && getMetrics() == null;
|
||||
}
|
||||
|
||||
private static Metrics getMetrics() {
|
||||
if (metrics == null) {
|
||||
metrics = new Metrics[]{Metrics.systemMetrics()};
|
||||
if (!name.contains(".Container")) {
|
||||
// Didn't match @Name("jdk.jfr.Container*") or class name "jdk.jfr.events.Container*"
|
||||
return true;
|
||||
}
|
||||
return metrics[0];
|
||||
return JVM.getJVM().isContainerized();
|
||||
}
|
||||
|
||||
private static String formatPositiveDuration(Duration d){
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.dcmd;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.InvalidPathException;
|
||||
@ -32,7 +31,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.ParseException;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -53,6 +51,7 @@ import jdk.jfr.internal.SecuritySupport;
|
||||
import jdk.jfr.internal.Type;
|
||||
import jdk.jfr.internal.jfc.JFC;
|
||||
import jdk.jfr.internal.jfc.model.JFCModel;
|
||||
import jdk.jfr.internal.jfc.model.JFCModelException;
|
||||
import jdk.jfr.internal.jfc.model.XmlInput;
|
||||
|
||||
/**
|
||||
@ -229,22 +228,23 @@ final class DCmdStart extends AbstractDCmd {
|
||||
for (String configName : settings) {
|
||||
try {
|
||||
s.putAll(JFC.createKnown(configName).getSettings());
|
||||
} catch(FileNotFoundException e) {
|
||||
throw new DCmdException("Could not find settings file'" + configName + "'", e);
|
||||
} catch (IOException | ParseException e) {
|
||||
throw new DCmdException("Could not parse settings file '" + settings[0] + "'", e);
|
||||
} catch (InvalidPathException | IOException | ParseException e) {
|
||||
throw new DCmdException(JFC.formatException("Could not", e, configName), e);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private LinkedHashMap<String, String> configureExtended(String[] settings, ArgumentParser parser) throws DCmdException {
|
||||
List<SafePath> paths = new ArrayList<>();
|
||||
JFCModel model = new JFCModel(l -> logWarning(l));
|
||||
for (String setting : settings) {
|
||||
paths.add(JFC.createSafePath(setting));
|
||||
try {
|
||||
model.parse(JFC.createSafePath(setting));
|
||||
} catch (InvalidPathException | IOException | JFCModelException | ParseException e) {
|
||||
throw new DCmdException(JFC.formatException("Could not", e, setting), e);
|
||||
}
|
||||
}
|
||||
try {
|
||||
JFCModel model = new JFCModel(paths, l -> logWarning(l));
|
||||
Set<String> jfcOptions = new HashSet<>();
|
||||
for (XmlInput input : model.getInputs()) {
|
||||
jfcOptions.add(input.getName());
|
||||
@ -266,13 +266,9 @@ final class DCmdStart extends AbstractDCmd {
|
||||
}
|
||||
}
|
||||
return model.getSettings();
|
||||
} catch (IllegalArgumentException iae) {
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new DCmdException(iae.getMessage()); // spelling error, invalid value
|
||||
} catch (FileNotFoundException ioe) {
|
||||
throw new DCmdException("Could not find settings file'" + settings[0] + "'", ioe);
|
||||
} catch (IOException | ParseException e) {
|
||||
throw new DCmdException("Could not parse settings file '" + settings[0] + "'", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Instruments JDK-events on class load to reduce startup time
|
||||
@ -436,7 +432,7 @@ final class DCmdStart extends AbstractDCmd {
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
} catch (IOException | ParseException e) {
|
||||
} catch (IOException | JFCModelException | ParseException e) {
|
||||
Logger.log(LogTag.JFR_DCMD, LogLevel.DEBUG, "Could not list .jfc options for JFR.start. " + e.getMessage());
|
||||
return "";
|
||||
}
|
||||
|
@ -174,7 +174,15 @@ public final class JDKEvents {
|
||||
}
|
||||
|
||||
private static void initializeContainerEvents() {
|
||||
containerMetrics = Container.metrics();
|
||||
if (JVM.getJVM().isContainerized() ) {
|
||||
Logger.log(LogTag.JFR_SYSTEM, LogLevel.DEBUG, "JVM is containerized");
|
||||
containerMetrics = Container.metrics();
|
||||
if (containerMetrics != null) {
|
||||
Logger.log(LogTag.JFR_SYSTEM, LogLevel.DEBUG, "Container metrics are available");
|
||||
}
|
||||
}
|
||||
// The registration of events and hooks are needed to provide metadata,
|
||||
// even when not running in a container
|
||||
SecuritySupport.registerEvent(ContainerConfigurationEvent.class);
|
||||
SecuritySupport.registerEvent(ContainerCPUUsageEvent.class);
|
||||
SecuritySupport.registerEvent(ContainerCPUThrottlingEvent.class);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2022, 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
|
||||
@ -25,12 +25,13 @@
|
||||
|
||||
package jdk.jfr.internal.jfc;
|
||||
|
||||
import java.io.FileReader;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.AccessDeniedException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
@ -41,6 +42,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import jdk.jfr.Configuration;
|
||||
import jdk.jfr.internal.jfc.model.JFCModelException;
|
||||
import jdk.jfr.internal.LogLevel;
|
||||
import jdk.jfr.internal.LogTag;
|
||||
import jdk.jfr.internal.Logger;
|
||||
@ -118,7 +120,11 @@ public final class JFC {
|
||||
* @see java.lang.SecurityManager#checkRead(java.lang.String)
|
||||
*/
|
||||
public static Configuration create(String name, Reader reader) throws IOException, ParseException {
|
||||
return JFCParser.createConfiguration(name, reader);
|
||||
try {
|
||||
return JFCParser.createConfiguration(name, reader);
|
||||
} catch (ParseException pe) {
|
||||
throw new ParseException("Error reading JFC file. " + pe.getMessage(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -281,6 +287,34 @@ public final class JFC {
|
||||
return new StringReader(c.content);
|
||||
}
|
||||
}
|
||||
return new FileReader(sf.toFile(), StandardCharsets.UTF_8);
|
||||
return Files.newBufferedReader(sf.toFile().toPath(), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static String formatException(String prefix, Exception e, String input) {
|
||||
String message = prefix + " " + JFC.exceptionToVerb(e) + " file '" + input + "'";
|
||||
String details = e.getMessage();
|
||||
if (e instanceof JFCModelException m) {
|
||||
return message + ". " + details;
|
||||
}
|
||||
if (e instanceof ParseException && !details.isEmpty()) {
|
||||
return message + ". " + details;
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
private static String exceptionToVerb(Exception e) {
|
||||
if (e instanceof FileNotFoundException || e instanceof NoSuchFileException) {
|
||||
return "find";
|
||||
}
|
||||
if (e instanceof ParseException) {
|
||||
return "parse";
|
||||
}
|
||||
if (e instanceof JFCModelException) {
|
||||
return "use";
|
||||
}
|
||||
if (e instanceof AccessDeniedException) {
|
||||
return "access";
|
||||
}
|
||||
return "open"; // InvalidPath, IOException
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2022, 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
|
||||
@ -54,12 +54,8 @@ final class JFCParser {
|
||||
JFCParserHandler ch = new JFCParserHandler();
|
||||
parseXML(content, ch);
|
||||
return PrivateAccess.getInstance().newConfiguration(name, ch.label, ch.description, ch.provider, ch.settings, content);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
throw new ParseException(iae.getMessage(), -1);
|
||||
} catch (SAXException e) {
|
||||
ParseException pe = new ParseException("Error reading JFC file. " + e.getMessage(), -1);
|
||||
pe.initCause(e);
|
||||
throw pe;
|
||||
} catch (IllegalArgumentException | SAXException e) {
|
||||
throw new ParseException(e.getMessage(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,7 +65,7 @@ final class JFCParser {
|
||||
parser.parse(new InputSource(r), ch);
|
||||
}
|
||||
|
||||
private static String readContent(Reader r) throws IOException {
|
||||
private static String readContent(Reader r) throws IOException, ParseException {
|
||||
CharArrayWriter writer = new CharArrayWriter(1024);
|
||||
int count = 0;
|
||||
int ch;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -44,39 +44,43 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
public final class JFCModel {
|
||||
private final Map<String, List<ControlElement>> controls = new LinkedHashMap<>();
|
||||
private final XmlConfiguration configuration;
|
||||
private final Consumer<String> logger;
|
||||
|
||||
private JFCModel(XmlConfiguration configuration) throws ParseException {
|
||||
private JFCModel(XmlConfiguration configuration) throws JFCModelException {
|
||||
configuration.validate();
|
||||
this.configuration = configuration;
|
||||
this.logger = x -> { }; // Nothing to log.
|
||||
}
|
||||
|
||||
public JFCModel(Reader reader, Consumer<String> logger) throws ParseException, IOException {
|
||||
public JFCModel(Reader reader, Consumer<String> logger) throws IOException, JFCModelException, ParseException {
|
||||
this(Parser.parse(reader));
|
||||
addControls();
|
||||
wireConditions();
|
||||
wireSettings(logger);
|
||||
}
|
||||
|
||||
public JFCModel(List<SafePath> files, Consumer<String> logger) throws IOException, ParseException {
|
||||
public JFCModel(Consumer<String> logger) {
|
||||
this.configuration = new XmlConfiguration();
|
||||
this.configuration.setAttribute("version", "2.0");
|
||||
for (SafePath file : files) {
|
||||
JFCModel model = JFCModel.create(file, logger);
|
||||
for (var entry : model.controls.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
// Fail-fast checks that prevents an ambiguous file to be written later
|
||||
if (controls.containsKey(name)) {
|
||||
throw new ParseException("Control with '" + name + "' is declared in multiple files", 0);
|
||||
}
|
||||
controls.put(name, entry.getValue());
|
||||
}
|
||||
for (XmlElement child : model.configuration.getChildren()) {
|
||||
this.configuration.addChild(child);
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void parse(SafePath file) throws IOException, JFCModelException, ParseException {
|
||||
JFCModel model = JFCModel.create(file, logger);
|
||||
for (var entry : model.controls.entrySet()) {
|
||||
String name = entry.getKey();
|
||||
// Fail-fast checks that prevents an ambiguous file to be written later
|
||||
if (controls.containsKey(name)) {
|
||||
throw new JFCModelException("Control with '" + name + "' is declared in multiple files");
|
||||
}
|
||||
controls.put(name, entry.getValue());
|
||||
}
|
||||
for (XmlElement child : model.configuration.getChildren()) {
|
||||
this.configuration.addChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
public static JFCModel create(SafePath file, Consumer<String> logger) throws ParseException, IOException {
|
||||
public static JFCModel create(SafePath file, Consumer<String> logger) throws IOException, JFCModelException, ParseException{
|
||||
if (file.toString().equals("none")) {
|
||||
XmlConfiguration configuration = new XmlConfiguration();
|
||||
configuration.setAttribute("version", "2.0");
|
||||
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 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. Oracle designates this
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* 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 jdk.jfr.internal.jfc.model;
|
||||
/**
|
||||
* Signals that a JFCModel is invalid.
|
||||
*/
|
||||
public final class JFCModelException extends Exception {
|
||||
private static final long serialVersionUID = -613252344752758699L;
|
||||
|
||||
public JFCModelException(String errorMessage) {
|
||||
super(errorMessage);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -29,7 +29,6 @@ import java.io.Reader;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
import jdk.internal.org.xml.sax.Attributes;
|
||||
import jdk.internal.org.xml.sax.InputSource;
|
||||
import jdk.internal.org.xml.sax.SAXException;
|
||||
@ -45,10 +44,8 @@ final class Parser {
|
||||
ConfigurationHandler handler = new ConfigurationHandler();
|
||||
saxParser.parse(new InputSource(reader), handler);
|
||||
return handler.configuration;
|
||||
} catch (SAXException sp) {
|
||||
ParseException pe = new ParseException(sp.getMessage(), -1);
|
||||
pe.initCause(sp);
|
||||
throw pe;
|
||||
} catch (SAXException | IllegalStateException e) {
|
||||
throw new ParseException(e.getMessage(), -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.jfc.model;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -45,9 +44,9 @@ final class XmlCondition extends XmlExpression implements ControlElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateChildConstraints() throws ParseException {
|
||||
protected void validateChildConstraints() throws JFCModelException {
|
||||
if (getExpressions().size() > 1) {
|
||||
throw new ParseException("Expected <condition> to not have more than one child", -1);
|
||||
throw new JFCModelException("Expected <condition> to not have more than one child");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.jfc.model;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@ -85,10 +84,10 @@ final class XmlConfiguration extends XmlElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateAttributes() throws ParseException {
|
||||
protected void validateAttributes() throws JFCModelException {
|
||||
super.validateAttributes();
|
||||
if (!attribute("version").equals("2.0")) {
|
||||
throw new ParseException("Only .jfc files of version 2.0 is supported", -1);
|
||||
throw new JFCModelException("Only .jfc files of version 2.0 is supported");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.jfc.model;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -63,7 +62,7 @@ class XmlElement {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
final void validate() throws ParseException {
|
||||
final void validate() throws JFCModelException {
|
||||
validateAttributes();
|
||||
validateChildConstraints();
|
||||
validateChildren();
|
||||
@ -179,35 +178,35 @@ class XmlElement {
|
||||
return producers.get(0).evaluate();
|
||||
}
|
||||
|
||||
protected void validateAttributes() throws ParseException {
|
||||
protected void validateAttributes() throws JFCModelException {
|
||||
for (String key : attributes()) {
|
||||
if (!attributes.containsKey(key)) {
|
||||
throw new ParseException("Missing mandatory attribute '" + key + "'", 0);
|
||||
throw new JFCModelException("Missing mandatory attribute '" + key + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateChildren() throws ParseException {
|
||||
private void validateChildren() throws JFCModelException {
|
||||
for (XmlElement child : elements) {
|
||||
child.validate();
|
||||
}
|
||||
}
|
||||
|
||||
protected void validateChildConstraints() throws ParseException {
|
||||
protected void validateChildConstraints() throws JFCModelException {
|
||||
for (Constraint c : constraints()) {
|
||||
validateConstraint(c);
|
||||
}
|
||||
}
|
||||
|
||||
private final void validateConstraint(Constraint c) throws ParseException {
|
||||
private final void validateConstraint(Constraint c) throws JFCModelException {
|
||||
int count = count(c.type());
|
||||
if (count < c.min()) {
|
||||
String elementName = Utilities.elementName(c.type());
|
||||
throw new ParseException("Missing mandatory element <" + elementName + ">", 0);
|
||||
throw new JFCModelException("Missing mandatory element <" + elementName + ">");
|
||||
}
|
||||
if (count > c.max()) {
|
||||
String elementName = Utilities.elementName(c.type());
|
||||
throw new ParseException("Too many elements of type <" + elementName + ">", 0);
|
||||
throw new JFCModelException("Too many elements of type <" + elementName + ">");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.jfc.model;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
// Base class for <condition>, <or>, <not>, <and> and <test>
|
||||
@ -45,9 +44,9 @@ abstract class XmlExpression extends XmlElement {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateChildConstraints() throws ParseException {
|
||||
protected void validateChildConstraints() throws JFCModelException {
|
||||
if (getExpressions().size() < 2) {
|
||||
throw new ParseException("Expected + <" + getElementName() + "> to have at least two children", 0);
|
||||
throw new JFCModelException("Expected + <" + getElementName() + "> to have at least two children");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.jfc.model;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
// Corresponds to <not>
|
||||
@ -36,9 +35,9 @@ final class XmlNot extends XmlExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateChildConstraints() throws ParseException {
|
||||
protected void validateChildConstraints() throws JFCModelException {
|
||||
if (getExpressions().size() != 1) {
|
||||
throw new ParseException("Expected <not> to have a single child", 0);
|
||||
throw new JFCModelException("Expected <not> to have a single child");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -24,7 +24,6 @@
|
||||
*/
|
||||
package jdk.jfr.internal.jfc.model;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.List;
|
||||
|
||||
// Corresponds to <test>
|
||||
@ -53,17 +52,17 @@ final class XmlTest extends XmlExpression {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateChildConstraints() throws ParseException {
|
||||
protected void validateChildConstraints() throws JFCModelException {
|
||||
if (!getExpressions().isEmpty()) {
|
||||
throw new ParseException("Expected <test> to not have child elements", 0);
|
||||
throw new JFCModelException("Expected <test> to not have child elements");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateAttributes() throws ParseException {
|
||||
protected void validateAttributes() throws JFCModelException {
|
||||
super.validateAttributes();
|
||||
if (!getOperator().equalsIgnoreCase("equal")) {
|
||||
throw new ParseException("Unknown operator '" + getOperator() + "', only supported is 'equal'", 0);
|
||||
throw new JFCModelException("Unknown operator '" + getOperator() + "', only supported is 'equal'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2021, 2022, 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
|
||||
@ -32,22 +32,23 @@ import java.nio.file.InvalidPathException;
|
||||
import java.nio.file.Path;
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Deque;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import jdk.jfr.internal.SecuritySupport;
|
||||
import jdk.jfr.internal.SecuritySupport.SafePath;
|
||||
import jdk.jfr.internal.jfc.JFC;
|
||||
import jdk.jfr.internal.jfc.model.AbortException;
|
||||
import jdk.jfr.internal.jfc.model.JFCModel;
|
||||
import jdk.jfr.internal.jfc.model.JFCModelException;
|
||||
import jdk.jfr.internal.jfc.model.SettingsLog;
|
||||
import jdk.jfr.internal.jfc.model.UserInterface;
|
||||
import jdk.jfr.internal.jfc.model.XmlInput;
|
||||
|
||||
final class Configure extends Command {
|
||||
private final List<SafePath> inputFiles = new ArrayList<>();
|
||||
private final List<String> inputFiles = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public List<String> getOptionSyntax() {
|
||||
@ -100,13 +101,8 @@ final class Configure extends Command {
|
||||
stream.println("The whitespace delimiter can be omitted for timespan values, i.e. 20ms. For");
|
||||
stream.println("more information about the settings syntax, see Javadoc of the jdk.jfr package.");
|
||||
ensureInputFiles();
|
||||
for (SafePath path : inputFiles) {
|
||||
try {
|
||||
String name = path.toPath().getFileName().toString();
|
||||
displayParameters(stream, path, name);
|
||||
} catch (InvalidPathException | ParseException | IOException e) {
|
||||
stream.println("Unable read options for " + path + " " + e.getMessage());
|
||||
}
|
||||
for (String name : inputFiles) {
|
||||
displayParameters(stream, name);
|
||||
}
|
||||
stream.println();
|
||||
stream.println("To run interactive configuration wizard:");
|
||||
@ -126,14 +122,19 @@ final class Configure extends Command {
|
||||
stream.println(" jfr configure --input none +Hello#enabled=true --output minimal.jfc");
|
||||
}
|
||||
|
||||
private void displayParameters(PrintStream stream, SafePath path, String name) throws ParseException, IOException {
|
||||
JFCModel parameters = JFCModel.create(path, l -> stream.println("Warning! " + l));
|
||||
private void displayParameters(PrintStream stream, String name) {
|
||||
stream.println();
|
||||
stream.println("Options for " + name + ":");
|
||||
stream.println();
|
||||
for (XmlInput input : parameters.getInputs()) {
|
||||
stream.println(" " + input.getOptionSyntax());
|
||||
stream.println();
|
||||
try {
|
||||
SafePath path = JFC.createSafePath(name);
|
||||
JFCModel parameters = JFCModel.create(path, l -> stream.println("Warning! " + l));
|
||||
for (XmlInput input : parameters.getInputs()) {
|
||||
stream.println(" " + input.getOptionSyntax());
|
||||
stream.println();
|
||||
}
|
||||
} catch (JFCModelException | InvalidPathException | ParseException | IOException e) {
|
||||
stream.println(JFC.formatException(" Could not", e, name)); // indented
|
||||
}
|
||||
}
|
||||
|
||||
@ -153,7 +154,7 @@ final class Configure extends Command {
|
||||
}
|
||||
if (acceptOption(options, "--input")) {
|
||||
String value = options.pop();
|
||||
inputFiles.addAll(makeSafePathList(value));
|
||||
inputFiles.addAll(Arrays.asList(value.split(",")));
|
||||
}
|
||||
if (acceptOption(options, "--output")) {
|
||||
if (output != null) {
|
||||
@ -190,16 +191,23 @@ final class Configure extends Command {
|
||||
}
|
||||
|
||||
private void configure(boolean interactive, boolean log, SafePath output, Map<String, String> options) throws UserDataException {
|
||||
UserInterface ui = new UserInterface();
|
||||
if (log) {
|
||||
SettingsLog.enable();
|
||||
}
|
||||
JFCModel model = new JFCModel(l -> ui.println("Warning! " + l));
|
||||
model.setLabel("Custom");
|
||||
for (String input : inputFiles) {
|
||||
try {
|
||||
model.parse(JFC.createSafePath(input));
|
||||
} catch (InvalidPathException | IOException | JFCModelException | ParseException e) {
|
||||
throw new UserDataException(JFC.formatException("could not", e, input));
|
||||
}
|
||||
}
|
||||
try {
|
||||
if (output == null) {
|
||||
output = new SafePath(Path.of("custom.jfc"));
|
||||
}
|
||||
UserInterface ui = new UserInterface();
|
||||
JFCModel model = new JFCModel(inputFiles, l -> ui.println("Warning! " + l));
|
||||
model.setLabel("Custom");
|
||||
if (log) {
|
||||
SettingsLog.enable();
|
||||
}
|
||||
for (var option : options.entrySet()) {
|
||||
model.configure(option.getKey(), option.getValue());
|
||||
}
|
||||
@ -227,27 +235,12 @@ final class Configure extends Command {
|
||||
throw new UserDataException("could not find file: " + ffe.getMessage());
|
||||
} catch (IOException ioe) {
|
||||
throw new UserDataException("i/o error: " + ioe.getMessage());
|
||||
} catch (ParseException pe) {
|
||||
throw new UserDataException("parsing error: " + pe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private List<SafePath> makeSafePathList(String value) {
|
||||
List<SafePath> paths = new ArrayList<>();
|
||||
for (String name : value.split(",")) {
|
||||
paths.add(JFC.createSafePath(name));
|
||||
}
|
||||
return paths;
|
||||
}
|
||||
|
||||
|
||||
private void ensureInputFiles() throws InternalError {
|
||||
if (inputFiles.isEmpty()) {
|
||||
for (SafePath predefined : SecuritySupport.getPredefinedJFCFiles()) {
|
||||
if (predefined.toString().endsWith("default.jfc")) {
|
||||
inputFiles.add(predefined);
|
||||
}
|
||||
}
|
||||
inputFiles.add("default.jfc");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package example1;
|
||||
package jdk.jfr.snippets;
|
||||
|
||||
import jdk.jfr.AnnotationElement;
|
||||
import jdk.jfr.ValueDescriptor;
|
||||
|
@ -28,7 +28,7 @@ import compiler.lib.ir_framework.*;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8278114
|
||||
* @bug 8278114 8288564
|
||||
* @summary Test that transformation from (x + x) >> c to x >> (c + 1) works as intended.
|
||||
* @library /test/lib /
|
||||
* @requires vm.compiler2.enabled
|
||||
@ -149,4 +149,34 @@ public class TestIRLShiftIdeal_XPlusX_LShiftC {
|
||||
Asserts.assertTrue(info.isTestC2Compiled());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(failOn = {IRNode.MUL_I})
|
||||
@IR(counts = {IRNode.LSHIFT_I, "1",
|
||||
IRNode.ADD_I, "1"})
|
||||
public int testIntRandom(int x) {
|
||||
return (x + x) << 31;
|
||||
}
|
||||
|
||||
@Run(test = "testIntRandom")
|
||||
public void runTestIntRandom() {
|
||||
int random = RunInfo.getRandom().nextInt();
|
||||
int interpreterResult = (random + random) << 31;
|
||||
Asserts.assertEQ(testIntRandom(random), interpreterResult);
|
||||
}
|
||||
|
||||
@Test
|
||||
@IR(failOn = {IRNode.MUL_L})
|
||||
@IR(counts = {IRNode.LSHIFT_L, "1",
|
||||
IRNode.ADD_L, "1"})
|
||||
public long testLongRandom(long x) {
|
||||
return (x + x) << 63;
|
||||
}
|
||||
|
||||
@Run(test = "testLongRandom")
|
||||
public void runTestLongRandom() {
|
||||
long random = RunInfo.getRandom().nextLong();
|
||||
long interpreterResult = (random + random) << 63;
|
||||
Asserts.assertEQ(testLongRandom(random), interpreterResult);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,148 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.vectorapi;
|
||||
|
||||
import compiler.lib.ir_framework.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import jdk.incubator.vector.DoubleVector;
|
||||
import jdk.incubator.vector.IntVector;
|
||||
import jdk.incubator.vector.LongVector;
|
||||
import jdk.incubator.vector.VectorMask;
|
||||
import jdk.incubator.vector.VectorShape;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.Utils;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8288397
|
||||
* @key randomness
|
||||
* @library /test/lib /
|
||||
* @requires vm.cpu.features ~= ".*sve.*"
|
||||
* @summary AArch64: Fix register issues in SVE backend match rules
|
||||
* @modules jdk.incubator.vector
|
||||
*
|
||||
* @run driver compiler.vectorapi.VectorGatherScatterTest
|
||||
*/
|
||||
|
||||
public class VectorGatherScatterTest {
|
||||
private static final VectorSpecies<Double> D_SPECIES = DoubleVector.SPECIES_MAX;
|
||||
private static final VectorSpecies<Long> L_SPECIES = LongVector.SPECIES_MAX;
|
||||
private static final VectorSpecies<Integer> I_SPECIES =
|
||||
VectorSpecies.of(int.class, VectorShape.forBitSize(L_SPECIES.vectorBitSize() / 2));
|
||||
|
||||
private static int LENGTH = 128;
|
||||
private static final Random RD = Utils.getRandomInstance();
|
||||
|
||||
private static int[] ia;
|
||||
private static int[] ir;
|
||||
private static long[] la;
|
||||
private static long[] lr;
|
||||
private static double[] da;
|
||||
private static double[] dr;
|
||||
private static boolean[] m;
|
||||
|
||||
static {
|
||||
ia = new int[LENGTH];
|
||||
ir = new int[LENGTH];
|
||||
la = new long[LENGTH];
|
||||
lr = new long[LENGTH];
|
||||
da = new double[LENGTH];
|
||||
dr = new double[LENGTH];
|
||||
m = new boolean[LENGTH];
|
||||
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
ia[i] = i;
|
||||
la[i] = RD.nextLong(25);
|
||||
da[i] = RD.nextDouble(25.0);
|
||||
m[i] = RD.nextBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Warmup(10000)
|
||||
@IR(counts = { "LoadVectorGather", ">= 1" })
|
||||
public static void testLoadGather() {
|
||||
LongVector av = LongVector.fromArray(L_SPECIES, la, 0, ia, 0);
|
||||
av.intoArray(lr, 0);
|
||||
IntVector bv = IntVector.fromArray(I_SPECIES, ia, 0);
|
||||
bv.add(0).intoArray(ir, 0);
|
||||
|
||||
for(int i = 0; i < I_SPECIES.length(); i++) {
|
||||
Asserts.assertEquals(ia[i], ir[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Warmup(10000)
|
||||
@IR(counts = { "LoadVectorGatherMasked", ">= 1" })
|
||||
public static void testLoadGatherMasked() {
|
||||
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
|
||||
LongVector av = LongVector.fromArray(L_SPECIES, la, 0, ia, 0, mask);
|
||||
av.intoArray(lr, 0);
|
||||
IntVector bv = IntVector.fromArray(I_SPECIES, ia, 0);
|
||||
bv.add(0).intoArray(ir, 0);
|
||||
|
||||
for(int i = 0; i < I_SPECIES.length(); i++) {
|
||||
Asserts.assertEquals(ia[i], ir[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Warmup(10000)
|
||||
@IR(counts = { "StoreVectorScatter", ">= 1" })
|
||||
public static void testStoreScatter() {
|
||||
DoubleVector av = DoubleVector.fromArray(D_SPECIES, da, 0);
|
||||
av.intoArray(dr, 0, ia, 0);
|
||||
IntVector bv = IntVector.fromArray(I_SPECIES, ia, 0);
|
||||
bv.add(0).intoArray(ir, 0);
|
||||
|
||||
for(int i = 0; i < I_SPECIES.length(); i++) {
|
||||
Asserts.assertEquals(ia[i], ir[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Warmup(10000)
|
||||
@IR(counts = { "StoreVectorScatterMasked", ">= 1" })
|
||||
public static void testStoreScatterMasked() {
|
||||
VectorMask<Double> mask = VectorMask.fromArray(D_SPECIES, m, 0);
|
||||
DoubleVector av = DoubleVector.fromArray(D_SPECIES, da, 0);
|
||||
av.intoArray(dr, 0, ia, 0, mask);
|
||||
IntVector bv = IntVector.fromArray(I_SPECIES, ia, 0);
|
||||
bv.add(0).intoArray(ir, 0);
|
||||
|
||||
for(int i = 0; i < I_SPECIES.length(); i++) {
|
||||
Asserts.assertEquals(ia[i], ir[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestFramework.runWithFlags("--add-modules=jdk.incubator.vector",
|
||||
"-XX:UseSVE=1");
|
||||
}
|
||||
}
|
118
test/hotspot/jtreg/compiler/vectorapi/VectorMaskedNotTest.java
Normal file
118
test/hotspot/jtreg/compiler/vectorapi/VectorMaskedNotTest.java
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2022, Arm Limited. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package compiler.vectorapi;
|
||||
|
||||
import compiler.lib.ir_framework.*;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import jdk.incubator.vector.IntVector;
|
||||
import jdk.incubator.vector.LongVector;
|
||||
import jdk.incubator.vector.VectorMask;
|
||||
import jdk.incubator.vector.VectorOperators;
|
||||
import jdk.incubator.vector.VectorSpecies;
|
||||
|
||||
import jdk.test.lib.Asserts;
|
||||
import jdk.test.lib.Utils;
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8288397
|
||||
* @key randomness
|
||||
* @library /test/lib /
|
||||
* @requires vm.cpu.features ~= ".*sve.*"
|
||||
* @summary AArch64: Fix register issues in SVE backend match rules
|
||||
* @modules jdk.incubator.vector
|
||||
*
|
||||
* @run driver compiler.vectorapi.VectorMaskedNotTest
|
||||
*/
|
||||
|
||||
public class VectorMaskedNotTest {
|
||||
private static final VectorSpecies<Integer> I_SPECIES = IntVector.SPECIES_MAX;
|
||||
private static final VectorSpecies<Long> L_SPECIES = LongVector.SPECIES_MAX;
|
||||
|
||||
private static int LENGTH = 128;
|
||||
private static final Random RD = Utils.getRandomInstance();
|
||||
|
||||
private static int[] ia;
|
||||
private static int[] ir;
|
||||
private static long[] la;
|
||||
private static long[] lr;
|
||||
private static boolean[] m;
|
||||
|
||||
static {
|
||||
ia = new int[LENGTH];
|
||||
ir = new int[LENGTH];
|
||||
la = new long[LENGTH];
|
||||
lr = new long[LENGTH];
|
||||
m = new boolean[LENGTH];
|
||||
|
||||
for (int i = 0; i < LENGTH; i++) {
|
||||
ia[i] = RD.nextInt(25);
|
||||
la[i] = RD.nextLong(25);
|
||||
m[i] = RD.nextBoolean();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Warmup(10000)
|
||||
@IR(counts = { "sve_not", ">= 1" })
|
||||
public static void testIntNotMasked() {
|
||||
VectorMask<Integer> mask = VectorMask.fromArray(I_SPECIES, m, 0);
|
||||
IntVector av = IntVector.fromArray(I_SPECIES, ia, 0);
|
||||
av.lanewise(VectorOperators.NOT, mask).add(av).intoArray(ir, 0);
|
||||
|
||||
// Verify results
|
||||
for (int i = 0; i < I_SPECIES.length(); i++) {
|
||||
if (m[i]) {
|
||||
Asserts.assertEquals((~ia[i]) + ia[i], ir[i]);
|
||||
} else {
|
||||
Asserts.assertEquals(ia[i] + ia[i], ir[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Warmup(10000)
|
||||
@IR(counts = { "sve_not", ">= 1" })
|
||||
public static void testLongNotMasked() {
|
||||
VectorMask<Long> mask = VectorMask.fromArray(L_SPECIES, m, 0);
|
||||
LongVector av = LongVector.fromArray(L_SPECIES, la, 0);
|
||||
av.lanewise(VectorOperators.NOT, mask).add(av).intoArray(lr, 0);
|
||||
|
||||
// Verify results
|
||||
for (int i = 0; i < L_SPECIES.length(); i++) {
|
||||
if (m[i]) {
|
||||
Asserts.assertEquals((~la[i]) + la[i], lr[i]);
|
||||
} else {
|
||||
Asserts.assertEquals(la[i] + la[i], lr[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
TestFramework.runWithFlags("--add-modules=jdk.incubator.vector",
|
||||
"-XX:UseSVE=1");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2022, 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
|
||||
@ -65,7 +65,7 @@ public class JcmdAsserts {
|
||||
// }
|
||||
|
||||
public static void assertNotAbleToFindSettingsFile(OutputAnalyzer output) {
|
||||
output.shouldContain("Could not parse setting");
|
||||
output.shouldContain("Could not find file");
|
||||
}
|
||||
|
||||
public static void assertNoRecordingsAvailable(OutputAnalyzer output) {
|
||||
|
@ -24,12 +24,12 @@
|
||||
#define __CallHelper_hpp__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <jni.h>
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
/*
|
||||
* basis of classes to provide a bunch of checking in native calls to java
|
||||
@ -48,7 +48,7 @@ protected:
|
||||
void emitErrorMessage(const std::string& msg) {
|
||||
std::string nm = classname;
|
||||
std::replace(nm.begin(), nm.end(), '/', '.');
|
||||
std::cerr << "ERROR: " << nm << "::" << method << ", " << msg << std::endl;
|
||||
::fprintf(stderr, "ERROR: %s::%s, %s\n", nm.c_str(), method.c_str(), msg.c_str());
|
||||
}
|
||||
|
||||
// check the given object which is expected to be null
|
||||
@ -202,7 +202,7 @@ public:
|
||||
};
|
||||
|
||||
void emitErrorMessageAndExit(const std::string& msg) {
|
||||
std::cerr << "ERROR: " << msg << std::endl;
|
||||
::fprintf(stderr, "ERROR: %s\n", msg.c_str());
|
||||
::exit(-1);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2022, 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 8288545
|
||||
* @summary Missing space in error message
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build toolbox.ToolBox javadoc.tester.*
|
||||
* @run main TestLinkNotFound
|
||||
*/
|
||||
|
||||
import javadoc.tester.JavadocTester;
|
||||
import toolbox.ToolBox;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class TestLinkNotFound extends JavadocTester {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
TestLinkNotFound tester = new TestLinkNotFound();
|
||||
tester.runTests();
|
||||
}
|
||||
|
||||
ToolBox tb = new ToolBox();
|
||||
|
||||
@Test
|
||||
public void test(Path base) throws Exception {
|
||||
Path src = base.resolve("src");
|
||||
tb.writeJavaFiles(src,
|
||||
"""
|
||||
/**
|
||||
* Comment.
|
||||
* {@link nowhere label}
|
||||
*/
|
||||
public class C{ }
|
||||
""");
|
||||
|
||||
javadoc("-d", base.resolve("api").toString(),
|
||||
"-Xdoclint:none",
|
||||
"-Werror",
|
||||
"-sourcepath", src.toString(),
|
||||
src.resolve("C.java").toString());
|
||||
checkExit(Exit.ERROR);
|
||||
|
||||
// the use of '\n' in the following check implies that the label does not appear after the reference
|
||||
checkOutput(Output.OUT, true,
|
||||
"reference not found: nowhere\n");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2022, 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
|
||||
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8035473 8288692
|
||||
* @summary Determine if proper warning messages are printed.
|
||||
* @library ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
|
Loading…
Reference in New Issue
Block a user