Mercurial > hg > icedtea8-forest > hotspot
changeset 10633:773c67608051
Merge jdk8u252-ga
line wrap: on
line diff
--- a/.hgtags Mon Apr 20 18:11:41 2020 +0100 +++ b/.hgtags Tue Apr 21 23:47:44 2020 +0100 @@ -1376,3 +1376,13 @@ f767447146983e6d1110c3f65eefb043b788e906 icedtea-3.16.0pre00 8c0733543544bbcd32c4404630d764d280299056 jdk8u252-b00 efb699b681a1245f020ca62ff3aba76c45d17810 icedtea-3.16.0pre01 +a67e9c6edcdd73cb860a16990f0905e102c282d7 jdk8u252-b01 +5bd3b8c0555292a967ea3b4c39a220d0c2cf40ad jdk8u252-b02 +2e972804450764c9ec3b7e548b07be869948ecca jdk8u252-b03 +ff1c3c1867b502c289c7c08ebc712663ec657f06 jdk8u252-b04 +9003f35baaa0d57d225bf72cf82fb0a8ee049c98 jdk8u252-b05 +b4fd7e078c54a23ed44f09aec3f6938bed3e3630 jdk8u252-b06 +d17814ea88e3aa0a2f2fdb125e35a878ee27fe3e jdk8u252-b07 +8f2780b3e4faf4792ac885f470bb1602d4ca5526 jdk8u252-b08 +095e60e7fc8c7813c2e0e68637bd53c01f8cba64 jdk8u252-b09 +095e60e7fc8c7813c2e0e68637bd53c01f8cba64 jdk8u252-ga
--- a/THIRD_PARTY_README Mon Apr 20 18:11:41 2020 +0100 +++ b/THIRD_PARTY_README Tue Apr 21 23:47:44 2020 +0100 @@ -1712,10 +1712,9 @@ --- begin of LICENSE --- - Mesa 3-D graphics library - Version: 5.0 - - Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + Mesa 3-D Graphics Library v19.2.1 + + Copyright (C) 1999-2007 Brian Paul All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -1730,9 +1729,118 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + +Attention, Contributors + +When contributing to the Mesa project you must agree to the licensing terms +of the component to which you're contributing. +The following section lists the primary components of the Mesa distribution +and their respective licenses. +Mesa Component Licenses + + + +Component Location License +------------------------------------------------------------------ +Main Mesa code src/mesa/ MIT +Device drivers src/mesa/drivers/* MIT, generally + +Gallium code src/gallium/ MIT + +Ext headers GL/glext.h Khronos + GL/glxext.h Khronos + GL/wglext.h Khronos + KHR/khrplatform.h Khronos + +***************************************************************************** + +---- +include/GL/gl.h : + + + Mesa 3-D graphics library + + Copyright (C) 1999-2006 Brian Paul All Rights Reserved. + Copyright (C) 2009 VMware, Inc. All Rights Reserved. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + ***************************************************************************** + +---- +include/GL/glext.h +include/GL/glxext.h +include/GL/wglxext.h : + + + Copyright (c) 2013 - 2018 The Khronos Group Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and/or associated documentation files (the + "Materials"), to deal in the Materials without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Materials, and to + permit persons to whom the Materials are furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Materials. + + THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + + ***************************************************************************** + +---- +include/KHR/khrplatform.h : + + Copyright (c) 2008 - 2018 The Khronos Group Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and/or associated documentation files (the + "Materials"), to deal in the Materials without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Materials, and to + permit persons to whom the Materials are furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Materials. + + THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. + + ***************************************************************************** --- end of LICENSE ---
--- a/make/bsd/makefiles/gcc.make Mon Apr 20 18:11:41 2020 +0100 +++ b/make/bsd/makefiles/gcc.make Tue Apr 21 23:47:44 2020 +0100 @@ -260,14 +260,13 @@ WARNINGS_ARE_ERRORS += -Wno-empty-body endif -WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef +WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" +ifeq ($(USE_CLANG),) # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit # conversions which might affect the values. Only enable it in earlier versions. - WARNING_FLAGS = -Wunused-function - ifeq ($(USE_CLANG),) - WARNING_FLAGS += -Wconversion + ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" + WARNINGS_FLAGS += -Wconversion endif endif
--- a/make/windows/build.make Mon Apr 20 18:11:41 2020 +0100 +++ b/make/windows/build.make Tue Apr 21 23:47:44 2020 +0100 @@ -280,7 +280,7 @@ @ echo HS_COMPANY=$(COMPANY_NAME) >> $@ @ echo HS_FILEDESC=$(HS_FILEDESC) >> $@ @ echo HOTSPOT_VM_DISTRO=$(HOTSPOT_VM_DISTRO) >> $@ - @ echo VENDOR=$(VENDOR) >> $@ + @ echo VENDOR=$(COMPANY_NAME) >> $@ @ echo VENDOR_URL=$(VENDOR_URL) >> $@ @ echo VENDOR_URL_BUG=$(VENDOR_URL_BUG) >> $@ @ echo VENDOR_URL_VM_BUG=$(VENDOR_URL_VM_BUG) >> $@
--- a/make/windows/makefiles/compile.make Mon Apr 20 18:11:41 2020 +0100 +++ b/make/windows/makefiles/compile.make Tue Apr 21 23:47:44 2020 +0100 @@ -346,7 +346,7 @@ /D "HS_BUILD_ID=$(HS_BUILD_ID)" \ /D "JDK_VER=$(JDK_VER)" \ /D "JDK_DOTVER=$(JDK_DOTVER)" \ - /D "HS_COMPANY=$(HS_COMPANY)" \ + /D "HS_COMPANY=$(COMPANY_NAME)" \ /D "HS_FILEDESC=$(HS_FILEDESC)" \ /D "HS_COPYRIGHT=$(HS_COPYRIGHT)" \ /D "HS_FNAME=$(HS_FNAME)" \
--- a/make/windows/makefiles/defs.make Mon Apr 20 18:11:41 2020 +0100 +++ b/make/windows/makefiles/defs.make Tue Apr 21 23:47:44 2020 +0100 @@ -157,6 +157,15 @@ MAKE_ARGS += RM="$(RM)" MAKE_ARGS += ZIPEXE=$(ZIPEXE) +MAKE_ARGS += COMPANY_NAME="$(COMPANY_NAME)" +MAKE_ARGS += VENDOR_URL=$(VENDOR_URL) +MAKE_ARGS += VENDOR_URL_BUG=$(VENDOR_URL_BUG) +MAKE_ARGS += VENDOR_URL_VM_BUG=$(VENDOR_URL_VM_BUG) +ifneq ($(VERSION_CFLAGS),) + # transform syntax from -DProp='"Value"' to /D "Prop=\"Value\"" for Windows build + MAKE_ARGS += VERSION_CFLAGS="$(subst -D,/D \",$(subst ',,$(subst '$() $(),\"$() $(),$(subst ",\\\",$(VERSION_CFLAGS)))))\"" +endif + # On 32 bit windows we build server and client, on 64 bit just server. ifeq ($(JVM_VARIANTS),) ifeq ($(ARCH_DATA_MODEL), 32)
--- a/make/windows/makefiles/vm.make Mon Apr 20 18:11:41 2020 +0100 +++ b/make/windows/makefiles/vm.make Tue Apr 21 23:47:44 2020 +0100 @@ -62,10 +62,6 @@ CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_TARGET=\"$(BUILD_FLAVOR)\"" CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_BUILD_USER=\"$(BuildUser)\"" CXX_FLAGS=$(CXX_FLAGS) /D "HOTSPOT_VM_DISTRO=\"$(HOTSPOT_VM_DISTRO)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR=\"$(COMPANY_NAME)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL=\"$(VENDOR_URL)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL_BUG=\"$(VENDOR_URL_BUG)\"" -CXX_FLAGS=$(CXX_FLAGS) /D "VENDOR_URL_VM_BUG=\"$(VENDOR_URL_VM_BUG)\"" CXX_FLAGS=$(CXX_FLAGS) $(CXX_INCLUDE_DIRS) @@ -217,6 +213,14 @@ bytecodeInterpreterWithChecks.obj: ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp $(CXX) $(CXX_FLAGS) $(CXX_DONT_USE_PCH) /c ..\generated\jvmtifiles\bytecodeInterpreterWithChecks.cpp +#files compiled with version flags + +vm_version.obj: $(WorkSpace)\src\share\vm\runtime\vm_version.cpp + $(CXX) $(CXX_FLAGS) $(VERSION_CFLAGS) $(CXX_USE_PCH) /c $(WorkSpace)\src\share\vm\runtime\vm_version.cpp + +arguments.obj: $(WorkSpace)\src\share\vm\runtime\arguments.cpp + $(CXX) $(CXX_FLAGS) $(VERSION_CFLAGS) $(CXX_USE_PCH) /c $(WorkSpace)\src\share\vm\runtime\arguments.cpp + # Default rules for the Virtual Machine {$(COMMONSRC)\share\vm\c1}.cpp.obj:: $(CXX) $(CXX_FLAGS) $(CXX_USE_PCH) /c $<
--- a/src/cpu/ppc/vm/globals_ppc.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/ppc/vm/globals_ppc.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright 2012, 2018 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -33,10 +33,8 @@ // (see globals.hpp) define_pd_global(bool, ConvertSleepToYield, true); -define_pd_global(bool, ShareVtableStubs, false); // Improves performance markedly for mtrt and compress. define_pd_global(bool, NeedsDeoptSuspend, false); // Only register window machines need this. - define_pd_global(bool, ImplicitNullChecks, true); // Generate code for implicit null checks. define_pd_global(bool, TrapBasedNullChecks, true); define_pd_global(bool, UncommonNullCast, true); // Uncommon-trap NULLs passed to check cast.
--- a/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/sparc/vm/c1_FrameMap_sparc.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -55,6 +55,8 @@ opr = as_oop_opr(reg); } else if (type == T_METADATA) { opr = as_metadata_opr(reg); + } else if (type == T_ADDRESS) { + opr = as_address_opr(reg); } else { opr = as_opr(reg); }
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -509,8 +509,13 @@ if (o == NULL) { __ set(NULL_WORD, reg); } else { +#ifdef ASSERT + { + ThreadInVMfromNative tiv(JavaThread::current()); + assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop"); + } +#endif int oop_index = __ oop_recorder()->find_index(o); - assert(Universe::heap()->is_in_reserved(JNIHandles::resolve(o)), "should be real oop"); RelocationHolder rspec = oop_Relocation::spec(oop_index); __ set(NULL_WORD, reg, rspec); // Will be set when the nmethod is created }
--- a/src/cpu/sparc/vm/globals_sparc.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/sparc/vm/globals_sparc.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, 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 @@ -38,7 +38,6 @@ // according to the prior table. So, we let the thread continue and let it block by itself. define_pd_global(bool, DontYieldALot, true); // yield no more than 100 times per second define_pd_global(bool, ConvertSleepToYield, false); // do not convert sleep(0) to yield. Helps GUI -define_pd_global(bool, ShareVtableStubs, false); // improves performance markedly for mtrt and compress define_pd_global(bool, CountInterpCalls, false); // not implemented in the interpreter define_pd_global(bool, NeedsDeoptSuspend, true); // register window machines need this
--- a/src/cpu/x86/vm/c1_FrameMap_x86.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/x86/vm/c1_FrameMap_x86.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -54,6 +54,8 @@ opr = as_oop_opr(reg); } else if (type == T_METADATA) { opr = as_metadata_opr(reg); + } else if (type == T_ADDRESS) { + opr = as_address_opr(reg); } else { opr = as_opr(reg); }
--- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -964,7 +964,7 @@ if (type == T_OBJECT || type == T_ARRAY) { __ verify_oop(src->as_register()); __ movptr (dst, src->as_register()); - } else if (type == T_METADATA) { + } else if (type == T_METADATA || type == T_ADDRESS) { __ movptr (dst, src->as_register()); } else { __ movl (dst, src->as_register()); @@ -1145,7 +1145,7 @@ if (type == T_ARRAY || type == T_OBJECT) { __ movptr(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix())); __ verify_oop(dest->as_register()); - } else if (type == T_METADATA) { + } else if (type == T_METADATA || type == T_ADDRESS) { __ movptr(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix())); } else { __ movl(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()));
--- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -233,8 +233,8 @@ } -bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, int c, LIR_Opr result, LIR_Opr tmp) { - if (tmp->is_valid()) { +bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { + if (tmp->is_valid() && c > 0 && c < max_jint) { if (is_power_of_2(c + 1)) { __ move(left, tmp); __ shift_left(left, log2_jint(c + 1), left); @@ -602,8 +602,8 @@ bool use_constant = false; bool use_tmp = false; if (right_arg->is_constant()) { - int iconst = right_arg->get_jint_constant(); - if (iconst > 0) { + jint iconst = right_arg->get_jint_constant(); + if (iconst > 0 && iconst < max_jint) { if (is_power_of_2(iconst)) { use_constant = true; } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
--- a/src/cpu/x86/vm/globals_x86.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/x86/vm/globals_x86.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ // (see globals.hpp) define_pd_global(bool, ConvertSleepToYield, true); -define_pd_global(bool, ShareVtableStubs, true); define_pd_global(bool, CountInterpCalls, true); define_pd_global(bool, NeedsDeoptSuspend, false); // only register window machines need this
--- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -2098,7 +2098,7 @@ // critical natives they are offset down. GrowableArray<int> arg_order(2 * total_in_args); VMRegPair tmp_vmreg; - tmp_vmreg.set1(rbx->as_VMReg()); + tmp_vmreg.set2(rbx->as_VMReg()); if (!is_critical_native) { for (int i = total_in_args - 1, c_arg = total_c_args - 1; i >= 0; i--, c_arg--) {
--- a/src/cpu/zero/vm/globals_zero.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/cpu/zero/vm/globals_zero.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -33,7 +33,6 @@ // runtime system. See globals.hpp for details of what they do. define_pd_global(bool, ConvertSleepToYield, true); -define_pd_global(bool, ShareVtableStubs, true); define_pd_global(bool, CountInterpCalls, true); define_pd_global(bool, NeedsDeoptSuspend, false);
--- a/src/share/vm/adlc/archDesc.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/adlc/archDesc.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -43,32 +43,6 @@ return result; } -// Utilities to characterize effect statements -static bool is_def(int usedef) { - switch(usedef) { - case Component::DEF: - case Component::USE_DEF: return true; break; - } - return false; -} - -static bool is_use(int usedef) { - switch(usedef) { - case Component::USE: - case Component::USE_DEF: - case Component::USE_KILL: return true; break; - } - return false; -} - -static bool is_kill(int usedef) { - switch(usedef) { - case Component::KILL: - case Component::USE_KILL: return true; break; - } - return false; -} - //---------------------------ChainList Methods------------------------------- ChainList::ChainList() { }
--- a/src/share/vm/adlc/main.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/adlc/main.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -29,7 +29,6 @@ static void usage(ArchDesc& AD); // Print usage message and exit static char *strip_ext(char *fname); // Strip off name extension static char *base_plus_suffix(const char* base, const char *suffix);// New concatenated string -static char *prefix_plus_base_plus_suffix(const char* prefix, const char* base, const char *suffix);// New concatenated string static int get_legal_text(FileBuff &fbuf, char **legal_text); // Get pointer to legal text ArchDesc* globalAD = NULL; // global reference to Architecture Description object
--- a/src/share/vm/adlc/output_c.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/adlc/output_c.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -35,23 +35,6 @@ return false; } -static bool is_use(int usedef) { - switch(usedef) { - case Component::USE: - case Component::USE_DEF: - case Component::USE_KILL: return true; break; - } - return false; -} - -static bool is_kill(int usedef) { - switch(usedef) { - case Component::KILL: - case Component::USE_KILL: return true; break; - } - return false; -} - // Define an array containing the machine register names, strings. static void defineRegNames(FILE *fp, RegisterForm *registers) { if (registers) {
--- a/src/share/vm/c1/c1_FrameMap.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/c1/c1_FrameMap.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -201,6 +201,10 @@ return LIR_OprFact::single_cpu_metadata(cpu_reg2rnr(r)); } + static LIR_Opr as_address_opr(Register r) { + return LIR_OprFact::single_cpu_address(cpu_reg2rnr(r)); + } + FrameMap(ciMethod* method, int monitors, int reserved_argument_area_size); bool finalize_frame(int nof_slots);
--- a/src/share/vm/c1/c1_LIRGenerator.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -539,11 +539,11 @@ case Bytecodes::_imul: { - bool did_strength_reduce = false; + bool did_strength_reduce = false; if (right->is_constant()) { - int c = right->as_jint(); - if (is_power_of_2(c)) { + jint c = right->as_jint(); + if (c > 0 && is_power_of_2(c)) { // do not need tmp here __ shift_left(left_op, exact_log2(c), result_op); did_strength_reduce = true; @@ -2339,7 +2339,7 @@ __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL)); __ branch(lir_cond_equal, T_OBJECT, Lcont->label()); } - LIR_Opr src_klass = new_register(T_OBJECT); + LIR_Opr src_klass = new_register(T_METADATA); if (gen_type_check) { // We have determined that offset == referent_offset && src != null. // if (src->_klass->_reference_type == REF_NONE) -> continue @@ -3304,7 +3304,7 @@ void LIRGenerator::do_ProfileCall(ProfileCall* x) { // Need recv in a temporary register so it interferes with the other temporaries LIR_Opr recv = LIR_OprFact::illegalOpr; - LIR_Opr mdo = new_register(T_OBJECT); + LIR_Opr mdo = new_register(T_METADATA); // tmp is used to hold the counters on SPARC LIR_Opr tmp = new_pointer_register();
--- a/src/share/vm/c1/c1_LIRGenerator.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/c1/c1_LIRGenerator.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -308,7 +308,7 @@ // is_strictfp is only needed for mul and div (and only generates different code on i486) void arithmetic_op(Bytecodes::Code code, LIR_Opr result, LIR_Opr left, LIR_Opr right, bool is_strictfp, LIR_Opr tmp, CodeEmitInfo* info = NULL); // machine dependent. returns true if it emitted code for the multiply - bool strength_reduce_multiply(LIR_Opr left, int constant, LIR_Opr result, LIR_Opr tmp); + bool strength_reduce_multiply(LIR_Opr left, jint constant, LIR_Opr result, LIR_Opr tmp); void store_stack_parameter (LIR_Opr opr, ByteSize offset_from_sp_in_bytes);
--- a/src/share/vm/code/debugInfo.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/code/debugInfo.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -27,6 +27,8 @@ #include "code/debugInfoRec.hpp" #include "code/nmethod.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/interfaceSupport.hpp" +#include "runtime/thread.hpp" PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC @@ -204,14 +206,24 @@ // ConstantOopWriteValue void ConstantOopWriteValue::write_on(DebugInfoWriteStream* stream) { - assert(JNIHandles::resolve(value()) == NULL || - Universe::heap()->is_in_reserved(JNIHandles::resolve(value())), - "Should be in heap"); +#ifdef ASSERT + { + // cannot use ThreadInVMfromNative here since in case of JVMCI compiler, + // thread is already in VM state. + ThreadInVMfromUnknown tiv; + assert(JNIHandles::resolve(value()) == NULL || + Universe::heap()->is_in_reserved(JNIHandles::resolve(value())), + "Should be in heap"); + } +#endif stream->write_int(CONSTANT_OOP_CODE); stream->write_handle(value()); } void ConstantOopWriteValue::print_on(outputStream* st) const { + // using ThreadInVMfromUnknown here since in case of JVMCI compiler, + // thread is already in VM state. + ThreadInVMfromUnknown tiv; JNIHandles::resolve(value())->print_value_on(st); }
--- a/src/share/vm/code/vtableStubs.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/code/vtableStubs.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -110,7 +110,7 @@ address VtableStubs::find_stub(bool is_vtable_stub, int vtable_index) { assert(vtable_index >= 0, "must be positive"); - VtableStub* s = ShareVtableStubs ? lookup(is_vtable_stub, vtable_index) : NULL; + VtableStub* s = lookup(is_vtable_stub, vtable_index); if (s == NULL) { if (is_vtable_stub) { s = create_vtable_stub(vtable_index);
--- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -1940,9 +1940,7 @@ // Has the GC time limit been exceeded? DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration(); - size_t max_eden_size = young_gen->max_capacity() - - young_gen->to()->capacity() - - young_gen->from()->capacity(); + size_t max_eden_size = young_gen->max_eden_size(); GenCollectedHeap* gch = GenCollectedHeap::heap(); GCCause::Cause gc_cause = gch->gc_cause(); size_policy()->check_gc_overhead_limit(_young_gen->used(),
--- a/src/share/vm/opto/loopPredicate.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/opto/loopPredicate.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -502,7 +502,31 @@ _lpt(lpt), _phase(lpt->_phase), _visited(area), _invariant(area), _stack(area, 10 /* guess */), _clone_visited(area), _old_new(area) - {} + { + Node* head = _lpt->_head; + Node* entry = head->in(LoopNode::EntryControl); + if (entry->outcnt() != 1) { + // If a node is pinned between the predicates and the loop + // entry, we won't be able to move any node in the loop that + // depends on it above it in a predicate. Mark all those nodes + // as non loop invariatnt. + Unique_Node_List wq; + wq.push(entry); + for (uint next = 0; next < wq.size(); ++next) { + Node *n = wq.at(next); + for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) { + Node* u = n->fast_out(i); + if (!u->is_CFG()) { + Node* c = _phase->get_ctrl(u); + if (_lpt->is_member(_phase->get_loop(c)) || _phase->is_dominator(c, head)) { + _visited.set(u->_idx); + wq.push(u); + } + } + } + } + } + } // Map old to n for invariance computation and clone void map_ctrl(Node* old, Node* n) {
--- a/src/share/vm/opto/node.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/opto/node.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -286,6 +286,10 @@ #ifdef _MSC_VER // the IDX_INIT hack falls foul of warning C4355 #pragma warning( disable:4355 ) // 'this' : used in base member initializer list #endif +#ifdef __clang__ +#pragma clang diagnostic push +#pragma GCC diagnostic ignored "-Wuninitialized" +#endif // Out-of-line code from node constructors. // Executed only when extra debug info. is being passed around. @@ -493,6 +497,10 @@ _in[6] = n6; if (n6 != NULL) n6->add_out((Node *)this); } +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + //------------------------------clone------------------------------------------ // Clone a Node.
--- a/src/share/vm/opto/type.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/opto/type.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -3753,29 +3753,22 @@ return make(_ptr, const_oop(), _ary, klass(), _klass_is_exact, _offset, instance_id, _speculative, _inline_depth); } -//-----------------------------narrow_size_type------------------------------- -// Local cache for arrayOopDesc::max_array_length(etype), -// which is kind of slow (and cached elsewhere by other users). -static jint max_array_length_cache[T_CONFLICT+1]; -static jint max_array_length(BasicType etype) { - jint& cache = max_array_length_cache[etype]; - jint res = cache; - if (res == 0) { - switch (etype) { - case T_NARROWOOP: +//-----------------------------max_array_length------------------------------- +// A wrapper around arrayOopDesc::max_array_length(etype) with some input normalization. +jint TypeAryPtr::max_array_length(BasicType etype) { + if (!is_java_primitive(etype) && !is_reference_type(etype)) { + if (etype == T_NARROWOOP) { etype = T_OBJECT; - break; - case T_NARROWKLASS: - case T_CONFLICT: - case T_ILLEGAL: - case T_VOID: - etype = T_BYTE; // will produce conservatively high value + } else if (etype == T_ILLEGAL) { // bottom[] + etype = T_BYTE; // will produce conservatively high value + } else { + fatal(err_msg("not an element type: %s", type2name(etype))); } - cache = res = arrayOopDesc::max_array_length(etype); } - return res; -} - + return arrayOopDesc::max_array_length(etype); +} + +//-----------------------------narrow_size_type------------------------------- // Narrow the given size type to the index range for the given array base type. // Return NULL if the resulting int type becomes empty. const TypeInt* TypeAryPtr::narrow_size_type(const TypeInt* size) const {
--- a/src/share/vm/opto/type.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/opto/type.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -433,7 +433,6 @@ private: // support arrays - static const BasicType _basic_type[]; static const Type* _zero_type[T_CONFLICT+1]; static const Type* _const_basic_type[T_CONFLICT+1]; }; @@ -1154,6 +1153,8 @@ const TypeAryPtr* cast_to_stable(bool stable, int stable_dimension = 1) const; int stable_dimension() const; + static jint max_array_length(BasicType etype) ; + // Convenience common pre-built types. static const TypeAryPtr *RANGE; static const TypeAryPtr *OOPS;
--- a/src/share/vm/prims/forte.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/prims/forte.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -625,7 +625,7 @@ #ifdef __APPLE__ // XXXDARWIN: Link errors occur even when __attribute__((weak_import)) // is added -#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0) +#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void) 0) #else void collector_func_load(char* name, void* null_argument_1,
--- a/src/share/vm/prims/jni.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/prims/jni.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -5101,6 +5101,7 @@ void TestNewSize_test(); void TestKlass_test(); void Test_linked_list(); +void TestResourcehash_test(); void TestChunkedList_test(); #if INCLUDE_ALL_GCS void TestOldFreeSpaceCalculation_test(); @@ -5133,6 +5134,7 @@ run_unit_test(test_snprintf()); run_unit_test(TestNewSize_test()); run_unit_test(TestKlass_test()); + run_unit_test(TestResourcehash_test()); run_unit_test(Test_linked_list()); run_unit_test(TestChunkedList_test()); run_unit_test(ObjectMonitor::sanity_checks());
--- a/src/share/vm/runtime/globals.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/globals.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -1192,9 +1192,6 @@ product(bool, ReduceSignalUsage, false, \ "Reduce the use of OS signals in Java and/or the VM") \ \ - develop_pd(bool, ShareVtableStubs, \ - "Share vtable stubs (smaller code but worse branch prediction") \ - \ develop(bool, LoadLineNumberTables, true, \ "Tell whether the class file parser loads line number tables") \ \
--- a/src/share/vm/runtime/java.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/java.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -338,7 +338,7 @@ klassVtable::print_statistics(); klassItable::print_statistics(); } - if (VerifyOops) { + if (VerifyOops && Verbose) { tty->print_cr("+VerifyOops count: %d", StubRoutines::verify_oop_count()); }
--- a/src/share/vm/runtime/safepoint.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/safepoint.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -190,7 +190,7 @@ }; // State class for a thread suspended at a safepoint -class ThreadSafepointState: public CHeapObj<mtInternal> { +class ThreadSafepointState: public CHeapObj<mtThread> { public: // These states are maintained by VM thread while threads are being brought // to a safepoint. After SafepointSynchronize::end(), they are reset to
--- a/src/share/vm/runtime/synchronizer.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/synchronizer.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -149,7 +149,7 @@ #define NINFLATIONLOCKS 256 static volatile intptr_t InflationLocks [NINFLATIONLOCKS] ; -ObjectMonitor * ObjectSynchronizer::gBlockList = NULL ; +ObjectMonitor * volatile ObjectSynchronizer::gBlockList = NULL; ObjectMonitor * volatile ObjectSynchronizer::gFreeList = NULL ; ObjectMonitor * volatile ObjectSynchronizer::gOmInUseList = NULL ; int ObjectSynchronizer::gOmInUseCount = 0; @@ -830,18 +830,18 @@ // Visitors ... void ObjectSynchronizer::monitors_iterate(MonitorClosure* closure) { - ObjectMonitor* block = gBlockList; - ObjectMonitor* mid; - while (block) { + ObjectMonitor* block = + (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList); + while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = _BLOCKSIZE - 1; i > 0; i--) { - mid = block + i; - oop object = (oop) mid->object(); + ObjectMonitor* mid = (ObjectMonitor *)(block + i); + oop object = (oop)mid->object(); if (object != NULL) { closure->do_monitor(mid); } } - block = (ObjectMonitor*) block->FreeNext; + block = (ObjectMonitor*)block->FreeNext; } } @@ -856,7 +856,9 @@ void ObjectSynchronizer::oops_do(OopClosure* f) { assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); - for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) { + ObjectMonitor* block = + (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList); + for (; block != NULL; block = (ObjectMonitor *)next(block)) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { ObjectMonitor* mid = &block[i]; @@ -1059,7 +1061,9 @@ // The very first objectMonitor in a block is reserved and dedicated. // It serves as blocklist "next" linkage. temp[0].FreeNext = gBlockList; - gBlockList = temp; + // There are lock-free uses of gBlockList so make sure that + // the previous stores happen before we update gBlockList. + OrderAccess::release_store_ptr(&gBlockList, temp); // Add the new string of objectMonitors to the global free list temp[_BLOCKSIZE - 1].FreeNext = gFreeList ; @@ -1536,29 +1540,33 @@ nInuse += gOmInUseCount; } - } else for (ObjectMonitor* block = gBlockList; block != NULL; block = next(block)) { - // Iterate over all extant monitors - Scavenge all idle monitors. - assert(block->object() == CHAINMARKER, "must be a block header"); - nInCirculation += _BLOCKSIZE ; - for (int i = 1 ; i < _BLOCKSIZE; i++) { - ObjectMonitor* mid = &block[i]; - oop obj = (oop) mid->object(); + } else { + ObjectMonitor* block = + (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList); + for (; block != NULL; block = (ObjectMonitor*)next(block)) { + // Iterate over all extant monitors - Scavenge all idle monitors. + assert(block->object() == CHAINMARKER, "must be a block header"); + nInCirculation += _BLOCKSIZE; + for (int i = 1; i < _BLOCKSIZE; i++) { + ObjectMonitor* mid = (ObjectMonitor*)&block[i]; + oop obj = (oop)mid->object(); - if (obj == NULL) { - // The monitor is not associated with an object. - // The monitor should either be a thread-specific private - // free list or the global free list. - // obj == NULL IMPLIES mid->is_busy() == 0 - guarantee (!mid->is_busy(), "invariant") ; - continue ; - } - deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail); + if (obj == NULL) { + // The monitor is not associated with an object. + // The monitor should either be a thread-specific private + // free list or the global free list. + // obj == NULL IMPLIES mid->is_busy() == 0 + guarantee(!mid->is_busy(), "invariant"); + continue; + } + deflated = deflate_monitor(mid, obj, &FreeHead, &FreeTail); - if (deflated) { - mid->FreeNext = NULL ; - nScavenged ++ ; - } else { - nInuse ++; + if (deflated) { + mid->FreeNext = NULL; + nScavenged++; + } else { + nInuse++; + } } } } @@ -1693,13 +1701,13 @@ // Verify all monitors in the monitor cache, the verification is weak. void ObjectSynchronizer::verify() { - ObjectMonitor* block = gBlockList; - ObjectMonitor* mid; - while (block) { + ObjectMonitor* block = + (ObjectMonitor *)OrderAccess::load_ptr_acquire(&gBlockList); + while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); for (int i = 1; i < _BLOCKSIZE; i++) { - mid = block + i; - oop object = (oop) mid->object(); + ObjectMonitor* mid = (ObjectMonitor *)(block + i); + oop object = (oop)mid->object(); if (object != NULL) { mid->verify(); } @@ -1713,18 +1721,18 @@ // the list of extant blocks without taking a lock. int ObjectSynchronizer::verify_objmon_isinpool(ObjectMonitor *monitor) { - ObjectMonitor* block = gBlockList; - - while (block) { + ObjectMonitor* block = + (ObjectMonitor*)OrderAccess::load_ptr_acquire(&gBlockList); + while (block != NULL) { assert(block->object() == CHAINMARKER, "must be a block header"); if (monitor > &block[0] && monitor < &block[_BLOCKSIZE]) { - address mon = (address) monitor; - address blk = (address) block; + address mon = (address)monitor; + address blk = (address)block; size_t diff = mon - blk; - assert((diff % sizeof(ObjectMonitor)) == 0, "check"); + assert((diff % sizeof(ObjectMonitor)) == 0, "must be aligned"); return 1; } - block = (ObjectMonitor*) block->FreeNext; + block = (ObjectMonitor*)block->FreeNext; } return 0; }
--- a/src/share/vm/runtime/synchronizer.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/synchronizer.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -131,7 +131,7 @@ private: enum { _BLOCKSIZE = 128 }; - static ObjectMonitor* gBlockList; + static ObjectMonitor * volatile gBlockList; static ObjectMonitor * volatile gFreeList; static ObjectMonitor * volatile gOmInUseList; // for moribund thread, so monitors they inflated still get scanned static int gOmInUseCount;
--- a/src/share/vm/runtime/thread.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/thread.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -836,7 +836,9 @@ } void Thread::oops_do(OopClosure* f, CLDClosure* cld_f, CodeBlobClosure* cf) { - active_handles()->oops_do(f); + if (active_handles() != NULL) { + active_handles()->oops_do(f); + } // Do oop for ThreadShadow f->do_oop((oop*)&_pending_exception); handle_area()->oops_do(f);
--- a/src/share/vm/runtime/vmStructs.cpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/runtime/vmStructs.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -267,6 +267,7 @@ #define VM_STRUCTS(nonstatic_field, \ static_field, \ + static_ptr_volatile_field, \ unchecked_nonstatic_field, \ volatile_nonstatic_field, \ nonproduct_nonstatic_field, \ @@ -1092,7 +1093,7 @@ volatile_nonstatic_field(BasicLock, _displaced_header, markOop) \ nonstatic_field(BasicObjectLock, _lock, BasicLock) \ nonstatic_field(BasicObjectLock, _obj, oop) \ - static_field(ObjectSynchronizer, gBlockList, ObjectMonitor*) \ + static_ptr_volatile_field(ObjectSynchronizer,gBlockList, ObjectMonitor*) \ \ /*********************/ \ /* Matcher (C2 only) */ \ @@ -2677,6 +2678,11 @@ #define GENERATE_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \ { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, &typeName::fieldName }, +// This macro generates a VMStructEntry line for a static pointer volatile field, +// e.g.: "static ObjectMonitor * volatile gBlockList;" +#define GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \ + { QUOTE(typeName), QUOTE(fieldName), QUOTE(type), 1, 0, (void*)&typeName::fieldName }, + // This macro generates a VMStructEntry line for an unchecked // nonstatic field, in which the size of the type is also specified. // The type string is given as NULL, indicating an "opaque" type. @@ -2702,10 +2708,15 @@ #define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \ {typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; } -// This macro checks the type of a VMStructEntry by comparing pointer types +// This macro checks the type of a static VMStructEntry by comparing pointer types #define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \ {type* dummy = &typeName::fieldName; } +// This macro checks the type of a static pointer volatile VMStructEntry by comparing pointer types, +// e.g.: "static ObjectMonitor * volatile gBlockList;" +#define CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY(typeName, fieldName, type) \ + {type volatile * dummy = &typeName::fieldName; } + // This macro ensures the type of a field and its containing type are // present in the type table. The assertion string is shorter than // preferable because (incredibly) of a bug in Solstice NFS client @@ -2899,6 +2910,7 @@ VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, GENERATE_STATIC_VM_STRUCT_ENTRY, + GENERATE_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY, GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, GENERATE_NONSTATIC_VM_STRUCT_ENTRY, GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, @@ -3057,6 +3069,7 @@ VMStructs::init() { VM_STRUCTS(CHECK_NONSTATIC_VM_STRUCT_ENTRY, CHECK_STATIC_VM_STRUCT_ENTRY, + CHECK_STATIC_PTR_VOLATILE_VM_STRUCT_ENTRY, CHECK_NO_OP, CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY, CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, @@ -3172,9 +3185,11 @@ CHECK_NO_OP, CHECK_NO_OP, CHECK_NO_OP, + CHECK_NO_OP, CHECK_NO_OP)); debug_only(VM_STRUCTS(CHECK_NO_OP, ENSURE_FIELD_TYPE_PRESENT, + ENSURE_FIELD_TYPE_PRESENT, CHECK_NO_OP, ENSURE_FIELD_TYPE_PRESENT, ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
--- a/src/share/vm/utilities/globalDefinitions.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/utilities/globalDefinitions.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -652,6 +652,10 @@ return (t == T_BYTE || t == T_SHORT); } +inline bool is_reference_type(BasicType t) { + return (t == T_OBJECT || t == T_ARRAY); +} + // Convert a char from a classfile signature to a BasicType inline BasicType char2type(char c) { switch( c ) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/share/vm/utilities/resourceHash.cpp Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,182 @@ +/* + * 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. + * + */ + +#include "precompiled.hpp" +#include "memory/allocation.hpp" +#include "memory/resourceArea.hpp" +#include "utilities/debug.hpp" +#include "utilities/resourceHash.hpp" + +#ifndef PRODUCT + +/////////////// Unit tests /////////////// + +class TestResourceHashtable : public AllStatic { + typedef void* K; + typedef int V; + + static unsigned identity_hash(const K& k) { + return (unsigned)(uintptr_t)k; + } + + static unsigned bad_hash(const K& k) { + return 1; + } + + class EqualityTestIter { + public: + bool do_entry(K const& k, V const& v) { + assert((uintptr_t)k == (uintptr_t)v, ""); + return true; // continue iteration + } + }; + + template< + unsigned (*HASH) (K const&) = primitive_hash<K>, + bool (*EQUALS)(K const&, K const&) = primitive_equals<K>, + unsigned SIZE = 256, + ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA, + MEMFLAGS MEM_TYPE = mtInternal + > + class Runner : public AllStatic { + static void* as_K(uintptr_t val) { return (void*)val; } + + public: + static void test_small() { + EqualityTestIter et; + ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh; + + assert(!rh.contains(as_K(0x1)), ""); + + assert(rh.put(as_K(0x1), 0x1), ""); + assert(rh.contains(as_K(0x1)), ""); + + assert(!rh.put(as_K(0x1), 0x1), ""); + + assert(rh.put(as_K(0x2), 0x2), ""); + assert(rh.put(as_K(0x3), 0x3), ""); + assert(rh.put(as_K(0x4), 0x4), ""); + assert(rh.put(as_K(0x5), 0x5), ""); + + assert(!rh.remove(as_K(0x0)), ""); + rh.iterate(&et); + + assert(rh.remove(as_K(0x1)), ""); + rh.iterate(&et); + + } + + // We use keys with the low bits cleared since the default hash will do some shifting + static void test_small_shifted() { + EqualityTestIter et; + ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh; + + assert(!rh.contains(as_K(0x10)), ""); + + assert(rh.put(as_K(0x10), 0x10), ""); + assert(rh.contains(as_K(0x10)), ""); + + assert(!rh.put(as_K(0x10), 0x10), ""); + + assert(rh.put(as_K(0x20), 0x20), ""); + assert(rh.put(as_K(0x30), 0x30), ""); + assert(rh.put(as_K(0x40), 0x40), ""); + assert(rh.put(as_K(0x50), 0x50), ""); + + assert(!rh.remove(as_K(0x00)), ""); + + assert(rh.remove(as_K(0x10)), ""); + + rh.iterate(&et); + } + + static void test(unsigned num_elements = SIZE) { + EqualityTestIter et; + ResourceHashtable<K, V, HASH, EQUALS, SIZE, ALLOC_TYPE, MEM_TYPE> rh; + + for (uintptr_t i = 0; i < num_elements; ++i) { + assert(rh.put(as_K(i), i), ""); + } + + rh.iterate(&et); + + for (uintptr_t i = num_elements; i > 0; --i) { + uintptr_t index = i - 1; + assert(rh.remove(as_K(index)), ""); + } + rh.iterate(&et); + for (uintptr_t i = num_elements; i > 0; --i) { + uintptr_t index = i - 1; + assert(!rh.remove(as_K(index)), ""); + } + rh.iterate(&et); + } + }; + + public: + static void run_tests() { + { + ResourceMark rm; + Runner<>::test_small(); + Runner<>::test_small_shifted(); + Runner<>::test(); + } + + { + ResourceMark rm; + Runner<identity_hash>::test_small(); + Runner<identity_hash>::test_small_shifted(); + Runner<identity_hash>::test(); + } + + { + ResourceMark rm; + Runner<bad_hash>::test_small(); + Runner<bad_hash>::test_small_shifted(); + Runner<bad_hash>::test(); + } + + + assert(Thread::current()->resource_area()->nesting() == 0, "this code depends on not having an active ResourceMark"); + // The following test calls will cause an assert if resource allocations occur since we don't have an active mark + Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small(); + Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small_shifted(); + Runner<primitive_hash<K>, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test(); + + Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small(); + Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test_small_shifted(); + Runner<bad_hash, primitive_equals<K>, 512, ResourceObj::C_HEAP>::test(); + + Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test_small(); + Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test_small_shifted(); + Runner<identity_hash, primitive_equals<K>, 1, ResourceObj::C_HEAP>::test(512); + } +}; + +void TestResourcehash_test() { + TestResourceHashtable::run_tests(); +} + +#endif // not PRODUCT +
--- a/src/share/vm/utilities/resourceHash.hpp Mon Apr 20 18:11:41 2020 +0100 +++ b/src/share/vm/utilities/resourceHash.hpp Tue Apr 21 23:47:44 2020 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 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 @@ -35,7 +35,7 @@ template<typename K> unsigned primitive_hash(const K& k) { unsigned hash = (unsigned)((uintptr_t)k); - return hash ^ (hash > 3); // just in case we're dealing with aligned ptrs + return hash ^ (hash >> 3); // just in case we're dealing with aligned ptrs } template<typename K> bool primitive_equals(const K& k0, const K& k1) { @@ -50,7 +50,9 @@ //typename ResourceHashtableFns<K>::equals_fn EQUALS = primitive_equals<K>, unsigned (*HASH) (K const&) = primitive_hash<K>, bool (*EQUALS)(K const&, K const&) = primitive_equals<K>, - unsigned SIZE = 256 + unsigned SIZE = 256, + ResourceObj::allocation_type ALLOC_TYPE = ResourceObj::RESOURCE_AREA, + MEMFLAGS MEM_TYPE = mtInternal > class ResourceHashtable : public ResourceObj { private: @@ -91,6 +93,21 @@ public: ResourceHashtable() { memset(_table, 0, SIZE * sizeof(Node*)); } + ~ResourceHashtable() { + if (ALLOC_TYPE == C_HEAP) { + Node* const* bucket = _table; + while (bucket < &_table[SIZE]) { + Node* node = *bucket; + while (node != NULL) { + Node* cur = node; + node = node->_next; + delete cur; + } + ++bucket; + } + } + } + bool contains(K const& key) const { return get(key) != NULL; } @@ -105,17 +122,38 @@ } } - // Inserts or replaces a value in the table - void put(K const& key, V const& value) { + /** + * Inserts or replaces a value in the table. + * @return: true: if a new item is added + * false: if the item already existed and the value is updated + */ + bool put(K const& key, V const& value) { unsigned hv = HASH(key); Node** ptr = lookup_node(hv, key); if (*ptr != NULL) { (*ptr)->_value = value; + return false; } else { - *ptr = new Node(hv, key, value); + *ptr = new (ALLOC_TYPE, MEM_TYPE) Node(hv, key, value); + return true; } } + bool remove(K const& key) { + unsigned hv = HASH(key); + Node** ptr = lookup_node(hv, key); + + Node* node = *ptr; + if (node != NULL) { + *ptr = node->_next; + if (ALLOC_TYPE == C_HEAP) { + delete node; + } + return true; + } + return false; + } + // ITER contains bool do_entry(K const&, V const&), which will be // called for each entry in the table. If do_entry() returns false, // the iteration is cancelled. @@ -132,6 +170,10 @@ ++bucket; } } + + static size_t node_size() { + return sizeof(Node); + } };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/c1/MultiplyByMaxInt.java Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2017, 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 8181872 + * + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions + * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=1 + * -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test + * compiler.c1.MultiplyByMaxInt + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-BackgroundCompilation + * -XX:CompileThreshold=100 -XX:+TieredCompilation -XX:TieredStopAtLevel=3 + * -XX:CompileCommand=dontinline,compiler.c1.MultiplyByMaxInt::test + * compiler.c1.MultiplyByMaxInt + */ +package compiler.c1; + +public class MultiplyByMaxInt { + static int test(int x) { + int loops = (x >>> 4) & 7; + while (loops-- > 0) { + x = (x * 2147483647) % 16807; + } + return x; + } + + public static void main(String[] args) { + for (int i = 0; i < 20000; i++) { + test(i); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/criticalnatives/argumentcorruption/CheckLongArgs.java Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2017, 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. + */ + +public class CheckLongArgs { + static { + System.loadLibrary("CNCheckLongArgs"); + } + static native void m1(long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8, byte[] result); + static native void m2(long a1, int[] a2, long a3, int[] a4, long a5, int[] a6, long a7, int[] a8, long a9, byte[] result); + public static void main(String args[]) throws Exception { + test(); + } + private static void test() throws Exception { + int[] l1 = { 1111, 2222, 3333 }; + int[] l2 = { 4444, 5555, 6666 }; + int[] l3 = { 7777, 8888, 9999 }; + int[] l4 = { 1010, 2020, 3030 }; + byte[] result = { -1 }; + m1(1111111122222222L, 3333333344444444L, 5555555566666666L, 7777777788888888L, 9999999900000000L, 1212121234343434L, + 5656565678787878L, 9090909012121212L, result); + check(result[0]); + result[0] = -1; + m2(1111111122222222L, l1, 3333333344444444L, l2, 5555555566666666L, l3, 7777777788888888L, l4, 9999999900000000L, result); + check(result[0]); + } + private static void check(byte result) throws Exception { + if (result != 2) { + if (result == 1) { + throw new Exception("critical native arguments mismatch"); + } + throw new Exception("critical native lookup failed"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/criticalnatives/argumentcorruption/Test8167409.sh Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,83 @@ +#!/bin/sh + +# +# Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019 Huawei Technologies Co. LTD. 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 Test8167409.sh +## @bug 8167409 +## @summary Invalid value passed to critical JNI function +## @run shell Test8167409.sh + +if [ "${TESTSRC}" = "" ] +then + TESTSRC=${PWD} + echo "TESTSRC not set. Using "${TESTSRC}" as default" +fi +echo "TESTSRC=${TESTSRC}" +## Adding common setup Variables for running shell tests. +. ${TESTSRC}/../../../test_env.sh + +# set platform-dependent variables +OS=`uname -s` +echo "Testing on " $OS +case "$OS" in + Linux) + cc_cmd=`which gcc` + if [ "x$cc_cmd" == "x" ]; then + echo "WARNING: gcc not found. Cannot execute test." 2>&1 + exit 0; + fi + ;; + Solaris) + cc_cmd=`which cc` + if [ "x$cc_cmd" == "x" ]; then + echo "WARNING: cc not found. Cannot execute test." 2>&1 + exit 0; + fi + ;; + *) + echo "Test passed; only valid for Linux and Solaris" + exit 0; + ;; +esac + +THIS_DIR=. + +cp ${TESTSRC}${FS}*.java ${THIS_DIR} +${TESTJAVA}${FS}bin${FS}javac *.java + +$cc_cmd -fPIC -shared -o libCNCheckLongArgs.so \ + -I${TESTJAVA}${FS}include -I${TESTJAVA}${FS}include${FS}linux \ + ${TESTSRC}${FS}libCNCheckLongArgs.c + +LD_LIBRARY_PATH=${THIS_DIR} +echo LD_LIBRARY_PATH = ${LD_LIBRARY_PATH} +export LD_LIBRARY_PATH + +echo +echo ${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} -Xcomp -XX:+CriticalJNINatives CheckLongArgs +${TESTJAVA}${FS}bin${FS}java -cp ${THIS_DIR} -Xcomp -XX:+CriticalJNINatives CheckLongArgs +JAVA_RETVAL=$? + +exit $JAVA_RETVAL
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/criticalnatives/argumentcorruption/libCNCheckLongArgs.c Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,30 @@ +#include "jni.h" +JNIEXPORT void JNICALL JavaCritical_CheckLongArgs_m1 + (jlong a1, jlong a2, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8,jint result_length,jbyte* result) { + + if (a1 != 1111111122222222LL || a2 != 3333333344444444LL || a3 != 5555555566666666LL || a4 != 7777777788888888LL || + a5 != 9999999900000000LL || a6 != 1212121234343434LL || a7 != 5656565678787878LL || a8 != 9090909012121212LL || + result_length != 1 || result[0] != -1) { + result[0] = 1; + } else { + result[0] = 2; + } +} + +JNIEXPORT void JNICALL JavaCritical_CheckLongArgs_m2 + (jlong a1, jint a2_length, jint* a2, jlong a3, jint a4_length, jint* a4, jlong a5, jint a6_length, jint* a6, jlong a7, + jint a8_length, jint* a8, jlong a9, jint result_length, jbyte* result) { + if (a1 != 1111111122222222LL || a2_length != 3 || a2[0] != 1111 || a3 != 3333333344444444LL || a4_length != 3 || a4[0] != 4444 || + a5 != 5555555566666666LL || a6_length != 3 || a6[0] != 7777 || a7 != 7777777788888888LL || a8_length != 3 || a8[0] != 1010 || a9 != 9999999900000000LL || + result_length != 1 || result[0] != -1) { + result[0] = 1; + } else { + result[0] = 2; + } +} + +JNIEXPORT void JNICALL Java_CheckLongArgs_m1 + (JNIEnv * env, jclass jclazz, jlong a3, jlong a4, jlong a5, jlong a6, jlong a7, jlong a8, jlong a9, jlong a10, jbyteArray result) {} + +JNIEXPORT void JNICALL Java_CheckLongArgs_m2 + (JNIEnv * env, jclass jclazz, jlong a3, jintArray a4, jlong a5, jintArray a6, jlong a7, jintArray a8, jlong a9, jintArray a10, jlong a11, jbyteArray result) {}
--- a/test/compiler/intrinsics/bmi/TestAndnI.java Mon Apr 20 18:11:41 2020 +0100 +++ b/test/compiler/intrinsics/bmi/TestAndnI.java Tue Apr 21 23:47:44 2020 +0100 @@ -58,15 +58,27 @@ } public int intExpr(int src1, Expr.MemI src2) { - return ~src1 & src2.value; + if (src2 != null) { + return ~src1 & src2.value; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, int src2) { - return ~src1.value & src2; + if (src1 != null) { + return ~src1.value & src2; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, Expr.MemI src2) { - return ~src1.value & src2.value; + if (src1 != null && src2 != null) { + return ~src1.value & src2.value; + } else { + return 0; + } } } @@ -77,15 +89,27 @@ } public int intExpr(int src1, Expr.MemI src2) { - return src1 & ~src2.value; + if (src2 != null) { + return src1 & ~src2.value; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, int src2) { - return src1.value & ~src2; + if (src1 != null) { + return src1.value & ~src2; + } else { + return 0; + } } public int intExpr(Expr.MemI src1, Expr.MemI src2) { - return src1.value & ~src2.value; + if (src1 != null && src2 != null) { + return src1.value & ~src2.value; + } else { + return 0; + } } } }
--- a/test/compiler/intrinsics/bmi/TestAndnL.java Mon Apr 20 18:11:41 2020 +0100 +++ b/test/compiler/intrinsics/bmi/TestAndnL.java Tue Apr 21 23:47:44 2020 +0100 @@ -58,15 +58,27 @@ } public long longExpr(long src1, Expr.MemL src2) { - return ~src1 & src2.value; + if (src2 != null) { + return ~src1 & src2.value; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, long src2) { - return ~src1.value & src2; + if (src1 != null) { + return ~src1.value & src2; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, Expr.MemL src2) { - return ~src1.value & src2.value; + if (src1 != null && src2 != null) { + return ~src1.value & src2.value; + } else { + return 0; + } } @@ -79,15 +91,27 @@ } public long longExpr(long src1, Expr.MemL src2) { - return src1 & ~src2.value; + if (src2 != null) { + return src1 & ~src2.value; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, long src2) { - return src1.value & ~src2; + if (src1 != null) { + return src1.value & ~src2; + } else { + return 0; + } } public long longExpr(Expr.MemL src1, Expr.MemL src2) { - return src1.value & ~src2.value; + if (src1 != null && src2 != null) { + return src1.value & ~src2.value; + } else { + return 0; + } } }
--- a/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java Mon Apr 20 18:11:41 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2014, 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 8031321 - * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. - * @build AddnTestI - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestI - */ - -import java.lang.reflect.Method; - -public class AddnTestI extends BmiIntrinsicBase.BmiTestCase { - - protected AddnTestI(Method method) { - super(method); - // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2 - instrMask = new byte[]{ - (byte) 0xFF, - (byte) 0x1F, - (byte) 0x00, - (byte) 0xFF}; - instrPattern = new byte[]{ - (byte) 0xC4, // prefix for 3-byte VEX instruction - (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes - (byte) 0x00, - (byte) 0xF2}; - } - - public static void main(String[] args) throws Exception { - BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); - BmiIntrinsicBase.verifyTestCase(AddnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); - } -}
--- a/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java Mon Apr 20 18:11:41 2020 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2014, 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 8031321 - * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. - * @build AddnTestL - * @run main ClassFileInstaller sun.hotspot.WhiteBox - * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI - * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AddnTestL - */ - -import java.lang.reflect.Method; - -public class AddnTestL extends AddnTestI { - - protected AddnTestL(Method method) { - super(method); - isLongOperation = true; - } - - public static void main(String[] args) throws Exception { - BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); - BmiIntrinsicBase.verifyTestCase(AddnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestI.java Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8031321 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. + * @build AndnTestI + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestI + */ + +import java.lang.reflect.Method; + +public class AndnTestI extends BmiIntrinsicBase.BmiTestCase { + + protected AndnTestI(Method method) { + super(method); + // from intel manual VEX.NDS.LZ.0F38.W0 F2 /r, example c4e260f2c2 + instrMask = new byte[]{ + (byte) 0xFF, + (byte) 0x1F, + (byte) 0x00, + (byte) 0xFF}; + instrPattern = new byte[]{ + (byte) 0xC4, // prefix for 3-byte VEX instruction + (byte) 0x02, // 00010 implied 0F 38 leading opcode bytes + (byte) 0x00, + (byte) 0xF2}; + } + + public static void main(String[] args) throws Exception { + BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnIExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestI::new, TestAndnI.AndnICommutativeExpr.class.getDeclaredMethods()); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/intrinsics/bmi/verifycode/AndnTestL.java Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8031321 + * @library /testlibrary /testlibrary/whitebox /compiler/whitebox .. + * @build AndnTestL + * @run main ClassFileInstaller sun.hotspot.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -Xbatch -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * -XX:+IgnoreUnrecognizedVMOptions -XX:+UseBMI1Instructions AndnTestL + */ + +import java.lang.reflect.Method; + +public class AndnTestL extends AndnTestI { + + protected AndnTestL(Method method) { + super(method); + isLongOperation = true; + } + + public static void main(String[] args) throws Exception { + BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLExpr.class.getDeclaredMethods()); + BmiIntrinsicBase.verifyTestCase(AndnTestL::new, TestAndnL.AndnLCommutativeExpr.class.getDeclaredMethods()); + } +}
--- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Mon Apr 20 18:11:41 2020 +0100 +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java Tue Apr 21 23:47:44 2020 +0100 @@ -44,6 +44,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); + // Avoid uncommon traps. + System.out.println("Num leading zeroes: " + new TestLzcntI.LzcntIExpr().intExpr(12341341)); BmiIntrinsicBase.verifyTestCase(LZcntTestI::new, TestLzcntI.LzcntIExpr.class.getDeclaredMethods()); }
--- a/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Mon Apr 20 18:11:41 2020 +0100 +++ b/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java Tue Apr 21 23:47:44 2020 +0100 @@ -49,6 +49,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); + // Avoid uncommon traps. + System.out.println("Num leading zeroes: " + new TestLzcntL.LzcntLExpr().longExpr(12341341)); BmiIntrinsicBase.verifyTestCase(LZcntTestL::new, TestLzcntL.LzcntLExpr.class.getDeclaredMethods()); } }
--- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Mon Apr 20 18:11:41 2020 +0100 +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java Tue Apr 21 23:47:44 2020 +0100 @@ -44,6 +44,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("class java.lang.Integer should be loaded. Proof: " + Integer.class); + // Avoid uncommon traps. + System.out.println("Num trailing zeroes: " + new TestTzcntI.TzcntIExpr().intExpr(12341341)); BmiIntrinsicBase.verifyTestCase(TZcntTestI::new, TestTzcntI.TzcntIExpr.class.getDeclaredMethods()); }
--- a/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Mon Apr 20 18:11:41 2020 +0100 +++ b/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java Tue Apr 21 23:47:44 2020 +0100 @@ -50,6 +50,8 @@ public static void main(String[] args) throws Exception { // j.l.Integer and Long should be loaded to allow a compilation of the methods that use their methods System.out.println("classes java.lang.Long should be loaded. Proof: " + Long.class); + // Avoid uncommon traps. + System.out.println("Num trailing zeroes: " + new TestTzcntL.TzcntLExpr().longExpr(12341341)); BmiIntrinsicBase.verifyTestCase(TZcntTestL::new, TestTzcntL.TzcntLExpr.class.getDeclaredMethods()); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/compiler/loopopts/BadPredicateAfterPartialPeel.java Tue Apr 21 23:47:44 2020 +0100 @@ -0,0 +1,312 @@ +/* + * 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 8146792 + * @summary Predicate moved after partial peel may lead to broken graph + * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileOnly=BadPredicateAfterPartialPeel::m -XX:CompileCommand=dontinline,BadPredicateAfterPartialPeel::not_inlined* -XX:CompileCommand=quiet BadPredicateAfterPartialPeel + * + */ + +public class BadPredicateAfterPartialPeel { + + static void not_inlined1() {} + static void not_inlined4() {} + + static int m_helper(int i, int i3, int i4) { + return i3 == 4 ? i4 : i; + } + + static float[] array = new float[1000]; + static int[] array2 = new int[1000]; + + boolean flag; + int j; + + static void m(BadPredicateAfterPartialPeel o1, BadPredicateAfterPartialPeel o2, BadPredicateAfterPartialPeel o, int i4) { + int i1 = 1; + + // To delay partial peeling to the loop opts pass right before CCP + int i2 = 0; + for (; i2 < 10; i2 += i1); + i2 = i2 / 10; + + // Simplified during CCP: + int i3 = 2; + for (; i3 < 4; i3 *= 2); + + // Loop is partial peeled right before CCP + int i = 0; + boolean b = true; + + not_inlined1(); + + array[0] = -1; + do { + // peeled section starts here + o.flag = false; + o.j = 0; + + if (b) { + // The following store will be pinned between + // predicates and the loop after partial peeling. All + // control flow will be optimized out and so nothing + // will prevent predicates from being moved out the + // loop. + array[i] = 0; + } + if (array[0] != 0) { + } + if (i >= 10) { + // peeled section ends here + return; + } + i += i2; + b = false; + int i5 = m_helper(i, i3, i4); // This will be simpliflied during CCP + if (array[i5] != 0) { // and this will become a predicate + } + if (o2.flag) { + } + // A bunch of stuff to grow loop body size and prevent peeling: + array2[0] = 0; + array2[1] = 0; + array2[2] = 0; + array2[3] = 0; + array2[4] = 0; + array2[5] = 0; + array2[6] = 0; + array2[7] = 0; + array2[8] = 0; + array2[9] = 0; + array2[10] = 0; + array2[11] = 0; + array2[12] = 0; + array2[13] = 0; + array2[14] = 0; + array2[15] = 0; + array2[16] = 0; + array2[17] = 0; + array2[18] = 0; + array2[19] = 0; + array2[20] = 0; + array2[21] = 0; + array2[22] = 0; + array2[23] = 0; + array2[24] = 0; + array2[25] = 0; + array2[26] = 0; + array2[27] = 0; + array2[28] = 0; + array2[29] = 0; + array2[30] = 0; + array2[31] = 0; + array2[32] = 0; + array2[33] = 0; + array2[34] = 0; + array2[35] = 0; + array2[36] = 0; + array2[37] = 0; + array2[38] = 0; + array2[39] = 0; + array2[40] = 0; + array2[41] = 0; + array2[42] = 0; + array2[43] = 0; + array2[44] = 0; + array2[45] = 0; + array2[46] = 0; + array2[47] = 0; + array2[48] = 0; + array2[49] = 0; + array2[50] = 0; + array2[51] = 0; + array2[52] = 0; + array2[53] = 0; + array2[54] = 0; + array2[55] = 0; + array2[56] = 0; + array2[57] = 0; + array2[58] = 0; + array2[59] = 0; + array2[60] = 0; + array2[61] = 0; + array2[62] = 0; + array2[63] = 0; + array2[64] = 0; + array2[65] = 0; + array2[66] = 0; + array2[67] = 0; + array2[68] = 0; + array2[69] = 0; + array2[70] = 0; + array2[71] = 0; + array2[72] = 0; + array2[73] = 0; + array2[74] = 0; + array2[75] = 0; + array2[76] = 0; + array2[77] = 0; + array2[78] = 0; + array2[79] = 0; + array2[80] = 0; + array2[81] = 0; + array2[82] = 0; + array2[83] = 0; + array2[84] = 0; + array2[85] = 0; + array2[86] = 0; + array2[87] = 0; + array2[88] = 0; + array2[89] = 0; + array2[90] = 0; + array2[91] = 0; + array2[92] = 0; + array2[93] = 0; + array2[94] = 0; + array2[95] = 0; + array2[96] = 0; + array2[97] = 0; + array2[98] = 0; + array2[99] = 0; + + array2[100] = 0; + array2[101] = 0; + array2[102] = 0; + array2[103] = 0; + array2[104] = 0; + array2[105] = 0; + array2[106] = 0; + array2[107] = 0; + array2[108] = 0; + array2[109] = 0; + array2[110] = 0; + array2[111] = 0; + array2[112] = 0; + array2[113] = 0; + array2[114] = 0; + array2[115] = 0; + array2[116] = 0; + array2[117] = 0; + array2[118] = 0; + array2[119] = 0; + array2[120] = 0; + array2[121] = 0; + array2[122] = 0; + array2[123] = 0; + array2[124] = 0; + array2[125] = 0; + array2[126] = 0; + array2[127] = 0; + array2[128] = 0; + array2[129] = 0; + array2[130] = 0; + array2[131] = 0; + array2[132] = 0; + array2[133] = 0; + array2[134] = 0; + array2[135] = 0; + array2[136] = 0; + array2[137] = 0; + array2[138] = 0; + array2[139] = 0; + array2[140] = 0; + array2[141] = 0; + array2[142] = 0; + array2[143] = 0; + array2[144] = 0; + array2[145] = 0; + array2[146] = 0; + array2[147] = 0; + array2[148] = 0; + array2[149] = 0; + array2[150] = 0; + array2[151] = 0; + array2[152] = 0; + array2[153] = 0; + array2[154] = 0; + array2[155] = 0; + array2[156] = 0; + array2[157] = 0; + array2[158] = 0; + array2[159] = 0; + array2[160] = 0; + array2[161] = 0; + array2[162] = 0; + array2[163] = 0; + array2[164] = 0; + array2[165] = 0; + array2[166] = 0; + array2[167] = 0; + array2[168] = 0; + array2[169] = 0; + array2[170] = 0; + array2[171] = 0; + array2[172] = 0; + array2[173] = 0; + array2[174] = 0; + array2[175] = 0; + array2[176] = 0; + array2[177] = 0; + array2[178] = 0; + array2[179] = 0; + array2[180] = 0; + array2[181] = 0; + array2[182] = 0; + array2[183] = 0; + array2[184] = 0; + array2[185] = 0; + array2[186] = 0; + array2[187] = 0; + array2[188] = 0; + array2[189] = 0; + array2[190] = 0; + array2[191] = 0; + array2[192] = 0; + array2[193] = 0; + array2[194] = 0; + array2[195] = 0; + array2[196] = 0; + array2[197] = 0; + array2[198] = 0; + array2[199] = 0; + if (o1.j >= 20) { + break; + } + o1.j++; + } while(true); + not_inlined4(); + } + + static public void main(String[] args) { + BadPredicateAfterPartialPeel o1 = new BadPredicateAfterPartialPeel(); + BadPredicateAfterPartialPeel o2 = new BadPredicateAfterPartialPeel(); + for (int i = 0; i < 20000; i++) { + o1.j = 0; + m(o1, o2, o2, 0); + m_helper(i, 2, i); // pollute profile + } + } +}