# HG changeset patch # User asaha # Date 1461862248 25200 # Node ID dd3db9a36c40f43e7a5a6188a37417fa31e74a7b # Parent d78403bec68b320ea0c5b5e907d84a2744455b4a# Parent e0fa1c8d84cc502b1a04c21e2a59f00eaff82f3c Merge diff -r d78403bec68b -r dd3db9a36c40 .hgtags --- a/.hgtags Wed Apr 27 14:41:55 2016 -0400 +++ b/.hgtags Thu Apr 28 09:50:48 2016 -0700 @@ -839,6 +839,10 @@ bbbb05e91c629f8d9eef2ba43933767f68a898b0 jdk8u91-b00 e36b6ade0499eadfd8673fe62ef0a613af2e6d67 jdk8u91-b13 fa8991ccf6e5b74890a0b5672440b3c09d8d8732 jdk8u91-b14 +1b6d4fd2730e58f17820930f797938dc182117c4 jdk8u77-b00 +ddd297e340b1170d3cec011ee64e729f8b493c86 jdk8u77-b01 +1b4072e4bb3ad54c4e894998486a8b33f0689160 jdk8u77-b02 +223b64a19e94222dd97b92bb40abcfbc0bf6ef1f jdk8u77-b03 d7b01fb81aa8a5437cb03bc36afe15cf0e55fb89 jdk8u76-b00 c1679cc87ba045219169cabb6b9b378c2b5cc578 jdk8u76-b01 218483967e52b419d885d34af4488a81c5133804 jdk8u76-b02 @@ -860,4 +864,13 @@ ead07188d11107e877e8e4ad215ff6cb238a8a92 jdk8u101-b01 34429bad9986677f4991c80aeb22665842881cba jdk8u101-b02 b41d5faaf1d32ed1bf9592f65f2f94ddd4c60fc4 jdk8u101-b03 +ceecf88e5c2c09bfabf5926581e6d0b0f65f5148 jdk8u101-b04 +19e74265fc8def6a7fc96c836d8ebe38ad1cf199 jdk8u101-b05 +d6c92b9e192ef97305a699e868387d55821c81ad jdk8u102-b00 +d6c92b9e192ef97305a699e868387d55821c81ad jdk8u82-b00 +516a64e6d7c2dc29fd932bf3b8313e560a01bcd0 jdk8u102-b01 +83dc7e55f71596e6e76fabfa56b6008e070ff44c jdk8u102-b02 +ef01a1634bb41dd5b36fc9824f8d35f745c6bd5a jdk8u102-b03 +2094cac55c5955b4f19cd9e35e3be8b467e59b57 jdk8u102-b04 +a96cf90239c64f51679d106b852c9a5b343b9488 jdk8u102-b05 ceecf88e5c2c09bfabf5926581e6d0b0f65f5148 jdk8u111-b00 diff -r d78403bec68b -r dd3db9a36c40 agent/src/os/linux/symtab.c --- a/agent/src/os/linux/symtab.c Wed Apr 27 14:41:55 2016 -0400 +++ b/agent/src/os/linux/symtab.c Thu Apr 28 09:50:48 2016 -0700 @@ -514,6 +514,7 @@ return (uintptr_t)NULL; item.key = (char*) strdup(sym_name); + item.data = NULL; hsearch_r(item, FIND, &ret, symtab->hash_table); if (ret) { struct elf_symbol * sym = (struct elf_symbol *)(ret->data); diff -r d78403bec68b -r dd3db9a36c40 agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java Wed Apr 27 14:41:55 2016 -0400 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -219,7 +219,7 @@ if (threadNameField == null) { SystemDictionary sysDict = VM.getVM().getSystemDictionary(); InstanceKlass k = sysDict.getThreadKlass(); - threadNameField = (OopField) k.findField("name", "[C"); + threadNameField = (OopField) k.findField("name", "Ljava/lang/String;"); threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;"); threadEETopField = (LongField) k.findField("eetop", "J"); threadTIDField = (LongField) k.findField("tid", "J"); @@ -258,7 +258,7 @@ public static String threadOopGetName(Oop threadOop) { initThreadFields(); - return charArrayToString((TypeArray) threadNameField.getValue(threadOop)); + return stringOopToString(threadNameField.getValue(threadOop)); } /** May return null if, e.g., thread was not started */ diff -r d78403bec68b -r dd3db9a36c40 make/windows/makefiles/sa.make --- a/make/windows/makefiles/sa.make Wed Apr 27 14:41:55 2016 -0400 +++ b/make/windows/makefiles/sa.make Thu Apr 28 09:50:48 2016 -0700 @@ -44,9 +44,11 @@ HS_ALT_SRC_REL=src/closed HS_ALT_SRC = $(WorkSpace)/$(HS_ALT_SRC_REL) !ifndef HS_ALT_MAKE +!if exist($(WorkSpace)/make/closed) HS_ALT_MAKE=$(WorkSpace)/make/closed !endif !endif +!endif HS_COMMON_SRC = $(WorkSpace)/$(HS_COMMON_SRC_REL) diff -r d78403bec68b -r dd3db9a36c40 src/cpu/sparc/vm/vm_version_sparc.cpp --- a/src/cpu/sparc/vm/vm_version_sparc.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/cpu/sparc/vm/vm_version_sparc.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -40,7 +40,10 @@ unsigned int VM_Version::_L2_data_cache_line_size = 0; void VM_Version::initialize() { - _features = determine_features(); + + assert(_features != VM_Version::unknown_m, "System pre-initialization is not complete."); + guarantee(VM_Version::has_v9(), "only SPARC v9 is supported"); + PrefetchCopyIntervalInBytes = prefetch_copy_interval_in_bytes(); PrefetchScanIntervalInBytes = prefetch_scan_interval_in_bytes(); PrefetchFieldsAhead = prefetch_fields_ahead(); @@ -76,8 +79,6 @@ FLAG_SET_DEFAULT(AllocatePrefetchStyle, 1); } - guarantee(VM_Version::has_v9(), "only SPARC v9 is supported"); - assert(ArraycopySrcPrefetchDistance < 4096, "invalid value"); if (ArraycopySrcPrefetchDistance >= 4096) ArraycopySrcPrefetchDistance = 4064; diff -r d78403bec68b -r dd3db9a36c40 src/cpu/sparc/vm/vm_version_sparc.hpp --- a/src/cpu/sparc/vm/vm_version_sparc.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/cpu/sparc/vm/vm_version_sparc.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -124,6 +124,8 @@ // Initialization static void initialize(); + static void init_before_ergo() { _features = determine_features(); } + // Instruction support static bool has_v8() { return (_features & v8_instructions_m) != 0; } static bool has_v9() { return (_features & v9_instructions_m) != 0; } diff -r d78403bec68b -r dd3db9a36c40 src/cpu/x86/vm/c1_LIRAssembler_x86.cpp --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1714,8 +1714,8 @@ Register Rtmp1 = noreg; // check if it needs to be profiled - ciMethodData* md; - ciProfileData* data; + ciMethodData* md = NULL; + ciProfileData* data = NULL; if (op->should_profile()) { ciMethod* method = op->profiled_method(); @@ -1874,8 +1874,8 @@ CodeStub* stub = op->stub(); // check if it needs to be profiled - ciMethodData* md; - ciProfileData* data; + ciMethodData* md = NULL; + ciProfileData* data = NULL; if (op->should_profile()) { ciMethod* method = op->profiled_method(); @@ -2052,7 +2052,8 @@ case lir_cond_greater: acond = Assembler::greater; ncond = Assembler::lessEqual; break; case lir_cond_belowEqual: acond = Assembler::belowEqual; ncond = Assembler::above; break; case lir_cond_aboveEqual: acond = Assembler::aboveEqual; ncond = Assembler::below; break; - default: ShouldNotReachHere(); + default: acond = Assembler::equal; ncond = Assembler::notEqual; + ShouldNotReachHere(); } if (opr1->is_cpu_register()) { @@ -3237,27 +3238,23 @@ assert(default_type != NULL && default_type->is_array_klass() && default_type->is_loaded(), "must be true at this point"); int elem_size = type2aelembytes(basic_type); - int shift_amount; Address::ScaleFactor scale; switch (elem_size) { case 1 : - shift_amount = 0; scale = Address::times_1; break; case 2 : - shift_amount = 1; scale = Address::times_2; break; case 4 : - shift_amount = 2; scale = Address::times_4; break; case 8 : - shift_amount = 3; scale = Address::times_8; break; default: + scale = Address::no_scale; ShouldNotReachHere(); } diff -r d78403bec68b -r dd3db9a36c40 src/cpu/x86/vm/c1_LIRGenerator_x86.cpp --- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -195,7 +195,7 @@ LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) { - LIR_Opr r; + LIR_Opr r = NULL; if (type == T_LONG) { r = LIR_OprFact::longConst(x); } else if (type == T_INT) { @@ -485,7 +485,7 @@ __ cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0)); __ branch(lir_cond_equal, T_LONG, new DivByZeroStub(info)); - address entry; + address entry = NULL; switch (x->op()) { case Bytecodes::_lrem: entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem); @@ -1025,7 +1025,7 @@ void LIRGenerator::do_Convert(Convert* x) { // flags that vary for the different operations and different SSE-settings - bool fixed_input, fixed_result, round_result, needs_stub; + bool fixed_input = false, fixed_result = false, round_result = false, needs_stub = false; switch (x->op()) { case Bytecodes::_i2l: // fall through diff -r d78403bec68b -r dd3db9a36c40 src/cpu/x86/vm/jniFastGetField_x86_32.cpp --- a/src/cpu/x86/vm/jniFastGetField_x86_32.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/cpu/x86/vm/jniFastGetField_x86_32.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -48,7 +48,7 @@ // between loads, which is much more efficient than lfence. address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) { - const char *name; + const char *name = NULL; switch (type) { case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break; case T_BYTE: name = "jni_fast_GetByteField"; break; @@ -122,7 +122,7 @@ slowcase_entry_pclist[count++] = __ pc(); __ bind (slow); - address slow_case_addr; + address slow_case_addr = NULL; switch (type) { case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break; case T_BYTE: slow_case_addr = jni_GetByteField_addr(); break; @@ -256,7 +256,7 @@ } address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) { - const char *name; + const char *name = NULL; switch (type) { case T_FLOAT: name = "jni_fast_GetFloatField"; break; case T_DOUBLE: name = "jni_fast_GetDoubleField"; break; @@ -337,7 +337,7 @@ slowcase_entry_pclist[count++] = __ pc(); __ bind (slow); - address slow_case_addr; + address slow_case_addr = NULL; switch (type) { case T_FLOAT: slow_case_addr = jni_GetFloatField_addr(); break; case T_DOUBLE: slow_case_addr = jni_GetDoubleField_addr(); break; diff -r d78403bec68b -r dd3db9a36c40 src/cpu/x86/vm/jniFastGetField_x86_64.cpp --- a/src/cpu/x86/vm/jniFastGetField_x86_64.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/cpu/x86/vm/jniFastGetField_x86_64.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -51,7 +51,7 @@ // since that may scratch r10! address JNI_FastGetField::generate_fast_get_int_field0(BasicType type) { - const char *name; + const char *name = NULL; switch (type) { case T_BOOLEAN: name = "jni_fast_GetBooleanField"; break; case T_BYTE: name = "jni_fast_GetByteField"; break; @@ -111,7 +111,7 @@ slowcase_entry_pclist[count++] = __ pc(); __ bind (slow); - address slow_case_addr; + address slow_case_addr = NULL; switch (type) { case T_BOOLEAN: slow_case_addr = jni_GetBooleanField_addr(); break; case T_BYTE: slow_case_addr = jni_GetByteField_addr(); break; @@ -153,7 +153,7 @@ } address JNI_FastGetField::generate_fast_get_float_field0(BasicType type) { - const char *name; + const char *name = NULL; switch (type) { case T_FLOAT: name = "jni_fast_GetFloatField"; break; case T_DOUBLE: name = "jni_fast_GetDoubleField"; break; @@ -206,7 +206,7 @@ slowcase_entry_pclist[count++] = __ pc(); __ bind (slow); - address slow_case_addr; + address slow_case_addr = NULL; switch (type) { case T_FLOAT: slow_case_addr = jni_GetFloatField_addr(); break; case T_DOUBLE: slow_case_addr = jni_GetDoubleField_addr(); diff -r d78403bec68b -r dd3db9a36c40 src/cpu/x86/vm/macroAssembler_x86.cpp diff -r d78403bec68b -r dd3db9a36c40 src/os/linux/vm/os_linux.cpp --- a/src/os/linux/vm/os_linux.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/os/linux/vm/os_linux.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -2755,7 +2755,7 @@ int os::Linux::sched_getcpu_syscall(void) { - unsigned int cpu; + unsigned int cpu = 0; int retval = -1; #if defined(IA32) @@ -4263,8 +4263,8 @@ sigaddset(&(actp->sa_mask), sig); } - sa_handler_t hand; - sa_sigaction_t sa; + sa_handler_t hand = NULL; + sa_sigaction_t sa = NULL; bool siginfo_flag_set = (actp->sa_flags & SA_SIGINFO) != 0; // retrieve the chained handler if (siginfo_flag_set) { @@ -4469,7 +4469,7 @@ static const char* get_signal_handler_name(address handler, char* buf, int buflen) { - int offset; + int offset = 0; bool found = os::dll_address_to_library_name(handler, buf, buflen, &offset); if (found) { // skip directory names diff -r d78403bec68b -r dd3db9a36c40 src/os/posix/vm/os_posix.cpp --- a/src/os/posix/vm/os_posix.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/os/posix/vm/os_posix.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* -* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -678,6 +678,21 @@ #if defined(IA64) && !defined(AIX) { SIGSEGV, SEGV_PSTKOVF, "SEGV_PSTKOVF", "Paragraph stack overflow" }, #endif +#if defined(__sparc) && defined(SOLARIS) +// define Solaris Sparc M7 ADI SEGV signals +#if !defined(SEGV_ACCADI) +#define SEGV_ACCADI 3 +#endif + { SIGSEGV, SEGV_ACCADI, "SEGV_ACCADI", "ADI not enabled for mapped object." }, +#if !defined(SEGV_ACCDERR) +#define SEGV_ACCDERR 4 +#endif + { SIGSEGV, SEGV_ACCDERR, "SEGV_ACCDERR", "ADI disrupting exception." }, +#if !defined(SEGV_ACCPERR) +#define SEGV_ACCPERR 5 +#endif + { SIGSEGV, SEGV_ACCPERR, "SEGV_ACCPERR", "ADI precise exception." }, +#endif // defined(__sparc) && defined(SOLARIS) { SIGBUS, BUS_ADRALN, "BUS_ADRALN", "Invalid address alignment." }, { SIGBUS, BUS_ADRERR, "BUS_ADRERR", "Nonexistent physical address." }, { SIGBUS, BUS_OBJERR, "BUS_OBJERR", "Object-specific hardware error." }, diff -r d78403bec68b -r dd3db9a36c40 src/os/solaris/vm/os_solaris.cpp diff -r d78403bec68b -r dd3db9a36c40 src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp --- a/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/os_cpu/linux_x86/vm/copy_linux_x86.inline.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -30,7 +30,7 @@ (void)memmove(to, from, count * HeapWordSize); #else // Includes a zero-count check. - intx temp; + intx temp = 0; __asm__ volatile(" testl %6,%6 ;" " jz 7f ;" " cmpl %4,%5 ;" @@ -88,7 +88,7 @@ } #else // Includes a zero-count check. - intx temp; + intx temp = 0; __asm__ volatile(" testl %6,%6 ;" " jz 3f ;" " cmpl $32,%6 ;" @@ -145,7 +145,7 @@ (void)memmove(to, from, count); #else // Includes a zero-count check. - intx temp; + intx temp = 0; __asm__ volatile(" testl %6,%6 ;" " jz 13f ;" " cmpl %4,%5 ;" diff -r d78403bec68b -r dd3db9a36c40 src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -244,7 +244,6 @@ bool PICL::open_library() { _dl_handle = dlopen("libpicl.so.1", RTLD_LAZY); if (_dl_handle == NULL) { - warning("PICL (libpicl.so.1) is missing. Performance will not be optimal."); return false; } if (!bind_library_functions()) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/c1/c1_Canonicalizer.cpp --- a/src/share/vm/c1/c1_Canonicalizer.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/c1/c1_Canonicalizer.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -640,7 +640,7 @@ if (l == r && !lt->is_float_kind()) { // pattern: If (a cond a) => simplify to Goto - BlockBegin* sux; + BlockBegin* sux = NULL; switch (x->cond()) { case If::eql: sux = x->sux_for(true); break; case If::neq: sux = x->sux_for(false); break; @@ -648,6 +648,7 @@ case If::leq: sux = x->sux_for(true); break; case If::gtr: sux = x->sux_for(false); break; case If::geq: sux = x->sux_for(true); break; + default: ShouldNotReachHere(); } // If is a safepoint then the debug information should come from the state_before of the If. set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); @@ -685,7 +686,7 @@ } else { // two successors differ and two successors are the same => simplify to: If (x cmp y) // determine new condition & successors - If::Condition cond; + If::Condition cond = If::eql; BlockBegin* tsux = NULL; BlockBegin* fsux = NULL; if (lss_sux == eql_sux) { cond = If::leq; tsux = lss_sux; fsux = gtr_sux; } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/c1/c1_GraphBuilder.cpp --- a/src/share/vm/c1/c1_GraphBuilder.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/c1/c1_GraphBuilder.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -3971,8 +3971,8 @@ caller_state->truncate_stack(args_base); assert(callee_state->stack_size() == 0, "callee stack must be empty"); - Value lock; - BlockBegin* sync_handler; + Value lock = NULL; + BlockBegin* sync_handler = NULL; // Inline the locking of the receiver if the callee is synchronized if (callee->is_synchronized()) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/c1/c1_LIRGenerator.cpp --- a/src/share/vm/c1/c1_LIRGenerator.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -3347,7 +3347,7 @@ } void LIRGenerator::increment_event_counter(CodeEmitInfo* info, int bci, bool backedge) { - int freq_log; + int freq_log = 0; int level = compilation()->env()->comp_level(); if (level == CompLevel_limited_profile) { freq_log = (backedge ? Tier2BackedgeNotifyFreqLog : Tier2InvokeNotifyFreqLog); @@ -3368,7 +3368,7 @@ assert(level > CompLevel_simple, "Shouldn't be here"); int offset = -1; - LIR_Opr counter_holder; + LIR_Opr counter_holder = NULL; if (level == CompLevel_limited_profile) { MethodCounters* counters_adr = method->ensure_method_counters(); if (counters_adr == NULL) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/c1/c1_LIRGenerator.hpp --- a/src/share/vm/c1/c1_LIRGenerator.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/c1/c1_LIRGenerator.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -410,7 +410,7 @@ } static LIR_Condition lir_cond(If::Condition cond) { - LIR_Condition l; + LIR_Condition l = lir_cond_unknown; switch (cond) { case If::eql: l = lir_cond_equal; break; case If::neq: l = lir_cond_notEqual; break; @@ -420,6 +420,7 @@ case If::gtr: l = lir_cond_greater; break; case If::aeq: l = lir_cond_aboveEqual; break; case If::beq: l = lir_cond_belowEqual; break; + default: fatal("You must pass valid If::Condition"); }; return l; } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/c1/c1_Runtime1.cpp --- a/src/share/vm/c1/c1_Runtime1.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/c1/c1_Runtime1.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -312,6 +312,7 @@ NOT_PRODUCT(_new_instance_slowcase_cnt++;) assert(klass->is_klass(), "not a class"); + Handle holder(THREAD, klass->klass_holder()); // keep the klass alive instanceKlassHandle h(thread, klass); h->check_valid_for_instantiation(true, CHECK); // make sure klass is initialized @@ -347,6 +348,7 @@ // anymore after new_objArray() and no GC can happen before. // (This may have to change if this code changes!) assert(array_klass->is_klass(), "not a class"); + Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass(); objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK); thread->set_vm_result(obj); @@ -363,6 +365,7 @@ assert(klass->is_klass(), "not a class"); assert(rank >= 1, "rank must be nonzero"); + Handle holder(THREAD, klass->klass_holder()); // keep the klass alive oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); thread->set_vm_result(obj); JRT_END diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/ci/ciObjectFactory.cpp --- a/src/share/vm/ci/ciObjectFactory.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/ci/ciObjectFactory.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -413,6 +413,7 @@ metadata_owner_klass = m->as_method()->get_Method()->constants()->pool_holder(); } else { fatal("Not implemented for other types of metadata"); + return; } oop metadata_holder = metadata_owner_klass->klass_holder(); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/classfile/classFileParser.cpp --- a/src/share/vm/classfile/classFileParser.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/classfile/classFileParser.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -3188,19 +3188,19 @@ // Field size and offset computation int nonstatic_field_size = _super_klass() == NULL ? 0 : _super_klass()->nonstatic_field_size(); - int next_static_oop_offset; - int next_static_double_offset; - int next_static_word_offset; - int next_static_short_offset; - int next_static_byte_offset; - int next_nonstatic_oop_offset; - int next_nonstatic_double_offset; - int next_nonstatic_word_offset; - int next_nonstatic_short_offset; - int next_nonstatic_byte_offset; - int first_nonstatic_oop_offset; - int next_nonstatic_field_offset; - int next_nonstatic_padded_offset; + int next_static_oop_offset = 0; + int next_static_double_offset = 0; + int next_static_word_offset = 0; + int next_static_short_offset = 0; + int next_static_byte_offset = 0; + int next_nonstatic_oop_offset = 0; + int next_nonstatic_double_offset = 0; + int next_nonstatic_word_offset = 0; + int next_nonstatic_short_offset = 0; + int next_nonstatic_byte_offset = 0; + int first_nonstatic_oop_offset = 0; + int next_nonstatic_field_offset = 0; + int next_nonstatic_padded_offset = 0; // Count the contended fields by type. // @@ -3353,14 +3353,14 @@ ShouldNotReachHere(); } - int nonstatic_oop_space_count = 0; - int nonstatic_word_space_count = 0; - int nonstatic_short_space_count = 0; - int nonstatic_byte_space_count = 0; - int nonstatic_oop_space_offset; - int nonstatic_word_space_offset; - int nonstatic_short_space_offset; - int nonstatic_byte_space_offset; + int nonstatic_oop_space_count = 0; + int nonstatic_word_space_count = 0; + int nonstatic_short_space_count = 0; + int nonstatic_byte_space_count = 0; + int nonstatic_oop_space_offset = 0; + int nonstatic_word_space_offset = 0; + int nonstatic_short_space_offset = 0; + int nonstatic_byte_space_offset = 0; // Try to squeeze some of the fields into the gaps due to // long/double alignment. @@ -3432,7 +3432,7 @@ // contended instance fields are handled below if (fs.is_contended() && !fs.access_flags().is_static()) continue; - int real_offset; + int real_offset = 0; FieldAllocationType atype = (FieldAllocationType) fs.allocation_type(); // pack the rest of the fields @@ -3565,7 +3565,7 @@ // handle statics below if (fs.access_flags().is_static()) continue; - int real_offset; + int real_offset = 0; FieldAllocationType atype = (FieldAllocationType) fs.allocation_type(); switch (atype) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/classfile/javaClasses.cpp --- a/src/share/vm/classfile/javaClasses.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/classfile/javaClasses.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -936,7 +936,7 @@ assert(_group_offset == 0, "offsets should be initialized only once"); Klass* k = SystemDictionary::Thread_klass(); - compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::char_array_signature()); + compute_offset(_name_offset, k, vmSymbols::name_name(), vmSymbols::string_signature()); compute_offset(_group_offset, k, vmSymbols::group_name(), vmSymbols::threadgroup_signature()); compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature()); compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature()); @@ -966,15 +966,12 @@ } -typeArrayOop java_lang_Thread::name(oop java_thread) { - oop name = java_thread->obj_field(_name_offset); - assert(name == NULL || (name->is_typeArray() && TypeArrayKlass::cast(name->klass())->element_type() == T_CHAR), "just checking"); - return typeArrayOop(name); -} - - -void java_lang_Thread::set_name(oop java_thread, typeArrayOop name) { - assert(java_thread->obj_field(_name_offset) == NULL, "name should be NULL"); +oop java_lang_Thread::name(oop java_thread) { + return java_thread->obj_field(_name_offset); +} + + +void java_lang_Thread::set_name(oop java_thread, oop name) { java_thread->obj_field_put(_name_offset, name); } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/classfile/javaClasses.hpp --- a/src/share/vm/classfile/javaClasses.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/classfile/javaClasses.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -343,8 +343,8 @@ // Set JavaThread for instance static void set_thread(oop java_thread, JavaThread* thread); // Name - static typeArrayOop name(oop java_thread); - static void set_name(oop java_thread, typeArrayOop name); + static oop name(oop java_thread); + static void set_name(oop java_thread, oop name); // Priority static ThreadPriority priority(oop java_thread); static void set_priority(oop java_thread, ThreadPriority priority); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/classfile/placeholders.hpp --- a/src/share/vm/classfile/placeholders.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/classfile/placeholders.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -220,7 +220,7 @@ } SeenThread* actionToQueue(PlaceholderTable::classloadAction action) { - SeenThread* queuehead; + SeenThread* queuehead = NULL; switch (action) { case PlaceholderTable::LOAD_INSTANCE: queuehead = _loadInstanceThreadQ; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/classfile/vmSymbols.hpp diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/compiler/oopMap.hpp --- a/src/share/vm/compiler/oopMap.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/compiler/oopMap.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -75,8 +75,8 @@ // Constructors OopMapValue () { set_value(0); set_content_reg(VMRegImpl::Bad()); } - OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg,t); } - OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg,t); set_content_reg(reg2); } + OopMapValue (VMReg reg, oop_types t) { set_reg_type(reg, t); set_content_reg(VMRegImpl::Bad()); } + OopMapValue (VMReg reg, oop_types t, VMReg reg2) { set_reg_type(reg, t); set_content_reg(reg2); } OopMapValue (CompressedReadStream* stream) { read_from(stream); } // Archiving @@ -89,7 +89,7 @@ void read_from(CompressedReadStream* stream) { set_value(stream->read_int()); - if(is_callee_saved() || is_derived_oop()) { + if (is_callee_saved() || is_derived_oop()) { set_content_reg(VMRegImpl::as_VMReg(stream->read_int(), true)); } } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -2288,7 +2288,7 @@ } // Used for PrintGC - size_t prev_used; + size_t prev_used = 0; if (PrintGC && Verbose) { prev_used = _cmsGen->used(); // XXXPERM } @@ -8624,7 +8624,7 @@ HeapWord* const fc_addr = (HeapWord*) fc; - bool coalesce; + bool coalesce = false; const size_t left = pointer_delta(fc_addr, freeFinger()); const size_t right = chunkSize; switch (FLSCoalescePolicy) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -3991,8 +3991,15 @@ TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty); - uint active_workers = (G1CollectedHeap::use_parallel_gc_threads() ? - workers()->active_workers() : 1); + uint active_workers = AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(), + workers()->active_workers(), + Threads::number_of_non_daemon_threads()); + assert(UseDynamicNumberOfGCThreads || + active_workers == workers()->total_workers(), + "If not dynamic should be using all the workers"); + workers()->set_active_workers(active_workers); + + double pause_start_sec = os::elapsedTime(); g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress()); log_gc_header(); @@ -5761,23 +5768,11 @@ hot_card_cache->reset_hot_cache_claimed_index(); hot_card_cache->set_use_cache(false); - uint n_workers; - if (G1CollectedHeap::use_parallel_gc_threads()) { - n_workers = - AdaptiveSizePolicy::calc_active_workers(workers()->total_workers(), - workers()->active_workers(), - Threads::number_of_non_daemon_threads()); + const uint n_workers = workers()->active_workers(); assert(UseDynamicNumberOfGCThreads || n_workers == workers()->total_workers(), "If not dynamic should be using all the workers"); - workers()->set_active_workers(n_workers); set_par_threads(n_workers); - } else { - assert(n_par_threads() == 0, - "Should be the original non-parallel value"); - n_workers = 1; - } - init_for_evac_failure(NULL); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp --- a/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -154,28 +154,28 @@ _has_new_data = true; } - double average(){ - calculate_totals(); + double average(uint active_threads){ + calculate_totals(active_threads); return _average; } - T sum() { - calculate_totals(); + T sum(uint active_threads) { + calculate_totals(active_threads); return _sum; } - T minimum() { - calculate_totals(); + T minimum(uint active_threads) { + calculate_totals(active_threads); return _min; } - T maximum() { - calculate_totals(); + T maximum(uint active_threads) { + calculate_totals(active_threads); return _max; } void reset() PRODUCT_RETURN; - void verify() PRODUCT_RETURN; + void verify(uint active_threads) PRODUCT_RETURN; void set_enabled(bool enabled) { _enabled = enabled; } @@ -183,7 +183,7 @@ private: - void calculate_totals(){ + void calculate_totals(uint active_threads){ if (!_has_new_data) { return; } @@ -191,13 +191,14 @@ _sum = (T)0; _min = _data[0]; _max = _min; - for (uint i = 0; i < _length; ++i) { + assert(active_threads <= _length, "Wrong number of active threads"); + for (uint i = 0; i < active_threads; ++i) { T val = _data[i]; _sum += val; _min = MIN2(_min, val); _max = MAX2(_max, val); } - _average = (double)_sum / (double)_length; + _average = (double)_sum / (double)active_threads; _has_new_data = false; } }; @@ -226,17 +227,18 @@ } template -void WorkerDataArray::verify() { +void WorkerDataArray::verify(uint active_threads) { if (!_enabled) { return; } - for (uint i = 0; i < _length; i++) { + assert(active_threads <= _length, "Wrong number of active threads"); + for (uint i = 0; i < active_threads; i++) { assert(_data[i] != WorkerDataArray::uninitialized(), err_msg("Invalid data for worker %u in '%s'", i, _title)); } if (_thread_work_items != NULL) { - _thread_work_items->verify(); + _thread_work_items->verify(active_threads); } } @@ -321,7 +323,7 @@ } for (int i = 0; i < GCParPhasesSentinel; i++) { - _gc_par_phases[i]->verify(); + _gc_par_phases[i]->verify(_active_gc_threads); } } @@ -378,7 +380,7 @@ // return the average time for a phase in milliseconds double G1GCPhaseTimes::average_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->average() * 1000.0; + return _gc_par_phases[phase]->average(_active_gc_threads) * 1000.0; } double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) { @@ -386,15 +388,15 @@ } double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->sum() * 1000.0; + return _gc_par_phases[phase]->sum(_active_gc_threads) * 1000.0; } double G1GCPhaseTimes::min_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->minimum() * 1000.0; + return _gc_par_phases[phase]->minimum(_active_gc_threads) * 1000.0; } double G1GCPhaseTimes::max_time_ms(GCParPhases phase) { - return _gc_par_phases[phase]->maximum() * 1000.0; + return _gc_par_phases[phase]->maximum(_active_gc_threads) * 1000.0; } size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) { @@ -404,22 +406,22 @@ size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->sum(); + return _gc_par_phases[phase]->thread_work_items()->sum(_active_gc_threads); } double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->average(); + return _gc_par_phases[phase]->thread_work_items()->average(_active_gc_threads); } size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->minimum(); + return _gc_par_phases[phase]->thread_work_items()->minimum(_active_gc_threads); } size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) { assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count"); - return _gc_par_phases[phase]->thread_work_items()->maximum(); + return _gc_par_phases[phase]->thread_work_items()->maximum(_active_gc_threads); } class G1GCParPhasePrinter : public StackObj { @@ -455,14 +457,16 @@ } void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* phase) { - for (uint i = 0; i < phase->_length; ++i) { + uint active_length = _phase_times->_active_gc_threads; + for (uint i = 0; i < active_length; ++i) { buf.append(" %.1lf", _phase_times->get_time_ms(phase_id, i)); } buf.print_cr(); } void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray* thread_work_items) { - for (uint i = 0; i < thread_work_items->_length; ++i) { + uint active_length = _phase_times->_active_gc_threads; + for (uint i = 0; i < active_length; ++i) { buf.append(" " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i)); } buf.print_cr(); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/g1/heapRegion.cpp --- a/src/share/vm/gc_implementation/g1/heapRegion.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/g1/heapRegion.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -794,7 +794,9 @@ "in region "HR_FORMAT, (void*) obj, HR_FORMAT_PARAMS(to)); - obj->print_on(gclog_or_tty); + if (obj->is_oop()) { + obj->print_on(gclog_or_tty); + } gclog_or_tty->print_cr("Obj head CTE = %d, field CTE = %d.", cv_obj, cv_field); gclog_or_tty->print_cr("----------"); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -572,7 +572,7 @@ assert(_n_fine_entries == _max_fine_entries, "Precondition"); PerRegionTable* max = NULL; jint max_occ = 0; - PerRegionTable** max_prev; + PerRegionTable** max_prev = NULL; size_t max_ind; size_t i = _fine_eviction_start; @@ -608,6 +608,7 @@ } guarantee(max != NULL, "Since _n_fine_entries > 0"); + guarantee(max_prev != NULL, "Since max != NULL."); // Set the corresponding coarse bit. size_t max_hrm_index = (size_t) max->hr()->hrm_index(); @@ -1168,7 +1169,7 @@ void HeapRegionRemSet::print_recorded() { int cur_evnt = 0; - Event cur_evnt_kind; + Event cur_evnt_kind = Event_illegal; int cur_evnt_ind = 0; if (_n_recorded_events > 0) { cur_evnt_kind = _recorded_events[cur_evnt]; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp --- a/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/g1/heapRegionRemSet.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -232,7 +232,7 @@ public: enum Event { - Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd + Event_EvacStart, Event_EvacEnd, Event_RSUpdateEnd, Event_illegal }; private: diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp --- a/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/gc_implementation/shared/adaptiveSizePolicy.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -193,8 +193,9 @@ (!FLAG_IS_DEFAULT(ParallelGCThreads) && !ForceDynamicNumberOfGCThreads)) { new_active_workers = total_workers; } else { + uintx min_workers = (total_workers == 1) ? 1 : 2; new_active_workers = calc_default_active_workers(total_workers, - 2, /* Minimum number of workers */ + min_workers, active_workers, application_workers); } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/interpreter/templateInterpreter.cpp --- a/src/share/vm/interpreter/templateInterpreter.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/interpreter/templateInterpreter.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -528,7 +528,7 @@ if (StopInterpreterAt > 0) stop_interpreter_at(); __ verify_FPU(1, t->tos_in()); #endif // !PRODUCT - int step; + int step = 0; if (!t->does_dispatch()) { step = t->is_wide() ? Bytecodes::wide_length_for(t->bytecode()) : Bytecodes::length_for(t->bytecode()); if (tos_out == ilgl) tos_out = t->tos_out(); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/memory/allocation.cpp --- a/src/share/vm/memory/allocation.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/memory/allocation.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -83,7 +83,7 @@ } void* ResourceObj::operator new(size_t size, allocation_type type, MEMFLAGS flags) throw() { - address res; + address res = NULL; switch (type) { case C_HEAP: res = (address)AllocateHeap(size, flags, CALLER_PC); @@ -105,8 +105,8 @@ void* ResourceObj::operator new(size_t size, const std::nothrow_t& nothrow_constant, allocation_type type, MEMFLAGS flags) throw() { - //should only call this with std::nothrow, use other operator new() otherwise - address res; + // should only call this with std::nothrow, use other operator new() otherwise + address res = NULL; switch (type) { case C_HEAP: res = (address)AllocateHeap(size, flags, CALLER_PC, AllocFailStrategy::RETURN_NULL); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/memory/universe.cpp --- a/src/share/vm/memory/universe.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/memory/universe.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -124,6 +124,7 @@ objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL; volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0; bool Universe::_verify_in_progress = false; +long Universe::verify_flags = Universe::Verify_All; oop Universe::_null_ptr_exception_instance = NULL; oop Universe::_arithmetic_exception_instance = NULL; oop Universe::_virtual_machine_error_instance = NULL; @@ -683,6 +684,9 @@ MetaspaceShared::prepare_for_dumping(); } } + if (strlen(VerifySubSet) > 0) { + Universe::initialize_verify_flags(); + } return JNI_OK; } @@ -1361,6 +1365,53 @@ st->print_cr("}"); } +void Universe::initialize_verify_flags() { + verify_flags = 0; + const char delimiter[] = " ,"; + + size_t length = strlen(VerifySubSet); + char* subset_list = NEW_C_HEAP_ARRAY(char, length + 1, mtInternal); + strncpy(subset_list, VerifySubSet, length + 1); + + char* token = strtok(subset_list, delimiter); + while (token != NULL) { + if (strcmp(token, "threads") == 0) { + verify_flags |= Verify_Threads; + } else if (strcmp(token, "heap") == 0) { + verify_flags |= Verify_Heap; + } else if (strcmp(token, "symbol_table") == 0) { + verify_flags |= Verify_SymbolTable; + } else if (strcmp(token, "string_table") == 0) { + verify_flags |= Verify_StringTable; + } else if (strcmp(token, "codecache") == 0) { + verify_flags |= Verify_CodeCache; + } else if (strcmp(token, "dictionary") == 0) { + verify_flags |= Verify_SystemDictionary; + } else if (strcmp(token, "classloader_data_graph") == 0) { + verify_flags |= Verify_ClassLoaderDataGraph; + } else if (strcmp(token, "metaspace") == 0) { + verify_flags |= Verify_MetaspaceAux; + } else if (strcmp(token, "jni_handles") == 0) { + verify_flags |= Verify_JNIHandles; + } else if (strcmp(token, "c-heap") == 0) { + verify_flags |= Verify_CHeap; + } else if (strcmp(token, "codecache_oops") == 0) { + verify_flags |= Verify_CodeCacheOops; + } else { + vm_exit_during_initialization(err_msg("VerifySubSet: \'%s\' memory sub-system is unknown, please correct it", token)); + } + token = strtok(NULL, delimiter); + } + FREE_C_HEAP_ARRAY(char, subset_list, mtInternal); +} + +bool Universe::should_verify_subset(uint subset) { + if (verify_flags & subset) { + return true; + } + return false; +} + void Universe::verify(VerifyOption option, const char* prefix, bool silent) { // The use of _verify_in_progress is a temporary work around for // 6320749. Don't bother with a creating a class to set and clear @@ -1380,33 +1431,55 @@ if (!silent) gclog_or_tty->print("%s", prefix); if (!silent) gclog_or_tty->print("[Verifying "); - if (!silent) gclog_or_tty->print("threads "); - Threads::verify(); - if (!silent) gclog_or_tty->print("heap "); - heap()->verify(silent, option); - if (!silent) gclog_or_tty->print("syms "); - SymbolTable::verify(); - if (!silent) gclog_or_tty->print("strs "); - StringTable::verify(); + if (should_verify_subset(Verify_Threads)) { + if (!silent) gclog_or_tty->print("Threads "); + Threads::verify(); + } + if (should_verify_subset(Verify_Heap)) { + if (!silent) gclog_or_tty->print("Heap "); + heap()->verify(silent, option); + } + if (should_verify_subset(Verify_SymbolTable)) { + if (!silent) gclog_or_tty->print("SymbolTable "); + SymbolTable::verify(); + } + if (should_verify_subset(Verify_StringTable)) { + if (!silent) gclog_or_tty->print("StringTable "); + StringTable::verify(); + } + if (should_verify_subset(Verify_CodeCache)) { { MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); - if (!silent) gclog_or_tty->print("zone "); + if (!silent) gclog_or_tty->print("CodeCache "); CodeCache::verify(); } - if (!silent) gclog_or_tty->print("dict "); - SystemDictionary::verify(); + } + if (should_verify_subset(Verify_SystemDictionary)) { + if (!silent) gclog_or_tty->print("SystemDictionary "); + SystemDictionary::verify(); + } #ifndef PRODUCT - if (!silent) gclog_or_tty->print("cldg "); - ClassLoaderDataGraph::verify(); + if (should_verify_subset(Verify_ClassLoaderDataGraph)) { + if (!silent) gclog_or_tty->print("ClassLoaderDataGraph "); + ClassLoaderDataGraph::verify(); + } #endif - if (!silent) gclog_or_tty->print("metaspace chunks "); - MetaspaceAux::verify_free_chunks(); - if (!silent) gclog_or_tty->print("hand "); - JNIHandles::verify(); - if (!silent) gclog_or_tty->print("C-heap "); - os::check_heap(); - if (!silent) gclog_or_tty->print("code cache "); - CodeCache::verify_oops(); + if (should_verify_subset(Verify_MetaspaceAux)) { + if (!silent) gclog_or_tty->print("MetaspaceAux "); + MetaspaceAux::verify_free_chunks(); + } + if (should_verify_subset(Verify_JNIHandles)) { + if (!silent) gclog_or_tty->print("JNIHandles "); + JNIHandles::verify(); + } + if (should_verify_subset(Verify_CHeap)) { + if (!silent) gclog_or_tty->print("C-heap "); + os::check_heap(); + } + if (should_verify_subset(Verify_CodeCacheOops)) { + if (!silent) gclog_or_tty->print("CodeCache Oops "); + CodeCache::verify_oops(); + } if (!silent) gclog_or_tty->print_cr("]"); _verify_in_progress = false; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/memory/universe.hpp --- a/src/share/vm/memory/universe.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/memory/universe.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -247,6 +247,7 @@ static int _verify_count; // number of verifies done // True during call to verify(). Should only be set/cleared in verify(). static bool _verify_in_progress; + static long verify_flags; static void compute_verify_oop_data(); @@ -425,6 +426,22 @@ static void init_self_patching_vtbl_list(void** list, int count); // Debugging + enum VERIFY_FLAGS { + Verify_Threads = 1, + Verify_Heap = 2, + Verify_SymbolTable = 4, + Verify_StringTable = 8, + Verify_CodeCache = 16, + Verify_SystemDictionary = 32, + Verify_ClassLoaderDataGraph = 64, + Verify_MetaspaceAux = 128, + Verify_JNIHandles = 256, + Verify_CHeap = 512, + Verify_CodeCacheOops = 1024, + Verify_All = -1 + }; + static void initialize_verify_flags(); + static bool should_verify_subset(uint subset); static bool verify_in_progress() { return _verify_in_progress; } static void verify(VerifyOption option, const char* prefix, bool silent = VerifySilently); static void verify(const char* prefix, bool silent = VerifySilently) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/c2_globals.hpp diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/c2compiler.cpp --- a/src/share/vm/opto/c2compiler.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/c2compiler.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -49,6 +49,9 @@ const char* C2Compiler::retry_no_escape_analysis() { return "retry without escape analysis"; } +const char* C2Compiler::retry_class_loading_during_parsing() { + return "retry class loading during parsing"; +} bool C2Compiler::init_c2_runtime() { // Check assumptions used while running ADLC @@ -115,6 +118,10 @@ // Check result and retry if appropriate. if (C.failure_reason() != NULL) { + if (C.failure_reason_is(retry_class_loading_during_parsing())) { + env->record_failure(C.failure_reason()); + continue; // retry + } if (C.failure_reason_is(retry_no_subsuming_loads())) { assert(subsume_loads, "must make progress"); subsume_loads = false; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/c2compiler.hpp --- a/src/share/vm/opto/c2compiler.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/c2compiler.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -49,6 +49,7 @@ // sentinel value used to trigger backtracking in compile_method(). static const char* retry_no_subsuming_loads(); static const char* retry_no_escape_analysis(); + static const char* retry_class_loading_during_parsing(); // Print compilation timers and statistics void print_timers(); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/callGenerator.cpp --- a/src/share/vm/opto/callGenerator.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/callGenerator.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -658,7 +658,7 @@ &exact_receiver); SafePointNode* slow_map = NULL; - JVMState* slow_jvms; + JVMState* slow_jvms = NULL; { PreserveJVMState pjvms(&kit); kit.set_control(slow_ctl); if (!kit.stopped()) { @@ -829,17 +829,18 @@ } } // Cast reference arguments to its type. - for (int i = 0; i < signature->count(); i++) { + for (int i = 0, j = 0; i < signature->count(); i++) { ciType* t = signature->type_at(i); if (t->is_klass()) { - Node* arg = kit.argument(receiver_skip + i); + Node* arg = kit.argument(receiver_skip + j); const TypeOopPtr* arg_type = arg->bottom_type()->isa_oopptr(); const Type* sig_type = TypeOopPtr::make_from_klass(t->as_klass()); if (arg_type != NULL && !arg_type->higher_equal(sig_type)) { Node* cast_obj = gvn.transform(new (C) CheckCastPPNode(kit.control(), arg, sig_type)); - kit.set_argument(receiver_skip + i, cast_obj); + kit.set_argument(receiver_skip + j, cast_obj); } } + j += t->size(); // long and double take two slots } // Try to get the most accurate receiver type diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/cfgnode.cpp --- a/src/share/vm/opto/cfgnode.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/cfgnode.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -973,7 +973,7 @@ #ifdef ASSERT // The following logic has been moved into TypeOopPtr::filter. const Type* jt = t->join_speculative(_type); - if( jt->empty() ) { // Emptied out??? + if (jt->empty()) { // Emptied out??? // Check for evil case of 't' being a class and '_type' expecting an // interface. This can happen because the bytecodes do not contain @@ -984,14 +984,21 @@ // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows // into a Phi which "knows" it's an Interface type we'll have to // uplift the type. - if( !t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface() ) - { assert(ft == _type, ""); } // Uplift to interface - else if( !t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface() ) - { assert(ft == _type, ""); } // Uplift to interface - // Otherwise it's something stupid like non-overlapping int ranges - // found on dying counted loops. - else - { assert(ft == Type::TOP, ""); } // Canonical empty value + if (!t->empty() && ttip && ttip->is_loaded() && ttip->klass()->is_interface()) { + assert(ft == _type, ""); // Uplift to interface + } else if (!t->empty() && ttkp && ttkp->is_loaded() && ttkp->klass()->is_interface()) { + assert(ft == _type, ""); // Uplift to interface + } else { + // We also have to handle 'evil cases' of interface- vs. class-arrays + Type::get_arrays_base_elements(jt, _type, NULL, &ttip); + if (!t->empty() && ttip != NULL && ttip->is_loaded() && ttip->klass()->is_interface()) { + assert(ft == _type, ""); // Uplift to array of interface + } else { + // Otherwise it's something stupid like non-overlapping int ranges + // found on dying counted loops. + assert(ft == Type::TOP, ""); // Canonical empty value + } + } } else { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/compile.cpp --- a/src/share/vm/opto/compile.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/compile.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -791,7 +791,9 @@ } JVMState* jvms = build_start_state(start(), tf()); if ((jvms = cg->generate(jvms)) == NULL) { - record_method_not_compilable("method parse failed"); + if (!failure_reason_is(C2Compiler::retry_class_loading_during_parsing())) { + record_method_not_compilable("method parse failed"); + } return; } GraphKit kit(jvms); @@ -3712,7 +3714,7 @@ MacroAssembler _masm(&cb); for (int i = 0; i < _constants.length(); i++) { Constant con = _constants.at(i); - address constant_addr; + address constant_addr = NULL; switch (con.type()) { case T_LONG: constant_addr = _masm.long_constant( con.get_jlong() ); break; case T_FLOAT: constant_addr = _masm.float_constant( con.get_jfloat() ); break; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/generateOptoStub.cpp --- a/src/share/vm/opto/generateOptoStub.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/generateOptoStub.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -273,7 +273,7 @@ //----------------------------- // If this is a normal subroutine return, issue the return and be done. - Node *ret; + Node *ret = NULL; switch( is_fancy_jump ) { case 0: // Make a return instruction // Return to caller, free any space for return address diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/lcm.cpp --- a/src/share/vm/opto/lcm.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/lcm.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -675,7 +675,7 @@ block->insert_node(proj, node_cnt++); // Select the right register save policy. - const char * save_policy; + const char *save_policy = NULL; switch (op) { case Op_CallRuntime: case Op_CallLeaf: diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/library_call.cpp --- a/src/share/vm/opto/library_call.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/library_call.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1649,7 +1649,7 @@ // public static double Math.log10(double) bool LibraryCallKit::inline_math(vmIntrinsics::ID id) { Node* arg = round_double_node(argument(0)); - Node* n; + Node* n = NULL; switch (id) { case vmIntrinsics::_dabs: n = new (C) AbsDNode( arg); break; case vmIntrinsics::_dsqrt: n = new (C) SqrtDNode(C, control(), arg); break; @@ -2390,7 +2390,7 @@ // inline long Long.reverseBytes(long) bool LibraryCallKit::inline_number_methods(vmIntrinsics::ID id) { Node* arg = argument(0); - Node* n; + Node* n = NULL; switch (id) { case vmIntrinsics::_numberOfLeadingZeros_i: n = new (C) CountLeadingZerosINode( arg); break; case vmIntrinsics::_numberOfLeadingZeros_l: n = new (C) CountLeadingZerosLNode( arg); break; @@ -2985,7 +2985,7 @@ // For now, we handle only those cases that actually exist: ints, // longs, and Object. Adding others should be straightforward. - Node* load_store; + Node* load_store = NULL; switch(type) { case T_INT: if (kind == LS_xadd) { @@ -3905,7 +3905,7 @@ Node* end = is_copyOfRange? argument(2): argument(1); Node* array_type_mirror = is_copyOfRange? argument(3): argument(2); - Node* newcopy; + Node* newcopy = NULL; // Set the original stack and the reexecute bit for the interpreter to reexecute // the bytecode that invokes Arrays.copyOf if deoptimization happens. @@ -4293,7 +4293,7 @@ bool LibraryCallKit::inline_fp_conversions(vmIntrinsics::ID id) { Node* arg = argument(0); - Node* result; + Node* result = NULL; switch (id) { case vmIntrinsics::_floatToRawIntBits: result = new (C) MoveF2INode(arg); break; @@ -6294,7 +6294,7 @@ //------------------------------inline_aescrypt_Block----------------------- bool LibraryCallKit::inline_aescrypt_Block(vmIntrinsics::ID id) { - address stubAddr; + address stubAddr = NULL; const char *stubName; assert(UseAES, "need AES instruction support"); @@ -6360,8 +6360,8 @@ //------------------------------inline_cipherBlockChaining_AESCrypt----------------------- bool LibraryCallKit::inline_cipherBlockChaining_AESCrypt(vmIntrinsics::ID id) { - address stubAddr; - const char *stubName; + address stubAddr = NULL; + const char *stubName = NULL; assert(UseAES, "need AES instruction support"); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/loopTransform.cpp --- a/src/share/vm/opto/loopTransform.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/loopTransform.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -2836,7 +2836,7 @@ // state of the loop. It's safe in this case to replace it with the // result_mem. _igvn.replace_node(store->in(MemNode::Memory), result_mem); - _igvn.replace_node(exit, result_ctrl); + lazy_replace(exit, result_ctrl); _igvn.replace_node(store, result_mem); // Any uses the increment outside of the loop become the loop limit. _igvn.replace_node(head->incr(), head->limit()); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/loopnode.cpp --- a/src/share/vm/opto/loopnode.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/loopnode.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -750,8 +750,8 @@ set_loop(iff2, get_loop(iffalse)); // Lazy update of 'get_ctrl' mechanism. - lazy_replace_proj( iffalse, iff2 ); - lazy_replace_proj( iftrue, ift2 ); + lazy_replace(iffalse, iff2); + lazy_replace(iftrue, ift2); // Swap names iffalse = iff2; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/loopnode.hpp --- a/src/share/vm/opto/loopnode.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/loopnode.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -660,13 +660,18 @@ } private: - Node *get_ctrl_no_update( Node *i ) const { + Node *get_ctrl_no_update_helper(Node *i) const { + assert(has_ctrl(i), "should be control, not loop"); + return (Node*)(((intptr_t)_nodes[i->_idx]) & ~1); + } + + Node *get_ctrl_no_update(Node *i) const { assert( has_ctrl(i), "" ); - Node *n = (Node*)(((intptr_t)_nodes[i->_idx]) & ~1); + Node *n = get_ctrl_no_update_helper(i); if (!n->in(0)) { // Skip dead CFG nodes do { - n = (Node*)(((intptr_t)_nodes[n->_idx]) & ~1); + n = get_ctrl_no_update_helper(n); } while (!n->in(0)); n = find_non_split_ctrl(n); } @@ -688,22 +693,15 @@ // from old_node to new_node to support the lazy update. Reference // replaces loop reference, since that is not needed for dead node. public: - void lazy_update( Node *old_node, Node *new_node ) { - assert( old_node != new_node, "no cycles please" ); - //old_node->set_req( 1, new_node /*NO DU INFO*/ ); - // Nodes always have DU info now, so re-use the side array slot - // for this node to provide the forwarding pointer. - _nodes.map( old_node->_idx, (Node*)((intptr_t)new_node + 1) ); + void lazy_update(Node *old_node, Node *new_node) { + assert(old_node != new_node, "no cycles please"); + // Re-use the side array slot for this node to provide the + // forwarding pointer. + _nodes.map(old_node->_idx, (Node*)((intptr_t)new_node + 1)); } - void lazy_replace( Node *old_node, Node *new_node ) { - _igvn.replace_node( old_node, new_node ); - lazy_update( old_node, new_node ); - } - void lazy_replace_proj( Node *old_node, Node *new_node ) { - assert( old_node->req() == 1, "use this for Projs" ); - _igvn.hash_delete(old_node); // Must hash-delete before hacking edges - old_node->add_req( NULL ); - lazy_replace( old_node, new_node ); + void lazy_replace(Node *old_node, Node *new_node) { + _igvn.replace_node(old_node, new_node); + lazy_update(old_node, new_node); } private: diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/loopopts.cpp --- a/src/share/vm/opto/loopopts.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/loopopts.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -43,6 +43,14 @@ return NULL; } + // Splitting range check CastIIs through a loop induction Phi can + // cause new Phis to be created that are left unrelated to the loop + // induction Phi and prevent optimizations (vectorization) + if (n->Opcode() == Op_CastII && n->as_CastII()->has_range_check() && + region->is_CountedLoop() && n->in(1) == region->as_CountedLoop()->phi()) { + return NULL; + } + int wins = 0; assert(!n->is_CFG(), ""); assert(region->is_Region(), ""); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/macro.cpp --- a/src/share/vm/opto/macro.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/macro.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -693,10 +693,10 @@ ciKlass* klass = NULL; ciInstanceKlass* iklass = NULL; int nfields = 0; - int array_base; - int element_size; - BasicType basic_elem_type; - ciType* elem_type; + int array_base = 0; + int element_size = 0; + BasicType basic_elem_type = T_ILLEGAL; + ciType* elem_type = NULL; Node* res = alloc->result_cast(); assert(res == NULL || res->is_CheckCastPP(), "unexpected AllocateNode result"); @@ -1177,10 +1177,10 @@ // We need a Region and corresponding Phi's to merge the slow-path and fast-path results. // they will not be used if "always_slow" is set enum { slow_result_path = 1, fast_result_path = 2 }; - Node *result_region; - Node *result_phi_rawmem; - Node *result_phi_rawoop; - Node *result_phi_i_o; + Node *result_region = NULL; + Node *result_phi_rawmem = NULL; + Node *result_phi_rawoop = NULL; + Node *result_phi_i_o = NULL; // The initial slow comparison is a size check, the comparison // we want to do is a BoolTest::gt diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/node.cpp diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/node.hpp diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/parse1.cpp --- a/src/share/vm/opto/parse1.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/parse1.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -27,6 +27,7 @@ #include "interpreter/linkResolver.hpp" #include "oops/method.hpp" #include "opto/addnode.hpp" +#include "opto/c2compiler.hpp" #include "opto/idealGraphPrinter.hpp" #include "opto/locknode.hpp" #include "opto/memnode.hpp" @@ -105,7 +106,7 @@ // Very similar to LoadNode::make, except we handle un-aligned longs and // doubles on Sparc. Intel can handle them just fine directly. - Node *l; + Node *l = NULL; switch (bt) { // Signature is flattened case T_INT: l = new (C) LoadINode(ctl, mem, adr, TypeRawPtr::BOTTOM, TypeInt::INT, MemNode::unordered); break; case T_FLOAT: l = new (C) LoadFNode(ctl, mem, adr, TypeRawPtr::BOTTOM, Type::FLOAT, MemNode::unordered); break; @@ -988,7 +989,23 @@ if (tf()->range()->cnt() > TypeFunc::Parms) { const Type* ret_type = tf()->range()->field_at(TypeFunc::Parms); Node* ret_phi = _gvn.transform( _exits.argument(0) ); - assert(_exits.control()->is_top() || !_gvn.type(ret_phi)->empty(), "return value must be well defined"); + if (!_exits.control()->is_top() && _gvn.type(ret_phi)->empty()) { + // In case of concurrent class loading, the type we set for the + // ret_phi in build_exits() may have been too optimistic and the + // ret_phi may be top now. + // Otherwise, we've encountered an error and have to mark the method as + // not compilable. Just using an assertion instead would be dangerous + // as this could lead to an infinite compile loop in non-debug builds. + { + MutexLockerEx ml(Compile_lock, Mutex::_no_safepoint_check_flag); + if (C->env()->system_dictionary_modification_counter_changed()) { + C->record_failure(C2Compiler::retry_class_loading_during_parsing()); + } else { + C->record_method_not_compilable("Can't determine return type."); + } + } + return; + } if (ret_type->isa_int()) { BasicType ret_bt = method()->return_type()->basic_type(); ret_phi = mask_int_value(ret_phi, ret_bt, &_gvn); @@ -1897,7 +1914,7 @@ // Now use a Phi here for merging assert(!nocreate, "Cannot build a phi for a block already parsed."); const JVMState* jvms = map->jvms(); - const Type* t; + const Type* t = NULL; if (jvms->is_loc(idx)) { t = block()->local_type_at(idx - jvms->locoff()); } else if (jvms->is_stk(idx)) { @@ -2116,15 +2133,24 @@ // here. Node* phi = _exits.argument(0); const TypeInstPtr *tr = phi->bottom_type()->isa_instptr(); - if( tr && tr->klass()->is_loaded() && - tr->klass()->is_interface() ) { + if (tr && tr->klass()->is_loaded() && + tr->klass()->is_interface()) { const TypeInstPtr *tp = value->bottom_type()->isa_instptr(); if (tp && tp->klass()->is_loaded() && !tp->klass()->is_interface()) { // sharpen the type eagerly; this eases certain assert checking if (tp->higher_equal(TypeInstPtr::NOTNULL)) tr = tr->join_speculative(TypeInstPtr::NOTNULL)->is_instptr(); - value = _gvn.transform(new (C) CheckCastPPNode(0,value,tr)); + value = _gvn.transform(new (C) CheckCastPPNode(0, value, tr)); + } + } else { + // Also handle returns of oop-arrays to an arrays-of-interface return + const TypeInstPtr* phi_tip; + const TypeInstPtr* val_tip; + Type::get_arrays_base_elements(phi->bottom_type(), value->bottom_type(), &phi_tip, &val_tip); + if (phi_tip != NULL && phi_tip->is_loaded() && phi_tip->klass()->is_interface() && + val_tip != NULL && val_tip->is_loaded() && !val_tip->klass()->is_interface()) { + value = _gvn.transform(new (C) CheckCastPPNode(0, value, phi->bottom_type())); } } phi->add_req(value); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/phaseX.cpp diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/runtime.cpp --- a/src/share/vm/opto/runtime.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/runtime.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -231,22 +231,17 @@ // These checks are cheap to make and support reflective allocation. int lh = klass->layout_helper(); - if (Klass::layout_helper_needs_slow_path(lh) - || !InstanceKlass::cast(klass)->is_initialized()) { - KlassHandle kh(THREAD, klass); - kh->check_valid_for_instantiation(false, THREAD); + if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) { + Handle holder(THREAD, klass->klass_holder()); // keep the klass alive + klass->check_valid_for_instantiation(false, THREAD); if (!HAS_PENDING_EXCEPTION) { - InstanceKlass::cast(kh())->initialize(THREAD); - } - if (!HAS_PENDING_EXCEPTION) { - klass = kh(); - } else { - klass = NULL; + InstanceKlass::cast(klass)->initialize(THREAD); } } - if (klass != NULL) { + if (!HAS_PENDING_EXCEPTION) { // Scavenge and allocate an instance. + Handle holder(THREAD, klass->klass_holder()); // keep the klass alive oop result = InstanceKlass::cast(klass)->allocate_instance(THREAD); thread->set_vm_result(result); @@ -286,6 +281,7 @@ // Although the oopFactory likes to work with the elem_type, // the compiler prefers the array_type, since it must already have // that latter value in hand for the fast path. + Handle holder(THREAD, array_type->klass_holder()); // keep the array klass alive Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass(); result = oopFactory::new_objArray(elem_type, len, THREAD); } @@ -364,6 +360,7 @@ jint dims[2]; dims[0] = len1; dims[1] = len2; + Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive oop obj = ArrayKlass::cast(elem_type)->multi_allocate(2, dims, THREAD); deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); thread->set_vm_result(obj); @@ -380,6 +377,7 @@ dims[0] = len1; dims[1] = len2; dims[2] = len3; + Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive oop obj = ArrayKlass::cast(elem_type)->multi_allocate(3, dims, THREAD); deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); thread->set_vm_result(obj); @@ -397,6 +395,7 @@ dims[1] = len2; dims[2] = len3; dims[3] = len4; + Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive oop obj = ArrayKlass::cast(elem_type)->multi_allocate(4, dims, THREAD); deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); thread->set_vm_result(obj); @@ -415,6 +414,7 @@ dims[2] = len3; dims[3] = len4; dims[4] = len5; + Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD); deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); thread->set_vm_result(obj); @@ -432,6 +432,7 @@ jint *c_dims = NEW_RESOURCE_ARRAY(jint, len); Copy::conjoint_jints_atomic(j_dims, c_dims, len); + Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD); deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION); thread->set_vm_result(obj); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/split_if.cpp --- a/src/share/vm/opto/split_if.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/split_if.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -451,8 +451,8 @@ // Replace both uses of 'new_iff' with Regions merging True/False // paths. This makes 'new_iff' go dead. - Node *old_false, *old_true; - Node *new_false, *new_true; + Node *old_false = NULL, *old_true = NULL; + Node *new_false = NULL, *new_true = NULL; for (DUIterator_Last j2min, j2 = iff->last_outs(j2min); j2 >= j2min; --j2) { Node *ifp = iff->last_out(j2); assert( ifp->Opcode() == Op_IfFalse || ifp->Opcode() == Op_IfTrue, "" ); @@ -472,7 +472,7 @@ // Replace in the graph with lazy-update mechanism new_iff->set_req(0, new_iff); // hook self so it does not go dead - lazy_replace_proj( ifp, ifpx ); + lazy_replace(ifp, ifpx); new_iff->set_req(0, region); // Record bits for later xforms diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/type.cpp --- a/src/share/vm/opto/type.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/type.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -149,6 +149,33 @@ return bt; } +// For two instance arrays of same dimension, return the base element types. +// Otherwise or if the arrays have different dimensions, return NULL. +void Type::get_arrays_base_elements(const Type *a1, const Type *a2, + const TypeInstPtr **e1, const TypeInstPtr **e2) { + + if (e1) *e1 = NULL; + if (e2) *e2 = NULL; + const TypeAryPtr* a1tap = (a1 == NULL) ? NULL : a1->isa_aryptr(); + const TypeAryPtr* a2tap = (a2 == NULL) ? NULL : a2->isa_aryptr(); + + if (a1tap != NULL && a2tap != NULL) { + // Handle multidimensional arrays + const TypePtr* a1tp = a1tap->elem()->make_ptr(); + const TypePtr* a2tp = a2tap->elem()->make_ptr(); + while (a1tp && a1tp->isa_aryptr() && a2tp && a2tp->isa_aryptr()) { + a1tap = a1tp->is_aryptr(); + a2tap = a2tp->is_aryptr(); + a1tp = a1tap->elem()->make_ptr(); + a2tp = a2tap->elem()->make_ptr(); + } + if (a1tp && a1tp->isa_instptr() && a2tp && a2tp->isa_instptr()) { + if (e1) *e1 = a1tp->is_instptr(); + if (e2) *e2 = a2tp->is_instptr(); + } + } +} + //---------------------------get_typeflow_type--------------------------------- // Import a type produced by ciTypeFlow. const Type* Type::get_typeflow_type(ciType* type) { @@ -1984,7 +2011,11 @@ bool TypeAry::interface_vs_oop(const Type *t) const { const TypeAry* t_ary = t->is_ary(); if (t_ary) { - return _elem->interface_vs_oop(t_ary->_elem); + const TypePtr* this_ptr = _elem->make_ptr(); // In case we have narrow_oops + const TypePtr* t_ptr = t_ary->_elem->make_ptr(); + if(this_ptr != NULL && t_ptr != NULL) { + return this_ptr->interface_vs_oop(t_ptr); + } } return false; } @@ -2836,8 +2867,17 @@ // be 'I' or 'j/l/O'. Thus we'll pick 'j/l/O'. If this then flows // into a Phi which "knows" it's an Interface type we'll have to // uplift the type. - if (!empty() && ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) - return kills; // Uplift to interface + if (!empty()) { + if (ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) { + return kills; // Uplift to interface + } + // Also check for evil cases of 'this' being a class array + // and 'kills' expecting an array of interfaces. + Type::get_arrays_base_elements(ft, kills, NULL, &ktip); + if (ktip != NULL && ktip->is_loaded() && ktip->klass()->is_interface()) { + return kills; // Uplift to array of interface + } + } return Type::TOP; // Canonical empty value } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/opto/type.hpp --- a/src/share/vm/opto/type.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/opto/type.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -367,6 +367,11 @@ return _const_basic_type[type]; } + // For two instance arrays of same dimension, return the base element types. + // Otherwise or if the arrays have different dimensions, return NULL. + static void get_arrays_base_elements(const Type *a1, const Type *a2, + const TypeInstPtr **e1, const TypeInstPtr **e2); + // Mapping to the array element's basic type. BasicType array_element_basic_type() const; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/jvmtiEnter.xsl --- a/src/share/vm/prims/jvmtiEnter.xsl Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/jvmtiEnter.xsl Thu Apr 28 09:50:48 2016 -0700 @@ -631,8 +631,8 @@ jint trace_flags = JvmtiTrace::trace_flags( ); - const char *func_name; - const char *curr_thread_name; + const char *func_name = NULL; + const char *curr_thread_name = NULL; if (trace_flags) { func_name = JvmtiTrace::function_name( diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/jvmtiEnv.cpp --- a/src/share/vm/prims/jvmtiEnv.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/jvmtiEnv.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -946,7 +946,7 @@ return JVMTI_ERROR_INVALID_THREAD; Handle thread_obj(current_thread, thread_oop); - typeArrayHandle name; + Handle name; ThreadPriority priority; Handle thread_group; Handle context_class_loader; @@ -954,7 +954,7 @@ { MutexLocker mu(Threads_lock); - name = typeArrayHandle(current_thread, java_lang_Thread::name(thread_obj())); + name = Handle(current_thread, java_lang_Thread::name(thread_obj())); priority = java_lang_Thread::priority(thread_obj()); thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj())); is_daemon = java_lang_Thread::is_daemon(thread_obj()); @@ -965,7 +965,7 @@ { const char *n; if (name() != NULL) { - n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + n = java_lang_String::as_utf8_string(name()); } else { n = UNICODE::as_utf8(NULL, 0); } @@ -3010,7 +3010,7 @@ // in thread.cpp. JvmtiPendingMonitors::enter(rmonitor); } else { - int r; + int r = 0; Thread* thread = Thread::current(); if (thread->is_Java_thread()) { @@ -3073,7 +3073,7 @@ err = JVMTI_ERROR_NOT_MONITOR_OWNER; } } else { - int r; + int r = 0; Thread* thread = Thread::current(); if (thread->is_Java_thread()) { @@ -3107,7 +3107,7 @@ // rmonitor - pre-checked for validity jvmtiError JvmtiEnv::RawMonitorWait(JvmtiRawMonitor * rmonitor, jlong millis) { - int r; + int r = 0; Thread* thread = Thread::current(); if (thread->is_Java_thread()) { @@ -3166,7 +3166,7 @@ // rmonitor - pre-checked for validity jvmtiError JvmtiEnv::RawMonitorNotify(JvmtiRawMonitor * rmonitor) { - int r; + int r = 0; Thread* thread = Thread::current(); if (thread->is_Java_thread()) { @@ -3197,7 +3197,7 @@ // rmonitor - pre-checked for validity jvmtiError JvmtiEnv::RawMonitorNotifyAll(JvmtiRawMonitor * rmonitor) { - int r; + int r = 0; Thread* thread = Thread::current(); if (thread->is_Java_thread()) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/jvmtiEnvBase.cpp --- a/src/share/vm/prims/jvmtiEnvBase.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/jvmtiEnvBase.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -511,7 +511,7 @@ // mean much better out of memory handling unsigned char * JvmtiEnvBase::jvmtiMalloc(jlong size) { - unsigned char* mem; + unsigned char* mem = NULL; jvmtiError result = allocate(size, &mem); assert(result == JVMTI_ERROR_NONE, "Allocate failed"); return mem; @@ -1038,7 +1038,7 @@ // implied else: entry_count == 0 } - int nWant,nWait; + int nWant = 0, nWait = 0; if (mon != NULL) { // this object has a heavyweight monitor nWant = mon->contentions(); // # of threads contending for monitor diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/jvmtiExport.cpp --- a/src/share/vm/prims/jvmtiExport.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/jvmtiExport.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -995,7 +995,9 @@ // Before we call the JVMTI agent, we have to set the state in the // thread for which we are proxying. JavaThreadState prev_state = real_thread->thread_state(); - assert(prev_state == _thread_blocked, "JavaThread should be at safepoint"); + assert(((Thread *)real_thread)->is_ConcurrentGC_thread() || + (real_thread->is_Java_thread() && prev_state == _thread_blocked), + "should be ConcurrentGCThread or JavaThread at safepoint"); real_thread->set_thread_state(_thread_in_native); jvmtiExtensionEvent callback = env->ext_callbacks()->ClassUnload; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/jvmtiRedefineClasses.cpp --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -332,7 +332,7 @@ int new_name_and_type_ref_i = find_or_append_indirect_entry(scratch_cp, name_and_type_ref_i, merge_cp_p, merge_cp_length_p, THREAD); - const char *entry_name; + const char *entry_name = NULL; switch (scratch_cp->tag_at(scratch_i).value()) { case JVM_CONSTANT_Fieldref: entry_name = "Fieldref"; @@ -3926,6 +3926,10 @@ scratch_class->set_methods(_old_methods); // To prevent potential GCing of the old methods, // and to be able to undo operation easily. + Array* old_ordering = the_class->method_ordering(); + the_class->set_method_ordering(scratch_class->method_ordering()); + scratch_class->set_method_ordering(old_ordering); + ConstantPool* old_constants = the_class->constants(); the_class->set_constants(scratch_class->constants()); scratch_class->set_constants(old_constants); // See the previous comment. diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/jvmtiTrace.cpp --- a/src/share/vm/prims/jvmtiTrace.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/jvmtiTrace.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -266,11 +266,11 @@ if (threadObj == NULL) { return "NULL"; } - typeArrayOop name = java_lang_Thread::name(threadObj); + oop name = java_lang_Thread::name(threadObj); if (name == NULL) { return ""; } - return UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + return java_lang_String::as_utf8_string(name); } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/prims/unsafe.cpp --- a/src/share/vm/prims/unsafe.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/prims/unsafe.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -864,7 +864,7 @@ UNSAFE_ENTRY(jint, Unsafe_ArrayBaseOffset(JNIEnv *env, jobject unsafe, jclass acls)) UnsafeWrapper("Unsafe_ArrayBaseOffset"); - int base, scale; + int base = 0, scale = 0; getBaseAndScale(base, scale, acls, CHECK_0); return field_offset_from_byte_offset(base); UNSAFE_END @@ -872,7 +872,7 @@ UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale(JNIEnv *env, jobject unsafe, jclass acls)) UnsafeWrapper("Unsafe_ArrayIndexScale"); - int base, scale; + int base = 0, scale = 0; getBaseAndScale(base, scale, acls, CHECK_0); // This VM packs both fields and array elements down to the byte. // But watch out: If this changes, so that array references for diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/runtime/arguments.cpp --- a/src/share/vm/runtime/arguments.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/runtime/arguments.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1675,9 +1675,8 @@ FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads()); if (ParallelGCThreads == 0) { - FLAG_SET_DEFAULT(ParallelGCThreads, - Abstract_VM_Version::parallel_worker_threads()); - } + vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL); + } #if INCLUDE_ALL_GCS if (G1ConcRefinementThreads == 0) { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/runtime/globals.hpp --- a/src/share/vm/runtime/globals.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/runtime/globals.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -2259,6 +2259,14 @@ diagnostic(bool, VerifyDuringGC, false, \ "Verify memory system during GC (between phases)") \ \ + diagnostic(ccstrlist, VerifySubSet, "", \ + "Memory sub-systems to verify when Verify*GC flag(s) " \ + "are enabled. One or more sub-systems can be specified " \ + "in a comma separated string. Sub-systems are: " \ + "threads, heap, symbol_table, string_table, codecache, " \ + "dictionary, classloader_data_graph, metaspace, jni_handles, " \ + "c-heap, codecache_oops") \ + \ diagnostic(bool, GCParallelVerificationEnabled, true, \ "Enable parallel memory system verification") \ \ diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/runtime/os.cpp --- a/src/share/vm/runtime/os.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/runtime/os.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -325,6 +325,10 @@ // We need to initialize large page support here because ergonomics takes some // decisions depending on large page support and the calculated large page size. large_page_init(); + + // VM version initialization identifies some characteristics of the + // the platform that are used during ergonomic decisions. + VM_Version::init_before_ergo(); } void os::signal_init() { diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/runtime/safepoint.cpp --- a/src/share/vm/runtime/safepoint.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/runtime/safepoint.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -142,7 +142,7 @@ // Save the starting time, so that it can be compared to see if this has taken // too long to complete. - jlong safepoint_limit_time; + jlong safepoint_limit_time = 0; timeout_error_printed = false; // PrintSafepointStatisticsTimeout can be specified separately. When @@ -925,7 +925,7 @@ void ThreadSafepointState::print_on(outputStream *st) const { - const char *s; + const char *s = NULL; switch(_type) { case _running : s = "_running"; break; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/runtime/thread.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -2926,13 +2926,13 @@ const char* name_str; oop thread_obj = threadObj(); if (thread_obj != NULL) { - typeArrayOop name = java_lang_Thread::name(thread_obj); + oop name = java_lang_Thread::name(thread_obj); if (name != NULL) { if (buf == NULL) { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length()); + name_str = java_lang_String::as_utf8_string(name); } else { - name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length(), buf, buflen); + name_str = java_lang_String::as_utf8_string(name, buf, buflen); } } else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306 diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/runtime/vm_version.hpp --- a/src/share/vm/runtime/vm_version.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/runtime/vm_version.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -54,6 +54,12 @@ unsigned int dem, unsigned int switch_pt); public: + // Called as part of the runtime services initialization which is + // called from the management module initialization (via init_globals()) + // after argument parsing and attaching of the main thread has + // occurred. Examines a variety of the hardware capabilities of + // the platform to determine which features can be used to execute the + // program. static void initialize(); // This allows for early initialization of VM_Version information @@ -63,6 +69,11 @@ // need to specialize this define VM_Version::early_initialize(). static void early_initialize() { } + // Called to initialize VM variables needing initialization + // after command line parsing. Platforms that need to specialize + // this should define VM_Version::init_before_ergo(). + static void init_before_ergo() {} + // Name static const char* vm_name(); // Vendor diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/services/diagnosticCommand.cpp --- a/src/share/vm/services/diagnosticCommand.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/services/diagnosticCommand.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -437,6 +437,10 @@ ("config.file", "set com.sun.management.config.file", "STRING", false), + _jmxremote_host + ("jmxremote.host", + "set com.sun.management.jmxremote.host", "STRING", false), + _jmxremote_port ("jmxremote.port", "set com.sun.management.jmxremote.port", "STRING", false), @@ -516,6 +520,7 @@ { _dcmdparser.add_dcmd_option(&_config_file); + _dcmdparser.add_dcmd_option(&_jmxremote_host); _dcmdparser.add_dcmd_option(&_jmxremote_port); _dcmdparser.add_dcmd_option(&_jmxremote_rmi_port); _dcmdparser.add_dcmd_option(&_jmxremote_ssl); @@ -586,6 +591,7 @@ } PUT_OPTION(_config_file); + PUT_OPTION(_jmxremote_host); PUT_OPTION(_jmxremote_port); PUT_OPTION(_jmxremote_rmi_port); PUT_OPTION(_jmxremote_ssl); diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/services/diagnosticCommand.hpp --- a/src/share/vm/services/diagnosticCommand.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/services/diagnosticCommand.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -280,6 +280,7 @@ // com.sun.management is omitted DCmdArgument _config_file; + DCmdArgument _jmxremote_host; DCmdArgument _jmxremote_port; DCmdArgument _jmxremote_rmi_port; DCmdArgument _jmxremote_ssl; diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/services/heapDumper.cpp --- a/src/share/vm/services/heapDumper.cpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/services/heapDumper.cpp Thu Apr 28 09:50:48 2016 -0700 @@ -376,11 +376,11 @@ }; int _fd; // file descriptor (-1 if dump file not open) - jlong _bytes_written; // number of byte written to dump file + julong _bytes_written; // number of byte written to dump file char* _buffer; // internal buffer - int _size; - int _pos; + size_t _size; + size_t _pos; char* _error; // error message when I/O fails @@ -388,14 +388,14 @@ int file_descriptor() const { return _fd; } char* buffer() const { return _buffer; } - int buffer_size() const { return _size; } - int position() const { return _pos; } - void set_position(int pos) { _pos = pos; } + size_t buffer_size() const { return _size; } + size_t position() const { return _pos; } + void set_position(size_t pos) { _pos = pos; } void set_error(const char* error) { _error = (char*)os::strdup(error); } // all I/O go through this function - void write_internal(void* s, int len); + void write_internal(void* s, size_t len); public: DumpWriter(const char* path); @@ -406,14 +406,14 @@ void flush(); // total number of bytes written to the disk - jlong bytes_written() const { return _bytes_written; } + julong bytes_written() const { return _bytes_written; } // adjust the number of bytes written to disk (used to keep the count // of the number of bytes written in case of rewrites) - void adjust_bytes_written(jlong n) { _bytes_written += n; } + void adjust_bytes_written(jlong n) { _bytes_written += n; } // number of (buffered) bytes as yet unwritten to the dump file - jlong bytes_unwritten() const { return (jlong)position(); } + size_t bytes_unwritten() const { return position(); } char* error() const { return _error; } @@ -421,7 +421,7 @@ void seek_to_offset(jlong pos); // writer functions - void write_raw(void* s, int len); + void write_raw(void* s, size_t len); void write_u1(u1 x) { write_raw((void*)&x, 1); } void write_u2(u2 x); void write_u4(u4 x); @@ -474,29 +474,33 @@ } // write directly to the file -void DumpWriter::write_internal(void* s, int len) { +void DumpWriter::write_internal(void* s, size_t len) { if (is_open()) { - int n = ::write(file_descriptor(), s, len); - if (n > 0) { - _bytes_written += n; - } - if (n != len) { + const char* pos = (char*)s; + ssize_t n = 0; + while (len > 0) { + uint tmp = (uint)MIN2(len, (size_t)UINT_MAX); + n = ::write(file_descriptor(), pos, tmp); + if (n < 0) { set_error(strerror(errno)); - } else { - set_error("file size limit"); + ::close(file_descriptor()); + set_file_descriptor(-1); + return; } - ::close(file_descriptor()); - set_file_descriptor(-1); + + _bytes_written += n; + pos += n; + len -= n; } } } // write raw bytes -void DumpWriter::write_raw(void* s, int len) { +void DumpWriter::write_raw(void* s, size_t len) { if (is_open()) { - // flush buffer to make toom - if ((position()+ len) >= buffer_size()) { + // flush buffer to make room + if ((position() + len) >= buffer_size()) { flush(); } @@ -519,13 +523,12 @@ } } - jlong DumpWriter::current_offset() { if (is_open()) { // the offset is the file offset plus whatever we have buffered jlong offset = os::current_file_offset(file_descriptor()); assert(offset >= 0, "lseek failed"); - return offset + (jlong)position(); + return offset + position(); } else { return (jlong)-1; } @@ -774,7 +777,7 @@ HandleMark hm; instanceKlassHandle ikh = instanceKlassHandle(Thread::current(), k); - int size = 0; + u4 size = 0; for (FieldStream fld(ikh, false, false); !fld.eos(); fld.next()) { if (!fld.access_flags().is_static()) { @@ -799,7 +802,7 @@ } } } - return (u4)size; + return size; } // dumps static fields of the given class @@ -1031,8 +1034,7 @@ } // If the byte ordering is big endian then we can copy most types directly - int length_in_bytes = array->length() * type2aelembytes(type); - assert(length_in_bytes > 0, "nothing to copy"); + u4 length_in_bytes = (u4)array->length() * type2aelembytes(type); switch (type) { case T_INT : { @@ -1285,22 +1287,18 @@ } } - // create a HPROF_GC_INSTANCE record for each object if (o->is_instance()) { + // create a HPROF_GC_INSTANCE record for each object DumperSupport::dump_instance(writer(), o); mark_end_of_record(); - } else { + } else if (o->is_objArray()) { // create a HPROF_GC_OBJ_ARRAY_DUMP record for each object array - if (o->is_objArray()) { - DumperSupport::dump_object_array(writer(), objArrayOop(o)); - mark_end_of_record(); - } else { - // create a HPROF_GC_PRIM_ARRAY_DUMP record for each type array - if (o->is_typeArray()) { - DumperSupport::dump_prim_array(writer(), typeArrayOop(o)); - mark_end_of_record(); - } - } + DumperSupport::dump_object_array(writer(), objArrayOop(o)); + mark_end_of_record(); + } else if (o->is_typeArray()) { + // create a HPROF_GC_PRIM_ARRAY_DUMP record for each type array + DumperSupport::dump_prim_array(writer(), typeArrayOop(o)); + mark_end_of_record(); } } @@ -1448,11 +1446,11 @@ assert(dump_start() >= 0, "no dump start recorded"); // calculate the size of the dump record - jlong dump_end = writer()->current_offset(); - jlong dump_len = (dump_end - dump_start() - 4); + julong dump_end = writer()->current_offset(); + julong dump_len = (dump_end - dump_start() - 4); // record length must fit in a u4 - if (dump_len > (jlong)(4L*(jlong)G)) { + if (dump_len > max_juint) { warning("record is too large"); } @@ -1461,7 +1459,7 @@ writer()->write_u4((u4)dump_len); // adjust the total size written to keep the bytes written correct. - writer()->adjust_bytes_written(-((long) sizeof(u4))); + writer()->adjust_bytes_written(-((jlong) sizeof(u4))); // seek to dump end so we can continue writer()->seek_to_offset(dump_end); @@ -1477,12 +1475,12 @@ if (writer()->is_open()) { if (is_segmented_dump()) { // don't use current_offset that would be too expensive on a per record basis - jlong dump_end = writer()->bytes_written() + writer()->bytes_unwritten(); - assert(dump_end == writer()->current_offset(), "checking"); - jlong dump_len = (dump_end - dump_start() - 4); - assert(dump_len >= 0 && dump_len <= max_juint, "bad dump length"); + julong dump_end = writer()->bytes_written() + writer()->bytes_unwritten(); + assert(dump_end == (julong)writer()->current_offset(), "checking"); + julong dump_len = (dump_end - dump_start() - 4); + assert(dump_len <= max_juint, "bad dump length"); - if (dump_len > (jlong)HeapDumpSegmentSize) { + if (dump_len > HeapDumpSegmentSize) { write_current_dump_record_length(); write_dump_header(); } @@ -1868,13 +1866,8 @@ if (print_to_tty()) { timer()->stop(); if (error() == NULL) { - char msg[256]; - sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]", - JLONG_FORMAT, timer()->seconds()); -PRAGMA_DIAG_PUSH -PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL - tty->print_cr(msg, writer.bytes_written()); -PRAGMA_DIAG_POP + tty->print_cr("Heap dump file created [" JULONG_FORMAT " bytes in %3.3f secs]", + writer.bytes_written(), timer()->seconds()); } else { tty->print_cr("Dump file is incomplete: %s", writer.error()); } diff -r d78403bec68b -r dd3db9a36c40 src/share/vm/services/threadService.hpp --- a/src/share/vm/services/threadService.hpp Wed Apr 27 14:41:55 2016 -0400 +++ b/src/share/vm/services/threadService.hpp Thu Apr 28 09:50:48 2016 -0700 @@ -425,12 +425,12 @@ } JavaThreadStatusChanger(JavaThread* java_thread, - java_lang_Thread::ThreadStatus state) { + java_lang_Thread::ThreadStatus state) : _old_state(java_lang_Thread::NEW) { save_old_state(java_thread); set_thread_status(state); } - JavaThreadStatusChanger(JavaThread* java_thread) { + JavaThreadStatusChanger(JavaThread* java_thread) : _old_state(java_lang_Thread::NEW) { save_old_state(java_thread); } @@ -527,7 +527,7 @@ // Current thread is the notifying thread which holds the monitor. static bool wait_reenter_begin(JavaThread *java_thread, ObjectMonitor *obj_m) { assert((java_thread != NULL), "Java thread should not be null here"); - bool active = false; + bool active = false; if (is_alive(java_thread) && ServiceUtil::visible_oop((oop)obj_m->object())) { active = contended_enter_begin(java_thread); } @@ -542,7 +542,7 @@ } JavaThreadBlockedOnMonitorEnterState(JavaThread *java_thread, ObjectMonitor *obj_m) : - JavaThreadStatusChanger(java_thread) { + _stat(NULL), _active(false), JavaThreadStatusChanger(java_thread) { assert((java_thread != NULL), "Java thread should not be null here"); // Change thread status and collect contended enter stats for monitor contended // enter done for external java world objects and it is contended. All other cases diff -r d78403bec68b -r dd3db9a36c40 test/TEST.groups --- a/test/TEST.groups Wed Apr 27 14:41:55 2016 -0400 +++ b/test/TEST.groups Thu Apr 28 09:50:48 2016 -0700 @@ -61,7 +61,6 @@ # can be resolved in some cases by using tools from the compile-jdk. # needs_jdk = \ - gc/TestG1ZeroPGCTJcmdThreadPrint.java \ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java \ gc/metaspace/TestMetaspacePerfCounters.java \ gc/metaspace/TestPerfCountersAndMemoryPools.java \ @@ -216,6 +215,7 @@ runtime/NMT \ gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \ gc/class_unloading/TestG1ClassUnloadingHWM.java \ + gc/ergonomics/TestDynamicNumberOfGCThreads.java \ gc/g1/TestRegionAlignment.java \ gc/g1/TestShrinkToOneRegion.java \ gc/metaspace/G1AddMetaspaceDependency.java \ diff -r d78403bec68b -r dd3db9a36c40 test/compiler/jsr292/LongReferenceCastingTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/jsr292/LongReferenceCastingTest.java Thu Apr 28 09:50:48 2016 -0700 @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +import java.lang.invoke.*; + +/** + * @test + * @bug 8148752 + * @summary Test correct casting of MH arguments during inlining. + * @run main LongReferenceCastingTest + */ +public class LongReferenceCastingTest { + static final String MY_STRING = "myString"; + static final MethodHandle MH; + + static { + try { + MethodHandles.Lookup lookup = MethodHandles.lookup(); + MethodType mt = MethodType.methodType(String.class, long.class, Object.class, String.class); + MH = lookup.findVirtual(LongReferenceCastingTest.class, "myMethod", mt); + } catch (Exception e) { + throw new Error(e); + } + } + + public String myMethod(long l, Object o, String s) { + // The long argument occupies two stack slots, causing C2 to treat it as + // two arguments and casting the fist one two long and the second one to Object. + // As a result, Object o is casted to String and the o.toString() call is + // inlined as String::toString(). We fail at runtime because 'o' is not a String. + return o.toString(); + } + + public String toString() { + return MY_STRING; + } + + public static void main(String[] args) throws Exception { + LongReferenceCastingTest test = new LongReferenceCastingTest(); + try { + for (int i = 0; i < 20_000; ++i) { + if (!test.invoke().equals(MY_STRING)) { + throw new RuntimeException("Invalid string"); + } + } + } catch (Throwable t) { + throw new RuntimeException("Test failed", t); + } + } + + public String invoke() throws Throwable { + return (String) MH.invokeExact(this, 0L, (Object)this, MY_STRING); + } +} diff -r d78403bec68b -r dd3db9a36c40 test/compiler/loopopts/TestArraysFillDeadControl.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/loopopts/TestArraysFillDeadControl.java Thu Apr 28 09:50:48 2016 -0700 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +/** + * @test + * @bug 8147645 + * @summary Array.fill intrinsification code doesn't mark replaced control as dead + * @run main/othervm -XX:-TieredCompilation -XX:CompileCommand=dontinline,TestArraysFillDeadControl::dont_inline TestArraysFillDeadControl + * + */ + +import java.util.Arrays; + +public class TestArraysFillDeadControl { + + static void dont_inline() { + } + + static int i = 1; + + public static void main(String[] args) { + for (int j = 0; j < 200000; j++) { + int[] a = new int[2]; + int b = i; + + Arrays.fill(a, 1); + Arrays.fill(a, 1+b); + + dont_inline(); + } + } +} diff -r d78403bec68b -r dd3db9a36c40 test/compiler/types/TestMeetIncompatibleInterfaceArrays.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/types/TestMeetIncompatibleInterfaceArrays.java Thu Apr 28 09:50:48 2016 -0700 @@ -0,0 +1,351 @@ +/* + * Copyright 2015 SAP AG. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8141551 + * @summary C2 can not handle returns with inccompatible interface arrays + * @library /testlibrary /testlibrary/whitebox/ + * @build sun.hotspot.WhiteBox + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * sun.hotspot.WhiteBox$WhiteBoxPermission + * @run main/othervm + * -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -Xbatch + * -XX:CompileThreshold=1 + * -XX:-TieredCompilation + * -XX:CICompilerCount=1 + * -XX:+PrintCompilation + * -XX:+PrintInlining + * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run + * -XX:CompileCommand=dontinline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=quiet + * TestMeetIncompatibleInterfaceArrays 0 + * @run main/othervm + * -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -Xbatch + * -XX:CompileThreshold=1 + * -XX:-TieredCompilation + * -XX:CICompilerCount=1 + * -XX:+PrintCompilation + * -XX:+PrintInlining + * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run + * -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=quiet + * TestMeetIncompatibleInterfaceArrays 1 + * @run main/othervm + * -Xbootclasspath/a:. + * -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI + * -Xbatch + * -XX:CompileThreshold=1 + * -XX:Tier0InvokeNotifyFreqLog=0 -XX:Tier2InvokeNotifyFreqLog=0 -XX:Tier3InvokeNotifyFreqLog=0 -XX:Tier23InlineeNotifyFreqLog=0 + * -XX:Tier3InvocationThreshold=2 -XX:Tier3MinInvocationThreshold=2 -XX:Tier3CompileThreshold=2 + * -XX:Tier4InvocationThreshold=1 -XX:Tier4MinInvocationThreshold=1 -XX:Tier4CompileThreshold=1 + * -XX:+TieredCompilation + * -XX:CICompilerCount=2 + * -XX:+PrintCompilation + * -XX:+PrintInlining + * -XX:CompileCommand=compileonly,MeetIncompatibleInterfaceArrays*.run + * -XX:CompileCommand=compileonly,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=inline,TestMeetIncompatibleInterfaceArrays$Helper.createI2* + * -XX:CompileCommand=quiet + * TestMeetIncompatibleInterfaceArrays 2 + * + * @author volker.simonis@gmail.com + */ + +import java.io.FileOutputStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import static jdk.internal.org.objectweb.asm.Opcodes.*; +import sun.hotspot.WhiteBox; + +public class TestMeetIncompatibleInterfaceArrays extends ClassLoader { + + private static final WhiteBox WB = WhiteBox.getWhiteBox(); + + public static interface I1 { public String getName(); } + public static interface I2 { public String getName(); } + public static class I2C implements I2 { public String getName() { return "I2";} } + public static class I21C implements I2, I1 { public String getName() { return "I2 and I1";} } + + public static class Helper { + public static I2 createI2Array0() { + return new I2C(); + } + public static I2[] createI2Array1() { + return new I2C[] { new I2C() }; + } + public static I2[][] createI2Array2() { + return new I2C[][] { new I2C[] { new I2C() } }; + } + public static I2[][][] createI2Array3() { + return new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } }; + } + public static I2[][][][] createI2Array4() { + return new I2C[][][][] { new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } } }; + } + public static I2[][][][][] createI2Array5() { + return new I2C[][][][][] { new I2C[][][][] { new I2C[][][] { new I2C[][] { new I2C[] { new I2C() } } } } }; + } + public static I2 createI21Array0() { + return new I21C(); + } + public static I2[] createI21Array1() { + return new I21C[] { new I21C() }; + } + public static I2[][] createI21Array2() { + return new I21C[][] { new I21C[] { new I21C() } }; + } + public static I2[][][] createI21Array3() { + return new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } }; + } + public static I2[][][][] createI21Array4() { + return new I21C[][][][] { new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } } }; + } + public static I2[][][][][] createI21Array5() { + return new I21C[][][][][] { new I21C[][][][] { new I21C[][][] { new I21C[][] { new I21C[] { new I21C() } } } } }; + } + } + + // Location for the generated class files + public static final String PATH = System.getProperty("test.classes", ".") + java.io.File.separator; + + /* + * With 'good == false' this helper method creates the following classes + * (using the nested 'Helper' class and the nested interfaces 'I1' and 'I2'). + * For brevity I omit the enclosing class 'TestMeetIncompatibleInterfaceArrays' in the + * following examples: + * + * public class MeetIncompatibleInterfaceArrays0ASM { + * public static I1 run() { + * return Helper.createI2Array0(); // returns I2 + * } + * public static void test() { + * I1 i1 = run(); + * System.out.println(i1.getName()); + * } + * } + * public class MeetIncompatibleInterfaceArrays1ASM { + * public static I1[] run() { + * return Helper.createI2Array1(); // returns I2[] + * } + * public static void test() { + * I1[] i1 = run(); + * System.out.println(i1[0].getName()); + * } + * } + * ... + * // MeetIncompatibleInterfaceArrays4ASM is special because it creates + * // an illegal class which will be rejected by the verifier. + * public class MeetIncompatibleInterfaceArrays4ASM { + * public static I1[][][][] run() { + * return Helper.createI2Array3(); // returns I1[][][] which gives a verifier error because return expects I1[][][][] + * } + * public static void test() { + * I1[][][][][] i1 = run(); + * System.out.println(i1[0][0][0][0][0].getName()); + * } + * ... + * public class MeetIncompatibleInterfaceArrays5ASM { + * public static I1[][][][][] run() { + * return Helper.createI2Array5(); // returns I2[][][][][] + * } + * public static void test() { + * I1[][][][][] i1 = run(); + * System.out.println(i1[0][0][0][0][0].getName()); + * } + * } + * + * Notice that this is not legal Java code. We would have to use a cast in "run()" to make it legal: + * + * public static I1[] run() { + * return (I1[])Helper.createI2Array1(); // returns I2[] + * } + * + * But in pure bytecode, the "run()" methods are perfectly legal: + * + * public static I1[] run(); + * Code: + * 0: invokestatic #16 // Method Helper.createI2Array1:()[LI2; + * 3: areturn + * + * The "test()" method calls the "getName()" function from I1 on the objects returned by "run()". + * This will epectedly fail with an "IncompatibleClassChangeError" because the objects returned + * by "run()" (and by createI2Array()) are actually of type "I2C" and only implement "I2" but not "I1". + * + * + * With 'good == true' this helper method will create the following classes: + * + * public class MeetIncompatibleInterfaceArraysGood0ASM { + * public static I1 run() { + * return Helper.createI21Array0(); // returns I2 + * } + * public static void test() { + * I1 i1 = run(); + * System.out.println(i1.getName()); + * } + * } + * + * Calling "test()" on these objects will succeed and output "I2 and I1" because now the "run()" + * method calls "createI21Array()" which actually return an object (or an array of objects) of + * type "I21C" which implements both "I2" and "I1". + * + * Notice that at the bytecode level, the code for the "run()" and "test()" methods in + * "MeetIncompatibleInterfaceArraysASM" and "MeetIncompatibleInterfaceArraysGoodASM" look exactly + * the same. I.e. the verifier has no chance to verify if the I2 object returned by "createI1Array()" + * or "createI21Array()" implements "I1" or not. That's actually the reason why both versions of + * generated classes are legal from a verifier point of view. + * + */ + static void generateTestClass(int dim, boolean good) throws Exception { + String baseClassName = "MeetIncompatibleInterfaceArrays"; + if (good) + baseClassName += "Good"; + String createName = "createI2" + (good ? "1" : "") + "Array"; + String a = ""; + for (int i = 0; i < dim; i++) + a += "["; + ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); + cw.visit(V1_8, ACC_PUBLIC, baseClassName + dim + "ASM", null, "java/lang/Object", null); + MethodVisitor constr = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + constr.visitCode(); + constr.visitVarInsn(ALOAD, 0); + constr.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + constr.visitInsn(RETURN); + constr.visitMaxs(0, 0); + constr.visitEnd(); + MethodVisitor run = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "run", + "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", null, null); + run.visitCode(); + if (dim == 4) { + run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + 3, + "()" + "[[[" + "LTestMeetIncompatibleInterfaceArrays$I2;", false); + } else { + run.visitMethodInsn(INVOKESTATIC, "TestMeetIncompatibleInterfaceArrays$Helper", createName + dim, + "()" + a + "LTestMeetIncompatibleInterfaceArrays$I2;", false); + } + run.visitInsn(ARETURN); + run.visitMaxs(0, 0); + run.visitEnd(); + MethodVisitor test = cw.visitMethod(ACC_PUBLIC | ACC_STATIC, "test", "()V", null, null); + test.visitCode(); + test.visitMethodInsn(INVOKESTATIC, baseClassName + dim + "ASM", "run", + "()" + a + "LTestMeetIncompatibleInterfaceArrays$I1;", false); + test.visitVarInsn(ASTORE, 0); + if (dim > 0) { + test.visitVarInsn(ALOAD, 0); + for (int i = 1; i <= dim; i++) { + test.visitInsn(ICONST_0); + test.visitInsn(AALOAD); + } + test.visitVarInsn(ASTORE, 1); + } + test.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + test.visitVarInsn(ALOAD, dim > 0 ? 1 : 0); + test.visitMethodInsn(INVOKEINTERFACE, "TestMeetIncompatibleInterfaceArrays$I1", "getName", + "()Ljava/lang/String;", true); + test.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/Object;)V", false); + test.visitInsn(RETURN); + test.visitMaxs(0, 0); + test.visitEnd(); + + // Get the bytes of the class.. + byte[] b = cw.toByteArray(); + // ..and write them into a class file (for debugging) + FileOutputStream fos = new FileOutputStream(PATH + baseClassName + dim + "ASM.class"); + fos.write(b); + fos.close(); + + } + + public static String[][] tier = { { "interpreted", "C2 (tier 4) without inlining", "C2 (tier4) without inlining" }, + { "interpreted", "C2 (tier 4) with inlining", "C2 (tier4) with inlining" }, + { "interpreted", "C1 (tier 3) with inlining", "C2 (tier4) with inlining" } }; + + public static void main(String[] args) throws Exception { + final int pass = Integer.parseInt(args.length > 0 ? args[0] : "0"); + + // Load and initialize some classes required for compilation + Class.forName("TestMeetIncompatibleInterfaceArrays$I1"); + Class.forName("TestMeetIncompatibleInterfaceArrays$I2"); + Class.forName("TestMeetIncompatibleInterfaceArrays$Helper"); + + for (int g = 0; g < 2; g++) { + String baseClassName = "MeetIncompatibleInterfaceArrays"; + boolean good = (g == 0) ? false : true; + if (good) + baseClassName += "Good"; + for (int i = 0; i < 6; i++) { + System.out.println(); + System.out.println("Creating " + baseClassName + i + "ASM.class"); + System.out.println("========================================" + "=" + "========="); + // Create the "MeetIncompatibleInterfaceArraysASM" class + generateTestClass(i, good); + Class c = null; + try { + c = Class.forName(baseClassName + i + "ASM"); + } catch (VerifyError ve) { + if (i == 4) { + System.out.println("OK - must be (" + ve.getMessage() + ")."); + } else { + throw ve; + } + continue; + } + // Call MeetIncompatibleInterfaceArraysASM.test() + Method m = c.getMethod("test"); + Method r = c.getMethod("run"); + for (int j = 0; j < 3; j++) { + System.out.println((j + 1) + ". invokation of " + baseClassName + i + "ASM.test() [should be " + + tier[pass][j] + "]"); + try { + m.invoke(null); + } catch (InvocationTargetException ite) { + if (good) { + throw ite; + } else { + if (ite.getCause() instanceof IncompatibleClassChangeError) { + System.out.println(" OK - catched InvocationTargetException(" + + ite.getCause().getMessage() + ")."); + } else { + throw ite; + } + } + } + } + System.out.println("Method " + r + (WB.isMethodCompiled(r) ? " has" : " has not") + " been compiled."); + if (!WB.isMethodCompiled(r)) { + throw new Exception("Method " + r + " must be compiled!"); + } + } + } + } +} diff -r d78403bec68b -r dd3db9a36c40 test/gc/8000311/Test8000311.java --- a/test/gc/8000311/Test8000311.java Wed Apr 27 14:41:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * @test Test8000311 - * @key gc - * @bug 8000311 - * @summary G1: ParallelGCThreads==0 broken - * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+ResizePLAB -XX:+ExplicitGCInvokesConcurrent Test8000311 - * @author filipp.zhinkin@oracle.com - */ - -import java.util.*; - -public class Test8000311 { - public static void main(String args[]) { - for(int i = 0; i<100; i++) { - byte[] garbage = new byte[1000]; - System.gc(); - } - } -} diff -r d78403bec68b -r dd3db9a36c40 test/gc/TestG1ZeroPGCTJcmdThreadPrint.java --- a/test/gc/TestG1ZeroPGCTJcmdThreadPrint.java Wed Apr 27 14:41:55 2016 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* @test TestG1ZeroPGCTJcmdThreadPrint - * @key gc - * @bug 8005875 - * @summary Use jcmd to generate a thread dump of a Java program being run with PGCT=0 to verify 8005875 - * @library /testlibrary - * @run main/othervm -XX:+UseG1GC -XX:ParallelGCThreads=0 -XX:+IgnoreUnrecognizedVMOptions TestG1ZeroPGCTJcmdThreadPrint - */ - -import com.oracle.java.testlibrary.*; - -public class TestG1ZeroPGCTJcmdThreadPrint { - public static void main(String args[]) throws Exception { - - // Grab the pid from the current java process - String pid = Integer.toString(ProcessTools.getProcessId()); - - // Create a ProcessBuilder - ProcessBuilder pb = new ProcessBuilder(); - - // Run jcmd Thread.print - pb.command(JDKToolFinder.getJDKTool("jcmd"), pid, "Thread.print"); - - OutputAnalyzer output = new OutputAnalyzer(pb.start()); - - // There shouldn't be a work gang for concurrent marking. - output.shouldNotContain("G1 Parallel Marking Threads"); - - // Make sure we didn't crash - output.shouldHaveExitValue(0); - } -} diff -r d78403bec68b -r dd3db9a36c40 test/gc/TestVerifySubSet.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/gc/TestVerifySubSet.java Thu Apr 28 09:50:48 2016 -0700 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* @test TestVerifySubSet.java + * @key gc + * @bug 8072725 + * @summary Test VerifySubSet option + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.ProcessTools; +import java.util.ArrayList; +import java.util.Collections; + +class RunSystemGC { + public static void main(String args[]) throws Exception { + System.gc(); + } +} + +public class TestVerifySubSet { + private static String[] getTestJavaOpts() { + String testVmOptsStr = System.getProperty("test.java.opts"); + if (!testVmOptsStr.isEmpty()) { + return testVmOptsStr.split(" "); + } else { + return new String[] {}; + } + } + + private static OutputAnalyzer runTest(String subset) throws Exception { + ArrayList vmOpts = new ArrayList(); + + Collections.addAll(vmOpts, getTestJavaOpts()); + Collections.addAll(vmOpts, new String[] {"-XX:+UnlockDiagnosticVMOptions", + "-XX:+VerifyBeforeGC", + "-XX:+VerifyAfterGC", + "-XX:VerifySubSet="+subset, + RunSystemGC.class.getName()}); + ProcessBuilder pb = + ProcessTools.createJavaProcessBuilder(vmOpts.toArray(new String[vmOpts.size()])); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + + System.out.println("Output:\n" + output.getOutput()); + return output; + } + + public static void main(String args[]) throws Exception { + + OutputAnalyzer output; + + output = runTest("heap, threads, codecache, metaspace"); + output.shouldContain("Heap"); + output.shouldContain("Threads"); + output.shouldContain("CodeCache"); + output.shouldContain("MetaspaceAux"); + output.shouldNotContain("SymbolTable"); + output.shouldNotContain("StringTable"); + output.shouldNotContain("SystemDictionary"); + output.shouldNotContain("CodeCache Oops"); + output.shouldHaveExitValue(0); + + output = runTest("hello, threads, codecache, metaspace"); + output.shouldContain("memory sub-system is unknown, please correct it"); + output.shouldNotContain("Threads"); + output.shouldNotContain("CodeCache"); + output.shouldNotContain("MetaspaceAux"); + output.shouldHaveExitValue(1); + } +} diff -r d78403bec68b -r dd3db9a36c40 test/gc/ergonomics/TestDynamicNumberOfGCThreads.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/gc/ergonomics/TestDynamicNumberOfGCThreads.java Thu Apr 28 09:50:48 2016 -0700 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test TestDynamicNumberOfGCThreads + * @bug 8017462 + * @summary Ensure that UseDynamicNumberOfGCThreads runs + * @requires vm.gc=="null" + * @key gc + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.ProcessTools; +import com.oracle.java.testlibrary.OutputAnalyzer; + +public class TestDynamicNumberOfGCThreads { + public static void main(String[] args) throws Exception { + + testDynamicNumberOfGCThreads("UseConcMarkSweepGC"); + + testDynamicNumberOfGCThreads("UseG1GC"); + + testDynamicNumberOfGCThreads("UseParallelGC"); + } + + private static void verifyDynamicNumberOfGCThreads(OutputAnalyzer output) { + output.shouldHaveExitValue(0); // test should run succesfully + output.shouldContain("new_active_workers"); + } + + private static void testDynamicNumberOfGCThreads(String gcFlag) throws Exception { + // UseDynamicNumberOfGCThreads and TraceDynamicGCThreads enabled + String[] baseArgs = {"-XX:+" + gcFlag, "-Xmx10M", "-XX:+PrintGCDetails", "-XX:+UseDynamicNumberOfGCThreads", "-XX:+TraceDynamicGCThreads", GCTest.class.getName()}; + + // Base test with gc and +UseDynamicNumberOfGCThreads: + ProcessBuilder pb_enabled = ProcessTools.createJavaProcessBuilder(baseArgs); + verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start())); + + // Ensure it also works on uniprocessors or if user specifies -XX:ParallelGCThreads=1: + String[] extraArgs = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+ForceDynamicNumberOfGCThreads", "-XX:ParallelGCThreads=1"}; + String[] finalArgs = new String[baseArgs.length + extraArgs.length]; + System.arraycopy(extraArgs, 0, finalArgs, 0, extraArgs.length); + System.arraycopy(baseArgs, 0, finalArgs, extraArgs.length, baseArgs.length); + pb_enabled = ProcessTools.createJavaProcessBuilder(finalArgs); + verifyDynamicNumberOfGCThreads(new OutputAnalyzer(pb_enabled.start())); + } + + static class GCTest { + private static byte[] garbage; + public static void main(String [] args) { + System.out.println("Creating garbage"); + // create 128MB of garbage. This should result in at least one GC + for (int i = 0; i < 1024; i++) { + garbage = new byte[128 * 1024]; + } + System.out.println("Done"); + } + } +} diff -r d78403bec68b -r dd3db9a36c40 test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java --- a/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java Wed Apr 27 14:41:55 2016 -0400 +++ b/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java Thu Apr 28 09:50:48 2016 -0700 @@ -42,8 +42,8 @@ public static void main(String args[]) throws Exception { OutputAnalyzer output; - long commitSize = 4 * 1024; // 4KB - long reserveSize = 1024 * 1024; // 1024KB + long commitSize = 128 * 1024; // 128KB + long reserveSize = 4 * 1024 * 1024; // 4096KB long addr; String pid = Integer.toString(ProcessTools.getProcessId()); @@ -62,11 +62,11 @@ "VM.native_memory", "detail" }); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=0KB)"); + output.shouldContain("Test (reserved=4096KB, committed=0KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } long addrA = addr; @@ -83,24 +83,24 @@ wb.NMTCommitMemory(addrD, commitSize); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=16KB)"); + output.shouldContain("Test (reserved=4096KB, committed=512KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } // uncommit BC wb.NMTUncommitMemory(addrB, commitSize); wb.NMTUncommitMemory(addrC, commitSize); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=8KB)"); + output.shouldContain("Test (reserved=4096KB, committed=256KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } // commit EF @@ -108,22 +108,22 @@ wb.NMTCommitMemory(addrF, commitSize); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=16KB)"); + output.shouldContain("Test (reserved=4096KB, committed=512KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } // uncommit A wb.NMTUncommitMemory(addrA, commitSize); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=12KB)"); + output.shouldContain("Test (reserved=4096KB, committed=384KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } // commit ABC @@ -132,11 +132,11 @@ wb.NMTCommitMemory(addrC, commitSize); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=24KB)"); + output.shouldContain("Test (reserved=4096KB, committed=768KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } // uncommit ABCDEF @@ -148,11 +148,11 @@ wb.NMTUncommitMemory(addrF, commitSize); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Test (reserved=1024KB, committed=0KB)"); + output.shouldContain("Test (reserved=4096KB, committed=0KB)"); if (has_nmt_detail) { output.shouldMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" + Long.toHexString(addr + reserveSize) - + "\\] reserved 1024KB for Test"); + + "\\] reserved 4096KB for Test"); } // release @@ -160,6 +160,6 @@ output = new OutputAnalyzer(pb.start()); output.shouldNotContain("Test (reserved="); output.shouldNotMatch("\\[0x[0]*" + Long.toHexString(addr) + " - 0x[0]*" - + Long.toHexString(addr + reserveSize) + "\\] reserved 1024KB for Test"); + + Long.toHexString(addr + reserveSize) + "\\] reserved 4096KB for Test"); } }