Merge jdk8u222-b06

Wed, 05 Jun 2019 05:15:56 +0100

author
andrew
date
Wed, 05 Jun 2019 05:15:56 +0100
changeset 9695
17778f8991c8
parent 9683
fba8dbd018a6
parent 9694
33776ba5db80
child 9696
b9f6b711e9da
child 9697
cfe3264deba4

Merge

     1.1 --- a/.hgtags	Wed May 29 09:09:43 2019 +0100
     1.2 +++ b/.hgtags	Wed Jun 05 05:15:56 2019 +0100
     1.3 @@ -1266,3 +1266,4 @@
     1.4  32bc598624bd33a1a8847e84f791559f18a69a49 jdk8u222-b02
     1.5  af43bab3c5d022f0e0b7890f732d8b365b4364cc jdk8u222-b03
     1.6  d690709cc3398f8cfd6ffebb89a229105fb3e69a jdk8u222-b04
     1.7 +1ec20e8a3d8a7a29e9113b14567abec9f0240e9d jdk8u222-b05
     2.1 --- a/THIRD_PARTY_README	Wed May 29 09:09:43 2019 +0100
     2.2 +++ b/THIRD_PARTY_README	Wed Jun 05 05:15:56 2019 +0100
     2.3 @@ -1612,7 +1612,7 @@
     2.4  
     2.5  -------------------------------------------------------------------------------
     2.6  
     2.7 -%% This notice is provided with respect to GIFLIB 5.1.1 & libungif 4.1.3, 
     2.8 +%% This notice is provided with respect to GIFLIB 5.1.8 & libungif 4.1.3, 
     2.9  which may be included with JRE 8, JDK 8, and OpenJDK 8.
    2.10  
    2.11  --- begin of LICENSE ---
    2.12 @@ -1682,7 +1682,7 @@
    2.13  --- begin of LICENSE ---
    2.14  
    2.15   Mesa 3-D graphics library
    2.16 - Version:  4.1
    2.17 + Version:  5.0
    2.18  
    2.19   Copyright (C) 1999-2002  Brian Paul   All Rights Reserved.
    2.20  
    2.21 @@ -2797,61 +2797,8 @@
    2.22  not be used in advertising or otherwise to promote the sale, use or
    2.23  other dealings in this Software without prior written authorization
    2.24  from the X Consortium.
    2.25 -___________________________
    2.26 -The files in motif/lib/Xm/util included this copyright:mkdirhier.man,
    2.27 -xmkmf.man, chownxterm.c, makeg.man, mergelib.cpp, lndir.man, makestrs.man, 
    2.28 -checktree.c, lndir.c, makestrs.c
    2.29 -Copyright (c) 1993, 1994 X Consortium
    2.30 -
    2.31 -Permission is hereby granted, free of charge, to any person obtaining a
    2.32 -copy of this software and associated documentation files (the "Software"),
    2.33 -to deal in the Software without restriction, including without limitation
    2.34 -the rights to use, copy, modify, merge, publish, distribute, sublicense,
    2.35 -and/or sell copies of the Software, and to permit persons to whom the
    2.36 -Software furnished to do so, subject to the following conditions:
    2.37 -
    2.38 -The above copyright notice and this permission notice shall be included in
    2.39 -all copies or substantial portions of the Software.
    2.40 -
    2.41 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.42 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.43 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    2.44 -THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    2.45 -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
    2.46 -OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    2.47 -SOFTWARE.
    2.48 -
    2.49 -Except as contained in this notice, the name of the X Consortium shall not
    2.50 -be used in advertising or otherwise to promote the sale, use or other
    2.51 -dealing in this Software without prior written authorization from the
    2.52 -X Consortium.
    2.53 -_____________________________
    2.54 -Xmos_r.h:
    2.55 -/*
    2.56 -Copyright (c) 1996 X Consortium
    2.57 -
    2.58 -Permission is hereby granted, free of charge, to any person obtaining a copy
    2.59 -of this software and associated documentation files (the "Software"), to deal
    2.60 -in the Software without restriction, including without limitation the rights
    2.61 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    2.62 -copies of the Software, and to permit persons to whom the Software is
    2.63 -furnished to do so, subject to the following conditions:
    2.64 -
    2.65 -The above copyright notice and this permission notice shall be included in
    2.66 -all copies or substantial portions of the Software.
    2.67 -
    2.68 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.69 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.70 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.71 -X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
    2.72 -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    2.73 -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    2.74 -
    2.75 -Except as contained in this notice, the name of the X Consortium shall not be
    2.76 -used in advertising or otherwise to promote the sale, use or other dealings
    2.77 -in this Software without prior written authorization from the X Consortium.
    2.78 -*/
    2.79 -
    2.80 +
    2.81 +--- end of LICENSE ---
    2.82  _____________________________
    2.83  Copyright notice for HPkeysym.h:
    2.84  /*
    2.85 @@ -2951,7 +2898,7 @@
    2.86    Apache Jakarta BCEL 5.1 
    2.87    Apache Jakarta Regexp 1.4 
    2.88    Apache Santuario XML Security for Java 1.5.4
    2.89 -  Apache Xalan-Java 2.7.1 
    2.90 +  Apache Xalan-Java 2.7.2
    2.91    Apache Xerces Java 2.10.0 
    2.92    Apache XML Resolver 1.1 
    2.93  
     3.1 --- a/src/cpu/ppc/vm/assembler_ppc.hpp	Wed May 29 09:09:43 2019 +0100
     3.2 +++ b/src/cpu/ppc/vm/assembler_ppc.hpp	Wed Jun 05 05:15:56 2019 +0100
     3.3 @@ -472,7 +472,12 @@
     3.4      LXVD2X_OPCODE  = (31u << OPCODE_SHIFT |  844u << 1),
     3.5      STXVD2X_OPCODE = (31u << OPCODE_SHIFT |  972u << 1),
     3.6      MTVSRD_OPCODE  = (31u << OPCODE_SHIFT |  179u << 1),
     3.7 +    MTVSRWZ_OPCODE = (31u << OPCODE_SHIFT |  243u << 1),
     3.8      MFVSRD_OPCODE  = (31u << OPCODE_SHIFT |   51u << 1),
     3.9 +    MFVSRWZ_OPCODE = (31u << OPCODE_SHIFT |  115u << 1),
    3.10 +    XXPERMDI_OPCODE= (60u << OPCODE_SHIFT |   10u << 3),
    3.11 +    XXMRGHW_OPCODE = (60u << OPCODE_SHIFT |   18u << 3),
    3.12 +    XXMRGLW_OPCODE = (60u << OPCODE_SHIFT |   50u << 3),
    3.13  
    3.14      // Vector Permute and Formatting
    3.15      VPKPX_OPCODE   = (4u  << OPCODE_SHIFT |  782u     ),
    3.16 @@ -522,6 +527,7 @@
    3.17      VADDUBM_OPCODE = (4u  << OPCODE_SHIFT |    0u     ),
    3.18      VADDUWM_OPCODE = (4u  << OPCODE_SHIFT |  128u     ),
    3.19      VADDUHM_OPCODE = (4u  << OPCODE_SHIFT |   64u     ),
    3.20 +    VADDUDM_OPCODE = (4u  << OPCODE_SHIFT |  192u     ),
    3.21      VADDUBS_OPCODE = (4u  << OPCODE_SHIFT |  512u     ),
    3.22      VADDUWS_OPCODE = (4u  << OPCODE_SHIFT |  640u     ),
    3.23      VADDUHS_OPCODE = (4u  << OPCODE_SHIFT |  576u     ),
    3.24 @@ -1056,16 +1062,19 @@
    3.25    static int vrs(   VectorRegister r)  { return  vrs(r->encoding());}
    3.26    static int vrt(   VectorRegister r)  { return  vrt(r->encoding());}
    3.27  
    3.28 +  // Only used on SHA sigma instructions (VX-form)
    3.29 +  static int vst(      int         x)  { return  opp_u_field(x,             16, 16); }
    3.30 +  static int vsix(     int         x)  { return  opp_u_field(x,             20, 17); }
    3.31 +
    3.32    // Support Vector-Scalar (VSX) instructions.
    3.33 -  static int vsra(      int         x)  { return  opp_u_field(x,            15, 11); }
    3.34 -  static int vsrb(      int         x)  { return  opp_u_field(x,            20, 16); }
    3.35 -  static int vsrc(      int         x)  { return  opp_u_field(x,            25, 21); }
    3.36 -  static int vsrs(      int         x)  { return  opp_u_field(x,            10,  6); }
    3.37 -  static int vsrt(      int         x)  { return  opp_u_field(x,            10,  6); }
    3.38 +  static int vsra(      int         x)  { return  opp_u_field(x & 0x1F,     15, 11) | opp_u_field((x & 0x20) >> 5, 29, 29); }
    3.39 +  static int vsrb(      int         x)  { return  opp_u_field(x & 0x1F,     20, 16) | opp_u_field((x & 0x20) >> 5, 30, 30); }
    3.40 +  static int vsrs(      int         x)  { return  opp_u_field(x & 0x1F,     10,  6) | opp_u_field((x & 0x20) >> 5, 31, 31); }
    3.41 +  static int vsrt(      int         x)  { return  vsrs(x); }
    3.42 +  static int vsdm(      int         x)  { return  opp_u_field(x,            23, 22); }
    3.43  
    3.44    static int vsra(   VectorSRegister r)  { return  vsra(r->encoding());}
    3.45    static int vsrb(   VectorSRegister r)  { return  vsrb(r->encoding());}
    3.46 -  static int vsrc(   VectorSRegister r)  { return  vsrc(r->encoding());}
    3.47    static int vsrs(   VectorSRegister r)  { return  vsrs(r->encoding());}
    3.48    static int vsrt(   VectorSRegister r)  { return  vsrt(r->encoding());}
    3.49  
    3.50 @@ -1869,6 +1878,7 @@
    3.51    inline void vaddubm(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.52    inline void vadduwm(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.53    inline void vadduhm(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.54 +  inline void vaddudm(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.55    inline void vaddubs(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.56    inline void vadduws(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.57    inline void vadduhs(  VectorRegister d, VectorRegister a, VectorRegister b);
    3.58 @@ -1944,6 +1954,7 @@
    3.59    inline void vandc(    VectorRegister d, VectorRegister a, VectorRegister b);
    3.60    inline void vnor(     VectorRegister d, VectorRegister a, VectorRegister b);
    3.61    inline void vor(      VectorRegister d, VectorRegister a, VectorRegister b);
    3.62 +  inline void vmr(      VectorRegister d, VectorRegister a);
    3.63    inline void vxor(     VectorRegister d, VectorRegister a, VectorRegister b);
    3.64    inline void vrld(     VectorRegister d, VectorRegister a, VectorRegister b);
    3.65    inline void vrlb(     VectorRegister d, VectorRegister a, VectorRegister b);
    3.66 @@ -1963,10 +1974,23 @@
    3.67    inline void mfvscr(   VectorRegister d);
    3.68  
    3.69    // Vector-Scalar (VSX) instructions.
    3.70 +  inline void lxvd2x(   VectorSRegister d, Register a);
    3.71    inline void lxvd2x(   VectorSRegister d, Register a, Register b);
    3.72 +  inline void stxvd2x(  VectorSRegister d, Register a);
    3.73    inline void stxvd2x(  VectorSRegister d, Register a, Register b);
    3.74 +  inline void mtvrwz(   VectorRegister  d, Register a);
    3.75 +  inline void mfvrwz(   Register        a, VectorRegister d);
    3.76    inline void mtvrd(    VectorRegister  d, Register a);
    3.77    inline void mfvrd(    Register        a, VectorRegister d);
    3.78 +  inline void xxpermdi( VectorSRegister d, VectorSRegister a, VectorSRegister b, int dm);
    3.79 +  inline void xxmrghw(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
    3.80 +  inline void xxmrglw(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
    3.81 +
    3.82 +  // VSX Extended Mnemonics
    3.83 +  inline void xxspltd(  VectorSRegister d, VectorSRegister a, int x);
    3.84 +  inline void xxmrghd(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
    3.85 +  inline void xxmrgld(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
    3.86 +  inline void xxswapd(  VectorSRegister d, VectorSRegister a);
    3.87  
    3.88    // AES (introduced with Power 8)
    3.89    inline void vcipher(     VectorRegister d, VectorRegister a, VectorRegister b);
     4.1 --- a/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Wed May 29 09:09:43 2019 +0100
     4.2 +++ b/src/cpu/ppc/vm/assembler_ppc.inline.hpp	Wed Jun 05 05:15:56 2019 +0100
     4.3 @@ -627,10 +627,23 @@
     4.4  inline void Assembler::lvsr(  VectorRegister d, Register s1, Register s2) { emit_int32( LVSR_OPCODE   | vrt(d) | ra0mem(s1) | rb(s2)); }
     4.5  
     4.6  // Vector-Scalar (VSX) instructions.
     4.7 -inline void Assembler::lxvd2x (VectorSRegister d, Register s1, Register s2) { emit_int32( LXVD2X_OPCODE  | vsrt(d) | ra(s1) | rb(s2)); }
     4.8 -inline void Assembler::stxvd2x(VectorSRegister d, Register s1, Register s2) { emit_int32( STXVD2X_OPCODE | vsrt(d) | ra(s1) | rb(s2)); }
     4.9 -inline void Assembler::mtvrd(  VectorRegister  d, Register a)               { emit_int32( MTVSRD_OPCODE  | vrt(d)  | ra(a)  | 1u); } // 1u: d is treated as Vector (VMX/Altivec).
    4.10 -inline void Assembler::mfvrd(  Register        a, VectorRegister d)         { emit_int32( MFVSRD_OPCODE  | vrt(d)  | ra(a)  | 1u); } // 1u: d is treated as Vector (VMX/Altivec).
    4.11 +inline void Assembler::lxvd2x(  VectorSRegister d, Register s1)              { emit_int32( LXVD2X_OPCODE  | vsrt(d) | ra(0) | rb(s1)); }
    4.12 +inline void Assembler::lxvd2x(  VectorSRegister d, Register s1, Register s2) { emit_int32( LXVD2X_OPCODE  | vsrt(d) | ra0mem(s1) | rb(s2)); }
    4.13 +inline void Assembler::stxvd2x( VectorSRegister d, Register s1)              { emit_int32( STXVD2X_OPCODE | vsrt(d) | ra(0) | rb(s1)); }
    4.14 +inline void Assembler::stxvd2x( VectorSRegister d, Register s1, Register s2) { emit_int32( STXVD2X_OPCODE | vsrt(d) | ra0mem(s1) | rb(s2)); }
    4.15 +inline void Assembler::mtvrd(   VectorRegister  d, Register a)               { emit_int32( MTVSRD_OPCODE  | vsrt(d->to_vsr()) | ra(a)); }
    4.16 +inline void Assembler::mfvrd(   Register        a, VectorRegister d)         { emit_int32( MFVSRD_OPCODE  | vsrt(d->to_vsr()) | ra(a)); }
    4.17 +inline void Assembler::mtvrwz(  VectorRegister  d, Register a)               { emit_int32( MTVSRWZ_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
    4.18 +inline void Assembler::mfvrwz(  Register        a, VectorRegister d)         { emit_int32( MFVSRWZ_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
    4.19 +inline void Assembler::xxpermdi(VectorSRegister d, VectorSRegister a, VectorSRegister b, int dm) { emit_int32( XXPERMDI_OPCODE | vsrt(d) | vsra(a) | vsrb(b) | vsdm(dm)); }
    4.20 +inline void Assembler::xxmrghw( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXMRGHW_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
    4.21 +inline void Assembler::xxmrglw( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXMRGHW_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
    4.22 +
    4.23 +// VSX Extended Mnemonics
    4.24 +inline void Assembler::xxspltd( VectorSRegister d, VectorSRegister a, int x)             { xxpermdi(d, a, a, x ? 3 : 0); }
    4.25 +inline void Assembler::xxmrghd( VectorSRegister d, VectorSRegister a, VectorSRegister b) { xxpermdi(d, a, b, 0); }
    4.26 +inline void Assembler::xxmrgld( VectorSRegister d, VectorSRegister a, VectorSRegister b) { xxpermdi(d, a, b, 3); }
    4.27 +inline void Assembler::xxswapd( VectorSRegister d, VectorSRegister a)                    { xxpermdi(d, a, a, 2); }
    4.28  
    4.29  inline void Assembler::vpkpx(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKPX_OPCODE   | vrt(d) | vra(a) | vrb(b)); }
    4.30  inline void Assembler::vpkshss( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VPKSHSS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.31 @@ -673,6 +686,7 @@
    4.32  inline void Assembler::vaddubm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUBM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.33  inline void Assembler::vadduwm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUWM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.34  inline void Assembler::vadduhm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUHM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.35 +inline void Assembler::vaddudm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUDM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.36  inline void Assembler::vaddubs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUBS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.37  inline void Assembler::vadduws( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUWS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.38  inline void Assembler::vadduhs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUHS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
    4.39 @@ -749,6 +763,7 @@
    4.40  inline void Assembler::vandc(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VANDC_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
    4.41  inline void Assembler::vnor(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VNOR_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
    4.42  inline void Assembler::vor(     VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VOR_OPCODE      | vrt(d) | vra(a) | vrb(b)); }
    4.43 +inline void Assembler::vmr(     VectorRegister d, VectorRegister a)                   { emit_int32( VOR_OPCODE      | vrt(d) | vra(a) | vrb(a)); }
    4.44  inline void Assembler::vxor(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VXOR_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
    4.45  inline void Assembler::vrld(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VRLD_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
    4.46  inline void Assembler::vrlb(    VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VRLB_OPCODE     | vrt(d) | vra(a) | vrb(b)); }
     5.1 --- a/src/cpu/ppc/vm/register_ppc.cpp	Wed May 29 09:09:43 2019 +0100
     5.2 +++ b/src/cpu/ppc/vm/register_ppc.cpp	Wed Jun 05 05:15:56 2019 +0100
     5.3 @@ -81,8 +81,17 @@
     5.4      "VSR0",  "VSR1",  "VSR2",  "VSR3",  "VSR4",  "VSR5",  "VSR6",  "VSR7",
     5.5      "VSR8",  "VSR9",  "VSR10", "VSR11", "VSR12", "VSR13", "VSR14", "VSR15",
     5.6      "VSR16", "VSR17", "VSR18", "VSR19", "VSR20", "VSR21", "VSR22", "VSR23",
     5.7 -    "VSR24", "VSR25", "VSR26", "VSR27", "VSR28", "VSR29", "VSR30", "VSR31"
     5.8 +    "VSR24", "VSR25", "VSR26", "VSR27", "VSR28", "VSR29", "VSR30", "VSR31",
     5.9 +    "VSR32", "VSR33", "VSR34", "VSR35", "VSR36", "VSR37", "VSR38", "VSR39",
    5.10 +    "VSR40", "VSR41", "VSR42", "VSR43", "VSR44", "VSR45", "VSR46", "VSR47",
    5.11 +    "VSR48", "VSR49", "VSR50", "VSR51", "VSR52", "VSR53", "VSR54", "VSR55",
    5.12 +    "VSR56", "VSR57", "VSR58", "VSR59", "VSR60", "VSR61", "VSR62", "VSR63"
    5.13    };
    5.14    return is_valid() ? names[encoding()] : "vsnoreg";
    5.15  }
    5.16  
    5.17 +// Method to convert a VectorRegister to a Vector-Scalar Register (VectorSRegister)
    5.18 +VectorSRegister VectorRegisterImpl::to_vsr() const {
    5.19 +  if (this == vnoreg) { return vsnoregi; }
    5.20 +  return as_VectorSRegister(encoding() + 32);
    5.21 +}
     6.1 --- a/src/cpu/ppc/vm/register_ppc.hpp	Wed May 29 09:09:43 2019 +0100
     6.2 +++ b/src/cpu/ppc/vm/register_ppc.hpp	Wed Jun 05 05:15:56 2019 +0100
     6.3 @@ -399,6 +399,11 @@
     6.4    return (VectorRegister)(intptr_t)encoding;
     6.5  }
     6.6  
     6.7 +// Forward declaration
     6.8 +// Use VectorSRegister as a shortcut.
     6.9 +class VectorSRegisterImpl;
    6.10 +typedef VectorSRegisterImpl* VectorSRegister;
    6.11 +
    6.12  // The implementation of vector registers for the Power architecture
    6.13  class VectorRegisterImpl: public AbstractRegisterImpl {
    6.14   public:
    6.15 @@ -416,6 +421,9 @@
    6.16    bool is_valid()       const { return   0 <=  value()       &&  value() < number_of_registers; }
    6.17  
    6.18    const char* name() const;
    6.19 +
    6.20 +  // convert to VSR
    6.21 +  VectorSRegister to_vsr() const;
    6.22  };
    6.23  
    6.24  // The Vector registers of the Power architecture
    6.25 @@ -492,10 +500,6 @@
    6.26  #endif // DONT_USE_REGISTER_DEFINES
    6.27  
    6.28  
    6.29 -// Use VectorSRegister as a shortcut.
    6.30 -class VectorSRegisterImpl;
    6.31 -typedef VectorSRegisterImpl* VectorSRegister;
    6.32 -
    6.33  inline VectorSRegister as_VectorSRegister(int encoding) {
    6.34    return (VectorSRegister)(intptr_t)encoding;
    6.35  }
    6.36 @@ -504,7 +508,7 @@
    6.37  class VectorSRegisterImpl: public AbstractRegisterImpl {
    6.38   public:
    6.39    enum {
    6.40 -    number_of_registers = 32
    6.41 +    number_of_registers = 64
    6.42    };
    6.43  
    6.44    // construction
    6.45 @@ -555,6 +559,38 @@
    6.46  CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR29, (29));
    6.47  CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR30, (30));
    6.48  CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR31, (31));
    6.49 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR32, (32));
    6.50 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR33, (33));
    6.51 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR34, (34));
    6.52 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR35, (35));
    6.53 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR36, (36));
    6.54 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR37, (37));
    6.55 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR38, (38));
    6.56 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR39, (39));
    6.57 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR40, (40));
    6.58 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR41, (41));
    6.59 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR42, (42));
    6.60 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR43, (43));
    6.61 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR44, (44));
    6.62 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR45, (45));
    6.63 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR46, (46));
    6.64 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR47, (47));
    6.65 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR48, (48));
    6.66 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR49, (49));
    6.67 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR50, (50));
    6.68 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR51, (51));
    6.69 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR52, (52));
    6.70 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR53, (53));
    6.71 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR54, (54));
    6.72 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR55, (55));
    6.73 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR56, (56));
    6.74 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR57, (57));
    6.75 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR58, (58));
    6.76 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR59, (59));
    6.77 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR60, (60));
    6.78 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR61, (61));
    6.79 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR62, (62));
    6.80 +CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR63, (63));
    6.81  
    6.82  #ifndef DONT_USE_REGISTER_DEFINES
    6.83  #define vsnoregi ((VectorSRegister)(vsnoreg_VectorSRegisterEnumValue))
    6.84 @@ -590,6 +626,38 @@
    6.85  #define VSR29   ((VectorSRegister)(  VSR29_VectorSRegisterEnumValue))
    6.86  #define VSR30   ((VectorSRegister)(  VSR30_VectorSRegisterEnumValue))
    6.87  #define VSR31   ((VectorSRegister)(  VSR31_VectorSRegisterEnumValue))
    6.88 +#define VSR32   ((VectorSRegister)(  VSR32_VectorSRegisterEnumValue))
    6.89 +#define VSR33   ((VectorSRegister)(  VSR33_VectorSRegisterEnumValue))
    6.90 +#define VSR34   ((VectorSRegister)(  VSR34_VectorSRegisterEnumValue))
    6.91 +#define VSR35   ((VectorSRegister)(  VSR35_VectorSRegisterEnumValue))
    6.92 +#define VSR36   ((VectorSRegister)(  VSR36_VectorSRegisterEnumValue))
    6.93 +#define VSR37   ((VectorSRegister)(  VSR37_VectorSRegisterEnumValue))
    6.94 +#define VSR38   ((VectorSRegister)(  VSR38_VectorSRegisterEnumValue))
    6.95 +#define VSR39   ((VectorSRegister)(  VSR39_VectorSRegisterEnumValue))
    6.96 +#define VSR40   ((VectorSRegister)(  VSR40_VectorSRegisterEnumValue))
    6.97 +#define VSR41   ((VectorSRegister)(  VSR41_VectorSRegisterEnumValue))
    6.98 +#define VSR42   ((VectorSRegister)(  VSR42_VectorSRegisterEnumValue))
    6.99 +#define VSR43   ((VectorSRegister)(  VSR43_VectorSRegisterEnumValue))
   6.100 +#define VSR44   ((VectorSRegister)(  VSR44_VectorSRegisterEnumValue))
   6.101 +#define VSR45   ((VectorSRegister)(  VSR45_VectorSRegisterEnumValue))
   6.102 +#define VSR46   ((VectorSRegister)(  VSR46_VectorSRegisterEnumValue))
   6.103 +#define VSR47   ((VectorSRegister)(  VSR47_VectorSRegisterEnumValue))
   6.104 +#define VSR48   ((VectorSRegister)(  VSR48_VectorSRegisterEnumValue))
   6.105 +#define VSR49   ((VectorSRegister)(  VSR49_VectorSRegisterEnumValue))
   6.106 +#define VSR50   ((VectorSRegister)(  VSR50_VectorSRegisterEnumValue))
   6.107 +#define VSR51   ((VectorSRegister)(  VSR51_VectorSRegisterEnumValue))
   6.108 +#define VSR52   ((VectorSRegister)(  VSR52_VectorSRegisterEnumValue))
   6.109 +#define VSR53   ((VectorSRegister)(  VSR53_VectorSRegisterEnumValue))
   6.110 +#define VSR54   ((VectorSRegister)(  VSR54_VectorSRegisterEnumValue))
   6.111 +#define VSR55   ((VectorSRegister)(  VSR55_VectorSRegisterEnumValue))
   6.112 +#define VSR56   ((VectorSRegister)(  VSR56_VectorSRegisterEnumValue))
   6.113 +#define VSR57   ((VectorSRegister)(  VSR57_VectorSRegisterEnumValue))
   6.114 +#define VSR58   ((VectorSRegister)(  VSR58_VectorSRegisterEnumValue))
   6.115 +#define VSR59   ((VectorSRegister)(  VSR59_VectorSRegisterEnumValue))
   6.116 +#define VSR60   ((VectorSRegister)(  VSR60_VectorSRegisterEnumValue))
   6.117 +#define VSR61   ((VectorSRegister)(  VSR61_VectorSRegisterEnumValue))
   6.118 +#define VSR62   ((VectorSRegister)(  VSR62_VectorSRegisterEnumValue))
   6.119 +#define VSR63   ((VectorSRegister)(  VSR63_VectorSRegisterEnumValue))
   6.120  #endif // DONT_USE_REGISTER_DEFINES
   6.121  
   6.122  // Maximum number of incoming arguments that can be passed in i registers.
   6.123 @@ -610,7 +678,7 @@
   6.124        * 2                                          // register halves
   6.125        + ConditionRegisterImpl::number_of_registers // condition code registers
   6.126        + SpecialRegisterImpl::number_of_registers   // special registers
   6.127 -      + VectorRegisterImpl::number_of_registers    // vector registers
   6.128 +      + VectorRegisterImpl::number_of_registers    // VSX registers
   6.129    };
   6.130  
   6.131    static const int max_gpr;
     7.1 --- a/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed May 29 09:09:43 2019 +0100
     7.2 +++ b/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed Jun 05 05:15:56 2019 +0100
     7.3 @@ -1228,8 +1228,8 @@
     7.4        __ bind(l_10);
     7.5        // Use loop with VSX load/store instructions to
     7.6        // copy 32 elements a time.
     7.7 -      __ lxvd2x(tmp_vsr1, 0, R3_ARG1);     // Load src
     7.8 -      __ stxvd2x(tmp_vsr1, 0, R4_ARG2);    // Store to dst
     7.9 +      __ lxvd2x(tmp_vsr1, R3_ARG1);        // Load src
    7.10 +      __ stxvd2x(tmp_vsr1, R4_ARG2);       // Store to dst
    7.11        __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1);  // Load src + 16
    7.12        __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
    7.13        __ addi(R3_ARG1, R3_ARG1, 32);       // Update src+=32
    7.14 @@ -1496,8 +1496,8 @@
    7.15          __ bind(l_9);
    7.16          // Use loop with VSX load/store instructions to
    7.17          // copy 16 elements a time.
    7.18 -        __ lxvd2x(tmp_vsr1, 0, R3_ARG1);     // Load from src.
    7.19 -        __ stxvd2x(tmp_vsr1, 0, R4_ARG2);    // Store to dst.
    7.20 +        __ lxvd2x(tmp_vsr1, R3_ARG1);        // Load from src.
    7.21 +        __ stxvd2x(tmp_vsr1, R4_ARG2);       // Store to dst.
    7.22          __ lxvd2x(tmp_vsr2, R3_ARG1, tmp1);  // Load from src + 16.
    7.23          __ stxvd2x(tmp_vsr2, R4_ARG2, tmp1); // Store to dst + 16.
    7.24          __ addi(R3_ARG1, R3_ARG1, 32);       // Update src+=32.
    7.25 @@ -1690,8 +1690,8 @@
    7.26        __ bind(l_7);
    7.27        // Use loop with VSX load/store instructions to
    7.28        // copy 8 elements a time.
    7.29 -      __ lxvd2x(tmp_vsr1, 0, R3_ARG1);     // Load src
    7.30 -      __ stxvd2x(tmp_vsr1, 0, R4_ARG2);    // Store to dst
    7.31 +      __ lxvd2x(tmp_vsr1, R3_ARG1);        // Load src
    7.32 +      __ stxvd2x(tmp_vsr1, R4_ARG2);       // Store to dst
    7.33        __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1);  // Load src + 16
    7.34        __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
    7.35        __ addi(R3_ARG1, R3_ARG1, 32);       // Update src+=32
    7.36 @@ -1756,13 +1756,16 @@
    7.37      // Do reverse copy.  We assume the case of actual overlap is rare enough
    7.38      // that we don't have to optimize it.
    7.39  
    7.40 -    Label l_1, l_2, l_3, l_4, l_5, l_6;
    7.41 +    Label l_1, l_2, l_3, l_4, l_5, l_6, l_7;
    7.42  
    7.43      Register tmp1 = R6_ARG4;
    7.44      Register tmp2 = R7_ARG5;
    7.45      Register tmp3 = R8_ARG6;
    7.46      Register tmp4 = R0;
    7.47  
    7.48 +    VectorSRegister tmp_vsr1  = VSR1;
    7.49 +    VectorSRegister tmp_vsr2  = VSR2;
    7.50 +
    7.51      { // FasterArrayCopy
    7.52        __ cmpwi(CCR0, R5_ARG3, 0);
    7.53        __ beq(CCR0, l_6);
    7.54 @@ -1772,6 +1775,25 @@
    7.55        __ add(R4_ARG2, R4_ARG2, R5_ARG3);
    7.56        __ srdi(R5_ARG3, R5_ARG3, 2);
    7.57  
    7.58 +      if (!aligned) {
    7.59 +        // check if arrays have same alignment mod 8.
    7.60 +        __ xorr(tmp1, R3_ARG1, R4_ARG2);
    7.61 +        __ andi_(R0, tmp1, 7);
    7.62 +        // Not the same alignment, but ld and std just need to be 4 byte aligned.
    7.63 +        __ bne(CCR0, l_7); // to OR from is 8 byte aligned -> copy 2 at a time
    7.64 +
    7.65 +        // copy 1 element to align to and from on an 8 byte boundary
    7.66 +        __ andi_(R0, R3_ARG1, 7);
    7.67 +        __ beq(CCR0, l_7);
    7.68 +
    7.69 +        __ addi(R3_ARG1, R3_ARG1, -4);
    7.70 +        __ addi(R4_ARG2, R4_ARG2, -4);
    7.71 +        __ addi(R5_ARG3, R5_ARG3, -1);
    7.72 +        __ lwzx(tmp2, R3_ARG1);
    7.73 +        __ stwx(tmp2, R4_ARG2);
    7.74 +        __ bind(l_7);
    7.75 +      }
    7.76 +
    7.77        __ cmpwi(CCR0, R5_ARG3, 7);
    7.78        __ ble(CCR0, l_5); // copy 1 at a time if less than 8 elements remain
    7.79  
    7.80 @@ -1779,6 +1801,7 @@
    7.81        __ andi(R5_ARG3, R5_ARG3, 7);
    7.82        __ mtctr(tmp1);
    7.83  
    7.84 +     if (!VM_Version::has_vsx()) {
    7.85        __ bind(l_4);
    7.86        // Use unrolled version for mass copying (copy 4 elements a time).
    7.87        // Load feeding store gets zero latency on Power6, however not on Power5.
    7.88 @@ -1794,6 +1817,40 @@
    7.89        __ std(tmp2, 8, R4_ARG2);
    7.90        __ std(tmp1, 0, R4_ARG2);
    7.91        __ bdnz(l_4);
    7.92 +     } else {  // Processor supports VSX, so use it to mass copy.
    7.93 +      // Prefetch the data into the L2 cache.
    7.94 +      __ dcbt(R3_ARG1, 0);
    7.95 +
    7.96 +      // If supported set DSCR pre-fetch to deepest.
    7.97 +      if (VM_Version::has_mfdscr()) {
    7.98 +        __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
    7.99 +        __ mtdscr(tmp2);
   7.100 +      }
   7.101 +
   7.102 +      __ li(tmp1, 16);
   7.103 +
   7.104 +      // Backbranch target aligned to 32-byte. Not 16-byte align as
   7.105 +      // loop contains < 8 instructions that fit inside a single
   7.106 +      // i-cache sector.
   7.107 +      __ align(32);
   7.108 +
   7.109 +      __ bind(l_4);
   7.110 +      // Use loop with VSX load/store instructions to
   7.111 +      // copy 8 elements a time.
   7.112 +      __ addi(R3_ARG1, R3_ARG1, -32);      // Update src-=32
   7.113 +      __ addi(R4_ARG2, R4_ARG2, -32);      // Update dsc-=32
   7.114 +      __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1);  // Load src+16
   7.115 +      __ lxvd2x(tmp_vsr1, R3_ARG1);        // Load src
   7.116 +      __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst+16
   7.117 +      __ stxvd2x(tmp_vsr1, R4_ARG2);       // Store to dst
   7.118 +      __ bdnz(l_4);
   7.119 +
   7.120 +      // Restore DSCR pre-fetch value.
   7.121 +      if (VM_Version::has_mfdscr()) {
   7.122 +        __ load_const_optimized(tmp2, VM_Version::_dscr_val);
   7.123 +        __ mtdscr(tmp2);
   7.124 +      }
   7.125 +     }
   7.126  
   7.127        __ cmpwi(CCR0, R5_ARG3, 0);
   7.128        __ beq(CCR0, l_6);
   7.129 @@ -1908,8 +1965,8 @@
   7.130        __ bind(l_5);
   7.131        // Use loop with VSX load/store instructions to
   7.132        // copy 4 elements a time.
   7.133 -      __ lxvd2x(tmp_vsr1, 0, R3_ARG1);     // Load src
   7.134 -      __ stxvd2x(tmp_vsr1, 0, R4_ARG2);    // Store to dst
   7.135 +      __ lxvd2x(tmp_vsr1, R3_ARG1);        // Load src
   7.136 +      __ stxvd2x(tmp_vsr1, R4_ARG2);       // Store to dst
   7.137        __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1);  // Load src + 16
   7.138        __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst + 16
   7.139        __ addi(R3_ARG1, R3_ARG1, 32);       // Update src+=32
   7.140 @@ -1976,6 +2033,9 @@
   7.141      Register tmp3 = R8_ARG6;
   7.142      Register tmp4 = R0;
   7.143  
   7.144 +    VectorSRegister tmp_vsr1  = VSR1;
   7.145 +    VectorSRegister tmp_vsr2  = VSR2;
   7.146 +
   7.147      Label l_1, l_2, l_3, l_4, l_5;
   7.148  
   7.149      __ cmpwi(CCR0, R5_ARG3, 0);
   7.150 @@ -1994,6 +2054,7 @@
   7.151        __ andi(R5_ARG3, R5_ARG3, 3);
   7.152        __ mtctr(tmp1);
   7.153  
   7.154 +     if (!VM_Version::has_vsx()) {
   7.155        __ bind(l_4);
   7.156        // Use unrolled version for mass copying (copy 4 elements a time).
   7.157        // Load feeding store gets zero latency on Power6, however not on Power5.
   7.158 @@ -2009,6 +2070,40 @@
   7.159        __ std(tmp2, 8, R4_ARG2);
   7.160        __ std(tmp1, 0, R4_ARG2);
   7.161        __ bdnz(l_4);
   7.162 +     } else { // Processor supports VSX, so use it to mass copy.
   7.163 +      // Prefetch the data into the L2 cache.
   7.164 +      __ dcbt(R3_ARG1, 0);
   7.165 +
   7.166 +      // If supported set DSCR pre-fetch to deepest.
   7.167 +      if (VM_Version::has_mfdscr()) {
   7.168 +        __ load_const_optimized(tmp2, VM_Version::_dscr_val | 7);
   7.169 +        __ mtdscr(tmp2);
   7.170 +      }
   7.171 +
   7.172 +      __ li(tmp1, 16);
   7.173 +
   7.174 +      // Backbranch target aligned to 32-byte. Not 16-byte align as
   7.175 +      // loop contains < 8 instructions that fit inside a single
   7.176 +      // i-cache sector.
   7.177 +      __ align(32);
   7.178 +
   7.179 +      __ bind(l_4);
   7.180 +      // Use loop with VSX load/store instructions to
   7.181 +      // copy 4 elements a time.
   7.182 +      __ addi(R3_ARG1, R3_ARG1, -32);      // Update src-=32
   7.183 +      __ addi(R4_ARG2, R4_ARG2, -32);      // Update dsc-=32
   7.184 +      __ lxvd2x(tmp_vsr2, tmp1, R3_ARG1);  // Load src+16
   7.185 +      __ lxvd2x(tmp_vsr1, R3_ARG1);        // Load src
   7.186 +      __ stxvd2x(tmp_vsr2, tmp1, R4_ARG2); // Store to dst+16
   7.187 +      __ stxvd2x(tmp_vsr1, R4_ARG2);       // Store to dst
   7.188 +      __ bdnz(l_4);
   7.189 +
   7.190 +      // Restore DSCR pre-fetch value.
   7.191 +      if (VM_Version::has_mfdscr()) {
   7.192 +        __ load_const_optimized(tmp2, VM_Version::_dscr_val);
   7.193 +        __ mtdscr(tmp2);
   7.194 +      }
   7.195 +     }
   7.196  
   7.197        __ cmpwi(CCR0, R5_ARG3, 0);
   7.198        __ beq(CCR0, l_1);
     8.1 --- a/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed May 29 09:09:43 2019 +0100
     8.2 +++ b/src/cpu/ppc/vm/vm_version_ppc.cpp	Wed Jun 05 05:15:56 2019 +0100
     8.3 @@ -502,7 +502,7 @@
     8.4    a->vcipher(VR0, VR1, VR2);                   // code[11] -> vcipher
     8.5    a->vpmsumb(VR0, VR1, VR2);                   // code[12] -> vpmsumb
     8.6    a->mfdscr(R0);                               // code[13] -> mfdscr
     8.7 -  a->lxvd2x(VSR0, 0, R3_ARG1);                 // code[14] -> vsx
     8.8 +  a->lxvd2x(VSR0, R3_ARG1);                    // code[14] -> vsx
     8.9    a->blr();
    8.10  
    8.11    // Emit function to set one cache line to zero. Emit function descriptor and get pointer to it.
     9.1 --- a/src/share/vm/compiler/compileBroker.cpp	Wed May 29 09:09:43 2019 +0100
     9.2 +++ b/src/share/vm/compiler/compileBroker.cpp	Wed Jun 05 05:15:56 2019 +0100
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -751,7 +751,9 @@
    9.11      No_Safepoint_Verifier nsv;
    9.12      task = CompilationPolicy::policy()->select_task(this);
    9.13    }
    9.14 -  remove(task);
    9.15 +  if (task != NULL) {
    9.16 +    remove(task);
    9.17 +  }
    9.18    purge_stale_tasks(); // may temporarily release MCQ lock
    9.19    return task;
    9.20  }
    10.1 --- a/src/share/vm/compiler/compileBroker.hpp	Wed May 29 09:09:43 2019 +0100
    10.2 +++ b/src/share/vm/compiler/compileBroker.hpp	Wed Jun 05 05:15:56 2019 +0100
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -339,7 +339,6 @@
   10.11  
   10.12    static CompilerThread* make_compiler_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, TRAPS);
   10.13    static void init_compiler_threads(int c1_compiler_count, int c2_compiler_count);
   10.14 -  static bool compilation_is_complete  (methodHandle method, int osr_bci, int comp_level);
   10.15    static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
   10.16    static bool is_compile_blocking      ();
   10.17    static void preload_classes          (methodHandle method, TRAPS);
   10.18 @@ -389,6 +388,7 @@
   10.19      return NULL;
   10.20    }
   10.21  
   10.22 +  static bool compilation_is_complete(methodHandle method, int osr_bci, int comp_level);
   10.23    static bool compilation_is_in_queue(methodHandle method);
   10.24    static int queue_size(int comp_level) {
   10.25      CompileQueue *q = compile_queue(comp_level);
    11.1 --- a/src/share/vm/oops/instanceKlass.cpp	Wed May 29 09:09:43 2019 +0100
    11.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Wed Jun 05 05:15:56 2019 +0100
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -2925,6 +2925,13 @@
   11.11  
   11.12  // On-stack replacement stuff
   11.13  void InstanceKlass::add_osr_nmethod(nmethod* n) {
   11.14 +#ifndef PRODUCT
   11.15 +  if (TieredCompilation) {
   11.16 +      nmethod * prev = lookup_osr_nmethod(n->method(), n->osr_entry_bci(), n->comp_level(), true);
   11.17 +      assert(prev == NULL || !prev->is_in_use(),
   11.18 +      "redundunt OSR recompilation detected. memory leak in CodeCache!");
   11.19 +  }
   11.20 +#endif
   11.21    // only one compilation can be active
   11.22    NEEDS_CLEANUP
   11.23    // This is a short non-blocking critical region, so the no safepoint check is ok.
   11.24 @@ -3046,7 +3053,9 @@
   11.25      osr = osr->osr_link();
   11.26    }
   11.27    OsrList_lock->unlock();
   11.28 -  if (best != NULL && best->comp_level() >= comp_level && match_level == false) {
   11.29 +
   11.30 +  assert(match_level == false || best == NULL, "shouldn't pick up anything if match_level is set");
   11.31 +  if (best != NULL && best->comp_level() >= comp_level) {
   11.32      return best;
   11.33    }
   11.34    return NULL;
    12.1 --- a/src/share/vm/opto/memnode.cpp	Wed May 29 09:09:43 2019 +0100
    12.2 +++ b/src/share/vm/opto/memnode.cpp	Wed Jun 05 05:15:56 2019 +0100
    12.3 @@ -3353,9 +3353,6 @@
    12.4  // within the initialized memory.
    12.5  intptr_t InitializeNode::can_capture_store(StoreNode* st, PhaseTransform* phase, bool can_reshape) {
    12.6    const int FAIL = 0;
    12.7 -  if (st->is_unaligned_access()) {
    12.8 -    return FAIL;
    12.9 -  }
   12.10    if (st->req() != MemNode::ValueIn + 1)
   12.11      return FAIL;                // an inscrutable StoreNode (card mark?)
   12.12    Node* ctl = st->in(MemNode::Control);
   12.13 @@ -3371,6 +3368,10 @@
   12.14      return FAIL;                // inscrutable address
   12.15    if (alloc != allocation())
   12.16      return FAIL;                // wrong allocation!  (store needs to float up)
   12.17 +  int size_in_bytes = st->memory_size();
   12.18 +  if ((size_in_bytes != 0) && (offset % size_in_bytes) != 0) {
   12.19 +    return FAIL;                // mismatched access
   12.20 +  }
   12.21    Node* val = st->in(MemNode::ValueIn);
   12.22    int complexity_count = 0;
   12.23    if (!detect_init_independence(val, complexity_count))
    13.1 --- a/src/share/vm/prims/whitebox.cpp	Wed May 29 09:09:43 2019 +0100
    13.2 +++ b/src/share/vm/prims/whitebox.cpp	Wed Jun 05 05:15:56 2019 +0100
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -633,6 +633,25 @@
   13.11    }
   13.12  WB_END
   13.13  
   13.14 +WB_ENTRY(void, WB_MarkMethodProfiled(JNIEnv* env, jobject o, jobject method))
   13.15 +  jmethodID jmid = reflected_method_to_jmid(thread, env, method);
   13.16 +  CHECK_JNI_EXCEPTION(env);
   13.17 +  methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
   13.18 +
   13.19 +  MethodData* mdo = mh->method_data();
   13.20 +  if (mdo == NULL) {
   13.21 +    Method::build_interpreter_method_data(mh, CHECK_AND_CLEAR);
   13.22 +    mdo = mh->method_data();
   13.23 +  }
   13.24 +  mdo->init();
   13.25 +  InvocationCounter* icnt = mdo->invocation_counter();
   13.26 +  InvocationCounter* bcnt = mdo->backedge_counter();
   13.27 +  // set i-counter according to AdvancedThresholdPolicy::is_method_profiled
   13.28 +  // because SimpleThresholdPolicy::call_predicate_helper uses > in jdk8u, that's why we need to plus one.
   13.29 +  icnt->set(InvocationCounter::wait_for_compile, Tier4MinInvocationThreshold + 1);
   13.30 +  bcnt->set(InvocationCounter::wait_for_compile, Tier4CompileThreshold + 1);
   13.31 +WB_END
   13.32 +
   13.33  template <typename T>
   13.34  static bool GetVMFlag(JavaThread* thread, JNIEnv* env, jstring name, T* value, bool (*TAt)(const char*, T*)) {
   13.35    if (name == NULL) {
   13.36 @@ -848,19 +867,23 @@
   13.37    ThreadToNativeFromVM ttn(thread);
   13.38    jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
   13.39    CHECK_JNI_EXCEPTION_(env, NULL);
   13.40 -  result = env->NewObjectArray(2, clazz, NULL);
   13.41 +  result = env->NewObjectArray(3, clazz, NULL);
   13.42    if (result == NULL) {
   13.43      return result;
   13.44    }
   13.45  
   13.46 -  jobject obj = integerBox(thread, env, code->comp_level());
   13.47 +  jobject level = integerBox(thread, env, code->comp_level());
   13.48    CHECK_JNI_EXCEPTION_(env, NULL);
   13.49 -  env->SetObjectArrayElement(result, 0, obj);
   13.50 +  env->SetObjectArrayElement(result, 0, level);
   13.51 +
   13.52 +  jobject id = integerBox(thread, env, code->compile_id());
   13.53 +  CHECK_JNI_EXCEPTION_(env, NULL);
   13.54 +  env->SetObjectArrayElement(result, 1, id);
   13.55  
   13.56    jbyteArray insts = env->NewByteArray(insts_size);
   13.57    CHECK_JNI_EXCEPTION_(env, NULL);
   13.58    env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
   13.59 -  env->SetObjectArrayElement(result, 1, insts);
   13.60 +  env->SetObjectArrayElement(result, 2, insts);
   13.61  
   13.62    return result;
   13.63  WB_END
   13.64 @@ -1119,6 +1142,8 @@
   13.65        CC"(Ljava/lang/reflect/Executable;II)Z",        (void*)&WB_EnqueueMethodForCompilation},
   13.66    {CC"clearMethodState",
   13.67        CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
   13.68 +  {CC"markMethodProfiled",
   13.69 +      CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_MarkMethodProfiled},
   13.70    {CC"setBooleanVMFlag",   CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
   13.71    {CC"setIntxVMFlag",      CC"(Ljava/lang/String;J)V",(void*)&WB_SetIntxVMFlag},
   13.72    {CC"setUintxVMFlag",     CC"(Ljava/lang/String;J)V",(void*)&WB_SetUintxVMFlag},
    14.1 --- a/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed May 29 09:09:43 2019 +0100
    14.2 +++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed Jun 05 05:15:56 2019 +0100
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -196,6 +196,16 @@
   14.11  
   14.12    if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
   14.13        && is_method_profiled(max_method)) {
   14.14 +
   14.15 +    if (CompileBroker::compilation_is_complete(max_method, max_task->osr_bci(), CompLevel_limited_profile)) {
   14.16 +      if (PrintTieredEvents) {
   14.17 +        print_event(REMOVE_FROM_QUEUE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level());
   14.18 +      }
   14.19 +      compile_queue->remove_and_mark_stale(max_task);
   14.20 +      max_method->clear_queued_for_compilation();
   14.21 +      return NULL;
   14.22 +    }
   14.23 +
   14.24      max_task->set_comp_level(CompLevel_limited_profile);
   14.25      if (PrintTieredEvents) {
   14.26        print_event(UPDATE_IN_QUEUE, max_method, max_method, max_task->osr_bci(), (CompLevel)max_task->comp_level());
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/compiler/c2/Test8202414.java	Wed Jun 05 05:15:56 2019 +0100
    15.3 @@ -0,0 +1,117 @@
    15.4 +/*
    15.5 + * Copyright (c) 2019, Huawei Technologies Co. Ltd. All rights reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.
   15.11 + *
   15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 + * version 2 for more details (a copy is included in the LICENSE file that
   15.16 + * accompanied this code).
   15.17 + *
   15.18 + * You should have received a copy of the GNU General Public License version
   15.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 + *
   15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   15.23 + * or visit www.oracle.com if you need additional information or have any
   15.24 + * questions.
   15.25 + */
   15.26 +
   15.27 +/**
   15.28 + * @test
   15.29 + * @bug 8202414
   15.30 + * @summary Unsafe write after primitive array creation may result in array length change
   15.31 + * @requires (os.arch != "sparc") & (os.arch != "sparcv9")
   15.32 + * @run main/othervm compiler.c2.Test8202414
   15.33 + */
   15.34 +
   15.35 +package compiler.c2;
   15.36 +
   15.37 +import sun.misc.Unsafe;
   15.38 +import java.lang.reflect.Field;
   15.39 +import java.security.AccessController;
   15.40 +import java.security.PrivilegedAction;
   15.41 +
   15.42 +public class Test8202414 {
   15.43 +
   15.44 +    public static void main(String[] args) {
   15.45 +        System.err.close();
   15.46 +        int count = 0;
   15.47 +        while (count++ < 120000) {
   15.48 +          test();
   15.49 +        }
   15.50 +    }
   15.51 +
   15.52 +    public static void test() {
   15.53 +        byte[] newBufb = serByte(397);
   15.54 +        short[] newBufs = serShort(397);
   15.55 +        int[] newBufi = serInt(397);
   15.56 +        long[] newBufl = serLong(397);
   15.57 +        if (newBufb.length != 397 || newBufs.length != 397
   15.58 +            || newBufi.length != 397 || newBufl.length != 397) {
   15.59 +            System.out.println("array length internal error");
   15.60 +            throw new RuntimeException("Test failed");
   15.61 +        }
   15.62 +
   15.63 +    }
   15.64 +
   15.65 +    public static byte[] serByte(int bufLen) {
   15.66 +        byte[] buf = new byte[bufLen];
   15.67 +        THE_UNSAFE.putByte(buf, BYTE_ARRAY_BASE_OFFSET + 1, (byte) buf.length);
   15.68 +        System.err.println("ref " + buf);
   15.69 +        return buf;
   15.70 +    }
   15.71 +
   15.72 +    public static short[] serShort(int bufLen) {
   15.73 +        short[] buf = new short[bufLen];
   15.74 +        THE_UNSAFE.putShort(buf, SHORT_ARRAY_BASE_OFFSET + 1, (short) buf.length);
   15.75 +        System.err.println("ref " + buf);
   15.76 +        return buf;
   15.77 +    }
   15.78 +
   15.79 +    public static int[] serInt(int bufLen) {
   15.80 +        int[] buf = new int[bufLen];
   15.81 +        THE_UNSAFE.putInt(buf, INT_ARRAY_BASE_OFFSET + 1, buf.length);
   15.82 +        System.err.println("ref " + buf);
   15.83 +        return buf;
   15.84 +    }
   15.85 +
   15.86 +    public static long[] serLong(int bufLen) {
   15.87 +        long[] buf = new long[bufLen];
   15.88 +        THE_UNSAFE.putLong(buf, LONG_ARRAY_BASE_OFFSET + 1, buf.length);
   15.89 +        System.err.println("ref " + buf);
   15.90 +        return buf;
   15.91 +    }
   15.92 +
   15.93 +    /* Unsafe fields and initialization
   15.94 +     */
   15.95 +    static final Unsafe THE_UNSAFE;
   15.96 +    static final long BYTE_ARRAY_BASE_OFFSET;
   15.97 +    static final long SHORT_ARRAY_BASE_OFFSET;
   15.98 +    static final long INT_ARRAY_BASE_OFFSET;
   15.99 +    static final long LONG_ARRAY_BASE_OFFSET;
  15.100 +    static {
  15.101 +        THE_UNSAFE = (Unsafe) AccessController.doPrivileged (
  15.102 +            new PrivilegedAction<Object>() {
  15.103 +                @Override
  15.104 +                public Object run() {
  15.105 +                    try {
  15.106 +                        Field f = Unsafe.class.getDeclaredField("theUnsafe");
  15.107 +                        f.setAccessible(true);
  15.108 +                        return f.get(null);
  15.109 +                    } catch (NoSuchFieldException | IllegalAccessException e) {
  15.110 +                        throw new Error();
  15.111 +                    }
  15.112 +                }
  15.113 +            }
  15.114 +        );
  15.115 +        BYTE_ARRAY_BASE_OFFSET = THE_UNSAFE.arrayBaseOffset(byte[].class);
  15.116 +        SHORT_ARRAY_BASE_OFFSET = THE_UNSAFE.arrayBaseOffset(short[].class);
  15.117 +        INT_ARRAY_BASE_OFFSET = THE_UNSAFE.arrayBaseOffset(int[].class);
  15.118 +        LONG_ARRAY_BASE_OFFSET = THE_UNSAFE.arrayBaseOffset(long[].class);
  15.119 +    }
  15.120 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/compiler/tiered/ConstantGettersTransitionsTest.java	Wed Jun 05 05:15:56 2019 +0100
    16.3 @@ -0,0 +1,193 @@
    16.4 +/*
    16.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.
   16.11 + *
   16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 + * version 2 for more details (a copy is included in the LICENSE file that
   16.16 + * accompanied this code).
   16.17 + *
   16.18 + * You should have received a copy of the GNU General Public License version
   16.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 + *
   16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   16.23 + * or visit www.oracle.com if you need additional information or have any
   16.24 + * questions.
   16.25 + */
   16.26 +
   16.27 +import java.lang.reflect.Executable;
   16.28 +import java.util.concurrent.Callable;
   16.29 +
   16.30 +/**
   16.31 + * @test ConstantGettersTransitionsTest
   16.32 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
   16.33 + * @build TransitionsTestExecutor ConstantGettersTransitionsTest
   16.34 + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
   16.35 + * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
   16.36 + *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
   16.37 + *                   -XX:CompileCommand=compileonly,ConstantGettersTestCase$TrivialMethods::*
   16.38 + *                   TransitionsTestExecutor ConstantGettersTransitionsTest
   16.39 + * @summary Test the correctness of compilation level transitions for constant getters methods
   16.40 + */
   16.41 +public class ConstantGettersTransitionsTest extends LevelTransitionTest {
   16.42 +    public static void main(String[] args) {
   16.43 +        assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
   16.44 +
   16.45 +        // run test cases
   16.46 +        for (TestCase testCase : ConstantGettersTestCase.values()) {
   16.47 +            new ConstantGettersTransitionsTest(testCase).runTest();
   16.48 +        }
   16.49 +    }
   16.50 +
   16.51 +    @Override
   16.52 +    protected boolean isTrivial() {
   16.53 +        return true;
   16.54 +    }
   16.55 +
   16.56 +    private ConstantGettersTransitionsTest(TestCase testCase) {
   16.57 +        super(testCase);
   16.58 +    }
   16.59 +}
   16.60 +
   16.61 +enum ConstantGettersTestCase implements CompilerWhiteBoxTest.TestCase {
   16.62 +    ICONST_M1,
   16.63 +    ICONST_0,
   16.64 +    ICONST_1,
   16.65 +    ICONST_2,
   16.66 +    ICONST_3,
   16.67 +    ICONST_4,
   16.68 +    ICONST_5,
   16.69 +    LCONST_0,
   16.70 +    LCONST_1,
   16.71 +    FCONST_0,
   16.72 +    FCONST_1,
   16.73 +    FCONST_2,
   16.74 +    DCONST_0,
   16.75 +    DCONST_1,
   16.76 +    DCONST_W,
   16.77 +    BYTE,
   16.78 +    SHORT,
   16.79 +    CHAR;
   16.80 +
   16.81 +    private final Executable executable;
   16.82 +    private final Callable<Integer> callable;
   16.83 +
   16.84 +    @Override
   16.85 +    public Executable getExecutable() {
   16.86 +        return executable;
   16.87 +    }
   16.88 +
   16.89 +    @Override
   16.90 +    public Callable<Integer> getCallable() {
   16.91 +        return callable;
   16.92 +    }
   16.93 +
   16.94 +    @Override
   16.95 +    public boolean isOsr() {
   16.96 +        return false;
   16.97 +    }
   16.98 +
   16.99 +    private ConstantGettersTestCase() {
  16.100 +        String name = "make" + this.name();
  16.101 +        this.executable = LevelTransitionTest.Helper.getMethod(TrivialMethods.class, name);
  16.102 +        this.callable = LevelTransitionTest.Helper.getCallable(new TrivialMethods(), name);
  16.103 +    }
  16.104 +
  16.105 +    /**
  16.106 +     * Contains methods that load constants with certain types of bytecodes
  16.107 +     * See JVMS 2.11.2. Load and Store Instructions
  16.108 +     * Note that it doesn't have a method for ldc_w instruction
  16.109 +     */
  16.110 +    private static class TrivialMethods {
  16.111 +        public static int makeICONST_M1() {
  16.112 +            return -1;
  16.113 +        }
  16.114 +
  16.115 +        public static int makeICONST_0() {
  16.116 +            return 0;
  16.117 +        }
  16.118 +
  16.119 +        public static int makeICONST_1() {
  16.120 +            return 1;
  16.121 +        }
  16.122 +
  16.123 +        public static int makeICONST_2() {
  16.124 +            return 2;
  16.125 +        }
  16.126 +
  16.127 +        public static int makeICONST_3() {
  16.128 +            return 3;
  16.129 +        }
  16.130 +
  16.131 +        public static int makeICONST_4() {
  16.132 +            return 4;
  16.133 +        }
  16.134 +
  16.135 +        public static int makeICONST_5() {
  16.136 +            return 5;
  16.137 +        }
  16.138 +
  16.139 +        public static long makeLCONST_0() {
  16.140 +            return 0L;
  16.141 +        }
  16.142 +
  16.143 +        public static long makeLCONST_1() {
  16.144 +            return 1L;
  16.145 +        }
  16.146 +
  16.147 +        public static float makeFCONST_0() {
  16.148 +            return 0F;
  16.149 +        }
  16.150 +
  16.151 +        public static float makeFCONST_1() {
  16.152 +            return 1F;
  16.153 +        }
  16.154 +
  16.155 +        public static float makeFCONST_2() {
  16.156 +            return 2F;
  16.157 +        }
  16.158 +
  16.159 +        public static double makeDCONST_0() {
  16.160 +            return 0D;
  16.161 +        }
  16.162 +
  16.163 +        public static double makeDCONST_1() {
  16.164 +            return 1D;
  16.165 +        }
  16.166 +
  16.167 +        public static double makeDCONST_W() {
  16.168 +            // ldc2_w
  16.169 +            return Double.MAX_VALUE;
  16.170 +        }
  16.171 +
  16.172 +        public static Object makeOBJECT() {
  16.173 +            // aconst_null
  16.174 +            return null;
  16.175 +        }
  16.176 +
  16.177 +        public static byte makeBYTE() {
  16.178 +            // bipush
  16.179 +            return (byte) 0x7F;
  16.180 +        }
  16.181 +
  16.182 +        public static short makeSHORT() {
  16.183 +            // sipush
  16.184 +            return (short) 0x7FFF;
  16.185 +        }
  16.186 +
  16.187 +        public static char makeCHAR() {
  16.188 +            // ldc
  16.189 +            return (char) 0xFFFF;
  16.190 +        }
  16.191 +
  16.192 +        public static boolean makeBOOLEAN() {
  16.193 +            return true;
  16.194 +        }
  16.195 +    }
  16.196 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/compiler/tiered/Level2RecompilationTest.java	Wed Jun 05 05:15:56 2019 +0100
    17.3 @@ -0,0 +1,92 @@
    17.4 +/*
    17.5 + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.
   17.11 + *
   17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 + * version 2 for more details (a copy is included in the LICENSE file that
   17.16 + * accompanied this code).
   17.17 + *
   17.18 + * You should have received a copy of the GNU General Public License version
   17.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 + *
   17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   17.23 + * or visit www.oracle.com if you need additional information or have any
   17.24 + * questions.
   17.25 + */
   17.26 +
   17.27 +/**
   17.28 + * @test Level2RecompilationTest
   17.29 + * @summary Test downgrading mechanism from level 3 to level 2 for those profiled methods.
   17.30 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
   17.31 + * @build Level2RecompilationTest
   17.32 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   17.33 + * @run main/othervm -Xbootclasspath/a:. -XX:+TieredCompilation
   17.34 + *                   -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCounterDecay
   17.35 + *                   -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
   17.36 + *                   -XX:CompileCommand=print,SimpleTestCase$Helper::*
   17.37 + *                   Level2RecompilationTest
   17.38 + */
   17.39 +public class Level2RecompilationTest extends CompLevelsTest {
   17.40 +    public static void main(String[] args) throws Throwable {
   17.41 +        if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
   17.42 +            throw new RuntimeException("Test isn't applicable for non-tiered mode");
   17.43 +        }
   17.44 +        String[] testcases = {"METHOD_TEST", "OSR_STATIC_TEST"};
   17.45 +        CompilerWhiteBoxTest.main(Level2RecompilationTest::new, testcases);
   17.46 +    }
   17.47 +
   17.48 +    protected Level2RecompilationTest(TestCase testCase) {
   17.49 +        super(testCase);
   17.50 +        // to prevent inlining of #method
   17.51 +        WHITE_BOX.testSetDontInlineMethod(method, true);
   17.52 +    }
   17.53 +
   17.54 +    @Override
   17.55 +    protected void test() throws Exception {
   17.56 +        if (skipXcompOSR()) {
   17.57 +          return;
   17.58 +        }
   17.59 +
   17.60 +        checkNotCompiled();
   17.61 +        int bci = WHITE_BOX.getMethodEntryBci(method);
   17.62 +        WHITE_BOX.markMethodProfiled(method);
   17.63 +        if (testCase.isOsr()) {
   17.64 +            // for OSR compilation, it must be the begin of a BB.
   17.65 +            // c1_GraphBulider.cpp:153  assert(method()->bci_block_start().at(cur_bci), ...
   17.66 +            bci = 0;
   17.67 +        }
   17.68 +
   17.69 +        WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_FULL_PROFILE, bci);
   17.70 +        checkCompiled();
   17.71 +        checkLevel(COMP_LEVEL_LIMITED_PROFILE, getCompLevel());
   17.72 +
   17.73 +        for (int i=0; i<100; ++i) {
   17.74 +            WHITE_BOX.enqueueMethodForCompilation(method, COMP_LEVEL_FULL_PROFILE, bci);
   17.75 +            waitBackgroundCompilation();
   17.76 +            checkLevel(COMP_LEVEL_LIMITED_PROFILE, getCompLevel());
   17.77 +        }
   17.78 +    }
   17.79 +
   17.80 +    @Override
   17.81 +    protected void checkLevel(int expected, int actual) {
   17.82 +        if (expected == COMP_LEVEL_FULL_PROFILE
   17.83 +                && actual == COMP_LEVEL_LIMITED_PROFILE) {
   17.84 +            // for simple method full_profile may be replaced by limited_profile
   17.85 +            if (IS_VERBOSE) {
   17.86 +                System.out.printf("Level check: full profiling was replaced "
   17.87 +                        + "by limited profiling. Expected: %d, actual:%d\n",
   17.88 +                        expected, actual);
   17.89 +            }
   17.90 +            return;
   17.91 +        }
   17.92 +        super.checkLevel(expected, actual);
   17.93 +    }
   17.94 +}
   17.95 +
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/compiler/tiered/LevelTransitionTest.java	Wed Jun 05 05:15:56 2019 +0100
    18.3 @@ -0,0 +1,247 @@
    18.4 +/*
    18.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 + *
    18.8 + * This code is free software; you can redistribute it and/or modify it
    18.9 + * under the terms of the GNU General Public License version 2 only, as
   18.10 + * published by the Free Software Foundation.
   18.11 + *
   18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.15 + * version 2 for more details (a copy is included in the LICENSE file that
   18.16 + * accompanied this code).
   18.17 + *
   18.18 + * You should have received a copy of the GNU General Public License version
   18.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.21 + *
   18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.23 + * or visit www.oracle.com if you need additional information or have any
   18.24 + * questions.
   18.25 + */
   18.26 +
   18.27 +import java.lang.reflect.Executable;
   18.28 +import java.lang.reflect.Method;
   18.29 +import java.util.Objects;
   18.30 +import java.util.concurrent.Callable;
   18.31 +
   18.32 +/**
   18.33 + * @test LevelTransitionTest
   18.34 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox
   18.35 + * @build TransitionsTestExecutor LevelTransitionTest
   18.36 + * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
   18.37 + * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
   18.38 + *                   -XX:+WhiteBoxAPI -XX:+TieredCompilation
   18.39 + *                   -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
   18.40 + *                   -XX:CompileCommand=compileonly,ExtendedTestCase$CompileMethodHolder::*
   18.41 + *                   TransitionsTestExecutor LevelTransitionTest
   18.42 + * @summary Test the correctness of compilation level transitions for different methods
   18.43 + */
   18.44 +public class LevelTransitionTest extends TieredLevelsTest {
   18.45 +    /** Shows if method was profiled by being executed on levels 2 or 3 */
   18.46 +    protected boolean isMethodProfiled;
   18.47 +    private int transitionCount;
   18.48 +
   18.49 +    public static void main(String[] args) throws Throwable {
   18.50 +        assert (!CompilerWhiteBoxTest.skipOnTieredCompilation(false));
   18.51 +
   18.52 +        CompilerWhiteBoxTest.main(LevelTransitionTest::new, args);
   18.53 +        // run extended test cases
   18.54 +        for (TestCase testCase : ExtendedTestCase.values()) {
   18.55 +            new LevelTransitionTest(testCase).runTest();
   18.56 +        }
   18.57 +    }
   18.58 +
   18.59 +    protected LevelTransitionTest(TestCase testCase) {
   18.60 +        super(testCase);
   18.61 +        isMethodProfiled = testCase.isOsr(); // OSR methods were already profiled by warmup
   18.62 +        transitionCount = 0;
   18.63 +    }
   18.64 +
   18.65 +    @Override
   18.66 +    protected void test() throws Exception {
   18.67 +        checkTransitions();
   18.68 +        deoptimize();
   18.69 +        printInfo();
   18.70 +        if (testCase.isOsr()) {
   18.71 +            // deoptimization makes the following transitions be unstable
   18.72 +            // methods go to level 3 before 4 because of uncommon_trap and reprofile
   18.73 +            return;
   18.74 +        }
   18.75 +        checkTransitions();
   18.76 +    }
   18.77 +
   18.78 +    /**
   18.79 +     * Makes and verifies transitions between compilation levels
   18.80 +     */
   18.81 +    protected void checkTransitions() {
   18.82 +        checkNotCompiled();
   18.83 +        boolean finish = false;
   18.84 +        while (!finish) {
   18.85 +            System.out.printf("Level transition #%d%n", ++transitionCount);
   18.86 +            int newLevel;
   18.87 +            int current = getCompLevel();
   18.88 +            int expected = getNextLevel(current);
   18.89 +            if (current == expected) {
   18.90 +                // if we are on expected level, just execute it more
   18.91 +                // to ensure that the level won't change
   18.92 +                System.out.printf("Method %s is already on expected level %d%n", method, expected);
   18.93 +                compile();
   18.94 +                newLevel = getCompLevel();
   18.95 +                finish = true;
   18.96 +            } else {
   18.97 +                newLevel = changeCompLevel();
   18.98 +                finish = false;
   18.99 +            }
  18.100 +            System.out.printf("Method %s is compiled on level %d. Expected level is %d%n", method, newLevel, expected);
  18.101 +            checkLevel(expected, newLevel);
  18.102 +            printInfo();
  18.103 +        };
  18.104 +    }
  18.105 +
  18.106 +    /**
  18.107 +     * Gets next expected level for the test case on each transition.
  18.108 +     *
  18.109 +     * @param currentLevel a level the test case is compiled on
  18.110 +     * @return expected compilation level
  18.111 +     */
  18.112 +    protected int getNextLevel(int currentLevel) {
  18.113 +        int nextLevel = currentLevel;
  18.114 +        switch (currentLevel) {
  18.115 +            case CompilerWhiteBoxTest.COMP_LEVEL_NONE:
  18.116 +                nextLevel = isMethodProfiled ? CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION
  18.117 +                        : CompilerWhiteBoxTest.COMP_LEVEL_FULL_PROFILE;
  18.118 +                break;
  18.119 +            case CompilerWhiteBoxTest.COMP_LEVEL_LIMITED_PROFILE:
  18.120 +            case CompilerWhiteBoxTest.COMP_LEVEL_FULL_PROFILE:
  18.121 +                nextLevel = CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION;
  18.122 +                isMethodProfiled = true;
  18.123 +                break;
  18.124 +        }
  18.125 +        nextLevel = isTrivial() ? CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE : nextLevel;
  18.126 +        return Math.min(nextLevel, CompilerWhiteBoxTest.TIERED_STOP_AT_LEVEL);
  18.127 +    }
  18.128 +
  18.129 +    /**
  18.130 +     * Determines if tested method should be handled as trivial
  18.131 +     *
  18.132 +     * @return {@code true} for trivial methods, {@code false} otherwise
  18.133 +     */
  18.134 +    protected boolean isTrivial() {
  18.135 +        return testCase == ExtendedTestCase.ACCESSOR_TEST
  18.136 +                || testCase == SimpleTestCase.METHOD_TEST
  18.137 +                || testCase == SimpleTestCase.STATIC_TEST
  18.138 +                || (testCase == ExtendedTestCase.TRIVIAL_CODE_TEST && isMethodProfiled);
  18.139 +    }
  18.140 +
  18.141 +    /**
  18.142 +     * Invokes {@linkplain #method} until its compilation level is changed.
  18.143 +     * Note that if the level won't change, it will be an endless loop
  18.144 +     *
  18.145 +     * @return compilation level the {@linkplain #method} was compiled on
  18.146 +     */
  18.147 +    protected int changeCompLevel() {
  18.148 +        int currentLevel = getCompLevel();
  18.149 +        int newLevel = currentLevel;
  18.150 +        int result = 0;
  18.151 +        while (currentLevel == newLevel) {
  18.152 +            result = compile(1);
  18.153 +            if (WHITE_BOX.isMethodCompiled(method, testCase.isOsr())) {
  18.154 +                newLevel = getCompLevel();
  18.155 +            }
  18.156 +        }
  18.157 +        return newLevel;
  18.158 +    }
  18.159 +
  18.160 +    protected static class Helper {
  18.161 +        /**
  18.162 +         * Gets method from a specified class using its name
  18.163 +         *
  18.164 +         * @param aClass type method belongs to
  18.165 +         * @param name   the name of the method
  18.166 +         * @return {@link Method} that represents corresponding class method
  18.167 +         */
  18.168 +        public static Method getMethod(Class<?> aClass, String name) {
  18.169 +            Method method;
  18.170 +            try {
  18.171 +                method = aClass.getDeclaredMethod(name);
  18.172 +            } catch (NoSuchMethodException e) {
  18.173 +                throw new Error("TESTBUG: Unable to get method " + name, e);
  18.174 +            }
  18.175 +            return method;
  18.176 +        }
  18.177 +
  18.178 +        /**
  18.179 +         * Gets {@link Callable} that invokes given method from the given object
  18.180 +         *
  18.181 +         * @param object the object the specified method is invoked from
  18.182 +         * @param name   the name of the method
  18.183 +         */
  18.184 +        public static Callable<Integer> getCallable(Object object, String name) {
  18.185 +            Method method = getMethod(object.getClass(), name);
  18.186 +            return () -> {
  18.187 +                try {
  18.188 +                    return Objects.hashCode(method.invoke(object));
  18.189 +                } catch (ReflectiveOperationException e) {
  18.190 +                    throw new Error("TESTBUG: Invocation failure", e);
  18.191 +                }
  18.192 +            };
  18.193 +        }
  18.194 +    }
  18.195 +}
  18.196 +
  18.197 +enum ExtendedTestCase implements CompilerWhiteBoxTest.TestCase {
  18.198 +    ACCESSOR_TEST("accessor"),
  18.199 +    NONTRIVIAL_METHOD_TEST("nonTrivialMethod"),
  18.200 +    TRIVIAL_CODE_TEST("trivialCode");
  18.201 +
  18.202 +    private final Executable executable;
  18.203 +    private final Callable<Integer> callable;
  18.204 +
  18.205 +    @Override
  18.206 +    public Executable getExecutable() {
  18.207 +        return executable;
  18.208 +    }
  18.209 +
  18.210 +    @Override
  18.211 +    public Callable<Integer> getCallable() {
  18.212 +        return callable;
  18.213 +    }
  18.214 +
  18.215 +    @Override
  18.216 +    public boolean isOsr() {
  18.217 +        return false;
  18.218 +    }
  18.219 +
  18.220 +    private ExtendedTestCase(String methodName) {
  18.221 +        this.executable = LevelTransitionTest.Helper.getMethod(CompileMethodHolder.class, methodName);
  18.222 +        this.callable = LevelTransitionTest.Helper.getCallable(new CompileMethodHolder(), methodName);
  18.223 +    }
  18.224 +
  18.225 +    private static class CompileMethodHolder {
  18.226 +        private final int iter = 10;
  18.227 +        private int field = 42;
  18.228 +
  18.229 +        /** Non-trivial method for threshold policy: contains loops */
  18.230 +        public int nonTrivialMethod() {
  18.231 +            int acc = 0;
  18.232 +            for (int i = 0; i < iter; i++) {
  18.233 +                acc += i;
  18.234 +            }
  18.235 +            return acc;
  18.236 +        }
  18.237 +
  18.238 +        /** Field accessor method */
  18.239 +        public int accessor() {
  18.240 +            return field;
  18.241 +        }
  18.242 +
  18.243 +        /** Method considered as trivial by amount of code */
  18.244 +        public int trivialCode() {
  18.245 +            int var = 0xBAAD_C0DE;
  18.246 +            var *= field;
  18.247 +            return var;
  18.248 +        }
  18.249 +    }
  18.250 +}
    19.1 --- a/test/compiler/tiered/NonTieredLevelsTest.java	Wed May 29 09:09:43 2019 +0100
    19.2 +++ b/test/compiler/tiered/NonTieredLevelsTest.java	Wed Jun 05 05:15:56 2019 +0100
    19.3 @@ -54,9 +54,7 @@
    19.4  
    19.5      }
    19.6      public static void main(String[] args) throws Exception {
    19.7 -        if (TIERED_COMPILATION) {
    19.8 -            System.err.println("Test isn't applicable w/ enabled "
    19.9 -                    + "TieredCompilation. Skip test.");
   19.10 +        if (CompilerWhiteBoxTest.skipOnTieredCompilation(true)) {
   19.11              return;
   19.12          }
   19.13          CompilerWhiteBoxTest.main(NonTieredLevelsTest::new, args);
    20.1 --- a/test/compiler/tiered/TieredLevelsTest.java	Wed May 29 09:09:43 2019 +0100
    20.2 +++ b/test/compiler/tiered/TieredLevelsTest.java	Wed Jun 05 05:15:56 2019 +0100
    20.3 @@ -34,16 +34,14 @@
    20.4   * @author igor.ignatyev@oracle.com
    20.5   */
    20.6  public class TieredLevelsTest extends CompLevelsTest {
    20.7 -    public static void main(String[] args) throws Exception {
    20.8 -        if (!TIERED_COMPILATION) {
    20.9 -            System.err.println("Test isn't applicable w/ disabled "
   20.10 -                    + "TieredCompilation. Skip test.");
   20.11 +    public static void main(String[] args) throws Exception, Throwable {
   20.12 +        if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
   20.13              return;
   20.14          }
   20.15          CompilerWhiteBoxTest.main(TieredLevelsTest::new, args);
   20.16      }
   20.17  
   20.18 -    private TieredLevelsTest(TestCase testCase) {
   20.19 +    protected TieredLevelsTest(TestCase testCase) {
   20.20          super(testCase);
   20.21          // to prevent inlining of #method
   20.22          WHITE_BOX.testSetDontInlineMethod(method, true);
   20.23 @@ -76,14 +74,18 @@
   20.24          }
   20.25      }
   20.26  
   20.27 -
   20.28      @Override
   20.29      protected void checkLevel(int expected, int actual) {
   20.30          if (expected == COMP_LEVEL_FULL_PROFILE
   20.31                  && actual == COMP_LEVEL_LIMITED_PROFILE) {
   20.32              // for simple method full_profile may be replaced by limited_profile
   20.33 +            if (IS_VERBOSE) {
   20.34 +                System.out.printf("Level check: full profiling was replaced "
   20.35 +                        + "by limited profiling. Expected: %d, actual:%d",
   20.36 +                        expected, actual);
   20.37 +            }
   20.38              return;
   20.39          }
   20.40          super.checkLevel(expected, actual);
   20.41 -   }
   20.42 +    }
   20.43  }
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/test/compiler/tiered/TransitionsTestExecutor.java	Wed Jun 05 05:15:56 2019 +0100
    21.3 @@ -0,0 +1,66 @@
    21.4 +/*
    21.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.
   21.11 + *
   21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.15 + * version 2 for more details (a copy is included in the LICENSE file that
   21.16 + * accompanied this code).
   21.17 + *
   21.18 + * You should have received a copy of the GNU General Public License version
   21.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.21 + *
   21.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   21.23 + * or visit www.oracle.com if you need additional information or have any
   21.24 + * questions.
   21.25 + */
   21.26 +
   21.27 +import com.oracle.java.testlibrary.OutputAnalyzer;
   21.28 +import com.oracle.java.testlibrary.ProcessTools;
   21.29 +
   21.30 +import java.lang.management.ManagementFactory;
   21.31 +import java.lang.management.RuntimeMXBean;
   21.32 +import java.util.ArrayList;
   21.33 +import java.util.Collections;
   21.34 +import java.util.List;
   21.35 +
   21.36 +/**
   21.37 + * Executes given test in a separate VM with enabled Tiered Compilation for
   21.38 + * CompilationPolicyChoice 2 and 3
   21.39 + */
   21.40 +public class TransitionsTestExecutor {
   21.41 +    public static void main(String[] args) throws Throwable {
   21.42 +        if (CompilerWhiteBoxTest.skipOnTieredCompilation(false)) {
   21.43 +            return;
   21.44 +        }
   21.45 +        if (args.length != 1) {
   21.46 +            throw new Error("TESTBUG: Test name should be specified");
   21.47 +        }
   21.48 +        executeTestFor(2, args[0]);
   21.49 +        executeTestFor(3, args[0]);
   21.50 +    }
   21.51 +
   21.52 +    private static void executeTestFor(int compilationPolicy, String testName) throws Throwable {
   21.53 +        String policy = "-XX:CompilationPolicyChoice=" + compilationPolicy;
   21.54 +
   21.55 +        // Get runtime arguments including VM options given to this executor
   21.56 +        RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean();
   21.57 +        List<String> vmArgs = runtime.getInputArguments();
   21.58 +
   21.59 +        // Construct execution command with compilation policy choice and test name
   21.60 +        List<String> args = new ArrayList<>(vmArgs);
   21.61 +        Collections.addAll(args, policy, testName);
   21.62 +
   21.63 +        OutputAnalyzer out = ProcessTools.executeTestJvm(args.toArray(new String[args.size()]));
   21.64 +        int exitCode = out.getExitValue();
   21.65 +        if (exitCode != 0) {
   21.66 +            throw new Error("Test execution failed with exit code " + exitCode);
   21.67 +        }
   21.68 +    }
   21.69 +}
    22.1 --- a/test/compiler/whitebox/CompilerWhiteBoxTest.java	Wed May 29 09:09:43 2019 +0100
    22.2 +++ b/test/compiler/whitebox/CompilerWhiteBoxTest.java	Wed Jun 05 05:15:56 2019 +0100
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
    22.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.8   *
    22.9   * This code is free software; you can redistribute it and/or modify it
   22.10 @@ -41,19 +41,19 @@
   22.11   */
   22.12  public abstract class CompilerWhiteBoxTest {
   22.13      /** {@code CompLevel::CompLevel_none} -- Interpreter */
   22.14 -    protected static int COMP_LEVEL_NONE = 0;
   22.15 +    protected static final int COMP_LEVEL_NONE = 0;
   22.16      /** {@code CompLevel::CompLevel_any}, {@code CompLevel::CompLevel_all} */
   22.17 -    protected static int COMP_LEVEL_ANY = -1;
   22.18 +    protected static final int COMP_LEVEL_ANY = -1;
   22.19      /** {@code CompLevel::CompLevel_simple} -- C1 */
   22.20 -    protected static int COMP_LEVEL_SIMPLE = 1;
   22.21 +    protected static final int COMP_LEVEL_SIMPLE = 1;
   22.22      /** {@code CompLevel::CompLevel_limited_profile} -- C1, invocation &amp; backedge counters */
   22.23 -    protected static int COMP_LEVEL_LIMITED_PROFILE = 2;
   22.24 +    protected static final int COMP_LEVEL_LIMITED_PROFILE = 2;
   22.25      /** {@code CompLevel::CompLevel_full_profile} -- C1, invocation &amp; backedge counters + mdo */
   22.26 -    protected static int COMP_LEVEL_FULL_PROFILE = 3;
   22.27 +    protected static final int COMP_LEVEL_FULL_PROFILE = 3;
   22.28      /** {@code CompLevel::CompLevel_full_optimization} -- C2 or Shark */
   22.29 -    protected static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
   22.30 +    protected static final int COMP_LEVEL_FULL_OPTIMIZATION = 4;
   22.31      /** Maximal value for CompLevel */
   22.32 -    protected static int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
   22.33 +    protected static final int COMP_LEVEL_MAX = COMP_LEVEL_FULL_OPTIMIZATION;
   22.34  
   22.35      /** Instance of WhiteBox */
   22.36      protected static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
   22.37 @@ -328,11 +328,11 @@
   22.38              return;
   22.39          }
   22.40          final Object obj = new Object();
   22.41 -        for (int i = 0; i < 10
   22.42 +        for (int i = 0; i < 100
   22.43                  && WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
   22.44              synchronized (obj) {
   22.45                  try {
   22.46 -                    obj.wait(1000);
   22.47 +                    obj.wait(100);
   22.48                  } catch (InterruptedException e) {
   22.49                      Thread.currentThread().interrupt();
   22.50                  }
   22.51 @@ -347,14 +347,22 @@
   22.52          System.out.printf("%n%s:%n", method);
   22.53          System.out.printf("\tcompilable:\t%b%n",
   22.54                  WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, false));
   22.55 -        System.out.printf("\tcompiled:\t%b%n",
   22.56 -                WHITE_BOX.isMethodCompiled(method, false));
   22.57 +        boolean isCompiled = WHITE_BOX.isMethodCompiled(method, false);
   22.58 +        System.out.printf("\tcompiled:\t%b%n", isCompiled);
   22.59 +        if (isCompiled) {
   22.60 +            System.out.printf("\tcompile_id:\t%d%n",
   22.61 +                    NMethod.get(method, false).compile_id);
   22.62 +        }
   22.63          System.out.printf("\tcomp_level:\t%d%n",
   22.64                  WHITE_BOX.getMethodCompilationLevel(method, false));
   22.65          System.out.printf("\tosr_compilable:\t%b%n",
   22.66                  WHITE_BOX.isMethodCompilable(method, COMP_LEVEL_ANY, true));
   22.67 -        System.out.printf("\tosr_compiled:\t%b%n",
   22.68 -                WHITE_BOX.isMethodCompiled(method, true));
   22.69 +        isCompiled = WHITE_BOX.isMethodCompiled(method, true);
   22.70 +        System.out.printf("\tosr_compiled:\t%b%n", isCompiled);
   22.71 +        if (isCompiled) {
   22.72 +            System.out.printf("\tosr_compile_id:\t%d%n",
   22.73 +                    NMethod.get(method, true).compile_id);
   22.74 +        }
   22.75          System.out.printf("\tosr_comp_level:\t%d%n",
   22.76                  WHITE_BOX.getMethodCompilationLevel(method, true));
   22.77          System.out.printf("\tin_queue:\t%b%n",
   22.78 @@ -437,6 +445,22 @@
   22.79          }
   22.80          return result;
   22.81      }
   22.82 +
   22.83 +    /**
   22.84 +     * Skip the test for the specified value of Tiered Compilation
   22.85 +     * @param value of TieredCompilation the test should not run with
   22.86 +     * @return {@code true} if the test should be skipped,
   22.87 +     *         {@code false} otherwise
   22.88 +     */
   22.89 +    protected static boolean skipOnTieredCompilation(boolean value) {
   22.90 +        if (value == CompilerWhiteBoxTest.TIERED_COMPILATION) {
   22.91 +            System.err.println("Test isn't applicable w/ "
   22.92 +                    + (value ? "enabled" : "disabled")
   22.93 +                    + "TieredCompilation. Skip test.");
   22.94 +            return true;
   22.95 +        }
   22.96 +        return false;
   22.97 +    }
   22.98  }
   22.99  
  22.100  enum SimpleTestCase implements CompilerWhiteBoxTest.TestCase {
    23.1 --- a/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Wed May 29 09:09:43 2019 +0100
    23.2 +++ b/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Wed Jun 05 05:15:56 2019 +0100
    23.3 @@ -162,6 +162,7 @@
    23.4    }
    23.5    public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
    23.6    public native void    clearMethodState(Executable method);
    23.7 +  public native void    markMethodProfiled(Executable method);
    23.8    public native int     getMethodEntryBci(Executable method);
    23.9    public native Object[] getNMethod(Executable method, boolean isOsr);
   23.10  
    24.1 --- a/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java	Wed May 29 09:09:43 2019 +0100
    24.2 +++ b/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java	Wed Jun 05 05:15:56 2019 +0100
    24.3 @@ -34,18 +34,21 @@
    24.4      return obj == null ? null : new NMethod(obj);
    24.5    }
    24.6    private NMethod(Object[] obj) {
    24.7 -    assert obj.length == 2;
    24.8 +    assert obj.length == 3;
    24.9      comp_level = (Integer) obj[0];
   24.10 -    insts = (byte[]) obj[1];
   24.11 +    compile_id = (Integer) obj[1];
   24.12 +    insts = (byte[]) obj[2];
   24.13    }
   24.14 -  public byte[] insts;
   24.15 -  public int comp_level;
   24.16 +  public final byte[] insts;
   24.17 +  public final int comp_level;
   24.18 +  public final int compile_id;
   24.19  
   24.20    @Override
   24.21    public String toString() {
   24.22      return "NMethod{" +
   24.23          "insts=" + insts +
   24.24          ", comp_level=" + comp_level +
   24.25 +        ", compile_id=" + compile_id +
   24.26          '}';
   24.27    }
   24.28  }

mercurial