Merge

Thu, 28 Apr 2016 09:50:48 -0700

author
asaha
date
Thu, 28 Apr 2016 09:50:48 -0700
changeset 8542
dd3db9a36c40
parent 8541
d78403bec68b
parent 8505
e0fa1c8d84cc
child 8543
ab925491360f

Merge

.hgtags file | annotate | diff | comparison | revisions
test/gc/8000311/Test8000311.java file | annotate | diff | comparison | revisions
test/gc/TestG1ZeroPGCTJcmdThreadPrint.java file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Wed Apr 27 14:41:55 2016 -0400
     1.2 +++ b/.hgtags	Thu Apr 28 09:50:48 2016 -0700
     1.3 @@ -839,6 +839,10 @@
     1.4  bbbb05e91c629f8d9eef2ba43933767f68a898b0 jdk8u91-b00
     1.5  e36b6ade0499eadfd8673fe62ef0a613af2e6d67 jdk8u91-b13
     1.6  fa8991ccf6e5b74890a0b5672440b3c09d8d8732 jdk8u91-b14
     1.7 +1b6d4fd2730e58f17820930f797938dc182117c4 jdk8u77-b00
     1.8 +ddd297e340b1170d3cec011ee64e729f8b493c86 jdk8u77-b01
     1.9 +1b4072e4bb3ad54c4e894998486a8b33f0689160 jdk8u77-b02
    1.10 +223b64a19e94222dd97b92bb40abcfbc0bf6ef1f jdk8u77-b03
    1.11  d7b01fb81aa8a5437cb03bc36afe15cf0e55fb89 jdk8u76-b00
    1.12  c1679cc87ba045219169cabb6b9b378c2b5cc578 jdk8u76-b01
    1.13  218483967e52b419d885d34af4488a81c5133804 jdk8u76-b02
    1.14 @@ -860,4 +864,13 @@
    1.15  ead07188d11107e877e8e4ad215ff6cb238a8a92 jdk8u101-b01
    1.16  34429bad9986677f4991c80aeb22665842881cba jdk8u101-b02
    1.17  b41d5faaf1d32ed1bf9592f65f2f94ddd4c60fc4 jdk8u101-b03
    1.18 +ceecf88e5c2c09bfabf5926581e6d0b0f65f5148 jdk8u101-b04
    1.19 +19e74265fc8def6a7fc96c836d8ebe38ad1cf199 jdk8u101-b05
    1.20 +d6c92b9e192ef97305a699e868387d55821c81ad jdk8u102-b00
    1.21 +d6c92b9e192ef97305a699e868387d55821c81ad jdk8u82-b00
    1.22 +516a64e6d7c2dc29fd932bf3b8313e560a01bcd0 jdk8u102-b01
    1.23 +83dc7e55f71596e6e76fabfa56b6008e070ff44c jdk8u102-b02
    1.24 +ef01a1634bb41dd5b36fc9824f8d35f745c6bd5a jdk8u102-b03
    1.25 +2094cac55c5955b4f19cd9e35e3be8b467e59b57 jdk8u102-b04
    1.26 +a96cf90239c64f51679d106b852c9a5b343b9488 jdk8u102-b05
    1.27  ceecf88e5c2c09bfabf5926581e6d0b0f65f5148 jdk8u111-b00
     2.1 --- a/agent/src/os/linux/symtab.c	Wed Apr 27 14:41:55 2016 -0400
     2.2 +++ b/agent/src/os/linux/symtab.c	Thu Apr 28 09:50:48 2016 -0700
     2.3 @@ -514,6 +514,7 @@
     2.4       return (uintptr_t)NULL;
     2.5  
     2.6    item.key = (char*) strdup(sym_name);
     2.7 +  item.data = NULL;
     2.8    hsearch_r(item, FIND, &ret, symtab->hash_table);
     2.9    if (ret) {
    2.10      struct elf_symbol * sym = (struct elf_symbol *)(ret->data);
     3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java	Wed Apr 27 14:41:55 2016 -0400
     3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java	Thu Apr 28 09:50:48 2016 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
     3.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8   *
     3.9   * This code is free software; you can redistribute it and/or modify it
    3.10 @@ -219,7 +219,7 @@
    3.11      if (threadNameField == null) {
    3.12        SystemDictionary sysDict = VM.getVM().getSystemDictionary();
    3.13        InstanceKlass k = sysDict.getThreadKlass();
    3.14 -      threadNameField  = (OopField) k.findField("name", "[C");
    3.15 +      threadNameField  = (OopField) k.findField("name", "Ljava/lang/String;");
    3.16        threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
    3.17        threadEETopField = (LongField) k.findField("eetop", "J");
    3.18        threadTIDField = (LongField) k.findField("tid", "J");
    3.19 @@ -258,7 +258,7 @@
    3.20  
    3.21    public static String threadOopGetName(Oop threadOop) {
    3.22      initThreadFields();
    3.23 -    return charArrayToString((TypeArray) threadNameField.getValue(threadOop));
    3.24 +    return stringOopToString(threadNameField.getValue(threadOop));
    3.25    }
    3.26  
    3.27    /** May return null if, e.g., thread was not started */
     4.1 --- a/make/windows/makefiles/sa.make	Wed Apr 27 14:41:55 2016 -0400
     4.2 +++ b/make/windows/makefiles/sa.make	Thu Apr 28 09:50:48 2016 -0700
     4.3 @@ -44,9 +44,11 @@
     4.4  HS_ALT_SRC_REL=src/closed
     4.5  HS_ALT_SRC = $(WorkSpace)/$(HS_ALT_SRC_REL)
     4.6  !ifndef HS_ALT_MAKE
     4.7 +!if exist($(WorkSpace)/make/closed)
     4.8  HS_ALT_MAKE=$(WorkSpace)/make/closed
     4.9  !endif
    4.10  !endif
    4.11 +!endif
    4.12  
    4.13  HS_COMMON_SRC = $(WorkSpace)/$(HS_COMMON_SRC_REL)
    4.14  
     5.1 --- a/src/cpu/sparc/vm/vm_version_sparc.cpp	Wed Apr 27 14:41:55 2016 -0400
     5.2 +++ b/src/cpu/sparc/vm/vm_version_sparc.cpp	Thu Apr 28 09:50:48 2016 -0700
     5.3 @@ -40,7 +40,10 @@
     5.4  unsigned int VM_Version::_L2_data_cache_line_size = 0;
     5.5  
     5.6  void VM_Version::initialize() {
     5.7 -  _features = determine_features();
     5.8 +
     5.9 +  assert(_features != VM_Version::unknown_m, "System pre-initialization is not complete.");
    5.10 +  guarantee(VM_Version::has_v9(), "only SPARC v9 is supported");
    5.11 +
    5.12    PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes();
    5.13    PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes();
    5.14    PrefetchFieldsAhead         = prefetch_fields_ahead();
    5.15 @@ -76,8 +79,6 @@
    5.16      FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1);
    5.17    }
    5.18  
    5.19 -  guarantee(VM_Version::has_v9(), "only SPARC v9 is supported");
    5.20 -
    5.21    assert(ArraycopySrcPrefetchDistance < 4096, "invalid value");
    5.22    if (ArraycopySrcPrefetchDistance >= 4096)
    5.23      ArraycopySrcPrefetchDistance = 4064;
     6.1 --- a/src/cpu/sparc/vm/vm_version_sparc.hpp	Wed Apr 27 14:41:55 2016 -0400
     6.2 +++ b/src/cpu/sparc/vm/vm_version_sparc.hpp	Thu Apr 28 09:50:48 2016 -0700
     6.3 @@ -124,6 +124,8 @@
     6.4    // Initialization
     6.5    static void initialize();
     6.6  
     6.7 +  static void init_before_ergo()        { _features = determine_features(); }
     6.8 +
     6.9    // Instruction support
    6.10    static bool has_v8()                  { return (_features & v8_instructions_m) != 0; }
    6.11    static bool has_v9()                  { return (_features & v9_instructions_m) != 0; }
     7.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Wed Apr 27 14:41:55 2016 -0400
     7.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp	Thu Apr 28 09:50:48 2016 -0700
     7.3 @@ -1714,8 +1714,8 @@
     7.4    Register Rtmp1 = noreg;
     7.5  
     7.6    // check if it needs to be profiled
     7.7 -  ciMethodData* md;
     7.8 -  ciProfileData* data;
     7.9 +  ciMethodData* md = NULL;
    7.10 +  ciProfileData* data = NULL;
    7.11  
    7.12    if (op->should_profile()) {
    7.13      ciMethod* method = op->profiled_method();
    7.14 @@ -1874,8 +1874,8 @@
    7.15      CodeStub* stub = op->stub();
    7.16  
    7.17      // check if it needs to be profiled
    7.18 -    ciMethodData* md;
    7.19 -    ciProfileData* data;
    7.20 +    ciMethodData* md = NULL;
    7.21 +    ciProfileData* data = NULL;
    7.22  
    7.23      if (op->should_profile()) {
    7.24        ciMethod* method = op->profiled_method();
    7.25 @@ -2052,7 +2052,8 @@
    7.26      case lir_cond_greater:      acond = Assembler::greater;      ncond = Assembler::lessEqual;    break;
    7.27      case lir_cond_belowEqual:   acond = Assembler::belowEqual;   ncond = Assembler::above;        break;
    7.28      case lir_cond_aboveEqual:   acond = Assembler::aboveEqual;   ncond = Assembler::below;        break;
    7.29 -    default:                    ShouldNotReachHere();
    7.30 +    default:                    acond = Assembler::equal;        ncond = Assembler::notEqual;
    7.31 +                                ShouldNotReachHere();
    7.32    }
    7.33  
    7.34    if (opr1->is_cpu_register()) {
    7.35 @@ -3237,27 +3238,23 @@
    7.36    assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point");
    7.37  
    7.38    int elem_size = type2aelembytes(basic_type);
    7.39 -  int shift_amount;
    7.40    Address::ScaleFactor scale;
    7.41  
    7.42    switch (elem_size) {
    7.43      case 1 :
    7.44 -      shift_amount = 0;
    7.45        scale = Address::times_1;
    7.46        break;
    7.47      case 2 :
    7.48 -      shift_amount = 1;
    7.49        scale = Address::times_2;
    7.50        break;
    7.51      case 4 :
    7.52 -      shift_amount = 2;
    7.53        scale = Address::times_4;
    7.54        break;
    7.55      case 8 :
    7.56 -      shift_amount = 3;
    7.57        scale = Address::times_8;
    7.58        break;
    7.59      default:
    7.60 +      scale = Address::no_scale;
    7.61        ShouldNotReachHere();
    7.62    }
    7.63  
     8.1 --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Apr 27 14:41:55 2016 -0400
     8.2 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Apr 28 09:50:48 2016 -0700
     8.3 @@ -195,7 +195,7 @@
     8.4  
     8.5  
     8.6  LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {
     8.7 -  LIR_Opr r;
     8.8 +  LIR_Opr r = NULL;
     8.9    if (type == T_LONG) {
    8.10      r = LIR_OprFact::longConst(x);
    8.11    } else if (type == T_INT) {
    8.12 @@ -485,7 +485,7 @@
    8.13      __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
    8.14      __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info));
    8.15  
    8.16 -    address entry;
    8.17 +    address entry = NULL;
    8.18      switch (x->op()) {
    8.19      case Bytecodes::_lrem:
    8.20        entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem);
    8.21 @@ -1025,7 +1025,7 @@
    8.22  
    8.23  void LIRGenerator::do_Convert(Convert* x) {
    8.24    // flags that vary for the different operations and different SSE-settings
    8.25 -  bool fixed_input, fixed_result, round_result, needs_stub;
    8.26 +  bool fixed_input = false, fixed_result = false, round_result = false, needs_stub = false;
    8.27  
    8.28    switch (x->op()) {
    8.29      case Bytecodes::_i2l: // fall through
     9.1 --- a/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Wed Apr 27 14:41:55 2016 -0400
     9.2 +++ b/src/cpu/x86/vm/jniFastGetField_x86_32.cpp	Thu Apr 28 09:50:48 2016 -0700
     9.3 @@ -48,7 +48,7 @@
     9.4  // between loads, which is much more efficient than lfence.
     9.5  
     9.6  address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
     9.7 -  const char *name;
     9.8 +  const char *name = NULL;
     9.9    switch (type) {
    9.10      case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break;
    9.11      case T_BYTE:    name = "jni_fast_GetByteField";    break;
    9.12 @@ -122,7 +122,7 @@
    9.13  
    9.14    slowcase_entry_pclist[count++] = __ pc();
    9.15    __ bind (slow);
    9.16 -  address slow_case_addr;
    9.17 +  address slow_case_addr = NULL;
    9.18    switch (type) {
    9.19      case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break;
    9.20      case T_BYTE:    slow_case_addr = jni_GetByteField_addr();    break;
    9.21 @@ -256,7 +256,7 @@
    9.22  }
    9.23  
    9.24  address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
    9.25 -  const char *name;
    9.26 +  const char *name = NULL;
    9.27    switch (type) {
    9.28      case T_FLOAT:  name = "jni_fast_GetFloatField";  break;
    9.29      case T_DOUBLE: name = "jni_fast_GetDoubleField"; break;
    9.30 @@ -337,7 +337,7 @@
    9.31  
    9.32    slowcase_entry_pclist[count++] = __ pc();
    9.33    __ bind (slow);
    9.34 -  address slow_case_addr;
    9.35 +  address slow_case_addr = NULL;
    9.36    switch (type) {
    9.37      case T_FLOAT:  slow_case_addr = jni_GetFloatField_addr();  break;
    9.38      case T_DOUBLE: slow_case_addr = jni_GetDoubleField_addr(); break;
    10.1 --- a/src/cpu/x86/vm/jniFastGetField_x86_64.cpp	Wed Apr 27 14:41:55 2016 -0400
    10.2 +++ b/src/cpu/x86/vm/jniFastGetField_x86_64.cpp	Thu Apr 28 09:50:48 2016 -0700
    10.3 @@ -51,7 +51,7 @@
    10.4  // since that may scratch r10!
    10.5  
    10.6  address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) {
    10.7 -  const char *name;
    10.8 +  const char *name = NULL;
    10.9    switch (type) {
   10.10      case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break;
   10.11      case T_BYTE:    name = "jni_fast_GetByteField";    break;
   10.12 @@ -111,7 +111,7 @@
   10.13  
   10.14    slowcase_entry_pclist[count++] = __ pc();
   10.15    __ bind (slow);
   10.16 -  address slow_case_addr;
   10.17 +  address slow_case_addr = NULL;
   10.18    switch (type) {
   10.19      case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break;
   10.20      case T_BYTE:    slow_case_addr = jni_GetByteField_addr();    break;
   10.21 @@ -153,7 +153,7 @@
   10.22  }
   10.23  
   10.24  address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) {
   10.25 -  const char *name;
   10.26 +  const char *name = NULL;
   10.27    switch (type) {
   10.28      case T_FLOAT:     name = "jni_fast_GetFloatField";     break;
   10.29      case T_DOUBLE:    name = "jni_fast_GetDoubleField";    break;
   10.30 @@ -206,7 +206,7 @@
   10.31  
   10.32    slowcase_entry_pclist[count++] = __ pc();
   10.33    __ bind (slow);
   10.34 -  address slow_case_addr;
   10.35 +  address slow_case_addr = NULL;
   10.36    switch (type) {
   10.37      case T_FLOAT:     slow_case_addr = jni_GetFloatField_addr();  break;
   10.38      case T_DOUBLE:    slow_case_addr = jni_GetDoubleField_addr();
    11.1 --- a/src/os/linux/vm/os_linux.cpp	Wed Apr 27 14:41:55 2016 -0400
    11.2 +++ b/src/os/linux/vm/os_linux.cpp	Thu Apr 28 09:50:48 2016 -0700
    11.3 @@ -2755,7 +2755,7 @@
    11.4  
    11.5  
    11.6  int os::Linux::sched_getcpu_syscall(void) {
    11.7 -  unsigned int cpu;
    11.8 +  unsigned int cpu = 0;
    11.9    int retval = -1;
   11.10  
   11.11  #if defined(IA32)
   11.12 @@ -4263,8 +4263,8 @@
   11.13        sigaddset(&(actp->sa_mask), sig);
   11.14      }
   11.15  
   11.16 -    sa_handler_t hand;
   11.17 -    sa_sigaction_t sa;
   11.18 +    sa_handler_t hand = NULL;
   11.19 +    sa_sigaction_t sa = NULL;
   11.20      bool siginfo_flag_set = (actp->sa_flags & SA_SIGINFO) != 0;
   11.21      // retrieve the chained handler
   11.22      if (siginfo_flag_set) {
   11.23 @@ -4469,7 +4469,7 @@
   11.24  
   11.25  static const char* get_signal_handler_name(address handler,
   11.26                                             char* buf, int buflen) {
   11.27 -  int offset;
   11.28 +  int offset = 0;
   11.29    bool found = os::dll_address_to_library_name(handler, buf, buflen, &offset);
   11.30    if (found) {
   11.31      // skip directory names
    12.1 --- a/src/os/posix/vm/os_posix.cpp	Wed Apr 27 14:41:55 2016 -0400
    12.2 +++ b/src/os/posix/vm/os_posix.cpp	Thu Apr 28 09:50:48 2016 -0700
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 -* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
    12.6 +* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -678,6 +678,21 @@
   12.11  #if defined(IA64) && !defined(AIX)
   12.12      { SIGSEGV, SEGV_PSTKOVF, "SEGV_PSTKOVF", "Paragraph stack overflow" },
   12.13  #endif
   12.14 +#if defined(__sparc) && defined(SOLARIS)
   12.15 +// define Solaris Sparc M7 ADI SEGV signals
   12.16 +#if !defined(SEGV_ACCADI)
   12.17 +#define SEGV_ACCADI 3
   12.18 +#endif
   12.19 +    { SIGSEGV, SEGV_ACCADI,  "SEGV_ACCADI",  "ADI not enabled for mapped object." },
   12.20 +#if !defined(SEGV_ACCDERR)
   12.21 +#define SEGV_ACCDERR 4
   12.22 +#endif
   12.23 +    { SIGSEGV, SEGV_ACCDERR, "SEGV_ACCDERR", "ADI disrupting exception." },
   12.24 +#if !defined(SEGV_ACCPERR)
   12.25 +#define SEGV_ACCPERR 5
   12.26 +#endif
   12.27 +    { SIGSEGV, SEGV_ACCPERR, "SEGV_ACCPERR", "ADI precise exception." },
   12.28 +#endif // defined(__sparc) && defined(SOLARIS)
   12.29      { SIGBUS,  BUS_ADRALN,   "BUS_ADRALN",   "Invalid address alignment." },
   12.30      { SIGBUS,  BUS_ADRERR,   "BUS_ADRERR",   "Nonexistent physical address." },
   12.31      { SIGBUS,  BUS_OBJERR,   "BUS_OBJERR",   "Object-specific hardware error." },
    13.1 --- a/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp	Wed Apr 27 14:41:55 2016 -0400
    13.2 +++ b/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp	Thu Apr 28 09:50:48 2016 -0700
    13.3 @@ -30,7 +30,7 @@
    13.4    (void)memmove(to, from, count * HeapWordSize);
    13.5  #else
    13.6    // Includes a zero-count check.
    13.7 -  intx temp;
    13.8 +  intx temp = 0;
    13.9    __asm__ volatile("        testl   %6,%6         ;"
   13.10                     "        jz      7f            ;"
   13.11                     "        cmpl    %4,%5         ;"
   13.12 @@ -88,7 +88,7 @@
   13.13    }
   13.14  #else
   13.15    // Includes a zero-count check.
   13.16 -  intx temp;
   13.17 +  intx temp = 0;
   13.18    __asm__ volatile("        testl   %6,%6       ;"
   13.19                     "        jz      3f          ;"
   13.20                     "        cmpl    $32,%6      ;"
   13.21 @@ -145,7 +145,7 @@
   13.22    (void)memmove(to, from, count);
   13.23  #else
   13.24    // Includes a zero-count check.
   13.25 -  intx temp;
   13.26 +  intx temp = 0;
   13.27    __asm__ volatile("        testl   %6,%6          ;"
   13.28                     "        jz      13f            ;"
   13.29                     "        cmpl    %4,%5          ;"
    14.1 --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Wed Apr 27 14:41:55 2016 -0400
    14.2 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Thu Apr 28 09:50:48 2016 -0700
    14.3 @@ -244,7 +244,6 @@
    14.4  bool PICL::open_library() {
    14.5    _dl_handle = dlopen("libpicl.so.1", RTLD_LAZY);
    14.6    if (_dl_handle == NULL) {
    14.7 -    warning("PICL (libpicl.so.1) is missing. Performance will not be optimal.");
    14.8      return false;
    14.9    }
   14.10    if (!bind_library_functions()) {
    15.1 --- a/src/share/vm/c1/c1_Canonicalizer.cpp	Wed Apr 27 14:41:55 2016 -0400
    15.2 +++ b/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Apr 28 09:50:48 2016 -0700
    15.3 @@ -640,7 +640,7 @@
    15.4  
    15.5    if (l == r && !lt->is_float_kind()) {
    15.6      // pattern: If (a cond a) => simplify to Goto
    15.7 -    BlockBegin* sux;
    15.8 +    BlockBegin* sux = NULL;
    15.9      switch (x->cond()) {
   15.10      case If::eql: sux = x->sux_for(true);  break;
   15.11      case If::neq: sux = x->sux_for(false); break;
   15.12 @@ -648,6 +648,7 @@
   15.13      case If::leq: sux = x->sux_for(true);  break;
   15.14      case If::gtr: sux = x->sux_for(false); break;
   15.15      case If::geq: sux = x->sux_for(true);  break;
   15.16 +    default: ShouldNotReachHere();
   15.17      }
   15.18      // If is a safepoint then the debug information should come from the state_before of the If.
   15.19      set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux)));
   15.20 @@ -685,7 +686,7 @@
   15.21        } else {
   15.22          // two successors differ and two successors are the same => simplify to: If (x cmp y)
   15.23          // determine new condition & successors
   15.24 -        If::Condition cond;
   15.25 +        If::Condition cond = If::eql;
   15.26          BlockBegin* tsux = NULL;
   15.27          BlockBegin* fsux = NULL;
   15.28               if (lss_sux == eql_sux) { cond = If::leq; tsux = lss_sux; fsux = gtr_sux; }
    16.1 --- a/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Apr 27 14:41:55 2016 -0400
    16.2 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Apr 28 09:50:48 2016 -0700
    16.3 @@ -3971,8 +3971,8 @@
    16.4    caller_state->truncate_stack(args_base);
    16.5    assert(callee_state->stack_size() == 0, "callee stack must be empty");
    16.6  
    16.7 -  Value lock;
    16.8 -  BlockBegin* sync_handler;
    16.9 +  Value lock = NULL;
   16.10 +  BlockBegin* sync_handler = NULL;
   16.11  
   16.12    // Inline the locking of the receiver if the callee is synchronized
   16.13    if (callee->is_synchronized()) {
    17.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 27 14:41:55 2016 -0400
    17.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Apr 28 09:50:48 2016 -0700
    17.3 @@ -3347,7 +3347,7 @@
    17.4  }
    17.5  
    17.6  void LIRGenerator::increment_event_counter(CodeEmitInfo* info, int bci, bool backedge) {
    17.7 -  int freq_log;
    17.8 +  int freq_log = 0;
    17.9    int level = compilation()->env()->comp_level();
   17.10    if (level == CompLevel_limited_profile) {
   17.11      freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog);
   17.12 @@ -3368,7 +3368,7 @@
   17.13    assert(level > CompLevel_simple, "Shouldn't be here");
   17.14  
   17.15    int offset = -1;
   17.16 -  LIR_Opr counter_holder;
   17.17 +  LIR_Opr counter_holder = NULL;
   17.18    if (level == CompLevel_limited_profile) {
   17.19      MethodCounters* counters_adr = method->ensure_method_counters();
   17.20      if (counters_adr == NULL) {
    18.1 --- a/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Apr 27 14:41:55 2016 -0400
    18.2 +++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Apr 28 09:50:48 2016 -0700
    18.3 @@ -410,7 +410,7 @@
    18.4    }
    18.5  
    18.6    static LIR_Condition lir_cond(If::Condition cond) {
    18.7 -    LIR_Condition l;
    18.8 +    LIR_Condition l = lir_cond_unknown;
    18.9      switch (cond) {
   18.10      case If::eql: l = lir_cond_equal;        break;
   18.11      case If::neq: l = lir_cond_notEqual;     break;
   18.12 @@ -420,6 +420,7 @@
   18.13      case If::gtr: l = lir_cond_greater;      break;
   18.14      case If::aeq: l = lir_cond_aboveEqual;   break;
   18.15      case If::beq: l = lir_cond_belowEqual;   break;
   18.16 +    default: fatal("You must pass valid If::Condition");
   18.17      };
   18.18      return l;
   18.19    }
    19.1 --- a/src/share/vm/c1/c1_Runtime1.cpp	Wed Apr 27 14:41:55 2016 -0400
    19.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp	Thu Apr 28 09:50:48 2016 -0700
    19.3 @@ -312,6 +312,7 @@
    19.4    NOT_PRODUCT(_new_instance_slowcase_cnt++;)
    19.5  
    19.6    assert(klass->is_klass(), "not a class");
    19.7 +  Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
    19.8    instanceKlassHandle h(thread, klass);
    19.9    h->check_valid_for_instantiation(true, CHECK);
   19.10    // make sure klass is initialized
   19.11 @@ -347,6 +348,7 @@
   19.12    //       anymore after new_objArray() and no GC can happen before.
   19.13    //       (This may have to change if this code changes!)
   19.14    assert(array_klass->is_klass(), "not a class");
   19.15 +  Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
   19.16    Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
   19.17    objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
   19.18    thread->set_vm_result(obj);
   19.19 @@ -363,6 +365,7 @@
   19.20  
   19.21    assert(klass->is_klass(), "not a class");
   19.22    assert(rank >= 1, "rank must be nonzero");
   19.23 +  Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
   19.24    oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
   19.25    thread->set_vm_result(obj);
   19.26  JRT_END
    20.1 --- a/src/share/vm/ci/ciObjectFactory.cpp	Wed Apr 27 14:41:55 2016 -0400
    20.2 +++ b/src/share/vm/ci/ciObjectFactory.cpp	Thu Apr 28 09:50:48 2016 -0700
    20.3 @@ -413,6 +413,7 @@
    20.4      metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder();
    20.5    } else {
    20.6      fatal("Not implemented for other types of metadata");
    20.7 +    return;
    20.8    }
    20.9  
   20.10    oop metadata_holder = metadata_owner_klass->klass_holder();
    21.1 --- a/src/share/vm/classfile/classFileParser.cpp	Wed Apr 27 14:41:55 2016 -0400
    21.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Thu Apr 28 09:50:48 2016 -0700
    21.3 @@ -3188,19 +3188,19 @@
    21.4  
    21.5    // Field size and offset computation
    21.6    int nonstatic_field_size = _super_klass() == NULL ? 0 : _super_klass()->nonstatic_field_size();
    21.7 -  int next_static_oop_offset;
    21.8 -  int next_static_double_offset;
    21.9 -  int next_static_word_offset;
   21.10 -  int next_static_short_offset;
   21.11 -  int next_static_byte_offset;
   21.12 -  int next_nonstatic_oop_offset;
   21.13 -  int next_nonstatic_double_offset;
   21.14 -  int next_nonstatic_word_offset;
   21.15 -  int next_nonstatic_short_offset;
   21.16 -  int next_nonstatic_byte_offset;
   21.17 -  int first_nonstatic_oop_offset;
   21.18 -  int next_nonstatic_field_offset;
   21.19 -  int next_nonstatic_padded_offset;
   21.20 +  int next_static_oop_offset = 0;
   21.21 +  int next_static_double_offset = 0;
   21.22 +  int next_static_word_offset = 0;
   21.23 +  int next_static_short_offset = 0;
   21.24 +  int next_static_byte_offset = 0;
   21.25 +  int next_nonstatic_oop_offset = 0;
   21.26 +  int next_nonstatic_double_offset = 0;
   21.27 +  int next_nonstatic_word_offset = 0;
   21.28 +  int next_nonstatic_short_offset = 0;
   21.29 +  int next_nonstatic_byte_offset = 0;
   21.30 +  int first_nonstatic_oop_offset = 0;
   21.31 +  int next_nonstatic_field_offset = 0;
   21.32 +  int next_nonstatic_padded_offset = 0;
   21.33  
   21.34    // Count the contended fields by type.
   21.35    //
   21.36 @@ -3353,14 +3353,14 @@
   21.37      ShouldNotReachHere();
   21.38    }
   21.39  
   21.40 -  int nonstatic_oop_space_count   = 0;
   21.41 -  int nonstatic_word_space_count  = 0;
   21.42 -  int nonstatic_short_space_count = 0;
   21.43 -  int nonstatic_byte_space_count  = 0;
   21.44 -  int nonstatic_oop_space_offset;
   21.45 -  int nonstatic_word_space_offset;
   21.46 -  int nonstatic_short_space_offset;
   21.47 -  int nonstatic_byte_space_offset;
   21.48 +  int nonstatic_oop_space_count    = 0;
   21.49 +  int nonstatic_word_space_count   = 0;
   21.50 +  int nonstatic_short_space_count  = 0;
   21.51 +  int nonstatic_byte_space_count   = 0;
   21.52 +  int nonstatic_oop_space_offset   = 0;
   21.53 +  int nonstatic_word_space_offset  = 0;
   21.54 +  int nonstatic_short_space_offset = 0;
   21.55 +  int nonstatic_byte_space_offset  = 0;
   21.56  
   21.57    // Try to squeeze some of the fields into the gaps due to
   21.58    // long/double alignment.
   21.59 @@ -3432,7 +3432,7 @@
   21.60      // contended instance fields are handled below
   21.61      if (fs.is_contended() && !fs.access_flags().is_static()) continue;
   21.62  
   21.63 -    int real_offset;
   21.64 +    int real_offset = 0;
   21.65      FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
   21.66  
   21.67      // pack the rest of the fields
   21.68 @@ -3565,7 +3565,7 @@
   21.69          // handle statics below
   21.70          if (fs.access_flags().is_static()) continue;
   21.71  
   21.72 -        int real_offset;
   21.73 +        int real_offset = 0;
   21.74          FieldAllocationType atype = (FieldAllocationType) fs.allocation_type();
   21.75  
   21.76          switch (atype) {
    22.1 --- a/src/share/vm/classfile/javaClasses.cpp	Wed Apr 27 14:41:55 2016 -0400
    22.2 +++ b/src/share/vm/classfile/javaClasses.cpp	Thu Apr 28 09:50:48 2016 -0700
    22.3 @@ -1,5 +1,5 @@
    22.4  /*
    22.5 - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
    22.6 + * Copyright (c) 1997, 2016, 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 @@ -936,7 +936,7 @@
   22.11    assert(_group_offset == 0, "offsets should be initialized only once");
   22.12  
   22.13    Klass* k = SystemDictionary::Thread_klass();
   22.14 -  compute_offset(_name_offset,      k, vmSymbols::name_name(),      vmSymbols::char_array_signature());
   22.15 +  compute_offset(_name_offset,      k, vmSymbols::name_name(),      vmSymbols::string_signature());
   22.16    compute_offset(_group_offset,     k, vmSymbols::group_name(),     vmSymbols::threadgroup_signature());
   22.17    compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature());
   22.18    compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature());
   22.19 @@ -966,15 +966,12 @@
   22.20  }
   22.21  
   22.22  
   22.23 -typeArrayOop java_lang_Thread::name(oop java_thread) {
   22.24 -  oop name = java_thread->obj_field(_name_offset);
   22.25 -  assert(name == NULL || (name->is_typeArray() && TypeArrayKlass::cast(name->klass())->element_type() == T_CHAR), "just checking");
   22.26 -  return typeArrayOop(name);
   22.27 -}
   22.28 -
   22.29 -
   22.30 -void java_lang_Thread::set_name(oop java_thread, typeArrayOop name) {
   22.31 -  assert(java_thread->obj_field(_name_offset) == NULL, "name should be NULL");
   22.32 +oop java_lang_Thread::name(oop java_thread) {
   22.33 +  return java_thread->obj_field(_name_offset);
   22.34 +}
   22.35 +
   22.36 +
   22.37 +void java_lang_Thread::set_name(oop java_thread, oop name) {
   22.38    java_thread->obj_field_put(_name_offset, name);
   22.39  }
   22.40  
    23.1 --- a/src/share/vm/classfile/javaClasses.hpp	Wed Apr 27 14:41:55 2016 -0400
    23.2 +++ b/src/share/vm/classfile/javaClasses.hpp	Thu Apr 28 09:50:48 2016 -0700
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -343,8 +343,8 @@
   23.11    // Set JavaThread for instance
   23.12    static void set_thread(oop java_thread, JavaThread* thread);
   23.13    // Name
   23.14 -  static typeArrayOop name(oop java_thread);
   23.15 -  static void set_name(oop java_thread, typeArrayOop name);
   23.16 +  static oop name(oop java_thread);
   23.17 +  static void set_name(oop java_thread, oop name);
   23.18    // Priority
   23.19    static ThreadPriority priority(oop java_thread);
   23.20    static void set_priority(oop java_thread, ThreadPriority priority);
    24.1 --- a/src/share/vm/classfile/placeholders.hpp	Wed Apr 27 14:41:55 2016 -0400
    24.2 +++ b/src/share/vm/classfile/placeholders.hpp	Thu Apr 28 09:50:48 2016 -0700
    24.3 @@ -220,7 +220,7 @@
    24.4    }
    24.5  
    24.6    SeenThread* actionToQueue(PlaceholderTable::classloadAction action) {
    24.7 -    SeenThread* queuehead;
    24.8 +    SeenThread* queuehead = NULL;
    24.9      switch (action) {
   24.10        case PlaceholderTable::LOAD_INSTANCE:
   24.11           queuehead = _loadInstanceThreadQ;
    25.1 --- a/src/share/vm/compiler/oopMap.hpp	Wed Apr 27 14:41:55 2016 -0400
    25.2 +++ b/src/share/vm/compiler/oopMap.hpp	Thu Apr 28 09:50:48 2016 -0700
    25.3 @@ -75,8 +75,8 @@
    25.4  
    25.5    // Constructors
    25.6    OopMapValue () { set_value(0); set_content_reg(VMRegImpl::Bad()); }
    25.7 -  OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg,t); }
    25.8 -  OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg,t); set_content_reg(reg2); }
    25.9 +  OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg, t); set_content_reg(VMRegImpl::Bad()); }
   25.10 +  OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg, t); set_content_reg(reg2); }
   25.11    OopMapValue (CompressedReadStream* stream) { read_from(stream); }
   25.12  
   25.13    // Archiving
   25.14 @@ -89,7 +89,7 @@
   25.15  
   25.16    void read_from(CompressedReadStream* stream) {
   25.17      set_value(stream->read_int());
   25.18 -    if(is_callee_saved() || is_derived_oop()) {
   25.19 +    if (is_callee_saved() || is_derived_oop()) {
   25.20        set_content_reg(VMRegImpl::as_VMReg(stream->read_int(), true));
   25.21      }
   25.22    }
    26.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 27 14:41:55 2016 -0400
    26.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Apr 28 09:50:48 2016 -0700
    26.3 @@ -2288,7 +2288,7 @@
    26.4    }
    26.5  
    26.6    // Used for PrintGC
    26.7 -  size_t prev_used;
    26.8 +  size_t prev_used = 0;
    26.9    if (PrintGC && Verbose) {
   26.10      prev_used = _cmsGen->used(); // XXXPERM
   26.11    }
   26.12 @@ -8624,7 +8624,7 @@
   26.13  
   26.14    HeapWord* const fc_addr = (HeapWord*) fc;
   26.15  
   26.16 -  bool coalesce;
   26.17 +  bool coalesce = false;
   26.18    const size_t left  = pointer_delta(fc_addr, freeFinger());
   26.19    const size_t right = chunkSize;
   26.20    switch (FLSCoalescePolicy) {
    27.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Apr 27 14:41:55 2016 -0400
    27.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Apr 28 09:50:48 2016 -0700
    27.3 @@ -3991,8 +3991,15 @@
    27.4  
    27.5      TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
    27.6  
    27.7 -    uint active_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
    27.8 -                                workers()->active_workers() : 1);
    27.9 +    uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
   27.10 +                                                                  workers()->active_workers(),
   27.11 +                                                                  Threads::number_of_non_daemon_threads());
   27.12 +    assert(UseDynamicNumberOfGCThreads ||
   27.13 +           active_workers == workers()->total_workers(),
   27.14 +           "If not dynamic should be using all the  workers");
   27.15 +    workers()->set_active_workers(active_workers);
   27.16 +
   27.17 +
   27.18      double pause_start_sec = os::elapsedTime();
   27.19      g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress());
   27.20      log_gc_header();
   27.21 @@ -5761,23 +5768,11 @@
   27.22    hot_card_cache->reset_hot_cache_claimed_index();
   27.23    hot_card_cache->set_use_cache(false);
   27.24  
   27.25 -  uint n_workers;
   27.26 -  if (G1CollectedHeap::use_parallel_gc_threads()) {
   27.27 -    n_workers =
   27.28 -      AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(),
   27.29 -                                     workers()->active_workers(),
   27.30 -                                     Threads::number_of_non_daemon_threads());
   27.31 +  const uint n_workers = workers()->active_workers();
   27.32      assert(UseDynamicNumberOfGCThreads ||
   27.33             n_workers == workers()->total_workers(),
   27.34             "If not dynamic should be using all the  workers");
   27.35 -    workers()->set_active_workers(n_workers);
   27.36      set_par_threads(n_workers);
   27.37 -  } else {
   27.38 -    assert(n_par_threads() == 0,
   27.39 -           "Should be the original non-parallel value");
   27.40 -    n_workers = 1;
   27.41 -  }
   27.42 -
   27.43  
   27.44    init_for_evac_failure(NULL);
   27.45  
    28.1 --- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Apr 27 14:41:55 2016 -0400
    28.2 +++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Thu Apr 28 09:50:48 2016 -0700
    28.3 @@ -154,28 +154,28 @@
    28.4      _has_new_data = true;
    28.5    }
    28.6  
    28.7 -  double average(){
    28.8 -    calculate_totals();
    28.9 +  double average(uint active_threads){
   28.10 +    calculate_totals(active_threads);
   28.11      return _average;
   28.12    }
   28.13  
   28.14 -  T sum() {
   28.15 -    calculate_totals();
   28.16 +  T sum(uint active_threads) {
   28.17 +    calculate_totals(active_threads);
   28.18      return _sum;
   28.19    }
   28.20  
   28.21 -  T minimum() {
   28.22 -    calculate_totals();
   28.23 +  T minimum(uint active_threads) {
   28.24 +    calculate_totals(active_threads);
   28.25      return _min;
   28.26    }
   28.27  
   28.28 -  T maximum() {
   28.29 -    calculate_totals();
   28.30 +  T maximum(uint active_threads) {
   28.31 +    calculate_totals(active_threads);
   28.32      return _max;
   28.33    }
   28.34  
   28.35    void reset() PRODUCT_RETURN;
   28.36 -  void verify() PRODUCT_RETURN;
   28.37 +  void verify(uint active_threads) PRODUCT_RETURN;
   28.38  
   28.39    void set_enabled(bool enabled) { _enabled = enabled; }
   28.40  
   28.41 @@ -183,7 +183,7 @@
   28.42  
   28.43   private:
   28.44  
   28.45 -  void calculate_totals(){
   28.46 +  void calculate_totals(uint active_threads){
   28.47      if (!_has_new_data) {
   28.48        return;
   28.49      }
   28.50 @@ -191,13 +191,14 @@
   28.51      _sum = (T)0;
   28.52      _min = _data[0];
   28.53      _max = _min;
   28.54 -    for (uint i = 0; i < _length; ++i) {
   28.55 +    assert(active_threads <= _length, "Wrong number of active threads");
   28.56 +    for (uint i = 0; i < active_threads; ++i) {
   28.57        T val = _data[i];
   28.58        _sum += val;
   28.59        _min = MIN2(_min, val);
   28.60        _max = MAX2(_max, val);
   28.61      }
   28.62 -    _average = (double)_sum / (double)_length;
   28.63 +    _average = (double)_sum / (double)active_threads;
   28.64      _has_new_data = false;
   28.65    }
   28.66  };
   28.67 @@ -226,17 +227,18 @@
   28.68  }
   28.69  
   28.70  template <class T>
   28.71 -void WorkerDataArray<T>::verify() {
   28.72 +void WorkerDataArray<T>::verify(uint active_threads) {
   28.73    if (!_enabled) {
   28.74      return;
   28.75    }
   28.76  
   28.77 -  for (uint i = 0; i < _length; i++) {
   28.78 +  assert(active_threads <= _length, "Wrong number of active threads");
   28.79 +  for (uint i = 0; i < active_threads; i++) {
   28.80      assert(_data[i] != WorkerDataArray<T>::uninitialized(),
   28.81          err_msg("Invalid data for worker %u in '%s'", i, _title));
   28.82    }
   28.83    if (_thread_work_items != NULL) {
   28.84 -    _thread_work_items->verify();
   28.85 +    _thread_work_items->verify(active_threads);
   28.86    }
   28.87  }
   28.88  
   28.89 @@ -321,7 +323,7 @@
   28.90    }
   28.91  
   28.92    for (int i = 0; i < GCParPhasesSentinel; i++) {
   28.93 -    _gc_par_phases[i]->verify();
   28.94 +    _gc_par_phases[i]->verify(_active_gc_threads);
   28.95    }
   28.96  }
   28.97  
   28.98 @@ -378,7 +380,7 @@
   28.99  
  28.100  // return the average time for a phase in milliseconds
  28.101  double G1GCPhaseTimes::average_time_ms(GCParPhases phase) {
  28.102 -  return _gc_par_phases[phase]->average() * 1000.0;
  28.103 +  return _gc_par_phases[phase]->average(_active_gc_threads) * 1000.0;
  28.104  }
  28.105  
  28.106  double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) {
  28.107 @@ -386,15 +388,15 @@
  28.108  }
  28.109  
  28.110  double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) {
  28.111 -  return _gc_par_phases[phase]->sum() * 1000.0;
  28.112 +  return _gc_par_phases[phase]->sum(_active_gc_threads) * 1000.0;
  28.113  }
  28.114  
  28.115  double G1GCPhaseTimes::min_time_ms(GCParPhases phase) {
  28.116 -  return _gc_par_phases[phase]->minimum() * 1000.0;
  28.117 +  return _gc_par_phases[phase]->minimum(_active_gc_threads) * 1000.0;
  28.118  }
  28.119  
  28.120  double G1GCPhaseTimes::max_time_ms(GCParPhases phase) {
  28.121 -  return _gc_par_phases[phase]->maximum() * 1000.0;
  28.122 +  return _gc_par_phases[phase]->maximum(_active_gc_threads) * 1000.0;
  28.123  }
  28.124  
  28.125  size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) {
  28.126 @@ -404,22 +406,22 @@
  28.127  
  28.128  size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) {
  28.129    assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
  28.130 -  return _gc_par_phases[phase]->thread_work_items()->sum();
  28.131 +  return _gc_par_phases[phase]->thread_work_items()->sum(_active_gc_threads);
  28.132  }
  28.133  
  28.134  double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) {
  28.135    assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
  28.136 -  return _gc_par_phases[phase]->thread_work_items()->average();
  28.137 +  return _gc_par_phases[phase]->thread_work_items()->average(_active_gc_threads);
  28.138  }
  28.139  
  28.140  size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) {
  28.141    assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
  28.142 -  return _gc_par_phases[phase]->thread_work_items()->minimum();
  28.143 +  return _gc_par_phases[phase]->thread_work_items()->minimum(_active_gc_threads);
  28.144  }
  28.145  
  28.146  size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) {
  28.147    assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
  28.148 -  return _gc_par_phases[phase]->thread_work_items()->maximum();
  28.149 +  return _gc_par_phases[phase]->thread_work_items()->maximum(_active_gc_threads);
  28.150  }
  28.151  
  28.152  class G1GCParPhasePrinter : public StackObj {
  28.153 @@ -455,14 +457,16 @@
  28.154    }
  28.155  
  28.156    void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
  28.157 -    for (uint i = 0; i < phase->_length; ++i) {
  28.158 +    uint active_length = _phase_times->_active_gc_threads;
  28.159 +    for (uint i = 0; i < active_length; ++i) {
  28.160        buf.append("  %.1lf", _phase_times->get_time_ms(phase_id, i));
  28.161      }
  28.162      buf.print_cr();
  28.163    }
  28.164  
  28.165    void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
  28.166 -    for (uint i = 0; i < thread_work_items->_length; ++i) {
  28.167 +    uint active_length = _phase_times->_active_gc_threads;
  28.168 +    for (uint i = 0; i < active_length; ++i) {
  28.169        buf.append("  " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i));
  28.170      }
  28.171      buf.print_cr();
    29.1 --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Apr 27 14:41:55 2016 -0400
    29.2 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp	Thu Apr 28 09:50:48 2016 -0700
    29.3 @@ -794,7 +794,9 @@
    29.4                                   "in region "HR_FORMAT,
    29.5                                   (void*) obj,
    29.6                                   HR_FORMAT_PARAMS(to));
    29.7 -          obj->print_on(gclog_or_tty);
    29.8 +          if (obj->is_oop()) {
    29.9 +            obj->print_on(gclog_or_tty);
   29.10 +          }
   29.11            gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.",
   29.12                          cv_obj, cv_field);
   29.13            gclog_or_tty->print_cr("----------");
    30.1 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Wed Apr 27 14:41:55 2016 -0400
    30.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp	Thu Apr 28 09:50:48 2016 -0700
    30.3 @@ -572,7 +572,7 @@
    30.4    assert(_n_fine_entries == _max_fine_entries, "Precondition");
    30.5    PerRegionTable* max = NULL;
    30.6    jint max_occ = 0;
    30.7 -  PerRegionTable** max_prev;
    30.8 +  PerRegionTable** max_prev = NULL;
    30.9    size_t max_ind;
   30.10  
   30.11    size_t i = _fine_eviction_start;
   30.12 @@ -608,6 +608,7 @@
   30.13    }
   30.14  
   30.15    guarantee(max != NULL, "Since _n_fine_entries > 0");
   30.16 +  guarantee(max_prev != NULL, "Since max != NULL.");
   30.17  
   30.18    // Set the corresponding coarse bit.
   30.19    size_t max_hrm_index = (size_t) max->hr()->hrm_index();
   30.20 @@ -1168,7 +1169,7 @@
   30.21  
   30.22  void HeapRegionRemSet::print_recorded() {
   30.23    int cur_evnt = 0;
   30.24 -  Event cur_evnt_kind;
   30.25 +  Event cur_evnt_kind = Event_illegal;
   30.26    int cur_evnt_ind = 0;
   30.27    if (_n_recorded_events > 0) {
   30.28      cur_evnt_kind = _recorded_events[cur_evnt];
    31.1 --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Wed Apr 27 14:41:55 2016 -0400
    31.2 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp	Thu Apr 28 09:50:48 2016 -0700
    31.3 @@ -232,7 +232,7 @@
    31.4  
    31.5  public:
    31.6    enum Event {
    31.7 -    Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd
    31.8 +    Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd, Event_illegal
    31.9    };
   31.10  
   31.11  private:
    32.1 --- a/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp	Wed Apr 27 14:41:55 2016 -0400
    32.2 +++ b/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp	Thu Apr 28 09:50:48 2016 -0700
    32.3 @@ -193,8 +193,9 @@
    32.4       (!FLAG_IS_DEFAULT(ParallelGCThreads) && !ForceDynamicNumberOfGCThreads)) {
    32.5      new_active_workers = total_workers;
    32.6    } else {
    32.7 +    uintx min_workers = (total_workers == 1) ? 1 : 2;
    32.8      new_active_workers = calc_default_active_workers(total_workers,
    32.9 -                                                     2, /* Minimum number of workers */
   32.10 +                                                     min_workers,
   32.11                                                       active_workers,
   32.12                                                       application_workers);
   32.13    }
    33.1 --- a/src/share/vm/interpreter/templateInterpreter.cpp	Wed Apr 27 14:41:55 2016 -0400
    33.2 +++ b/src/share/vm/interpreter/templateInterpreter.cpp	Thu Apr 28 09:50:48 2016 -0700
    33.3 @@ -528,7 +528,7 @@
    33.4    if (StopInterpreterAt > 0)                                     stop_interpreter_at();
    33.5    __ verify_FPU(1, t->tos_in());
    33.6  #endif // !PRODUCT
    33.7 -  int step;
    33.8 +  int step = 0;
    33.9    if (!t->does_dispatch()) {
   33.10      step = t->is_wide() ? Bytecodes::wide_length_for(t->bytecode()) : Bytecodes::length_for(t->bytecode());
   33.11      if (tos_out == ilgl) tos_out = t->tos_out();
    34.1 --- a/src/share/vm/memory/allocation.cpp	Wed Apr 27 14:41:55 2016 -0400
    34.2 +++ b/src/share/vm/memory/allocation.cpp	Thu Apr 28 09:50:48 2016 -0700
    34.3 @@ -83,7 +83,7 @@
    34.4  }
    34.5  
    34.6  void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() {
    34.7 -  address res;
    34.8 +  address res = NULL;
    34.9    switch (type) {
   34.10     case C_HEAP:
   34.11      res = (address)AllocateHeap(size, flags, CALLER_PC);
   34.12 @@ -105,8 +105,8 @@
   34.13  
   34.14  void* ResourceObj::operator new(size_t size, const std::nothrow_t&  nothrow_constant,
   34.15      allocation_type type, MEMFLAGS flags) throw() {
   34.16 -  //should only call this with std::nothrow, use other operator new() otherwise
   34.17 -  address res;
   34.18 +  // should only call this with std::nothrow, use other operator new() otherwise
   34.19 +  address res = NULL;
   34.20    switch (type) {
   34.21     case C_HEAP:
   34.22      res = (address)AllocateHeap(size, flags, CALLER_PC, AllocFailStrategy::RETURN_NULL);
    35.1 --- a/src/share/vm/memory/universe.cpp	Wed Apr 27 14:41:55 2016 -0400
    35.2 +++ b/src/share/vm/memory/universe.cpp	Thu Apr 28 09:50:48 2016 -0700
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
   35.10 @@ -124,6 +124,7 @@
   35.11  objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
   35.12  volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
   35.13  bool Universe::_verify_in_progress                    = false;
   35.14 +long Universe::verify_flags                           = Universe::Verify_All;
   35.15  oop Universe::_null_ptr_exception_instance            = NULL;
   35.16  oop Universe::_arithmetic_exception_instance          = NULL;
   35.17  oop Universe::_virtual_machine_error_instance         = NULL;
   35.18 @@ -683,6 +684,9 @@
   35.19        MetaspaceShared::prepare_for_dumping();
   35.20      }
   35.21    }
   35.22 +  if (strlen(VerifySubSet) > 0) {
   35.23 +    Universe::initialize_verify_flags();
   35.24 +  }
   35.25  
   35.26    return JNI_OK;
   35.27  }
   35.28 @@ -1361,6 +1365,53 @@
   35.29    st->print_cr("}");
   35.30  }
   35.31  
   35.32 +void Universe::initialize_verify_flags() {
   35.33 +  verify_flags = 0;
   35.34 +  const char delimiter[] = " ,";
   35.35 +
   35.36 +  size_t length = strlen(VerifySubSet);
   35.37 +  char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal);
   35.38 +  strncpy(subset_list, VerifySubSet, length + 1);
   35.39 +
   35.40 +  char* token = strtok(subset_list, delimiter);
   35.41 +  while (token != NULL) {
   35.42 +    if (strcmp(token, "threads") == 0) {
   35.43 +      verify_flags |= Verify_Threads;
   35.44 +    } else if (strcmp(token, "heap") == 0) {
   35.45 +      verify_flags |= Verify_Heap;
   35.46 +    } else if (strcmp(token, "symbol_table") == 0) {
   35.47 +      verify_flags |= Verify_SymbolTable;
   35.48 +    } else if (strcmp(token, "string_table") == 0) {
   35.49 +      verify_flags |= Verify_StringTable;
   35.50 +    } else if (strcmp(token, "codecache") == 0) {
   35.51 +      verify_flags |= Verify_CodeCache;
   35.52 +    } else if (strcmp(token, "dictionary") == 0) {
   35.53 +      verify_flags |= Verify_SystemDictionary;
   35.54 +    } else if (strcmp(token, "classloader_data_graph") == 0) {
   35.55 +      verify_flags |= Verify_ClassLoaderDataGraph;
   35.56 +    } else if (strcmp(token, "metaspace") == 0) {
   35.57 +      verify_flags |= Verify_MetaspaceAux;
   35.58 +    } else if (strcmp(token, "jni_handles") == 0) {
   35.59 +      verify_flags |= Verify_JNIHandles;
   35.60 +    } else if (strcmp(token, "c-heap") == 0) {
   35.61 +      verify_flags |= Verify_CHeap;
   35.62 +    } else if (strcmp(token, "codecache_oops") == 0) {
   35.63 +      verify_flags |= Verify_CodeCacheOops;
   35.64 +    } else {
   35.65 +      vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token));
   35.66 +    }
   35.67 +    token = strtok(NULL, delimiter);
   35.68 +  }
   35.69 +  FREE_C_HEAP_ARRAY(char, subset_list, mtInternal);
   35.70 +}
   35.71 +
   35.72 +bool Universe::should_verify_subset(uint subset) {
   35.73 +  if (verify_flags & subset) {
   35.74 +    return true;
   35.75 +  }
   35.76 +  return false;
   35.77 +}
   35.78 +
   35.79  void Universe::verify(VerifyOption option, const char* prefix, bool silent) {
   35.80    // The use of _verify_in_progress is a temporary work around for
   35.81    // 6320749.  Don't bother with a creating a class to set and clear
   35.82 @@ -1380,33 +1431,55 @@
   35.83  
   35.84    if (!silent) gclog_or_tty->print("%s", prefix);
   35.85    if (!silent) gclog_or_tty->print("[Verifying ");
   35.86 -  if (!silent) gclog_or_tty->print("threads ");
   35.87 -  Threads::verify();
   35.88 -  if (!silent) gclog_or_tty->print("heap ");
   35.89 -  heap()->verify(silent, option);
   35.90 -  if (!silent) gclog_or_tty->print("syms ");
   35.91 -  SymbolTable::verify();
   35.92 -  if (!silent) gclog_or_tty->print("strs ");
   35.93 -  StringTable::verify();
   35.94 +  if (should_verify_subset(Verify_Threads)) {
   35.95 +    if (!silent) gclog_or_tty->print("Threads ");
   35.96 +    Threads::verify();
   35.97 +  }
   35.98 +  if (should_verify_subset(Verify_Heap)) {
   35.99 +    if (!silent) gclog_or_tty->print("Heap ");
  35.100 +    heap()->verify(silent, option);
  35.101 +  }
  35.102 +  if (should_verify_subset(Verify_SymbolTable)) {
  35.103 +    if (!silent) gclog_or_tty->print("SymbolTable ");
  35.104 +    SymbolTable::verify();
  35.105 +  }
  35.106 +  if (should_verify_subset(Verify_StringTable)) {
  35.107 +    if (!silent) gclog_or_tty->print("StringTable ");
  35.108 +    StringTable::verify();
  35.109 +  }
  35.110 +  if (should_verify_subset(Verify_CodeCache)) {
  35.111    {
  35.112      MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  35.113 -    if (!silent) gclog_or_tty->print("zone ");
  35.114 +    if (!silent) gclog_or_tty->print("CodeCache ");
  35.115      CodeCache::verify();
  35.116    }
  35.117 -  if (!silent) gclog_or_tty->print("dict ");
  35.118 -  SystemDictionary::verify();
  35.119 +  }
  35.120 +  if (should_verify_subset(Verify_SystemDictionary)) {
  35.121 +    if (!silent) gclog_or_tty->print("SystemDictionary ");
  35.122 +    SystemDictionary::verify();
  35.123 +  }
  35.124  #ifndef PRODUCT
  35.125 -  if (!silent) gclog_or_tty->print("cldg ");
  35.126 -  ClassLoaderDataGraph::verify();
  35.127 +  if (should_verify_subset(Verify_ClassLoaderDataGraph)) {
  35.128 +    if (!silent) gclog_or_tty->print("ClassLoaderDataGraph ");
  35.129 +    ClassLoaderDataGraph::verify();
  35.130 +  }
  35.131  #endif
  35.132 -  if (!silent) gclog_or_tty->print("metaspace chunks ");
  35.133 -  MetaspaceAux::verify_free_chunks();
  35.134 -  if (!silent) gclog_or_tty->print("hand ");
  35.135 -  JNIHandles::verify();
  35.136 -  if (!silent) gclog_or_tty->print("C-heap ");
  35.137 -  os::check_heap();
  35.138 -  if (!silent) gclog_or_tty->print("code cache ");
  35.139 -  CodeCache::verify_oops();
  35.140 +  if (should_verify_subset(Verify_MetaspaceAux)) {
  35.141 +    if (!silent) gclog_or_tty->print("MetaspaceAux ");
  35.142 +    MetaspaceAux::verify_free_chunks();
  35.143 +  }
  35.144 +  if (should_verify_subset(Verify_JNIHandles)) {
  35.145 +    if (!silent) gclog_or_tty->print("JNIHandles ");
  35.146 +    JNIHandles::verify();
  35.147 +  }
  35.148 +  if (should_verify_subset(Verify_CHeap)) {
  35.149 +    if (!silent) gclog_or_tty->print("C-heap ");
  35.150 +    os::check_heap();
  35.151 +  }
  35.152 +  if (should_verify_subset(Verify_CodeCacheOops)) {
  35.153 +    if (!silent) gclog_or_tty->print("CodeCache Oops ");
  35.154 +    CodeCache::verify_oops();
  35.155 +  }
  35.156    if (!silent) gclog_or_tty->print_cr("]");
  35.157  
  35.158    _verify_in_progress = false;
    36.1 --- a/src/share/vm/memory/universe.hpp	Wed Apr 27 14:41:55 2016 -0400
    36.2 +++ b/src/share/vm/memory/universe.hpp	Thu Apr 28 09:50:48 2016 -0700
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -247,6 +247,7 @@
   36.11    static int _verify_count;                           // number of verifies done
   36.12    // True during call to verify().  Should only be set/cleared in verify().
   36.13    static bool _verify_in_progress;
   36.14 +  static long verify_flags;
   36.15  
   36.16    static void compute_verify_oop_data();
   36.17  
   36.18 @@ -425,6 +426,22 @@
   36.19    static void init_self_patching_vtbl_list(void** list, int count);
   36.20  
   36.21    // Debugging
   36.22 +  enum VERIFY_FLAGS {
   36.23 +    Verify_Threads = 1,
   36.24 +    Verify_Heap = 2,
   36.25 +    Verify_SymbolTable = 4,
   36.26 +    Verify_StringTable = 8,
   36.27 +    Verify_CodeCache = 16,
   36.28 +    Verify_SystemDictionary = 32,
   36.29 +    Verify_ClassLoaderDataGraph = 64,
   36.30 +    Verify_MetaspaceAux = 128,
   36.31 +    Verify_JNIHandles = 256,
   36.32 +    Verify_CHeap = 512,
   36.33 +    Verify_CodeCacheOops = 1024,
   36.34 +    Verify_All = -1
   36.35 +  };
   36.36 +  static void initialize_verify_flags();
   36.37 +  static bool should_verify_subset(uint subset);
   36.38    static bool verify_in_progress() { return _verify_in_progress; }
   36.39    static void verify(VerifyOption option, const char* prefix, bool silent = VerifySilently);
   36.40    static void verify(const char* prefix, bool silent = VerifySilently) {
    37.1 --- a/src/share/vm/opto/c2compiler.cpp	Wed Apr 27 14:41:55 2016 -0400
    37.2 +++ b/src/share/vm/opto/c2compiler.cpp	Thu Apr 28 09:50:48 2016 -0700
    37.3 @@ -49,6 +49,9 @@
    37.4  const char* C2Compiler::retry_no_escape_analysis() {
    37.5    return "retry without escape analysis";
    37.6  }
    37.7 +const char* C2Compiler::retry_class_loading_during_parsing() {
    37.8 +  return "retry class loading during parsing";
    37.9 +}
   37.10  bool C2Compiler::init_c2_runtime() {
   37.11  
   37.12    // Check assumptions used while running ADLC
   37.13 @@ -115,6 +118,10 @@
   37.14  
   37.15      // Check result and retry if appropriate.
   37.16      if (C.failure_reason() != NULL) {
   37.17 +      if (C.failure_reason_is(retry_class_loading_during_parsing())) {
   37.18 +        env->record_failure(C.failure_reason());
   37.19 +        continue;  // retry
   37.20 +      }
   37.21        if (C.failure_reason_is(retry_no_subsuming_loads())) {
   37.22          assert(subsume_loads, "must make progress");
   37.23          subsume_loads = false;
    38.1 --- a/src/share/vm/opto/c2compiler.hpp	Wed Apr 27 14:41:55 2016 -0400
    38.2 +++ b/src/share/vm/opto/c2compiler.hpp	Thu Apr 28 09:50:48 2016 -0700
    38.3 @@ -49,6 +49,7 @@
    38.4    // sentinel value used to trigger backtracking in compile_method().
    38.5    static const char* retry_no_subsuming_loads();
    38.6    static const char* retry_no_escape_analysis();
    38.7 +  static const char* retry_class_loading_during_parsing();
    38.8  
    38.9    // Print compilation timers and statistics
   38.10    void print_timers();
    39.1 --- a/src/share/vm/opto/callGenerator.cpp	Wed Apr 27 14:41:55 2016 -0400
    39.2 +++ b/src/share/vm/opto/callGenerator.cpp	Thu Apr 28 09:50:48 2016 -0700
    39.3 @@ -658,7 +658,7 @@
    39.4                                             &exact_receiver);
    39.5  
    39.6    SafePointNode* slow_map = NULL;
    39.7 -  JVMState* slow_jvms;
    39.8 +  JVMState* slow_jvms = NULL;
    39.9    { PreserveJVMState pjvms(&kit);
   39.10      kit.set_control(slow_ctl);
   39.11      if (!kit.stopped()) {
   39.12 @@ -829,17 +829,18 @@
   39.13            }
   39.14          }
   39.15          // Cast reference arguments to its type.
   39.16 -        for (int i = 0; i < signature->count(); i++) {
   39.17 +        for (int i = 0, j = 0; i < signature->count(); i++) {
   39.18            ciType* t = signature->type_at(i);
   39.19            if (t->is_klass()) {
   39.20 -            Node* arg = kit.argument(receiver_skip + i);
   39.21 +            Node* arg = kit.argument(receiver_skip + j);
   39.22              const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr();
   39.23              const Type*       sig_type = TypeOopPtr::make_from_klass(t->as_klass());
   39.24              if (arg_type != NULL && !arg_type->higher_equal(sig_type)) {
   39.25                Node* cast_obj = gvn.transform(new (C) CheckCastPPNode(kit.control(), arg, sig_type));
   39.26 -              kit.set_argument(receiver_skip + i, cast_obj);
   39.27 +              kit.set_argument(receiver_skip + j, cast_obj);
   39.28              }
   39.29            }
   39.30 +          j += t->size();  // long and double take two slots
   39.31          }
   39.32  
   39.33          // Try to get the most accurate receiver type
    40.1 --- a/src/share/vm/opto/cfgnode.cpp	Wed Apr 27 14:41:55 2016 -0400
    40.2 +++ b/src/share/vm/opto/cfgnode.cpp	Thu Apr 28 09:50:48 2016 -0700
    40.3 @@ -973,7 +973,7 @@
    40.4  #ifdef ASSERT
    40.5    // The following logic has been moved into TypeOopPtr::filter.
    40.6    const Type* jt = t->join_speculative(_type);
    40.7 -  if( jt->empty() ) {           // Emptied out???
    40.8 +  if (jt->empty()) {           // Emptied out???
    40.9  
   40.10      // Check for evil case of 't' being a class and '_type' expecting an
   40.11      // interface.  This can happen because the bytecodes do not contain
   40.12 @@ -984,14 +984,21 @@
   40.13      // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
   40.14      // into a Phi which "knows" it's an Interface type we'll have to
   40.15      // uplift the type.
   40.16 -    if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() )
   40.17 -      { assert(ft == _type, ""); } // Uplift to interface
   40.18 -    else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() )
   40.19 -      { assert(ft == _type, ""); } // Uplift to interface
   40.20 -    // Otherwise it's something stupid like non-overlapping int ranges
   40.21 -    // found on dying counted loops.
   40.22 -    else
   40.23 -      { assert(ft == Type::TOP, ""); } // Canonical empty value
   40.24 +    if (!t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface()) {
   40.25 +      assert(ft == _type, ""); // Uplift to interface
   40.26 +    } else if (!t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface()) {
   40.27 +      assert(ft == _type, ""); // Uplift to interface
   40.28 +    } else {
   40.29 +      // We also have to handle 'evil cases' of interface- vs. class-arrays
   40.30 +      Type::get_arrays_base_elements(jt, _type, NULL, &ttip);
   40.31 +      if (!t->empty() && ttip != NULL && ttip->is_loaded() && ttip->klass()->is_interface()) {
   40.32 +          assert(ft == _type, "");   // Uplift to array of interface
   40.33 +      } else {
   40.34 +        // Otherwise it's something stupid like non-overlapping int ranges
   40.35 +        // found on dying counted loops.
   40.36 +        assert(ft == Type::TOP, ""); // Canonical empty value
   40.37 +      }
   40.38 +    }
   40.39    }
   40.40  
   40.41    else {
    41.1 --- a/src/share/vm/opto/compile.cpp	Wed Apr 27 14:41:55 2016 -0400
    41.2 +++ b/src/share/vm/opto/compile.cpp	Thu Apr 28 09:50:48 2016 -0700
    41.3 @@ -791,7 +791,9 @@
    41.4      }
    41.5      JVMState* jvms = build_start_state(start(), tf());
    41.6      if ((jvms = cg->generate(jvms)) == NULL) {
    41.7 -      record_method_not_compilable("method parse failed");
    41.8 +      if (!failure_reason_is(C2Compiler::retry_class_loading_during_parsing())) {
    41.9 +        record_method_not_compilable("method parse failed");
   41.10 +      }
   41.11        return;
   41.12      }
   41.13      GraphKit kit(jvms);
   41.14 @@ -3712,7 +3714,7 @@
   41.15    MacroAssembler _masm(&cb);
   41.16    for (int i = 0; i < _constants.length(); i++) {
   41.17      Constant con = _constants.at(i);
   41.18 -    address constant_addr;
   41.19 +    address constant_addr = NULL;
   41.20      switch (con.type()) {
   41.21      case T_LONG:   constant_addr = _masm.long_constant(  con.get_jlong()  ); break;
   41.22      case T_FLOAT:  constant_addr = _masm.float_constant( con.get_jfloat() ); break;
    42.1 --- a/src/share/vm/opto/generateOptoStub.cpp	Wed Apr 27 14:41:55 2016 -0400
    42.2 +++ b/src/share/vm/opto/generateOptoStub.cpp	Thu Apr 28 09:50:48 2016 -0700
    42.3 @@ -273,7 +273,7 @@
    42.4  
    42.5    //-----------------------------
    42.6    // If this is a normal subroutine return, issue the return and be done.
    42.7 -  Node *ret;
    42.8 +  Node *ret = NULL;
    42.9    switch( is_fancy_jump ) {
   42.10    case 0:                       // Make a return instruction
   42.11      // Return to caller, free any space for return address
    43.1 --- a/src/share/vm/opto/lcm.cpp	Wed Apr 27 14:41:55 2016 -0400
    43.2 +++ b/src/share/vm/opto/lcm.cpp	Thu Apr 28 09:50:48 2016 -0700
    43.3 @@ -675,7 +675,7 @@
    43.4    block->insert_node(proj, node_cnt++);
    43.5  
    43.6    // Select the right register save policy.
    43.7 -  const char * save_policy;
    43.8 +  const char *save_policy = NULL;
    43.9    switch (op) {
   43.10      case Op_CallRuntime:
   43.11      case Op_CallLeaf:
    44.1 --- a/src/share/vm/opto/library_call.cpp	Wed Apr 27 14:41:55 2016 -0400
    44.2 +++ b/src/share/vm/opto/library_call.cpp	Thu Apr 28 09:50:48 2016 -0700
    44.3 @@ -1649,7 +1649,7 @@
    44.4  // public static double Math.log10(double)
    44.5  bool LibraryCallKit::inline_math(vmIntrinsics::ID id) {
    44.6    Node* arg = round_double_node(argument(0));
    44.7 -  Node* n;
    44.8 +  Node* n = NULL;
    44.9    switch (id) {
   44.10    case vmIntrinsics::_dabs:   n = new (C) AbsDNode(                arg);  break;
   44.11    case vmIntrinsics::_dsqrt:  n = new (C) SqrtDNode(C, control(),  arg);  break;
   44.12 @@ -2390,7 +2390,7 @@
   44.13  // inline long       Long.reverseBytes(long)
   44.14  bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) {
   44.15    Node* arg = argument(0);
   44.16 -  Node* n;
   44.17 +  Node* n = NULL;
   44.18    switch (id) {
   44.19    case vmIntrinsics::_numberOfLeadingZeros_i:   n = new (C) CountLeadingZerosINode( arg);  break;
   44.20    case vmIntrinsics::_numberOfLeadingZeros_l:   n = new (C) CountLeadingZerosLNode( arg);  break;
   44.21 @@ -2985,7 +2985,7 @@
   44.22  
   44.23    // For now, we handle only those cases that actually exist: ints,
   44.24    // longs, and Object. Adding others should be straightforward.
   44.25 -  Node* load_store;
   44.26 +  Node* load_store = NULL;
   44.27    switch(type) {
   44.28    case T_INT:
   44.29      if (kind == LS_xadd) {
   44.30 @@ -3905,7 +3905,7 @@
   44.31    Node* end               = is_copyOfRange? argument(2): argument(1);
   44.32    Node* array_type_mirror = is_copyOfRange? argument(3): argument(2);
   44.33  
   44.34 -  Node* newcopy;
   44.35 +  Node* newcopy = NULL;
   44.36  
   44.37    // Set the original stack and the reexecute bit for the interpreter to reexecute
   44.38    // the bytecode that invokes Arrays.copyOf if deoptimization happens.
   44.39 @@ -4293,7 +4293,7 @@
   44.40  
   44.41  bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) {
   44.42    Node* arg = argument(0);
   44.43 -  Node* result;
   44.44 +  Node* result = NULL;
   44.45  
   44.46    switch (id) {
   44.47    case vmIntrinsics::_floatToRawIntBits:    result = new (C) MoveF2INode(arg);  break;
   44.48 @@ -6294,7 +6294,7 @@
   44.49  
   44.50  //------------------------------inline_aescrypt_Block-----------------------
   44.51  bool LibraryCallKit::inline_aescrypt_Block(vmIntrinsics::ID id) {
   44.52 -  address stubAddr;
   44.53 +  address stubAddr = NULL;
   44.54    const char *stubName;
   44.55    assert(UseAES, "need AES instruction support");
   44.56  
   44.57 @@ -6360,8 +6360,8 @@
   44.58  
   44.59  //------------------------------inline_cipherBlockChaining_AESCrypt-----------------------
   44.60  bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) {
   44.61 -  address stubAddr;
   44.62 -  const char *stubName;
   44.63 +  address stubAddr = NULL;
   44.64 +  const char *stubName = NULL;
   44.65  
   44.66    assert(UseAES, "need AES instruction support");
   44.67  
    45.1 --- a/src/share/vm/opto/loopTransform.cpp	Wed Apr 27 14:41:55 2016 -0400
    45.2 +++ b/src/share/vm/opto/loopTransform.cpp	Thu Apr 28 09:50:48 2016 -0700
    45.3 @@ -2836,7 +2836,7 @@
    45.4    // state of the loop.  It's safe in this case to replace it with the
    45.5    // result_mem.
    45.6    _igvn.replace_node(store->in(MemNode::Memory), result_mem);
    45.7 -  _igvn.replace_node(exit, result_ctrl);
    45.8 +  lazy_replace(exit, result_ctrl);
    45.9    _igvn.replace_node(store, result_mem);
   45.10    // Any uses the increment outside of the loop become the loop limit.
   45.11    _igvn.replace_node(head->incr(), head->limit());
    46.1 --- a/src/share/vm/opto/loopnode.cpp	Wed Apr 27 14:41:55 2016 -0400
    46.2 +++ b/src/share/vm/opto/loopnode.cpp	Thu Apr 28 09:50:48 2016 -0700
    46.3 @@ -750,8 +750,8 @@
    46.4      set_loop(iff2, get_loop(iffalse));
    46.5  
    46.6      // Lazy update of 'get_ctrl' mechanism.
    46.7 -    lazy_replace_proj( iffalse, iff2 );
    46.8 -    lazy_replace_proj( iftrue,  ift2 );
    46.9 +    lazy_replace(iffalse, iff2);
   46.10 +    lazy_replace(iftrue,  ift2);
   46.11  
   46.12      // Swap names
   46.13      iffalse = iff2;
    47.1 --- a/src/share/vm/opto/loopnode.hpp	Wed Apr 27 14:41:55 2016 -0400
    47.2 +++ b/src/share/vm/opto/loopnode.hpp	Thu Apr 28 09:50:48 2016 -0700
    47.3 @@ -660,13 +660,18 @@
    47.4    }
    47.5  
    47.6  private:
    47.7 -  Node *get_ctrl_no_update( Node *i ) const {
    47.8 +  Node *get_ctrl_no_update_helper(Node *i) const {
    47.9 +    assert(has_ctrl(i), "should be control, not loop");
   47.10 +    return (Node*)(((intptr_t)_nodes[i->_idx]) & ~1);
   47.11 +  }
   47.12 +
   47.13 +  Node *get_ctrl_no_update(Node *i) const {
   47.14      assert( has_ctrl(i), "" );
   47.15 -    Node *n = (Node*)(((intptr_t)_nodes[i->_idx]) & ~1);
   47.16 +    Node *n = get_ctrl_no_update_helper(i);
   47.17      if (!n->in(0)) {
   47.18        // Skip dead CFG nodes
   47.19        do {
   47.20 -        n = (Node*)(((intptr_t)_nodes[n->_idx]) & ~1);
   47.21 +        n = get_ctrl_no_update_helper(n);
   47.22        } while (!n->in(0));
   47.23        n = find_non_split_ctrl(n);
   47.24      }
   47.25 @@ -688,22 +693,15 @@
   47.26    // from old_node to new_node to support the lazy update.  Reference
   47.27    // replaces loop reference, since that is not needed for dead node.
   47.28  public:
   47.29 -  void lazy_update( Node *old_node, Node *new_node ) {
   47.30 -    assert( old_node != new_node, "no cycles please" );
   47.31 -    //old_node->set_req( 1, new_node /*NO DU INFO*/ );
   47.32 -    // Nodes always have DU info now, so re-use the side array slot
   47.33 -    // for this node to provide the forwarding pointer.
   47.34 -    _nodes.map( old_node->_idx, (Node*)((intptr_t)new_node + 1) );
   47.35 +  void lazy_update(Node *old_node, Node *new_node) {
   47.36 +    assert(old_node != new_node, "no cycles please");
   47.37 +    // Re-use the side array slot for this node to provide the
   47.38 +    // forwarding pointer.
   47.39 +    _nodes.map(old_node->_idx, (Node*)((intptr_t)new_node + 1));
   47.40    }
   47.41 -  void lazy_replace( Node *old_node, Node *new_node ) {
   47.42 -    _igvn.replace_node( old_node, new_node );
   47.43 -    lazy_update( old_node, new_node );
   47.44 -  }
   47.45 -  void lazy_replace_proj( Node *old_node, Node *new_node ) {
   47.46 -    assert( old_node->req() == 1, "use this for Projs" );
   47.47 -    _igvn.hash_delete(old_node); // Must hash-delete before hacking edges
   47.48 -    old_node->add_req( NULL );
   47.49 -    lazy_replace( old_node, new_node );
   47.50 +  void lazy_replace(Node *old_node, Node *new_node) {
   47.51 +    _igvn.replace_node(old_node, new_node);
   47.52 +    lazy_update(old_node, new_node);
   47.53    }
   47.54  
   47.55  private:
    48.1 --- a/src/share/vm/opto/loopopts.cpp	Wed Apr 27 14:41:55 2016 -0400
    48.2 +++ b/src/share/vm/opto/loopopts.cpp	Thu Apr 28 09:50:48 2016 -0700
    48.3 @@ -43,6 +43,14 @@
    48.4      return NULL;
    48.5    }
    48.6  
    48.7 +  // Splitting range check CastIIs through a loop induction Phi can
    48.8 +  // cause new Phis to be created that are left unrelated to the loop
    48.9 +  // induction Phi and prevent optimizations (vectorization)
   48.10 +  if (n->Opcode() == Op_CastII && n->as_CastII()->has_range_check() &&
   48.11 +      region->is_CountedLoop() && n->in(1) == region->as_CountedLoop()->phi()) {
   48.12 +    return NULL;
   48.13 +  }
   48.14 +
   48.15    int wins = 0;
   48.16    assert(!n->is_CFG(), "");
   48.17    assert(region->is_Region(), "");
    49.1 --- a/src/share/vm/opto/macro.cpp	Wed Apr 27 14:41:55 2016 -0400
    49.2 +++ b/src/share/vm/opto/macro.cpp	Thu Apr 28 09:50:48 2016 -0700
    49.3 @@ -693,10 +693,10 @@
    49.4    ciKlass* klass = NULL;
    49.5    ciInstanceKlass* iklass = NULL;
    49.6    int nfields = 0;
    49.7 -  int array_base;
    49.8 -  int element_size;
    49.9 -  BasicType basic_elem_type;
   49.10 -  ciType* elem_type;
   49.11 +  int array_base = 0;
   49.12 +  int element_size = 0;
   49.13 +  BasicType basic_elem_type = T_ILLEGAL;
   49.14 +  ciType* elem_type = NULL;
   49.15  
   49.16    Node* res = alloc->result_cast();
   49.17    assert(res == NULL || res->is_CheckCastPP(), "unexpected AllocateNode result");
   49.18 @@ -1177,10 +1177,10 @@
   49.19    // We need a Region and corresponding Phi's to merge the slow-path and fast-path results.
   49.20    // they will not be used if "always_slow" is set
   49.21    enum { slow_result_path = 1, fast_result_path = 2 };
   49.22 -  Node *result_region;
   49.23 -  Node *result_phi_rawmem;
   49.24 -  Node *result_phi_rawoop;
   49.25 -  Node *result_phi_i_o;
   49.26 +  Node *result_region = NULL;
   49.27 +  Node *result_phi_rawmem = NULL;
   49.28 +  Node *result_phi_rawoop = NULL;
   49.29 +  Node *result_phi_i_o = NULL;
   49.30  
   49.31    // The initial slow comparison is a size check, the comparison
   49.32    // we want to do is a BoolTest::gt
    50.1 --- a/src/share/vm/opto/parse1.cpp	Wed Apr 27 14:41:55 2016 -0400
    50.2 +++ b/src/share/vm/opto/parse1.cpp	Thu Apr 28 09:50:48 2016 -0700
    50.3 @@ -27,6 +27,7 @@
    50.4  #include "interpreter/linkResolver.hpp"
    50.5  #include "oops/method.hpp"
    50.6  #include "opto/addnode.hpp"
    50.7 +#include "opto/c2compiler.hpp"
    50.8  #include "opto/idealGraphPrinter.hpp"
    50.9  #include "opto/locknode.hpp"
   50.10  #include "opto/memnode.hpp"
   50.11 @@ -105,7 +106,7 @@
   50.12  
   50.13    // Very similar to LoadNode::make, except we handle un-aligned longs and
   50.14    // doubles on Sparc.  Intel can handle them just fine directly.
   50.15 -  Node *l;
   50.16 +  Node *l = NULL;
   50.17    switch (bt) {                // Signature is flattened
   50.18    case T_INT:     l = new (C) LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT,        MemNode::unordered); break;
   50.19    case T_FLOAT:   l = new (C) LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT,         MemNode::unordered); break;
   50.20 @@ -988,7 +989,23 @@
   50.21    if (tf()->range()->cnt() > TypeFunc::Parms) {
   50.22      const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms);
   50.23      Node*       ret_phi  = _gvn.transform( _exits.argument(0) );
   50.24 -    assert(_exits.control()->is_top() || !_gvn.type(ret_phi)->empty(), "return value must be well defined");
   50.25 +    if (!_exits.control()->is_top() && _gvn.type(ret_phi)->empty()) {
   50.26 +      // In case of concurrent class loading, the type we set for the
   50.27 +      // ret_phi in build_exits() may have been too optimistic and the
   50.28 +      // ret_phi may be top now.
   50.29 +      // Otherwise, we've encountered an error and have to mark the method as
   50.30 +      // not compilable. Just using an assertion instead would be dangerous
   50.31 +      // as this could lead to an infinite compile loop in non-debug builds.
   50.32 +      {
   50.33 +        MutexLockerEx ml(Compile_lock, Mutex::_no_safepoint_check_flag);
   50.34 +        if (C->env()->system_dictionary_modification_counter_changed()) {
   50.35 +          C->record_failure(C2Compiler::retry_class_loading_during_parsing());
   50.36 +        } else {
   50.37 +          C->record_method_not_compilable("Can't determine return type.");
   50.38 +        }
   50.39 +      }
   50.40 +      return;
   50.41 +    }
   50.42      if (ret_type->isa_int()) {
   50.43        BasicType ret_bt = method()->return_type()->basic_type();
   50.44        ret_phi = mask_int_value(ret_phi, ret_bt, &_gvn);
   50.45 @@ -1897,7 +1914,7 @@
   50.46    // Now use a Phi here for merging
   50.47    assert(!nocreate, "Cannot build a phi for a block already parsed.");
   50.48    const JVMState* jvms = map->jvms();
   50.49 -  const Type* t;
   50.50 +  const Type* t = NULL;
   50.51    if (jvms->is_loc(idx)) {
   50.52      t = block()->local_type_at(idx - jvms->locoff());
   50.53    } else if (jvms->is_stk(idx)) {
   50.54 @@ -2116,15 +2133,24 @@
   50.55      // here.
   50.56      Node* phi = _exits.argument(0);
   50.57      const TypeInstPtr *tr = phi->bottom_type()->isa_instptr();
   50.58 -    if( tr && tr->klass()->is_loaded() &&
   50.59 -        tr->klass()->is_interface() ) {
   50.60 +    if (tr && tr->klass()->is_loaded() &&
   50.61 +        tr->klass()->is_interface()) {
   50.62        const TypeInstPtr *tp = value->bottom_type()->isa_instptr();
   50.63        if (tp && tp->klass()->is_loaded() &&
   50.64            !tp->klass()->is_interface()) {
   50.65          // sharpen the type eagerly; this eases certain assert checking
   50.66          if (tp->higher_equal(TypeInstPtr::NOTNULL))
   50.67            tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr();
   50.68 -        value = _gvn.transform(new (C) CheckCastPPNode(0,value,tr));
   50.69 +        value = _gvn.transform(new (C) CheckCastPPNode(0, value, tr));
   50.70 +      }
   50.71 +    } else {
   50.72 +      // Also handle returns of oop-arrays to an arrays-of-interface return
   50.73 +      const TypeInstPtr* phi_tip;
   50.74 +      const TypeInstPtr* val_tip;
   50.75 +      Type::get_arrays_base_elements(phi->bottom_type(), value->bottom_type(), &phi_tip, &val_tip);
   50.76 +      if (phi_tip != NULL && phi_tip->is_loaded() && phi_tip->klass()->is_interface() &&
   50.77 +          val_tip != NULL && val_tip->is_loaded() && !val_tip->klass()->is_interface()) {
   50.78 +         value = _gvn.transform(new (C) CheckCastPPNode(0, value, phi->bottom_type()));
   50.79        }
   50.80      }
   50.81      phi->add_req(value);
    51.1 --- a/src/share/vm/opto/runtime.cpp	Wed Apr 27 14:41:55 2016 -0400
    51.2 +++ b/src/share/vm/opto/runtime.cpp	Thu Apr 28 09:50:48 2016 -0700
    51.3 @@ -231,22 +231,17 @@
    51.4  
    51.5    // These checks are cheap to make and support reflective allocation.
    51.6    int lh = klass->layout_helper();
    51.7 -  if (Klass::layout_helper_needs_slow_path(lh)
    51.8 -      || !InstanceKlass::cast(klass)->is_initialized()) {
    51.9 -    KlassHandle kh(THREAD, klass);
   51.10 -    kh->check_valid_for_instantiation(false, THREAD);
   51.11 +  if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) {
   51.12 +    Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
   51.13 +    klass->check_valid_for_instantiation(false, THREAD);
   51.14      if (!HAS_PENDING_EXCEPTION) {
   51.15 -      InstanceKlass::cast(kh())->initialize(THREAD);
   51.16 -    }
   51.17 -    if (!HAS_PENDING_EXCEPTION) {
   51.18 -      klass = kh();
   51.19 -    } else {
   51.20 -      klass = NULL;
   51.21 +      InstanceKlass::cast(klass)->initialize(THREAD);
   51.22      }
   51.23    }
   51.24  
   51.25 -  if (klass != NULL) {
   51.26 +  if (!HAS_PENDING_EXCEPTION) {
   51.27      // Scavenge and allocate an instance.
   51.28 +    Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
   51.29      oop result = InstanceKlass::cast(klass)->allocate_instance(THREAD);
   51.30      thread->set_vm_result(result);
   51.31  
   51.32 @@ -286,6 +281,7 @@
   51.33      // Although the oopFactory likes to work with the elem_type,
   51.34      // the compiler prefers the array_type, since it must already have
   51.35      // that latter value in hand for the fast path.
   51.36 +    Handle holder(THREAD, array_type->klass_holder()); // keep the array klass alive
   51.37      Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass();
   51.38      result = oopFactory::new_objArray(elem_type, len, THREAD);
   51.39    }
   51.40 @@ -364,6 +360,7 @@
   51.41    jint dims[2];
   51.42    dims[0] = len1;
   51.43    dims[1] = len2;
   51.44 +  Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
   51.45    oop obj = ArrayKlass::cast(elem_type)->multi_allocate(2, dims, THREAD);
   51.46    deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
   51.47    thread->set_vm_result(obj);
   51.48 @@ -380,6 +377,7 @@
   51.49    dims[0] = len1;
   51.50    dims[1] = len2;
   51.51    dims[2] = len3;
   51.52 +  Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
   51.53    oop obj = ArrayKlass::cast(elem_type)->multi_allocate(3, dims, THREAD);
   51.54    deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
   51.55    thread->set_vm_result(obj);
   51.56 @@ -397,6 +395,7 @@
   51.57    dims[1] = len2;
   51.58    dims[2] = len3;
   51.59    dims[3] = len4;
   51.60 +  Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
   51.61    oop obj = ArrayKlass::cast(elem_type)->multi_allocate(4, dims, THREAD);
   51.62    deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
   51.63    thread->set_vm_result(obj);
   51.64 @@ -415,6 +414,7 @@
   51.65    dims[2] = len3;
   51.66    dims[3] = len4;
   51.67    dims[4] = len5;
   51.68 +  Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
   51.69    oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
   51.70    deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
   51.71    thread->set_vm_result(obj);
   51.72 @@ -432,6 +432,7 @@
   51.73    jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
   51.74    Copy::conjoint_jints_atomic(j_dims, c_dims, len);
   51.75  
   51.76 +  Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
   51.77    oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
   51.78    deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
   51.79    thread->set_vm_result(obj);
    52.1 --- a/src/share/vm/opto/split_if.cpp	Wed Apr 27 14:41:55 2016 -0400
    52.2 +++ b/src/share/vm/opto/split_if.cpp	Thu Apr 28 09:50:48 2016 -0700
    52.3 @@ -451,8 +451,8 @@
    52.4  
    52.5    // Replace both uses of 'new_iff' with Regions merging True/False
    52.6    // paths.  This makes 'new_iff' go dead.
    52.7 -  Node *old_false, *old_true;
    52.8 -  Node *new_false, *new_true;
    52.9 +  Node *old_false = NULL, *old_true = NULL;
   52.10 +  Node *new_false = NULL, *new_true = NULL;
   52.11    for (DUIterator_Last j2min, j2 = iff->last_outs(j2min); j2 >= j2min; --j2) {
   52.12      Node *ifp = iff->last_out(j2);
   52.13      assert( ifp->Opcode() == Op_IfFalse || ifp->Opcode() == Op_IfTrue, "" );
   52.14 @@ -472,7 +472,7 @@
   52.15  
   52.16      // Replace in the graph with lazy-update mechanism
   52.17      new_iff->set_req(0, new_iff); // hook self so it does not go dead
   52.18 -    lazy_replace_proj( ifp, ifpx );
   52.19 +    lazy_replace(ifp, ifpx);
   52.20      new_iff->set_req(0, region);
   52.21  
   52.22      // Record bits for later xforms
    53.1 --- a/src/share/vm/opto/type.cpp	Wed Apr 27 14:41:55 2016 -0400
    53.2 +++ b/src/share/vm/opto/type.cpp	Thu Apr 28 09:50:48 2016 -0700
    53.3 @@ -149,6 +149,33 @@
    53.4    return bt;
    53.5  }
    53.6  
    53.7 +// For two instance arrays of same dimension, return the base element types.
    53.8 +// Otherwise or if the arrays have different dimensions, return NULL.
    53.9 +void Type::get_arrays_base_elements(const Type *a1, const Type *a2,
   53.10 +                                    const TypeInstPtr **e1, const TypeInstPtr **e2) {
   53.11 +
   53.12 +  if (e1) *e1 = NULL;
   53.13 +  if (e2) *e2 = NULL;
   53.14 +  const TypeAryPtr* a1tap = (a1 == NULL) ? NULL : a1->isa_aryptr();
   53.15 +  const TypeAryPtr* a2tap = (a2 == NULL) ? NULL : a2->isa_aryptr();
   53.16 +
   53.17 +  if (a1tap != NULL && a2tap != NULL) {
   53.18 +    // Handle multidimensional arrays
   53.19 +    const TypePtr* a1tp = a1tap->elem()->make_ptr();
   53.20 +    const TypePtr* a2tp = a2tap->elem()->make_ptr();
   53.21 +    while (a1tp && a1tp->isa_aryptr() && a2tp && a2tp->isa_aryptr()) {
   53.22 +      a1tap = a1tp->is_aryptr();
   53.23 +      a2tap = a2tp->is_aryptr();
   53.24 +      a1tp = a1tap->elem()->make_ptr();
   53.25 +      a2tp = a2tap->elem()->make_ptr();
   53.26 +    }
   53.27 +    if (a1tp && a1tp->isa_instptr() && a2tp && a2tp->isa_instptr()) {
   53.28 +      if (e1) *e1 = a1tp->is_instptr();
   53.29 +      if (e2) *e2 = a2tp->is_instptr();
   53.30 +    }
   53.31 +  }
   53.32 +}
   53.33 +
   53.34  //---------------------------get_typeflow_type---------------------------------
   53.35  // Import a type produced by ciTypeFlow.
   53.36  const Type* Type::get_typeflow_type(ciType* type) {
   53.37 @@ -1984,7 +2011,11 @@
   53.38  bool TypeAry::interface_vs_oop(const Type *t) const {
   53.39    const TypeAry* t_ary = t->is_ary();
   53.40    if (t_ary) {
   53.41 -    return _elem->interface_vs_oop(t_ary->_elem);
   53.42 +    const TypePtr* this_ptr = _elem->make_ptr(); // In case we have narrow_oops
   53.43 +    const TypePtr*    t_ptr = t_ary->_elem->make_ptr();
   53.44 +    if(this_ptr != NULL && t_ptr != NULL) {
   53.45 +      return this_ptr->interface_vs_oop(t_ptr);
   53.46 +    }
   53.47    }
   53.48    return false;
   53.49  }
   53.50 @@ -2836,8 +2867,17 @@
   53.51      // be 'I' or 'j/l/O'.  Thus we'll pick 'j/l/O'.  If this then flows
   53.52      // into a Phi which "knows" it's an Interface type we'll have to
   53.53      // uplift the type.
   53.54 -    if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface())
   53.55 -      return kills;             // Uplift to interface
   53.56 +    if (!empty()) {
   53.57 +      if (ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) {
   53.58 +        return kills;           // Uplift to interface
   53.59 +      }
   53.60 +      // Also check for evil cases of 'this' being a class array
   53.61 +      // and 'kills' expecting an array of interfaces.
   53.62 +      Type::get_arrays_base_elements(ft, kills, NULL, &ktip);
   53.63 +      if (ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) {
   53.64 +        return kills;           // Uplift to array of interface
   53.65 +      }
   53.66 +    }
   53.67  
   53.68      return Type::TOP;           // Canonical empty value
   53.69    }
    54.1 --- a/src/share/vm/opto/type.hpp	Wed Apr 27 14:41:55 2016 -0400
    54.2 +++ b/src/share/vm/opto/type.hpp	Thu Apr 28 09:50:48 2016 -0700
    54.3 @@ -367,6 +367,11 @@
    54.4      return _const_basic_type[type];
    54.5    }
    54.6  
    54.7 +  // For two instance arrays of same dimension, return the base element types.
    54.8 +  // Otherwise or if the arrays have different dimensions, return NULL.
    54.9 +  static void get_arrays_base_elements(const Type *a1, const Type *a2,
   54.10 +                                       const TypeInstPtr **e1, const TypeInstPtr **e2);
   54.11 +
   54.12    // Mapping to the array element's basic type.
   54.13    BasicType array_element_basic_type() const;
   54.14  
    55.1 --- a/src/share/vm/prims/jvmtiEnter.xsl	Wed Apr 27 14:41:55 2016 -0400
    55.2 +++ b/src/share/vm/prims/jvmtiEnter.xsl	Thu Apr 28 09:50:48 2016 -0700
    55.3 @@ -631,8 +631,8 @@
    55.4    jint trace_flags = JvmtiTrace::trace_flags(</xsl:text>
    55.5        <xsl:value-of select="@num"/>
    55.6        <xsl:text>);
    55.7 -  const char *func_name;
    55.8 -  const char *curr_thread_name;
    55.9 +  const char *func_name = NULL;
   55.10 +  const char *curr_thread_name = NULL;
   55.11    if (trace_flags) {
   55.12      func_name = JvmtiTrace::function_name(</xsl:text>
   55.13        <xsl:value-of select="@num"/>
    56.1 --- a/src/share/vm/prims/jvmtiEnv.cpp	Wed Apr 27 14:41:55 2016 -0400
    56.2 +++ b/src/share/vm/prims/jvmtiEnv.cpp	Thu Apr 28 09:50:48 2016 -0700
    56.3 @@ -1,5 +1,5 @@
    56.4  /*
    56.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    56.6 + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
    56.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.8   *
    56.9   * This code is free software; you can redistribute it and/or modify it
   56.10 @@ -946,7 +946,7 @@
   56.11      return JVMTI_ERROR_INVALID_THREAD;
   56.12  
   56.13    Handle thread_obj(current_thread, thread_oop);
   56.14 -  typeArrayHandle    name;
   56.15 +  Handle name;
   56.16    ThreadPriority priority;
   56.17    Handle     thread_group;
   56.18    Handle context_class_loader;
   56.19 @@ -954,7 +954,7 @@
   56.20  
   56.21    { MutexLocker mu(Threads_lock);
   56.22  
   56.23 -    name = typeArrayHandle(current_thread, java_lang_Thread::name(thread_obj()));
   56.24 +    name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
   56.25      priority = java_lang_Thread::priority(thread_obj());
   56.26      thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
   56.27      is_daemon = java_lang_Thread::is_daemon(thread_obj());
   56.28 @@ -965,7 +965,7 @@
   56.29    { const char *n;
   56.30  
   56.31      if (name() != NULL) {
   56.32 -      n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
   56.33 +      n = java_lang_String::as_utf8_string(name());
   56.34      } else {
   56.35        n = UNICODE::as_utf8(NULL, 0);
   56.36      }
   56.37 @@ -3010,7 +3010,7 @@
   56.38      // in thread.cpp.
   56.39      JvmtiPendingMonitors::enter(rmonitor);
   56.40    } else {
   56.41 -    int r;
   56.42 +    int r = 0;
   56.43      Thread* thread = Thread::current();
   56.44  
   56.45      if (thread->is_Java_thread()) {
   56.46 @@ -3073,7 +3073,7 @@
   56.47        err = JVMTI_ERROR_NOT_MONITOR_OWNER;
   56.48      }
   56.49    } else {
   56.50 -    int r;
   56.51 +    int r = 0;
   56.52      Thread* thread = Thread::current();
   56.53  
   56.54      if (thread->is_Java_thread()) {
   56.55 @@ -3107,7 +3107,7 @@
   56.56  // rmonitor - pre-checked for validity
   56.57  jvmtiError
   56.58  JvmtiEnv::RawMonitorWait(JvmtiRawMonitor * rmonitor, jlong millis) {
   56.59 -  int r;
   56.60 +  int r = 0;
   56.61    Thread* thread = Thread::current();
   56.62  
   56.63    if (thread->is_Java_thread()) {
   56.64 @@ -3166,7 +3166,7 @@
   56.65  // rmonitor - pre-checked for validity
   56.66  jvmtiError
   56.67  JvmtiEnv::RawMonitorNotify(JvmtiRawMonitor * rmonitor) {
   56.68 -  int r;
   56.69 +  int r = 0;
   56.70    Thread* thread = Thread::current();
   56.71  
   56.72    if (thread->is_Java_thread()) {
   56.73 @@ -3197,7 +3197,7 @@
   56.74  // rmonitor - pre-checked for validity
   56.75  jvmtiError
   56.76  JvmtiEnv::RawMonitorNotifyAll(JvmtiRawMonitor * rmonitor) {
   56.77 -  int r;
   56.78 +  int r = 0;
   56.79    Thread* thread = Thread::current();
   56.80  
   56.81    if (thread->is_Java_thread()) {
    57.1 --- a/src/share/vm/prims/jvmtiEnvBase.cpp	Wed Apr 27 14:41:55 2016 -0400
    57.2 +++ b/src/share/vm/prims/jvmtiEnvBase.cpp	Thu Apr 28 09:50:48 2016 -0700
    57.3 @@ -511,7 +511,7 @@
    57.4  // mean much better out of memory handling
    57.5  unsigned char *
    57.6  JvmtiEnvBase::jvmtiMalloc(jlong size) {
    57.7 -  unsigned char* mem;
    57.8 +  unsigned char* mem = NULL;
    57.9    jvmtiError result = allocate(size, &mem);
   57.10    assert(result == JVMTI_ERROR_NONE, "Allocate failed");
   57.11    return mem;
   57.12 @@ -1038,7 +1038,7 @@
   57.13      // implied else: entry_count == 0
   57.14    }
   57.15  
   57.16 -  int nWant,nWait;
   57.17 +  int nWant = 0, nWait = 0;
   57.18    if (mon != NULL) {
   57.19      // this object has a heavyweight monitor
   57.20      nWant = mon->contentions(); // # of threads contending for monitor
    58.1 --- a/src/share/vm/prims/jvmtiExport.cpp	Wed Apr 27 14:41:55 2016 -0400
    58.2 +++ b/src/share/vm/prims/jvmtiExport.cpp	Thu Apr 28 09:50:48 2016 -0700
    58.3 @@ -995,7 +995,9 @@
    58.4          // Before we call the JVMTI agent, we have to set the state in the
    58.5          // thread for which we are proxying.
    58.6          JavaThreadState prev_state = real_thread->thread_state();
    58.7 -        assert(prev_state == _thread_blocked, "JavaThread should be at safepoint");
    58.8 +        assert(((Thread *)real_thread)->is_ConcurrentGC_thread() ||
    58.9 +               (real_thread->is_Java_thread() && prev_state == _thread_blocked),
   58.10 +               "should be ConcurrentGCThread or JavaThread at safepoint");
   58.11          real_thread->set_thread_state(_thread_in_native);
   58.12  
   58.13          jvmtiExtensionEvent callback = env->ext_callbacks()->ClassUnload;
    59.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Apr 27 14:41:55 2016 -0400
    59.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Apr 28 09:50:48 2016 -0700
    59.3 @@ -1,5 +1,5 @@
    59.4  /*
    59.5 - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
    59.6 + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
    59.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.8   *
    59.9   * This code is free software; you can redistribute it and/or modify it
   59.10 @@ -332,7 +332,7 @@
   59.11        int new_name_and_type_ref_i = find_or_append_indirect_entry(scratch_cp, name_and_type_ref_i,
   59.12                                                            merge_cp_p, merge_cp_length_p, THREAD);
   59.13  
   59.14 -      const char *entry_name;
   59.15 +      const char *entry_name = NULL;
   59.16        switch (scratch_cp->tag_at(scratch_i).value()) {
   59.17        case JVM_CONSTANT_Fieldref:
   59.18          entry_name = "Fieldref";
   59.19 @@ -3926,6 +3926,10 @@
   59.20    scratch_class->set_methods(_old_methods);     // To prevent potential GCing of the old methods,
   59.21                                            // and to be able to undo operation easily.
   59.22  
   59.23 +  Array<int>* old_ordering = the_class->method_ordering();
   59.24 +  the_class->set_method_ordering(scratch_class->method_ordering());
   59.25 +  scratch_class->set_method_ordering(old_ordering);
   59.26 +
   59.27    ConstantPool* old_constants = the_class->constants();
   59.28    the_class->set_constants(scratch_class->constants());
   59.29    scratch_class->set_constants(old_constants);  // See the previous comment.
    60.1 --- a/src/share/vm/prims/jvmtiTrace.cpp	Wed Apr 27 14:41:55 2016 -0400
    60.2 +++ b/src/share/vm/prims/jvmtiTrace.cpp	Thu Apr 28 09:50:48 2016 -0700
    60.3 @@ -1,5 +1,5 @@
    60.4  /*
    60.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    60.6 + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
    60.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.8   *
    60.9   * This code is free software; you can redistribute it and/or modify it
   60.10 @@ -266,11 +266,11 @@
   60.11    if (threadObj == NULL) {
   60.12      return "NULL";
   60.13    }
   60.14 -  typeArrayOop name = java_lang_Thread::name(threadObj);
   60.15 +  oop name = java_lang_Thread::name(threadObj);
   60.16    if (name == NULL) {
   60.17      return "<NOT FILLED IN>";
   60.18    }
   60.19 -  return UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
   60.20 +  return java_lang_String::as_utf8_string(name);
   60.21  }
   60.22  
   60.23  
    61.1 --- a/src/share/vm/prims/unsafe.cpp	Wed Apr 27 14:41:55 2016 -0400
    61.2 +++ b/src/share/vm/prims/unsafe.cpp	Thu Apr 28 09:50:48 2016 -0700
    61.3 @@ -864,7 +864,7 @@
    61.4  
    61.5  UNSAFE_ENTRY(jint, Unsafe_ArrayBaseOffset(JNIEnv *env, jobject unsafe, jclass acls))
    61.6    UnsafeWrapper("Unsafe_ArrayBaseOffset");
    61.7 -  int base, scale;
    61.8 +  int base = 0, scale = 0;
    61.9    getBaseAndScale(base, scale, acls, CHECK_0);
   61.10    return field_offset_from_byte_offset(base);
   61.11  UNSAFE_END
   61.12 @@ -872,7 +872,7 @@
   61.13  
   61.14  UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale(JNIEnv *env, jobject unsafe, jclass acls))
   61.15    UnsafeWrapper("Unsafe_ArrayIndexScale");
   61.16 -  int base, scale;
   61.17 +  int base = 0, scale = 0;
   61.18    getBaseAndScale(base, scale, acls, CHECK_0);
   61.19    // This VM packs both fields and array elements down to the byte.
   61.20    // But watch out:  If this changes, so that array references for
    62.1 --- a/src/share/vm/runtime/arguments.cpp	Wed Apr 27 14:41:55 2016 -0400
    62.2 +++ b/src/share/vm/runtime/arguments.cpp	Thu Apr 28 09:50:48 2016 -0700
    62.3 @@ -1675,9 +1675,8 @@
    62.4    FLAG_SET_DEFAULT(ParallelGCThreads,
    62.5                       Abstract_VM_Version::parallel_worker_threads());
    62.6    if (ParallelGCThreads == 0) {
    62.7 -    FLAG_SET_DEFAULT(ParallelGCThreads,
    62.8 -                     Abstract_VM_Version::parallel_worker_threads());
    62.9 -  }
   62.10 +    vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
   62.11 +    }
   62.12  
   62.13  #if INCLUDE_ALL_GCS
   62.14    if (G1ConcRefinementThreads == 0) {
    63.1 --- a/src/share/vm/runtime/globals.hpp	Wed Apr 27 14:41:55 2016 -0400
    63.2 +++ b/src/share/vm/runtime/globals.hpp	Thu Apr 28 09:50:48 2016 -0700
    63.3 @@ -2259,6 +2259,14 @@
    63.4    diagnostic(bool, VerifyDuringGC, false,                                   \
    63.5            "Verify memory system during GC (between phases)")                \
    63.6                                                                              \
    63.7 +  diagnostic(ccstrlist, VerifySubSet, "",                                   \
    63.8 +          "Memory sub-systems to verify when Verify*GC flag(s) "            \
    63.9 +          "are enabled. One or more sub-systems can be specified "          \
   63.10 +          "in a comma separated string. Sub-systems are: "                  \
   63.11 +          "threads, heap, symbol_table, string_table, codecache, "          \
   63.12 +          "dictionary, classloader_data_graph, metaspace, jni_handles, "    \
   63.13 +          "c-heap, codecache_oops")                                         \
   63.14 +                                                                            \
   63.15    diagnostic(bool, GCParallelVerificationEnabled, true,                     \
   63.16            "Enable parallel memory system verification")                     \
   63.17                                                                              \
    64.1 --- a/src/share/vm/runtime/os.cpp	Wed Apr 27 14:41:55 2016 -0400
    64.2 +++ b/src/share/vm/runtime/os.cpp	Thu Apr 28 09:50:48 2016 -0700
    64.3 @@ -325,6 +325,10 @@
    64.4    // We need to initialize large page support here because ergonomics takes some
    64.5    // decisions depending on large page support and the calculated large page size.
    64.6    large_page_init();
    64.7 +
    64.8 +  // VM version initialization identifies some characteristics of the
    64.9 +  // the platform that are used during ergonomic decisions.
   64.10 +  VM_Version::init_before_ergo();
   64.11  }
   64.12  
   64.13  void os::signal_init() {
    65.1 --- a/src/share/vm/runtime/safepoint.cpp	Wed Apr 27 14:41:55 2016 -0400
    65.2 +++ b/src/share/vm/runtime/safepoint.cpp	Thu Apr 28 09:50:48 2016 -0700
    65.3 @@ -142,7 +142,7 @@
    65.4  
    65.5    // Save the starting time, so that it can be compared to see if this has taken
    65.6    // too long to complete.
    65.7 -  jlong safepoint_limit_time;
    65.8 +  jlong safepoint_limit_time = 0;
    65.9    timeout_error_printed = false;
   65.10  
   65.11    // PrintSafepointStatisticsTimeout can be specified separately. When
   65.12 @@ -925,7 +925,7 @@
   65.13  
   65.14  
   65.15  void ThreadSafepointState::print_on(outputStream *st) const {
   65.16 -  const char *s;
   65.17 +  const char *s = NULL;
   65.18  
   65.19    switch(_type) {
   65.20      case _running                : s = "_running";              break;
    66.1 --- a/src/share/vm/runtime/thread.cpp	Wed Apr 27 14:41:55 2016 -0400
    66.2 +++ b/src/share/vm/runtime/thread.cpp	Thu Apr 28 09:50:48 2016 -0700
    66.3 @@ -1,5 +1,5 @@
    66.4  /*
    66.5 - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
    66.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    66.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.8   *
    66.9   * This code is free software; you can redistribute it and/or modify it
   66.10 @@ -2926,13 +2926,13 @@
   66.11    const char* name_str;
   66.12    oop thread_obj = threadObj();
   66.13    if (thread_obj != NULL) {
   66.14 -    typeArrayOop name = java_lang_Thread::name(thread_obj);
   66.15 +    oop name = java_lang_Thread::name(thread_obj);
   66.16      if (name != NULL) {
   66.17        if (buf == NULL) {
   66.18 -        name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
   66.19 +        name_str = java_lang_String::as_utf8_string(name);
   66.20        }
   66.21        else {
   66.22 -        name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length(), buf, buflen);
   66.23 +        name_str = java_lang_String::as_utf8_string(name, buf, buflen);
   66.24        }
   66.25      }
   66.26      else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306
    67.1 --- a/src/share/vm/runtime/vm_version.hpp	Wed Apr 27 14:41:55 2016 -0400
    67.2 +++ b/src/share/vm/runtime/vm_version.hpp	Thu Apr 28 09:50:48 2016 -0700
    67.3 @@ -54,6 +54,12 @@
    67.4                                                    unsigned int dem,
    67.5                                                    unsigned int switch_pt);
    67.6   public:
    67.7 +  // Called as part of the runtime services initialization which is
    67.8 +  // called from the management module initialization (via init_globals())
    67.9 +  // after argument parsing and attaching of the main thread has
   67.10 +  // occurred.  Examines a variety of the hardware capabilities of
   67.11 +  // the platform to determine which features can be used to execute the
   67.12 +  // program.
   67.13    static void initialize();
   67.14  
   67.15    // This allows for early initialization of VM_Version information
   67.16 @@ -63,6 +69,11 @@
   67.17    // need to specialize this define VM_Version::early_initialize().
   67.18    static void early_initialize() { }
   67.19  
   67.20 +  // Called to initialize VM variables needing initialization
   67.21 +  // after command line parsing. Platforms that need to specialize
   67.22 +  // this should define VM_Version::init_before_ergo().
   67.23 +  static void init_before_ergo() {}
   67.24 +
   67.25    // Name
   67.26    static const char* vm_name();
   67.27    // Vendor
    68.1 --- a/src/share/vm/services/diagnosticCommand.cpp	Wed Apr 27 14:41:55 2016 -0400
    68.2 +++ b/src/share/vm/services/diagnosticCommand.cpp	Thu Apr 28 09:50:48 2016 -0700
    68.3 @@ -437,6 +437,10 @@
    68.4    ("config.file",
    68.5     "set com.sun.management.config.file", "STRING", false),
    68.6  
    68.7 +  _jmxremote_host
    68.8 +  ("jmxremote.host",
    68.9 +   "set com.sun.management.jmxremote.host", "STRING", false),
   68.10 +
   68.11    _jmxremote_port
   68.12    ("jmxremote.port",
   68.13     "set com.sun.management.jmxremote.port", "STRING", false),
   68.14 @@ -516,6 +520,7 @@
   68.15  
   68.16    {
   68.17      _dcmdparser.add_dcmd_option(&_config_file);
   68.18 +    _dcmdparser.add_dcmd_option(&_jmxremote_host);
   68.19      _dcmdparser.add_dcmd_option(&_jmxremote_port);
   68.20      _dcmdparser.add_dcmd_option(&_jmxremote_rmi_port);
   68.21      _dcmdparser.add_dcmd_option(&_jmxremote_ssl);
   68.22 @@ -586,6 +591,7 @@
   68.23      }
   68.24  
   68.25      PUT_OPTION(_config_file);
   68.26 +    PUT_OPTION(_jmxremote_host);
   68.27      PUT_OPTION(_jmxremote_port);
   68.28      PUT_OPTION(_jmxremote_rmi_port);
   68.29      PUT_OPTION(_jmxremote_ssl);
    69.1 --- a/src/share/vm/services/diagnosticCommand.hpp	Wed Apr 27 14:41:55 2016 -0400
    69.2 +++ b/src/share/vm/services/diagnosticCommand.hpp	Thu Apr 28 09:50:48 2016 -0700
    69.3 @@ -280,6 +280,7 @@
    69.4    // com.sun.management is omitted
    69.5  
    69.6    DCmdArgument<char *> _config_file;
    69.7 +  DCmdArgument<char *> _jmxremote_host;
    69.8    DCmdArgument<char *> _jmxremote_port;
    69.9    DCmdArgument<char *> _jmxremote_rmi_port;
   69.10    DCmdArgument<char *> _jmxremote_ssl;
    70.1 --- a/src/share/vm/services/heapDumper.cpp	Wed Apr 27 14:41:55 2016 -0400
    70.2 +++ b/src/share/vm/services/heapDumper.cpp	Thu Apr 28 09:50:48 2016 -0700
    70.3 @@ -376,11 +376,11 @@
    70.4    };
    70.5  
    70.6    int _fd;              // file descriptor (-1 if dump file not open)
    70.7 -  jlong _bytes_written; // number of byte written to dump file
    70.8 +  julong _bytes_written; // number of byte written to dump file
    70.9  
   70.10    char* _buffer;    // internal buffer
   70.11 -  int _size;
   70.12 -  int _pos;
   70.13 +  size_t _size;
   70.14 +  size_t _pos;
   70.15  
   70.16    char* _error;   // error message when I/O fails
   70.17  
   70.18 @@ -388,14 +388,14 @@
   70.19    int file_descriptor() const                   { return _fd; }
   70.20  
   70.21    char* buffer() const                          { return _buffer; }
   70.22 -  int buffer_size() const                       { return _size; }
   70.23 -  int position() const                          { return _pos; }
   70.24 -  void set_position(int pos)                    { _pos = pos; }
   70.25 +  size_t buffer_size() const                    { return _size; }
   70.26 +  size_t position() const                       { return _pos; }
   70.27 +  void set_position(size_t pos)                 { _pos = pos; }
   70.28  
   70.29    void set_error(const char* error)             { _error = (char*)os::strdup(error); }
   70.30  
   70.31    // all I/O go through this function
   70.32 -  void write_internal(void* s, int len);
   70.33 +  void write_internal(void* s, size_t len);
   70.34  
   70.35   public:
   70.36    DumpWriter(const char* path);
   70.37 @@ -406,14 +406,14 @@
   70.38    void flush();
   70.39  
   70.40    // total number of bytes written to the disk
   70.41 -  jlong bytes_written() const           { return _bytes_written; }
   70.42 +  julong bytes_written() const          { return _bytes_written; }
   70.43  
   70.44    // adjust the number of bytes written to disk (used to keep the count
   70.45    // of the number of bytes written in case of rewrites)
   70.46 -  void adjust_bytes_written(jlong n)     { _bytes_written += n; }
   70.47 +  void adjust_bytes_written(jlong n)    { _bytes_written += n; }
   70.48  
   70.49    // number of (buffered) bytes as yet unwritten to the dump file
   70.50 -  jlong bytes_unwritten() const          { return (jlong)position(); }
   70.51 +  size_t bytes_unwritten() const        { return position(); }
   70.52  
   70.53    char* error() const                   { return _error; }
   70.54  
   70.55 @@ -421,7 +421,7 @@
   70.56    void seek_to_offset(jlong pos);
   70.57  
   70.58    // writer functions
   70.59 -  void write_raw(void* s, int len);
   70.60 +  void write_raw(void* s, size_t len);
   70.61    void write_u1(u1 x)                   { write_raw((void*)&x, 1); }
   70.62    void write_u2(u2 x);
   70.63    void write_u4(u4 x);
   70.64 @@ -474,29 +474,33 @@
   70.65  }
   70.66  
   70.67  // write directly to the file
   70.68 -void DumpWriter::write_internal(void* s, int len) {
   70.69 +void DumpWriter::write_internal(void* s, size_t len) {
   70.70    if (is_open()) {
   70.71 -    int n = ::write(file_descriptor(), s, len);
   70.72 -    if (n > 0) {
   70.73 -      _bytes_written += n;
   70.74 -    }
   70.75 -    if (n != len) {
   70.76 +    const char* pos = (char*)s;
   70.77 +    ssize_t n = 0;
   70.78 +    while (len > 0) {
   70.79 +      uint tmp = (uint)MIN2(len, (size_t)UINT_MAX);
   70.80 +      n = ::write(file_descriptor(), pos, tmp);
   70.81 +
   70.82        if (n < 0) {
   70.83          set_error(strerror(errno));
   70.84 -      } else {
   70.85 -        set_error("file size limit");
   70.86 +        ::close(file_descriptor());
   70.87 +        set_file_descriptor(-1);
   70.88 +        return;
   70.89        }
   70.90 -      ::close(file_descriptor());
   70.91 -      set_file_descriptor(-1);
   70.92 +
   70.93 +      _bytes_written += n;
   70.94 +      pos += n;
   70.95 +      len -= n;
   70.96      }
   70.97    }
   70.98  }
   70.99  
  70.100  // write raw bytes
  70.101 -void DumpWriter::write_raw(void* s, int len) {
  70.102 +void DumpWriter::write_raw(void* s, size_t len) {
  70.103    if (is_open()) {
  70.104 -    // flush buffer to make toom
  70.105 -    if ((position()+ len) >= buffer_size()) {
  70.106 +    // flush buffer to make room
  70.107 +    if ((position() + len) >= buffer_size()) {
  70.108        flush();
  70.109      }
  70.110  
  70.111 @@ -519,13 +523,12 @@
  70.112    }
  70.113  }
  70.114  
  70.115 -
  70.116  jlong DumpWriter::current_offset() {
  70.117    if (is_open()) {
  70.118      // the offset is the file offset plus whatever we have buffered
  70.119      jlong offset = os::current_file_offset(file_descriptor());
  70.120      assert(offset >= 0, "lseek failed");
  70.121 -    return offset + (jlong)position();
  70.122 +    return offset + position();
  70.123    } else {
  70.124      return (jlong)-1;
  70.125    }
  70.126 @@ -774,7 +777,7 @@
  70.127    HandleMark hm;
  70.128    instanceKlassHandle ikh = instanceKlassHandle(Thread::current(), k);
  70.129  
  70.130 -  int size = 0;
  70.131 +  u4 size = 0;
  70.132  
  70.133    for (FieldStream fld(ikh, false, false); !fld.eos(); fld.next()) {
  70.134      if (!fld.access_flags().is_static()) {
  70.135 @@ -799,7 +802,7 @@
  70.136        }
  70.137      }
  70.138    }
  70.139 -  return (u4)size;
  70.140 +  return size;
  70.141  }
  70.142  
  70.143  // dumps static fields of the given class
  70.144 @@ -1031,8 +1034,7 @@
  70.145    }
  70.146  
  70.147    // If the byte ordering is big endian then we can copy most types directly
  70.148 -  int length_in_bytes = array->length() * type2aelembytes(type);
  70.149 -  assert(length_in_bytes > 0, "nothing to copy");
  70.150 +  u4 length_in_bytes = (u4)array->length() * type2aelembytes(type);
  70.151  
  70.152    switch (type) {
  70.153      case T_INT : {
  70.154 @@ -1285,22 +1287,18 @@
  70.155      }
  70.156    }
  70.157  
  70.158 -  // create a HPROF_GC_INSTANCE record for each object
  70.159    if (o->is_instance()) {
  70.160 +    // create a HPROF_GC_INSTANCE record for each object
  70.161      DumperSupport::dump_instance(writer(), o);
  70.162      mark_end_of_record();
  70.163 -  } else {
  70.164 +  } else if (o->is_objArray()) {
  70.165      // create a HPROF_GC_OBJ_ARRAY_DUMP record for each object array
  70.166 -    if (o->is_objArray()) {
  70.167 -      DumperSupport::dump_object_array(writer(), objArrayOop(o));
  70.168 -      mark_end_of_record();
  70.169 -    } else {
  70.170 -      // create a HPROF_GC_PRIM_ARRAY_DUMP record for each type array
  70.171 -      if (o->is_typeArray()) {
  70.172 -        DumperSupport::dump_prim_array(writer(), typeArrayOop(o));
  70.173 -        mark_end_of_record();
  70.174 -      }
  70.175 -    }
  70.176 +    DumperSupport::dump_object_array(writer(), objArrayOop(o));
  70.177 +    mark_end_of_record();
  70.178 +  } else if (o->is_typeArray()) {
  70.179 +    // create a HPROF_GC_PRIM_ARRAY_DUMP record for each type array
  70.180 +    DumperSupport::dump_prim_array(writer(), typeArrayOop(o));
  70.181 +    mark_end_of_record();
  70.182    }
  70.183  }
  70.184  
  70.185 @@ -1448,11 +1446,11 @@
  70.186      assert(dump_start() >= 0, "no dump start recorded");
  70.187  
  70.188      // calculate the size of the dump record
  70.189 -    jlong dump_end = writer()->current_offset();
  70.190 -    jlong dump_len = (dump_end - dump_start() - 4);
  70.191 +    julong dump_end = writer()->current_offset();
  70.192 +    julong dump_len = (dump_end - dump_start() - 4);
  70.193  
  70.194      // record length must fit in a u4
  70.195 -    if (dump_len > (jlong)(4L*(jlong)G)) {
  70.196 +    if (dump_len > max_juint) {
  70.197        warning("record is too large");
  70.198      }
  70.199  
  70.200 @@ -1461,7 +1459,7 @@
  70.201      writer()->write_u4((u4)dump_len);
  70.202  
  70.203      // adjust the total size written to keep the bytes written correct.
  70.204 -    writer()->adjust_bytes_written(-((long) sizeof(u4)));
  70.205 +    writer()->adjust_bytes_written(-((jlong) sizeof(u4)));
  70.206  
  70.207      // seek to dump end so we can continue
  70.208      writer()->seek_to_offset(dump_end);
  70.209 @@ -1477,12 +1475,12 @@
  70.210    if (writer()->is_open()) {
  70.211      if (is_segmented_dump()) {
  70.212        // don't use current_offset that would be too expensive on a per record basis
  70.213 -      jlong dump_end = writer()->bytes_written() + writer()->bytes_unwritten();
  70.214 -      assert(dump_end == writer()->current_offset(), "checking");
  70.215 -      jlong dump_len = (dump_end - dump_start() - 4);
  70.216 -      assert(dump_len >= 0 && dump_len <= max_juint, "bad dump length");
  70.217 +      julong dump_end = writer()->bytes_written() + writer()->bytes_unwritten();
  70.218 +      assert(dump_end == (julong)writer()->current_offset(), "checking");
  70.219 +      julong dump_len = (dump_end - dump_start() - 4);
  70.220 +      assert(dump_len <= max_juint, "bad dump length");
  70.221  
  70.222 -      if (dump_len > (jlong)HeapDumpSegmentSize) {
  70.223 +      if (dump_len > HeapDumpSegmentSize) {
  70.224          write_current_dump_record_length();
  70.225          write_dump_header();
  70.226        }
  70.227 @@ -1868,13 +1866,8 @@
  70.228    if (print_to_tty()) {
  70.229      timer()->stop();
  70.230      if (error() == NULL) {
  70.231 -      char msg[256];
  70.232 -      sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]",
  70.233 -        JLONG_FORMAT, timer()->seconds());
  70.234 -PRAGMA_DIAG_PUSH
  70.235 -PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL
  70.236 -      tty->print_cr(msg, writer.bytes_written());
  70.237 -PRAGMA_DIAG_POP
  70.238 +      tty->print_cr("Heap dump file created [" JULONG_FORMAT " bytes in %3.3f secs]",
  70.239 +                    writer.bytes_written(), timer()->seconds());
  70.240      } else {
  70.241        tty->print_cr("Dump file is incomplete: %s", writer.error());
  70.242      }
    71.1 --- a/src/share/vm/services/threadService.hpp	Wed Apr 27 14:41:55 2016 -0400
    71.2 +++ b/src/share/vm/services/threadService.hpp	Thu Apr 28 09:50:48 2016 -0700
    71.3 @@ -425,12 +425,12 @@
    71.4    }
    71.5  
    71.6    JavaThreadStatusChanger(JavaThread* java_thread,
    71.7 -                          java_lang_Thread::ThreadStatus state) {
    71.8 +                          java_lang_Thread::ThreadStatus state) : _old_state(java_lang_Thread::NEW) {
    71.9      save_old_state(java_thread);
   71.10      set_thread_status(state);
   71.11    }
   71.12  
   71.13 -  JavaThreadStatusChanger(JavaThread* java_thread) {
   71.14 +  JavaThreadStatusChanger(JavaThread* java_thread) : _old_state(java_lang_Thread::NEW) {
   71.15      save_old_state(java_thread);
   71.16    }
   71.17  
   71.18 @@ -527,7 +527,7 @@
   71.19    // Current thread is the notifying thread which holds the monitor.
   71.20    static bool wait_reenter_begin(JavaThread *java_thread, ObjectMonitor *obj_m) {
   71.21      assert((java_thread != NULL), "Java thread should not be null here");
   71.22 -    bool active  = false;
   71.23 +    bool active = false;
   71.24      if (is_alive(java_thread) && ServiceUtil::visible_oop((oop)obj_m->object())) {
   71.25        active = contended_enter_begin(java_thread);
   71.26      }
   71.27 @@ -542,7 +542,7 @@
   71.28    }
   71.29  
   71.30    JavaThreadBlockedOnMonitorEnterState(JavaThread *java_thread, ObjectMonitor *obj_m) :
   71.31 -    JavaThreadStatusChanger(java_thread) {
   71.32 +    _stat(NULL), _active(false), JavaThreadStatusChanger(java_thread) {
   71.33      assert((java_thread != NULL), "Java thread should not be null here");
   71.34      // Change thread status and collect contended enter stats for monitor contended
   71.35      // enter done for external java world objects and it is contended. All other cases
    72.1 --- a/test/TEST.groups	Wed Apr 27 14:41:55 2016 -0400
    72.2 +++ b/test/TEST.groups	Thu Apr 28 09:50:48 2016 -0700
    72.3 @@ -61,7 +61,6 @@
    72.4  # can be resolved in some cases by using tools from the compile-jdk.
    72.5  #
    72.6  needs_jdk = \
    72.7 -  gc/TestG1ZeroPGCTJcmdThreadPrint.java \
    72.8    gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \
    72.9    gc/metaspace/TestMetaspacePerfCounters.java \
   72.10    gc/metaspace/TestPerfCountersAndMemoryPools.java \
   72.11 @@ -216,6 +215,7 @@
   72.12    runtime/NMT \
   72.13    gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \
   72.14    gc/class_unloading/TestG1ClassUnloadingHWM.java \
   72.15 +  gc/ergonomics/TestDynamicNumberOfGCThreads.java \
   72.16    gc/g1/TestRegionAlignment.java \
   72.17    gc/g1/TestShrinkToOneRegion.java \
   72.18    gc/metaspace/G1AddMetaspaceDependency.java \
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/test/compiler/jsr292/LongReferenceCastingTest.java	Thu Apr 28 09:50:48 2016 -0700
    73.3 @@ -0,0 +1,75 @@
    73.4 +/*
    73.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
    73.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    73.7 + *
    73.8 + * This code is free software; you can redistribute it and/or modify it
    73.9 + * under the terms of the GNU General Public License version 2 only, as
   73.10 + * published by the Free Software Foundation.
   73.11 + *
   73.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   73.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   73.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   73.15 + * version 2 for more details (a copy is included in the LICENSE file that
   73.16 + * accompanied this code).
   73.17 + *
   73.18 + * You should have received a copy of the GNU General Public License version
   73.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   73.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   73.21 + *
   73.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   73.23 + * or visit www.oracle.com if you need additional information or have any
   73.24 + * questions.
   73.25 + *
   73.26 + */
   73.27 +
   73.28 +import java.lang.invoke.*;
   73.29 +
   73.30 +/**
   73.31 + * @test
   73.32 + * @bug 8148752
   73.33 + * @summary Test correct casting of MH arguments during inlining.
   73.34 + * @run main LongReferenceCastingTest
   73.35 + */
   73.36 +public class LongReferenceCastingTest {
   73.37 +    static final String MY_STRING = "myString";
   73.38 +    static final MethodHandle MH;
   73.39 +
   73.40 +    static {
   73.41 +        try {
   73.42 +            MethodHandles.Lookup lookup = MethodHandles.lookup();
   73.43 +            MethodType mt = MethodType.methodType(String.class, long.class, Object.class, String.class);
   73.44 +            MH = lookup.findVirtual(LongReferenceCastingTest.class, "myMethod", mt);
   73.45 +        } catch (Exception e) {
   73.46 +            throw new Error(e);
   73.47 +        }
   73.48 +    }
   73.49 +
   73.50 +    public String myMethod(long l, Object o, String s) {
   73.51 +        // The long argument occupies two stack slots, causing C2 to treat it as
   73.52 +        // two arguments and casting the fist one two long and the second one to Object.
   73.53 +        // As a result, Object o is casted to String and the o.toString() call is
   73.54 +        // inlined as String::toString(). We fail at runtime because 'o' is not a String.
   73.55 +        return o.toString();
   73.56 +    }
   73.57 +
   73.58 +    public String toString() {
   73.59 +        return MY_STRING;
   73.60 +    }
   73.61 +
   73.62 +    public static void main(String[] args) throws Exception {
   73.63 +        LongReferenceCastingTest test = new LongReferenceCastingTest();
   73.64 +        try {
   73.65 +            for (int i = 0; i < 20_000; ++i) {
   73.66 +                if (!test.invoke().equals(MY_STRING)) {
   73.67 +                    throw new RuntimeException("Invalid string");
   73.68 +                }
   73.69 +            }
   73.70 +        } catch (Throwable t) {
   73.71 +            throw new RuntimeException("Test failed", t);
   73.72 +        }
   73.73 +    }
   73.74 +
   73.75 +    public String invoke() throws Throwable {
   73.76 +        return (String) MH.invokeExact(this, 0L, (Object)this, MY_STRING);
   73.77 +    }
   73.78 +}
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/test/compiler/loopopts/TestArraysFillDeadControl.java	Thu Apr 28 09:50:48 2016 -0700
    74.3 @@ -0,0 +1,53 @@
    74.4 +/*
    74.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
    74.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.7 + *
    74.8 + * This code is free software; you can redistribute it and/or modify it
    74.9 + * under the terms of the GNU General Public License version 2 only, as
   74.10 + * published by the Free Software Foundation.
   74.11 + *
   74.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   74.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   74.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   74.15 + * version 2 for more details (a copy is included in the LICENSE file that
   74.16 + * accompanied this code).
   74.17 + *
   74.18 + * You should have received a copy of the GNU General Public License version
   74.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   74.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   74.21 + *
   74.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   74.23 + * or visit www.oracle.com if you need additional information or have any
   74.24 + * questions.
   74.25 + *
   74.26 + */
   74.27 +
   74.28 +/**
   74.29 + * @test
   74.30 + * @bug 8147645
   74.31 + * @summary Array.fill intrinsification code doesn't mark replaced control as dead
   74.32 + * @run main/othervm  -XX:-TieredCompilation -XX:CompileCommand=dontinline,TestArraysFillDeadControl::dont_inline TestArraysFillDeadControl
   74.33 + *
   74.34 + */
   74.35 +
   74.36 +import java.util.Arrays;
   74.37 +
   74.38 +public class TestArraysFillDeadControl {
   74.39 +
   74.40 +    static void dont_inline() {
   74.41 +    }
   74.42 +
   74.43 +    static int i = 1;
   74.44 +
   74.45 +    public static void main(String[] args) {
   74.46 +        for (int j = 0; j < 200000; j++) {
   74.47 +            int[] a = new int[2];
   74.48 +            int b = i;
   74.49 +
   74.50 +            Arrays.fill(a, 1);
   74.51 +            Arrays.fill(a, 1+b);
   74.52 +
   74.53 +            dont_inline();
   74.54 +        }
   74.55 +    }
   74.56 +}
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java	Thu Apr 28 09:50:48 2016 -0700
    75.3 @@ -0,0 +1,351 @@
    75.4 +/*
    75.5 + * Copyright 2015 SAP AG.  All Rights Reserved.
    75.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.7 + *
    75.8 + * This code is free software; you can redistribute it and/or modify it
    75.9 + * under the terms of the GNU General Public License version 2 only, as
   75.10 + * published by the Free Software Foundation.
   75.11 + *
   75.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   75.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   75.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   75.15 + * version 2 for more details (a copy is included in the LICENSE file that
   75.16 + * accompanied this code).
   75.17 + *
   75.18 + * You should have received a copy of the GNU General Public License version
   75.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   75.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   75.21 + *
   75.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   75.23 + * or visit www.oracle.com if you need additional information or have any
   75.24 + * questions.
   75.25 + */
   75.26 +
   75.27 +/*
   75.28 + * @test
   75.29 + * @bug 8141551
   75.30 + * @summary C2 can not handle returns with inccompatible interface arrays
   75.31 + * @library /testlibrary /testlibrary/whitebox/
   75.32 + * @build sun.hotspot.WhiteBox
   75.33 + * @run main ClassFileInstaller sun.hotspot.WhiteBox
   75.34 + *                              sun.hotspot.WhiteBox$WhiteBoxPermission
   75.35 + * @run main/othervm
   75.36 + *        -Xbootclasspath/a:.
   75.37 + *        -XX:+UnlockDiagnosticVMOptions
   75.38 + *        -XX:+WhiteBoxAPI
   75.39 + *        -Xbatch
   75.40 + *        -XX:CompileThreshold=1
   75.41 + *        -XX:-TieredCompilation
   75.42 + *        -XX:CICompilerCount=1
   75.43 + *        -XX:+PrintCompilation
   75.44 + *        -XX:+PrintInlining
   75.45 + *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run
   75.46 + *        -XX:CompileCommand=dontinline,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
   75.47 + *        -XX:CompileCommand=quiet
   75.48 + *        TestMeetIncompatibleInterfaceArrays 0
   75.49 + * @run main/othervm
   75.50 + *        -Xbootclasspath/a:.
   75.51 + *        -XX:+UnlockDiagnosticVMOptions
   75.52 + *        -XX:+WhiteBoxAPI
   75.53 + *        -Xbatch
   75.54 + *        -XX:CompileThreshold=1
   75.55 + *        -XX:-TieredCompilation
   75.56 + *        -XX:CICompilerCount=1
   75.57 + *        -XX:+PrintCompilation
   75.58 + *        -XX:+PrintInlining
   75.59 + *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run
   75.60 + *        -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
   75.61 + *        -XX:CompileCommand=quiet
   75.62 + *        TestMeetIncompatibleInterfaceArrays 1
   75.63 + * @run main/othervm
   75.64 + *        -Xbootclasspath/a:.
   75.65 + *        -XX:+UnlockDiagnosticVMOptions
   75.66 + *        -XX:+WhiteBoxAPI
   75.67 + *        -Xbatch
   75.68 + *        -XX:CompileThreshold=1
   75.69 + *        -XX:Tier0InvokeNotifyFreqLog=0 -XX:Tier2InvokeNotifyFreqLog=0 -XX:Tier3InvokeNotifyFreqLog=0 -XX:Tier23InlineeNotifyFreqLog=0
   75.70 + *        -XX:Tier3InvocationThreshold=2 -XX:Tier3MinInvocationThreshold=2 -XX:Tier3CompileThreshold=2
   75.71 + *        -XX:Tier4InvocationThreshold=1 -XX:Tier4MinInvocationThreshold=1 -XX:Tier4CompileThreshold=1
   75.72 + *        -XX:+TieredCompilation
   75.73 + *        -XX:CICompilerCount=2
   75.74 + *        -XX:+PrintCompilation
   75.75 + *        -XX:+PrintInlining
   75.76 + *        -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run
   75.77 + *        -XX:CompileCommand=compileonly,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
   75.78 + *        -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2*
   75.79 + *        -XX:CompileCommand=quiet
   75.80 + *        TestMeetIncompatibleInterfaceArrays 2
   75.81 + *
   75.82 + * @author volker.simonis@gmail.com
   75.83 + */
   75.84 +
   75.85 +import java.io.FileOutputStream;
   75.86 +import java.lang.reflect.InvocationTargetException;
   75.87 +import java.lang.reflect.Method;
   75.88 +import jdk.internal.org.objectweb.asm.ClassWriter;
   75.89 +import jdk.internal.org.objectweb.asm.MethodVisitor;
   75.90 +import static jdk.internal.org.objectweb.asm.Opcodes.*;
   75.91 +import sun.hotspot.WhiteBox;
   75.92 +
   75.93 +public class TestMeetIncompatibleInterfaceArrays extends ClassLoader {
   75.94 +
   75.95 +    private static final WhiteBox WB = WhiteBox.getWhiteBox();
   75.96 +
   75.97 +    public static interface I1 { public String getName(); }
   75.98 +    public static interface I2 { public String getName(); }
   75.99 +    public static class I2C implements I2 { public String getName() { return "I2";} }
  75.100 +    public static class I21C implements I2, I1 { public String getName() { return "I2 and I1";} }
  75.101 +
  75.102 +    public static class Helper {
  75.103 +        public static I2 createI2Array0() {
  75.104 +            return new I2C();
  75.105 +        }
  75.106 +        public static I2[] createI2Array1() {
  75.107 +            return new I2C[] { new I2C() };
  75.108 +        }
  75.109 +        public static I2[][] createI2Array2() {
  75.110 +            return new I2C[][] { new I2C[] { new I2C() } };
  75.111 +        }
  75.112 +        public static I2[][][] createI2Array3() {
  75.113 +            return new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } };
  75.114 +        }
  75.115 +        public static I2[][][][] createI2Array4() {
  75.116 +            return new I2C[][][][] { new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } } };
  75.117 +        }
  75.118 +        public static I2[][][][][] createI2Array5() {
  75.119 +            return new I2C[][][][][] { new I2C[][][][] { new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } } } };
  75.120 +        }
  75.121 +        public static I2 createI21Array0() {
  75.122 +            return new I21C();
  75.123 +        }
  75.124 +        public static I2[] createI21Array1() {
  75.125 +            return new I21C[] { new I21C() };
  75.126 +        }
  75.127 +        public static I2[][] createI21Array2() {
  75.128 +            return new I21C[][] { new I21C[] { new I21C() } };
  75.129 +        }
  75.130 +        public static I2[][][] createI21Array3() {
  75.131 +            return new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } };
  75.132 +        }
  75.133 +        public static I2[][][][] createI21Array4() {
  75.134 +            return new I21C[][][][] { new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } } };
  75.135 +        }
  75.136 +        public static I2[][][][][] createI21Array5() {
  75.137 +            return new I21C[][][][][] { new I21C[][][][] { new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } } } };
  75.138 +        }
  75.139 +    }
  75.140 +
  75.141 +    // Location for the generated class files
  75.142 +    public static final String PATH = System.getProperty("test.classes", ".") + java.io.File.separator;
  75.143 +
  75.144 +    /*
  75.145 +     * With 'good == false' this helper method creates the following classes
  75.146 +     * (using the nested 'Helper' class and the nested interfaces 'I1' and 'I2').
  75.147 +     * For brevity I omit the enclosing class 'TestMeetIncompatibleInterfaceArrays' in the
  75.148 +     * following examples:
  75.149 +     *
  75.150 +     * public class MeetIncompatibleInterfaceArrays0ASM {
  75.151 +     *   public static I1 run() {
  75.152 +     *     return Helper.createI2Array0(); // returns I2
  75.153 +     *   }
  75.154 +     *   public static void test() {
  75.155 +     *     I1 i1 = run();
  75.156 +     *     System.out.println(i1.getName());
  75.157 +     *   }
  75.158 +     * }
  75.159 +     * public class MeetIncompatibleInterfaceArrays1ASM {
  75.160 +     *   public static I1[] run() {
  75.161 +     *     return Helper.createI2Array1(); // returns I2[]
  75.162 +     *   }
  75.163 +     *   public static void test() {
  75.164 +     *     I1[] i1 = run();
  75.165 +     *     System.out.println(i1[0].getName());
  75.166 +     *   }
  75.167 +     * }
  75.168 +     * ...
  75.169 +     * // MeetIncompatibleInterfaceArrays4ASM is special because it creates
  75.170 +     * // an illegal class which will be rejected by the verifier.
  75.171 +     * public class MeetIncompatibleInterfaceArrays4ASM {
  75.172 +     *   public static I1[][][][] run() {
  75.173 +     *     return Helper.createI2Array3(); // returns I1[][][] which gives a verifier error because return expects I1[][][][]
  75.174 +     *   }
  75.175 +     *   public static void test() {
  75.176 +     *     I1[][][][][] i1 = run();
  75.177 +     *     System.out.println(i1[0][0][0][0][0].getName());
  75.178 +     *   }
  75.179 +     * ...
  75.180 +     * public class MeetIncompatibleInterfaceArrays5ASM {
  75.181 +     *   public static I1[][][][][] run() {
  75.182 +     *     return Helper.createI2Array5(); // returns I2[][][][][]
  75.183 +     *   }
  75.184 +     *   public static void test() {
  75.185 +     *     I1[][][][][] i1 = run();
  75.186 +     *     System.out.println(i1[0][0][0][0][0].getName());
  75.187 +     *   }
  75.188 +     * }
  75.189 +     *
  75.190 +     * Notice that this is not legal Java code. We would have to use a cast in "run()" to make it legal:
  75.191 +     *
  75.192 +     *   public static I1[] run() {
  75.193 +     *     return (I1[])Helper.createI2Array1(); // returns I2[]
  75.194 +     *   }
  75.195 +     *
  75.196 +     * But in pure bytecode, the "run()" methods are perfectly legal:
  75.197 +     *
  75.198 +     *   public static I1[] run();
  75.199 +     *     Code:
  75.200 +     *       0: invokestatic  #16  // Method Helper.createI2Array1:()[LI2;
  75.201 +     *       3: areturn
  75.202 +     *
  75.203 +     * The "test()" method calls the "getName()" function from I1 on the objects returned by "run()".
  75.204 +     * This will epectedly fail with an "IncompatibleClassChangeError" because the objects returned
  75.205 +     * by "run()" (and by createI2Array()) are actually of type "I2C" and only implement "I2" but not "I1".
  75.206 +     *
  75.207 +     *
  75.208 +     * With 'good == true' this helper method will create the following classes:
  75.209 +     *
  75.210 +     * public class MeetIncompatibleInterfaceArraysGood0ASM {
  75.211 +     *   public static I1 run() {
  75.212 +     *     return Helper.createI21Array0(); // returns I2
  75.213 +     *   }
  75.214 +     *   public static void test() {
  75.215 +     *     I1 i1 = run();
  75.216 +     *     System.out.println(i1.getName());
  75.217 +     *   }
  75.218 +     * }
  75.219 +     *
  75.220 +     * Calling "test()" on these objects will succeed and output "I2 and I1" because now the "run()"
  75.221 +     * method calls "createI21Array()" which actually return an object (or an array of objects) of
  75.222 +     * type "I21C" which implements both "I2" and "I1".
  75.223 +     *
  75.224 +     * Notice that at the bytecode level, the code for the "run()" and "test()" methods in
  75.225 +     * "MeetIncompatibleInterfaceArraysASM" and "MeetIncompatibleInterfaceArraysGoodASM" look exactly
  75.226 +     * the same. I.e. the verifier has no chance to verify if the I2 object returned by "createI1Array()"
  75.227 +     * or "createI21Array()" implements "I1" or not. That's actually the reason why both versions of
  75.228 +     * generated classes are legal from a verifier point of view.
  75.229 +     *
  75.230 +     */
  75.231 +    static void generateTestClass(int dim, boolean good) throws Exception {
  75.232 +        String baseClassName = "MeetIncompatibleInterfaceArrays";
  75.233 +        if (good)
  75.234 +            baseClassName += "Good";
  75.235 +        String createName = "createI2" + (good ? "1" : "") + "Array";
  75.236 +        String a = "";
  75.237 +        for (int i = 0; i < dim; i++)
  75.238 +            a += "[";
  75.239 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
  75.240 +        cw.visit(V1_8, ACC_PUBLIC, baseClassName + dim + "ASM", null, "java/lang/Object", null);
  75.241 +        MethodVisitor constr = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  75.242 +        constr.visitCode();
  75.243 +        constr.visitVarInsn(ALOAD, 0);
  75.244 +        constr.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
  75.245 +        constr.visitInsn(RETURN);
  75.246 +        constr.visitMaxs(0, 0);
  75.247 +        constr.visitEnd();
  75.248 +        MethodVisitor run = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "run",
  75.249 +                "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", null, null);
  75.250 +        run.visitCode();
  75.251 +        if (dim == 4) {
  75.252 +            run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + 3,
  75.253 +                    "()" + "[[[" + "LTestMeetIncompatibleInterfaceArrays$I2;", false);
  75.254 +        } else {
  75.255 +            run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + dim,
  75.256 +                    "()" + a + "LTestMeetIncompatibleInterfaceArrays$I2;", false);
  75.257 +        }
  75.258 +        run.visitInsn(ARETURN);
  75.259 +        run.visitMaxs(0, 0);
  75.260 +        run.visitEnd();
  75.261 +        MethodVisitor test = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "test", "()V", null, null);
  75.262 +        test.visitCode();
  75.263 +        test.visitMethodInsn(INVOKESTATIC, baseClassName + dim + "ASM", "run",
  75.264 +                "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", false);
  75.265 +        test.visitVarInsn(ASTORE, 0);
  75.266 +        if (dim > 0) {
  75.267 +            test.visitVarInsn(ALOAD, 0);
  75.268 +            for (int i = 1; i <= dim; i++) {
  75.269 +                test.visitInsn(ICONST_0);
  75.270 +                test.visitInsn(AALOAD);
  75.271 +            }
  75.272 +            test.visitVarInsn(ASTORE, 1);
  75.273 +        }
  75.274 +        test.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;");
  75.275 +        test.visitVarInsn(ALOAD, dim > 0 ? 1 : 0);
  75.276 +        test.visitMethodInsn(INVOKEINTERFACE, "TestMeetIncompatibleInterfaceArrays$I1", "getName",
  75.277 +                "()Ljava/lang/String;", true);
  75.278 +        test.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false);
  75.279 +        test.visitInsn(RETURN);
  75.280 +        test.visitMaxs(0, 0);
  75.281 +        test.visitEnd();
  75.282 +
  75.283 +        // Get the bytes of the class..
  75.284 +        byte[] b = cw.toByteArray();
  75.285 +        // ..and write them into a class file (for debugging)
  75.286 +        FileOutputStream fos = new FileOutputStream(PATH + baseClassName + dim + "ASM.class");
  75.287 +        fos.write(b);
  75.288 +        fos.close();
  75.289 +
  75.290 +    }
  75.291 +
  75.292 +    public static String[][] tier = { { "interpreted", "C2 (tier 4) without inlining", "C2 (tier4) without inlining" },
  75.293 +            { "interpreted", "C2 (tier 4) with inlining", "C2 (tier4) with inlining" },
  75.294 +            { "interpreted", "C1 (tier 3) with inlining", "C2 (tier4) with inlining" } };
  75.295 +
  75.296 +    public static void main(String[] args) throws Exception {
  75.297 +        final int pass = Integer.parseInt(args.length > 0 ? args[0] : "0");
  75.298 +
  75.299 +        // Load and initialize some classes required for compilation
  75.300 +        Class.forName("TestMeetIncompatibleInterfaceArrays$I1");
  75.301 +        Class.forName("TestMeetIncompatibleInterfaceArrays$I2");
  75.302 +        Class.forName("TestMeetIncompatibleInterfaceArrays$Helper");
  75.303 +
  75.304 +        for (int g = 0; g < 2; g++) {
  75.305 +            String baseClassName = "MeetIncompatibleInterfaceArrays";
  75.306 +            boolean good = (g == 0) ? false : true;
  75.307 +            if (good)
  75.308 +                baseClassName += "Good";
  75.309 +            for (int i = 0; i < 6; i++) {
  75.310 +                System.out.println();
  75.311 +                System.out.println("Creating " + baseClassName + i + "ASM.class");
  75.312 +                System.out.println("========================================" + "=" + "=========");
  75.313 +                // Create the "MeetIncompatibleInterfaceArrays<i>ASM" class
  75.314 +                generateTestClass(i, good);
  75.315 +                Class<?> c = null;
  75.316 +                try {
  75.317 +                    c = Class.forName(baseClassName + i + "ASM");
  75.318 +                } catch (VerifyError ve) {
  75.319 +                    if (i == 4) {
  75.320 +                        System.out.println("OK - must be (" + ve.getMessage() + ").");
  75.321 +                    } else {
  75.322 +                        throw ve;
  75.323 +                    }
  75.324 +                    continue;
  75.325 +                }
  75.326 +                // Call MeetIncompatibleInterfaceArrays<i>ASM.test()
  75.327 +                Method m = c.getMethod("test");
  75.328 +                Method r = c.getMethod("run");
  75.329 +                for (int j = 0; j < 3; j++) {
  75.330 +                    System.out.println((j + 1) + ". invokation of " + baseClassName + i + "ASM.test() [should be "
  75.331 +                            + tier[pass][j] + "]");
  75.332 +                    try {
  75.333 +                        m.invoke(null);
  75.334 +                    } catch (InvocationTargetException ite) {
  75.335 +                        if (good) {
  75.336 +                            throw ite;
  75.337 +                        } else {
  75.338 +                            if (ite.getCause() instanceof IncompatibleClassChangeError) {
  75.339 +                                System.out.println("  OK - catched InvocationTargetException("
  75.340 +                                        + ite.getCause().getMessage() + ").");
  75.341 +                            } else {
  75.342 +                                throw ite;
  75.343 +                            }
  75.344 +                        }
  75.345 +                    }
  75.346 +                }
  75.347 +                System.out.println("Method " + r + (WB.isMethodCompiled(r) ? " has" : " has not") + " been compiled.");
  75.348 +                if (!WB.isMethodCompiled(r)) {
  75.349 +                    throw new Exception("Method " + r + " must be compiled!");
  75.350 +                }
  75.351 +            }
  75.352 +        }
  75.353 +    }
  75.354 +}
    76.1 --- a/test/gc/8000311/Test8000311.java	Wed Apr 27 14:41:55 2016 -0400
    76.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.3 @@ -1,42 +0,0 @@
    76.4 -/*
    76.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    76.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    76.7 - *
    76.8 - * This code is free software; you can redistribute it and/or modify it
    76.9 - * under the terms of the GNU General Public License version 2 only, as
   76.10 - * published by the Free Software Foundation.
   76.11 - *
   76.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   76.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   76.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   76.15 - * version 2 for more details (a copy is included in the LICENSE file that
   76.16 - * accompanied this code).
   76.17 - *
   76.18 - * You should have received a copy of the GNU General Public License version
   76.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   76.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   76.21 - *
   76.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   76.23 - * or visit www.oracle.com if you need additional information or have any
   76.24 - * questions.
   76.25 - */
   76.26 -
   76.27 -/**
   76.28 - * @test Test8000311
   76.29 - * @key gc
   76.30 - * @bug 8000311
   76.31 - * @summary G1: ParallelGCThreads==0 broken
   76.32 - * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+ResizePLAB -XX:+ExplicitGCInvokesConcurrent Test8000311
   76.33 - * @author filipp.zhinkin@oracle.com
   76.34 - */
   76.35 -
   76.36 -import java.util.*;
   76.37 -
   76.38 -public class Test8000311 {
   76.39 -  public static void main(String args[]) {
   76.40 -    for(int i = 0; i<100; i++) {
   76.41 -      byte[] garbage = new byte[1000];
   76.42 -      System.gc();
   76.43 -    }
   76.44 -  }
   76.45 -}
    77.1 --- a/test/gc/TestG1ZeroPGCTJcmdThreadPrint.java	Wed Apr 27 14:41:55 2016 -0400
    77.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.3 @@ -1,54 +0,0 @@
    77.4 -/*
    77.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    77.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 - *
    77.8 - * This code is free software; you can redistribute it and/or modify it
    77.9 - * under the terms of the GNU General Public License version 2 only, as
   77.10 - * published by the Free Software Foundation.
   77.11 - *
   77.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 - * version 2 for more details (a copy is included in the LICENSE file that
   77.16 - * accompanied this code).
   77.17 - *
   77.18 - * You should have received a copy of the GNU General Public License version
   77.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 - *
   77.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 - * or visit www.oracle.com if you need additional information or have any
   77.24 - * questions.
   77.25 - */
   77.26 -
   77.27 -/* @test TestG1ZeroPGCTJcmdThreadPrint
   77.28 - * @key gc
   77.29 - * @bug 8005875
   77.30 - * @summary Use jcmd to generate a thread dump of a Java program being run with PGCT=0 to verify 8005875
   77.31 - * @library /testlibrary
   77.32 - * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+IgnoreUnrecognizedVMOptions TestG1ZeroPGCTJcmdThreadPrint
   77.33 - */
   77.34 -
   77.35 -import com.oracle.java.testlibrary.*;
   77.36 -
   77.37 -public class TestG1ZeroPGCTJcmdThreadPrint {
   77.38 -  public static void main(String args[]) throws Exception {
   77.39 -
   77.40 -    // Grab the pid from the current java process
   77.41 -    String pid = Integer.toString(ProcessTools.getProcessId());
   77.42 -
   77.43 -    // Create a ProcessBuilder
   77.44 -    ProcessBuilder pb = new ProcessBuilder();
   77.45 -
   77.46 -    // Run jcmd <pid> Thread.print
   77.47 -    pb.command(JDKToolFinder.getJDKTool("jcmd"), pid, "Thread.print");
   77.48 -
   77.49 -    OutputAnalyzer output = new OutputAnalyzer(pb.start());
   77.50 -
   77.51 -    // There shouldn't be a work gang for concurrent marking.
   77.52 -    output.shouldNotContain("G1 Parallel Marking Threads");
   77.53 -
   77.54 -    // Make sure we didn't crash
   77.55 -    output.shouldHaveExitValue(0);
   77.56 -  }
   77.57 -}
    78.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    78.2 +++ b/test/gc/TestVerifySubSet.java	Thu Apr 28 09:50:48 2016 -0700
    78.3 @@ -0,0 +1,91 @@
    78.4 +/*
    78.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
    78.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    78.7 + *
    78.8 + * This code is free software; you can redistribute it and/or modify it
    78.9 + * under the terms of the GNU General Public License version 2 only, as
   78.10 + * published by the Free Software Foundation.
   78.11 + *
   78.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   78.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   78.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   78.15 + * version 2 for more details (a copy is included in the LICENSE file that
   78.16 + * accompanied this code).
   78.17 + *
   78.18 + * You should have received a copy of the GNU General Public License version
   78.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   78.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   78.21 + *
   78.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   78.23 + * or visit www.oracle.com if you need additional information or have any
   78.24 + * questions.
   78.25 + */
   78.26 +
   78.27 +/* @test TestVerifySubSet.java
   78.28 + * @key gc
   78.29 + * @bug 8072725
   78.30 + * @summary Test VerifySubSet option
   78.31 + * @library /testlibrary
   78.32 + */
   78.33 +
   78.34 +import com.oracle.java.testlibrary.OutputAnalyzer;
   78.35 +import com.oracle.java.testlibrary.ProcessTools;
   78.36 +import java.util.ArrayList;
   78.37 +import java.util.Collections;
   78.38 +
   78.39 +class RunSystemGC {
   78.40 +    public static void main(String args[]) throws Exception {
   78.41 +        System.gc();
   78.42 +    }
   78.43 +}
   78.44 +
   78.45 +public class TestVerifySubSet {
   78.46 +    private static String[] getTestJavaOpts() {
   78.47 +        String testVmOptsStr = System.getProperty("test.java.opts");
   78.48 +        if (!testVmOptsStr.isEmpty()) {
   78.49 +            return testVmOptsStr.split(" ");
   78.50 +        } else {
   78.51 +            return new String[] {};
   78.52 +        }
   78.53 +    }
   78.54 +
   78.55 +    private static OutputAnalyzer runTest(String subset) throws Exception {
   78.56 +        ArrayList<String> vmOpts = new ArrayList();
   78.57 +
   78.58 +        Collections.addAll(vmOpts, getTestJavaOpts());
   78.59 +        Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions",
   78.60 +                                                 "-XX:+VerifyBeforeGC",
   78.61 +                                                 "-XX:+VerifyAfterGC",
   78.62 +                                                 "-XX:VerifySubSet="+subset,
   78.63 +                                                 RunSystemGC.class.getName()});
   78.64 +        ProcessBuilder pb =
   78.65 +            ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()]));
   78.66 +        OutputAnalyzer output = new OutputAnalyzer(pb.start());
   78.67 +
   78.68 +        System.out.println("Output:\n" + output.getOutput());
   78.69 +        return output;
   78.70 +    }
   78.71 +
   78.72 +    public static void main(String args[]) throws Exception {
   78.73 +
   78.74 +        OutputAnalyzer output;
   78.75 +
   78.76 +        output = runTest("heap, threads, codecache, metaspace");
   78.77 +        output.shouldContain("Heap");
   78.78 +        output.shouldContain("Threads");
   78.79 +        output.shouldContain("CodeCache");
   78.80 +        output.shouldContain("MetaspaceAux");
   78.81 +        output.shouldNotContain("SymbolTable");
   78.82 +        output.shouldNotContain("StringTable");
   78.83 +        output.shouldNotContain("SystemDictionary");
   78.84 +        output.shouldNotContain("CodeCache Oops");
   78.85 +        output.shouldHaveExitValue(0);
   78.86 +
   78.87 +        output = runTest("hello, threads, codecache, metaspace");
   78.88 +        output.shouldContain("memory sub-system is unknown, please correct it");
   78.89 +        output.shouldNotContain("Threads");
   78.90 +        output.shouldNotContain("CodeCache");
   78.91 +        output.shouldNotContain("MetaspaceAux");
   78.92 +        output.shouldHaveExitValue(1);
   78.93 +    }
   78.94 +}
    79.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    79.2 +++ b/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java	Thu Apr 28 09:50:48 2016 -0700
    79.3 @@ -0,0 +1,79 @@
    79.4 +/*
    79.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
    79.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    79.7 + *
    79.8 + * This code is free software; you can redistribute it and/or modify it
    79.9 + * under the terms of the GNU General Public License version 2 only, as
   79.10 + * published by the Free Software Foundation.
   79.11 + *
   79.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   79.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   79.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   79.15 + * version 2 for more details (a copy is included in the LICENSE file that
   79.16 + * accompanied this code).
   79.17 + *
   79.18 + * You should have received a copy of the GNU General Public License version
   79.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   79.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   79.21 + *
   79.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   79.23 + * or visit www.oracle.com if you need additional information or have any
   79.24 + * questions.
   79.25 + */
   79.26 +
   79.27 +/*
   79.28 + * @test TestDynamicNumberOfGCThreads
   79.29 + * @bug 8017462
   79.30 + * @summary Ensure that UseDynamicNumberOfGCThreads runs
   79.31 + * @requires vm.gc=="null"
   79.32 + * @key gc
   79.33 + * @library /testlibrary
   79.34 + */
   79.35 +
   79.36 +import com.oracle.java.testlibrary.ProcessTools;
   79.37 +import com.oracle.java.testlibrary.OutputAnalyzer;
   79.38 +
   79.39 +public class TestDynamicNumberOfGCThreads {
   79.40 +  public static void main(String[] args) throws Exception {
   79.41 +
   79.42 +    testDynamicNumberOfGCThreads("UseConcMarkSweepGC");
   79.43 +
   79.44 +    testDynamicNumberOfGCThreads("UseG1GC");
   79.45 +
   79.46 +    testDynamicNumberOfGCThreads("UseParallelGC");
   79.47 +  }
   79.48 +
   79.49 +  private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output) {
   79.50 +    output.shouldHaveExitValue(0); // test should run succesfully
   79.51 +    output.shouldContain("new_active_workers");
   79.52 +  }
   79.53 +
   79.54 +  private static void testDynamicNumberOfGCThreads(String gcFlag) throws Exception {
   79.55 +    // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled
   79.56 +    String[] baseArgs = {"-XX:+" + gcFlag, "-Xmx10M", "-XX:+PrintGCDetails",  "-XX:+UseDynamicNumberOfGCThreads", "-XX:+TraceDynamicGCThreads", GCTest.class.getName()};
   79.57 +
   79.58 +    // Base test with gc and +UseDynamicNumberOfGCThreads:
   79.59 +    ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs);
   79.60 +    verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start()));
   79.61 +
   79.62 +    // Ensure it also works on uniprocessors or if user specifies -XX:ParallelGCThreads=1:
   79.63 +    String[] extraArgs = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+ForceDynamicNumberOfGCThreads", "-XX:ParallelGCThreads=1"};
   79.64 +    String[] finalArgs = new String[baseArgs.length + extraArgs.length];
   79.65 +    System.arraycopy(extraArgs, 0, finalArgs, 0,                extraArgs.length);
   79.66 +    System.arraycopy(baseArgs,  0, finalArgs, extraArgs.length, baseArgs.length);
   79.67 +    pb_enabled = ProcessTools.createJavaProcessBuilder(finalArgs);
   79.68 +    verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start()));
   79.69 +  }
   79.70 +
   79.71 +  static class GCTest {
   79.72 +    private static byte[] garbage;
   79.73 +    public static void main(String [] args) {
   79.74 +      System.out.println("Creating garbage");
   79.75 +      // create 128MB of garbage. This should result in at least one GC
   79.76 +      for (int i = 0; i < 1024; i++) {
   79.77 +        garbage = new byte[128 * 1024];
   79.78 +      }
   79.79 +      System.out.println("Done");
   79.80 +    }
   79.81 +  }
   79.82 +}
    80.1 --- a/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java	Wed Apr 27 14:41:55 2016 -0400
    80.2 +++ b/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java	Thu Apr 28 09:50:48 2016 -0700
    80.3 @@ -42,8 +42,8 @@
    80.4  
    80.5      public static void main(String args[]) throws Exception {
    80.6          OutputAnalyzer output;
    80.7 -        long commitSize = 4 * 1024; // 4KB
    80.8 -        long reserveSize = 1024 * 1024; // 1024KB
    80.9 +        long commitSize = 128 * 1024; // 128KB
   80.10 +        long reserveSize = 4 * 1024 * 1024; // 4096KB
   80.11          long addr;
   80.12  
   80.13          String pid = Integer.toString(ProcessTools.getProcessId());
   80.14 @@ -62,11 +62,11 @@
   80.15                  "VM.native_memory", "detail" });
   80.16  
   80.17          output = new OutputAnalyzer(pb.start());
   80.18 -        output.shouldContain("Test (reserved=1024KB, committed=0KB)");
   80.19 +        output.shouldContain("Test (reserved=4096KB, committed=0KB)");
   80.20          if (has_nmt_detail) {
   80.21              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
   80.22                      + Long.toHexString(addr + reserveSize)
   80.23 -                    + "\\] reserved 1024KB for Test");
   80.24 +                    + "\\] reserved 4096KB for Test");
   80.25          }
   80.26  
   80.27          long addrA = addr;
   80.28 @@ -83,24 +83,24 @@
   80.29          wb.NMTCommitMemory(addrD, commitSize);
   80.30  
   80.31          output = new OutputAnalyzer(pb.start());
   80.32 -        output.shouldContain("Test (reserved=1024KB, committed=16KB)");
   80.33 +        output.shouldContain("Test (reserved=4096KB, committed=512KB)");
   80.34  
   80.35          if (has_nmt_detail) {
   80.36              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
   80.37                      + Long.toHexString(addr + reserveSize)
   80.38 -                    + "\\] reserved 1024KB for Test");
   80.39 +                    + "\\] reserved 4096KB for Test");
   80.40          }
   80.41          // uncommit BC
   80.42          wb.NMTUncommitMemory(addrB, commitSize);
   80.43          wb.NMTUncommitMemory(addrC, commitSize);
   80.44  
   80.45          output = new OutputAnalyzer(pb.start());
   80.46 -        output.shouldContain("Test (reserved=1024KB, committed=8KB)");
   80.47 +        output.shouldContain("Test (reserved=4096KB, committed=256KB)");
   80.48  
   80.49          if (has_nmt_detail) {
   80.50              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
   80.51                      + Long.toHexString(addr + reserveSize)
   80.52 -                    + "\\] reserved 1024KB for Test");
   80.53 +                    + "\\] reserved 4096KB for Test");
   80.54          }
   80.55  
   80.56          // commit EF
   80.57 @@ -108,22 +108,22 @@
   80.58          wb.NMTCommitMemory(addrF, commitSize);
   80.59  
   80.60          output = new OutputAnalyzer(pb.start());
   80.61 -        output.shouldContain("Test (reserved=1024KB, committed=16KB)");
   80.62 +        output.shouldContain("Test (reserved=4096KB, committed=512KB)");
   80.63          if (has_nmt_detail) {
   80.64              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
   80.65                      + Long.toHexString(addr + reserveSize)
   80.66 -                    + "\\] reserved 1024KB for Test");
   80.67 +                    + "\\] reserved 4096KB for Test");
   80.68          }
   80.69  
   80.70          // uncommit A
   80.71          wb.NMTUncommitMemory(addrA, commitSize);
   80.72  
   80.73          output = new OutputAnalyzer(pb.start());
   80.74 -        output.shouldContain("Test (reserved=1024KB, committed=12KB)");
   80.75 +        output.shouldContain("Test (reserved=4096KB, committed=384KB)");
   80.76          if (has_nmt_detail) {
   80.77              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
   80.78                      + Long.toHexString(addr + reserveSize)
   80.79 -                    + "\\] reserved 1024KB for Test");
   80.80 +                    + "\\] reserved 4096KB for Test");
   80.81          }
   80.82  
   80.83          // commit ABC
   80.84 @@ -132,11 +132,11 @@
   80.85          wb.NMTCommitMemory(addrC, commitSize);
   80.86  
   80.87          output = new OutputAnalyzer(pb.start());
   80.88 -        output.shouldContain("Test (reserved=1024KB, committed=24KB)");
   80.89 +        output.shouldContain("Test (reserved=4096KB, committed=768KB)");
   80.90          if (has_nmt_detail) {
   80.91              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
   80.92                      + Long.toHexString(addr + reserveSize)
   80.93 -                    + "\\] reserved 1024KB for Test");
   80.94 +                    + "\\] reserved 4096KB for Test");
   80.95          }
   80.96  
   80.97          // uncommit ABCDEF
   80.98 @@ -148,11 +148,11 @@
   80.99          wb.NMTUncommitMemory(addrF, commitSize);
  80.100  
  80.101          output = new OutputAnalyzer(pb.start());
  80.102 -        output.shouldContain("Test (reserved=1024KB, committed=0KB)");
  80.103 +        output.shouldContain("Test (reserved=4096KB, committed=0KB)");
  80.104          if (has_nmt_detail) {
  80.105              output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
  80.106                      + Long.toHexString(addr + reserveSize)
  80.107 -                    + "\\] reserved 1024KB for Test");
  80.108 +                    + "\\] reserved 4096KB for Test");
  80.109          }
  80.110  
  80.111          // release
  80.112 @@ -160,6 +160,6 @@
  80.113          output = new OutputAnalyzer(pb.start());
  80.114          output.shouldNotContain("Test (reserved=");
  80.115          output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*"
  80.116 -                + Long.toHexString(addr + reserveSize) + "\\] reserved 1024KB for Test");
  80.117 +                + Long.toHexString(addr + reserveSize) + "\\] reserved 4096KB for Test");
  80.118      }
  80.119  }

mercurial