Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/corba.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/corba.tar.xz differ diff -Nru openjdk-8-8u292-b10/debian/changelog openjdk-8-8u312-b07/debian/changelog --- openjdk-8-8u292-b10/debian/changelog 2021-04-21 11:46:09.000000000 +0000 +++ openjdk-8-8u312-b07/debian/changelog 2021-11-03 13:54:59.000000000 +0000 @@ -1,8 +1,69 @@ -openjdk-8 (8u292-b10-0ubuntu1~20.04) focal-security; urgency=medium +openjdk-8 (8u312-b07-0ubuntu1~20.04) focal-security; urgency=medium - * Backport the security update to 20.04 LTS. + * Security update for Ubuntu 20.04. - -- Matthias Klose Wed, 21 Apr 2021 13:46:09 +0200 + -- Matthias Klose Wed, 03 Nov 2021 15:54:59 +0200 + +openjdk-8 (8u312-b07-0ubuntu1) jammy; urgency=medium + + * Update to 8u312-b07 (GA). + * Security fixes + - JDK-8130183, CVE-2021-35588: InnerClasses: VM permits wrong Throw + ClassFormatError if InnerClasses attribute's inner_class_info_index is 0. + - JDK-8161016: Strange behavior of URLConnection with proxy. + - JDK-8163326, CVE-2021-35550: Update the default enabled cipher suites + preference. + - JDK-8254967, CVE-2021-35565: com.sun.net.HttpsServer spins on TLS + session close. + - JDK-8263314: Enhance XML Dsig modes. + - JDK-8265167, CVE-2021-35556: Richer Text Editors. + - JDK-8265574: Improve handling of sheets. + - JDK-8265580, CVE-2021-35559: Enhanced style for RTF kit. + - JDK-8265776: Improve Stream handling for SSL. + - JDK-8266097, CVE-2021-35561: Better hashing support. + - JDK-8266103: Better specified spec values. + - JDK-8266109: More Resilient Classloading. + - JDK-8266115: More Manifest Jar Loading. + - JDK-8266137, CVE-2021-35564: Improve Keystore integrity. + - JDK-8266689, CVE-2021-35567: More Constrained Delegation. + - JDK-8267086: ArrayIndexOutOfBoundsException in + java.security.KeyFactory.generatePublic. + - JDK-8267712: Better LDAP reference processing. + - JDK-8267729, CVE-2021-35578: Improve TLS client handshaking. + - JDK-8267735, CVE-2021-35586: Better BMP support. + - JDK-8268193: Improve requests of certificates. + - JDK-8268199: Correct certificate requests. + - JDK-8268506: More Manifest Digests. + - JDK-8269618, CVE-2021-35603: Better session identification. + - JDK-8269624: Enhance method selection support. + - JDK-8270398: Enhance canonicalization. + - JDK-8270404: Better canonicalization. + * Use mktemp instead of tempfile in maintainer script. + + -- Matthias Klose Wed, 03 Nov 2021 14:27:30 +0200 + +openjdk-8 (8u302-b08-0ubuntu2) impish; urgency=medium + + * Update to 8u302-b08 (GA). + * Security fixes + - JDK-8256157: Improve bytecode assembly + - JDK-8256491: Better HTTP transport + - JDK-8258432, CVE-2021-2341: Improve file transfers + - JDK-8260453: Improve Font Bounding + - JDK-8260960: Signs of jarsigner signing + - JDK-8260967, CVE-2021-2369: Better jar file validation + - JDK-8262380: Enhance XML processing passes + - JDK-8262403: Enhanced data transfer + - JDK-8262410: Enhanced rules for zones + - JDK-8262477: Enhance String Conclusions + - JDK-8262967: Improve Zip file support + - JDK-8264066, CVE-2021-2388: Enhance compiler validation + - JDK-8264079: Improve abstractions + - JDK-8264460: Improve NTLM support + * Other changes: + See https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-July/014118.html + + -- Matthias Klose Mon, 23 Aug 2021 16:45:43 +0200 openjdk-8 (8u292-b10-0ubuntu1) hirsute; urgency=medium diff -Nru openjdk-8-8u292-b10/debian/JB-jre-headless.postinst.in openjdk-8-8u312-b07/debian/JB-jre-headless.postinst.in --- openjdk-8-8u292-b10/debian/JB-jre-headless.postinst.in 2015-03-17 00:13:29.000000000 +0000 +++ openjdk-8-8u312-b07/debian/JB-jre-headless.postinst.in 2021-11-03 13:41:38.000000000 +0000 @@ -109,7 +109,7 @@ # activate class data sharing case @archdir@ in i386|sparc) rm -f $basedir/jre/lib/@archdir@/client/classes.jsa - log=$(tempfile) + log=$(mktemp) if ! $basedir/bin/java -client -Xshare:dump -XX:PermSize=128m > $log; then cat >&2 $log rm -f $log @@ -121,7 +121,7 @@ esac case @archdir@ in amd64|i386|sparc) rm -f $basedir/jre/lib/@archdir@/server/classes.jsa - log=$(tempfile) + log=$(mktemp) if ! $basedir/bin/java -server -Xshare:dump > $log; then cat >&2 $log rm -f $log diff -Nru openjdk-8-8u292-b10/debian/patches/aarch32-update.diff openjdk-8-8u312-b07/debian/patches/aarch32-update.diff --- openjdk-8-8u292-b10/debian/patches/aarch32-update.diff 2021-04-21 10:11:44.000000000 +0000 +++ openjdk-8-8u312-b07/debian/patches/aarch32-update.diff 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ ---- a/hotspot/src/share/vm/code/dependencies.cpp 2021-03-29 19:21:07.000000000 +0000 -+++ b/hotspot/src/share/vm/code/dependencies.cpp 2021-04-08 05:00:17.000000000 +0000 -@@ -29,6 +29,7 @@ - #include "ci/ciMethod.hpp" - #include "code/dependencies.hpp" - #include "compiler/compileLog.hpp" -+#include "oops/klass.hpp" - #include "oops/oop.inline.hpp" - #include "runtime/handles.hpp" - #include "runtime/handles.inline.hpp" -@@ -896,8 +897,9 @@ - } else if (!k->oop_is_instance()) { - return false; // no methods to find in an array type - } else { -- // Search class hierarchy first. -- Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature); -+ // Search class hierarchy first, skipping private implementations -+ // as they never override any inherited methods -+ Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature, Klass::skip_private); - if (!Dependencies::is_concrete_method(m, k)) { - // Check for re-abstraction of method - if (!k->is_interface() && m != NULL && m->is_abstract()) { -@@ -907,7 +909,7 @@ - ClassHierarchyWalker wf(_participants, _num_participants); - Klass* w = wf.find_witness_subtype(k); - if (w != NULL) { -- Method* wm = InstanceKlass::cast(w)->find_instance_method(_name, _signature); -+ Method* wm = InstanceKlass::cast(w)->find_instance_method(_name, _signature, Klass::skip_private); - if (!Dependencies::is_concrete_method(wm, w)) { - // Found a concrete subtype 'w' which does not override abstract method 'm'. - // Bail out because 'm' could be called with 'w' as receiver (leading to an -@@ -968,6 +970,7 @@ - Klass* find_witness_in(KlassDepChange& changes, - Klass* context_type, - bool participants_hide_witnesses); -+ bool witnessed_reabstraction_in_supers(Klass* k); - public: - Klass* find_witness_subtype(Klass* context_type, KlassDepChange* changes = NULL) { - assert(doing_subtype_search(), "must set up a subtype search"); -@@ -1042,7 +1045,6 @@ - #define count_find_witness_calls() (0) - #endif //PRODUCT - -- - Klass* ClassHierarchyWalker::find_witness_in(KlassDepChange& changes, - Klass* context_type, - bool participants_hide_witnesses) { -@@ -1080,15 +1082,20 @@ - } - } - -- if (is_witness(new_type) && -- !ignore_witness(new_type)) { -- return new_type; -+ if (is_witness(new_type)) { -+ if (!ignore_witness(new_type)) { -+ return new_type; -+ } -+ } else if (!doing_subtype_search()) { -+ // No witness found, but is_witness() doesn't detect method re-abstraction in case of spot-checking. -+ if (witnessed_reabstraction_in_supers(new_type)) { -+ return new_type; -+ } - } - - return NULL; - } - -- - // Walk hierarchy under a context type, looking for unexpected types. - // Do not report participant types, and recursively walk beneath - // them only if participants_hide_witnesses is false. -@@ -1207,6 +1214,32 @@ - #undef ADD_SUBCLASS_CHAIN - } - -+bool ClassHierarchyWalker::witnessed_reabstraction_in_supers(Klass* k) { -+ if (!k->oop_is_instance()) { -+ return false; // no methods to find in an array type -+ } else { -+ // Looking for a case when an abstract method is inherited into a concrete class. -+ if (Dependencies::is_concrete_klass(k) && !k->is_interface()) { -+ Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature, Klass::skip_private); -+ if (m != NULL) { -+ return false; // no reabstraction possible: local method found -+ } -+ for (InstanceKlass* super = InstanceKlass::cast(k)->java_super(); super != NULL; super = super->java_super()) { -+ m = super->find_instance_method(_name, _signature, Klass::skip_private); -+ if (m != NULL) { // inherited method found -+ if (m->is_abstract() || m->is_overpass()) { -+ _found_methods[_num_participants] = m; -+ return true; // abstract method found -+ } -+ return false; -+ } -+ } -+ assert(false, "root method not found"); -+ return true; -+ } -+ return false; -+ } -+} - - bool Dependencies::is_concrete_klass(Klass* k) { - if (k->is_abstract()) return false; ---- a/hotspot/src/share/vm/oops/instanceKlass.cpp 2021-03-29 19:21:07.000000000 +0000 -+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp 2021-04-08 05:00:17.000000000 +0000 -@@ -1495,18 +1495,22 @@ - - // find_instance_method looks up the name/signature in the local methods array - // and skips over static methods --Method* InstanceKlass::find_instance_method( -- Array* methods, Symbol* name, Symbol* signature) { -+Method* InstanceKlass::find_instance_method(Array* methods, -+ Symbol* name, -+ Symbol* signature, -+ PrivateLookupMode private_mode) { - Method* meth = InstanceKlass::find_method_impl(methods, name, signature, -- find_overpass, skip_static, find_private); -+ find_overpass, skip_static, private_mode); - assert(((meth == NULL) || !meth->is_static()), "find_instance_method should have skipped statics"); - return meth; - } - - // find_instance_method looks up the name/signature in the local methods array - // and skips over static methods --Method* InstanceKlass::find_instance_method(Symbol* name, Symbol* signature) { -- return InstanceKlass::find_instance_method(methods(), name, signature); -+Method* InstanceKlass::find_instance_method(Symbol* name, -+ Symbol* signature, -+ PrivateLookupMode private_mode) { -+ return InstanceKlass::find_instance_method(methods(), name, signature, private_mode); - } - - // Find looks up the name/signature in the local methods array ---- a/hotspot/src/share/vm/oops/instanceKlass.hpp 2021-03-29 19:21:07.000000000 +0000 -+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp 2021-04-08 05:00:17.000000000 +0000 -@@ -526,8 +526,11 @@ - static Method* find_method(Array* methods, Symbol* name, Symbol* signature); - - // find a local method, but skip static methods -- Method* find_instance_method(Symbol* name, Symbol* signature); -- static Method* find_instance_method(Array* methods, Symbol* name, Symbol* signature); -+ Method* find_instance_method(Symbol* name, Symbol* signature, -+ PrivateLookupMode private_mode); -+ static Method* find_instance_method(Array* methods, -+ Symbol* name, Symbol* signature, -+ PrivateLookupMode private_mode); - - // find a local method (returns NULL if not found) - Method* find_local_method(Symbol* name, Symbol* signature, diff -Nru openjdk-8-8u292-b10/debian/patches/compare-pointer-with-literal.patch openjdk-8-8u312-b07/debian/patches/compare-pointer-with-literal.patch --- openjdk-8-8u292-b10/debian/patches/compare-pointer-with-literal.patch 2017-01-23 10:09:22.000000000 +0000 +++ openjdk-8-8u312-b07/debian/patches/compare-pointer-with-literal.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ ---- a/jdk/src/solaris/native/sun/awt/awt_Font.c -+++ b/jdk/src/solaris/native/sun/awt/awt_Font.c -@@ -502,7 +502,7 @@ awtJNI_GetFontData(JNIEnv * env, jobject - jio_snprintf(fdata->flist[i].xlfd, strlen(nativename) + 10, - nativename, size * 10); - -- if (nativename != NULL && nativename != "") -+ if (nativename && !strcmp(nativename, "")) - JNU_ReleaseStringPlatformChars(env, fontDescriptorName, (const char *) nativename); - - /* diff -Nru openjdk-8-8u292-b10/debian/rules openjdk-8-8u312-b07/debian/rules --- openjdk-8-8u292-b10/debian/rules 2021-04-21 11:46:09.000000000 +0000 +++ openjdk-8-8u312-b07/debian/rules 2021-11-03 13:54:59.000000000 +0000 @@ -132,6 +132,9 @@ ifneq (,$(filter $(DEB_HOST_ARCH), armel)) with_check = disabled running check on $(DEB_HOST_ARCH) endif +ifneq (,$(filter $(distrel),precise)) + with_check = disabled running check on $(distrel) +endif #with_check = disabled for this build with_docs = $(if $(findstring nodoc, $(DEB_BUILD_OPTIONS)),,yes) @@ -260,7 +263,7 @@ else ifneq (,$(filter $(distrel),utopic vivid jessie)) export CC = gcc-4.9 export CXX = g++-4.9 -else ifneq (,$(filter $(distrel),wily)) +else ifneq (,$(filter $(distrel),xenial wily)) export CC = $(DEB_HOST_GNU_TYPE)-gcc-5 export CXX = $(DEB_HOST_GNU_TYPE)-g++-5 else ifneq (,$(filter $(distrel),zesty stretch)) @@ -273,9 +276,12 @@ else ifneq (,$(filter $(distrel),buster precise)) export CC = $(DEB_HOST_GNU_TYPE)-gcc-8 export CXX = $(DEB_HOST_GNU_TYPE)-g++-8 -else +else ifneq (,$(filter $(distrel),trusty xenial bionic focal hirsute)) export CC = $(DEB_HOST_GNU_TYPE)-gcc-9 export CXX = $(DEB_HOST_GNU_TYPE)-g++-9 +else + export CC = $(DEB_HOST_GNU_TYPE)-gcc-11 + export CXX = $(DEB_HOST_GNU_TYPE)-g++-11 endif ifneq (,$(filter $(DEB_HOST_ARCH), armel armhf)) @@ -353,7 +359,6 @@ workaround_expand_exec_shield_cs_limit.diff \ zero-architectures.diff \ adlc-parser.patch \ - compare-pointer-with-literal.patch \ multiple-pkcs11-library-init.patch \ applet-hole.patch \ libjpeg-fix.diff \ @@ -421,8 +426,7 @@ # set LIBARCH/aarch32 to arm ifneq (,$(filter $(DEB_HOST_ARCH), $(hotspot_aarch32_archs))) COMMON_PATCHES += \ - aarch32.diff \ - aarch32-update.diff + aarch32.diff endif ifneq (,$(filter $(DEB_HOST_ARCH), kfreebsd-amd64 kfreebsd-i386)) @@ -674,7 +678,7 @@ bd_gcc = g++-4.8, else ifneq (,$(filter $(distrel),utopic vivid jessie)) bd_gcc = g++-4.9, -else ifneq (,$(filter $(distrel),wily xenial)) +else ifneq (,$(filter $(distrel),xenial wily)) bd_gcc = g++-5, else ifneq (,$(filter $(distrel),stretch zesty)) bd_gcc = g++-6, @@ -683,8 +687,10 @@ #else ifneq (,$(filter $(distrel),buster precise trusty)) else ifneq (,$(filter $(distrel),buster precise)) bd_gcc = g++-8, -else +else ifneq (,$(filter $(distrel),trusty xenial bionic focal hirsute)) bd_gcc = g++-9, +else + bd_gcc = g++-11, endif bd_syslibs = zlib1g-dev, libattr1-dev, ifneq (,$(filter $(distrel),squeeze lucid)) @@ -2001,17 +2007,17 @@ is_release = is_release = yes hg_project = jdk8u -hg_tag = jdk8u292-b10 +hg_tag = jdk8u312-b07 package_version = $(subst jdk,,$(hg_tag)) ifneq ($(is_release),yes) package_version := $(subst -,~,$(package_version)) endif hg_url = http://hg.openjdk.java.net/jdk8u/$(hg_project) hg_project_aarch64 = jdk8u-shenandoah -hg_tag_aarch64 = aarch64-shenandoah-jdk8u292-b10 +hg_tag_aarch64 = aarch64-shenandoah-jdk8u312-b07 hg_url_aarch64 = http://hg.openjdk.java.net/aarch64-port/$(hg_project_aarch64) hg_project_aarch32 = jdk8u -hg_tag_aarch32 = jdk8u292-b09-aarch32-20210330 +hg_tag_aarch32 = jdk8u312-b07-aarch32-20211101 hg_url_aarch32 = http://hg.openjdk.java.net/aarch32-port/$(hg_project_aarch32) origdir = ../openjdk-8-$(package_version).orig orig_tarball = ../openjdk-8_$(package_version).orig.tar.xz Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/hotspot-aarch32.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/hotspot-aarch32.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/hotspot-aarch64.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/hotspot-aarch64.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/hotspot.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/hotspot.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/jaxp.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/jaxp.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/jaxws.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/jaxws.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/jdk.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/jdk.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/langtools.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/langtools.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/nashorn.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/nashorn.tar.xz differ Binary files /tmp/tmpy92uvcru/qWmGDoYGws/openjdk-8-8u292-b10/root.tar.xz and /tmp/tmpy92uvcru/LB4UZRjZHL/openjdk-8-8u312-b07/root.tar.xz differ diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/.hg_archival.txt openjdk-8-8u312-b07/=unpacked-tar1=/.hg_archival.txt --- openjdk-8-8u292-b10/=unpacked-tar1=/.hg_archival.txt 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/.hg_archival.txt 2021-09-13 23:27:15.000000000 +0000 @@ -1,5 +1,5 @@ repo: 9a66ca7c79fab293c1bb0534e0d208c7e4f58b01 -node: e096ebc661e8c12321891587c0351a66f165143c +node: 67e50991d2ffea9ae2436651530a6645187f7928 branch: default -tag: jdk8u292-b10 -tag: jdk8u292-ga +tag: jdk8u312-b07 +tag: jdk8u312-ga diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/.hgtags openjdk-8-8u312-b07/=unpacked-tar1=/.hgtags --- openjdk-8-8u292-b10/=unpacked-tar1=/.hgtags 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/.hgtags 2021-09-13 23:27:15.000000000 +0000 @@ -1087,3 +1087,22 @@ 376b8ec147cf881c1139331f64c258bfc1550119 jdk8u292-b07 65614a3f68a2ef8a853f2c0505b8bbbf3a1414c3 jdk8u292-b08 eabecd4e5adc603f93dc891b6245f8164d97517d jdk8u292-b09 +e096ebc661e8c12321891587c0351a66f165143c jdk8u292-b10 +e096ebc661e8c12321891587c0351a66f165143c jdk8u292-ga +cd6eb36db1bbeb5b638a577059ecf0a4c4a90b82 jdk8u302-b00 +55148c63b3e8b5a23d4eef33a7bab2c57396a32e jdk8u302-b01 +c94d325a24672375c4767ae08bece4e7d6ea210d jdk8u302-b02 +a6ea99c01d68cb35822f03104b2f7acab656312c jdk8u302-b03 +a6ea4245dc1484ce52656fb981ad453cd4bb8488 jdk8u302-b04 +ef5cb85b148ef2fb4711df4ac075bcf8e4836e5e jdk8u302-b05 +ef5cb85b148ef2fb4711df4ac075bcf8e4836e5e jdk8u312-b00 +b13b58afad1effc6726104dacdc24748e591d9d0 jdk8u302-b06 +dccbf90608ebab1f656e53846774e436a9cd5d00 jdk8u302-b07 +361a561709af891da4bf5e9ad2f469afd602c3df jdk8u302-b08 +361a561709af891da4bf5e9ad2f469afd602c3df jdk8u302-ga +c2908eb7d16d7899ac98cefead3993948f2d932a jdk8u312-b01 +ac02c03356e077adbf3fce8116d442eeade3dbda jdk8u312-b02 +de6e8a37b71b8e10d682e187e433c8064a9dda44 jdk8u312-b03 +7580f5f7f89007a1990b49333f369bcb12ba1caf jdk8u312-b04 +8ec4f4e9ef0fd48ee08562681eb6b8e99fa2b9fe jdk8u312-b05 +9472308f16d41cd401044a8cd2666114c28a5208 jdk8u312-b06 diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/src/share/classes/com/sun/tools/javac/comp/Check.java openjdk-8-8u312-b07/=unpacked-tar1=/src/share/classes/com/sun/tools/javac/comp/Check.java --- openjdk-8-8u292-b10/=unpacked-tar1=/src/share/classes/com/sun/tools/javac/comp/Check.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/src/share/classes/com/sun/tools/javac/comp/Check.java 2021-09-13 23:27:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 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 @@ -2617,6 +2617,8 @@ if (type.isErroneous()) return; for (List l = types.interfaces(type); l.nonEmpty(); l = l.tail) { Type it = l.head; + if (type.hasTag(CLASS) && !it.hasTag(CLASS)) continue; // JLS 8.1.5 + Type oldit = seensofar.put(it.tsym, it); if (oldit != null) { List oldparams = oldit.allparams(); @@ -2629,6 +2631,7 @@ checkClassBounds(pos, seensofar, it); } Type st = types.supertype(type); + if (type.hasTag(CLASS) && !st.hasTag(CLASS)) return; // JLS 8.1.4 if (st != Type.noType) checkClassBounds(pos, seensofar, st); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/test/Makefile openjdk-8-8u312-b07/=unpacked-tar1=/test/Makefile --- openjdk-8-8u292-b10/=unpacked-tar1=/test/Makefile 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/test/Makefile 2021-09-13 23:27:15.000000000 +0000 @@ -139,21 +139,19 @@ # Default JDK for JTREG and JCK # -# JT_JAVA is the version of java used to run jtreg/JCK. Since it is now -# standard to execute tests in sameVM mode, it should normally be set the -# same as TESTJAVA (although not necessarily so.) +# JT_JAVA is the version of java used to run jtreg/JCK. # ifdef JPRT_JAVA_HOME JT_JAVA = $(JPRT_JAVA_HOME) else - JT_JAVA = $(SLASH_JAVA)/re/jdk/1.7.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH) + JT_JAVA = $(SLASH_JAVA)/re/jdk/1.9.0/archive/fcs/binaries/$(PLATFORM)-$(ARCH) endif # Default JDK to test ifdef JPRT_IMPORT_PRODUCT_HOME TESTJAVA = $(JPRT_IMPORT_PRODUCT_HOME) else - TESTJAVA = $(SLASH_JAVA)/re/jdk/1.7.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) + TESTJAVA = $(SLASH_JAVA)/re/jdk/1.9.0/promoted/latest/binaries/$(PLATFORM)-$(ARCH) endif # PRODUCT_HOME is a JPRT variable pointing to a directory containing the output from @@ -186,7 +184,7 @@ ifdef CONCURRENCY JTREG_OPTIONS += -agentvm -concurrency:$(CONCURRENCY) else - JTREG_OPTIONS += -samevm + JTREG_OPTIONS += -agentvm endif ifdef JCK_CONCURRENCY diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/diags/examples/NoJavaLang.java openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/diags/examples/NoJavaLang.java --- openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/diags/examples/NoJavaLang.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/diags/examples/NoJavaLang.java 2021-09-13 23:27:15.000000000 +0000 @@ -22,7 +22,7 @@ */ // key: compiler.misc.fatal.err.no.java.lang -// options: -Xbootclasspath: +// options: -Xbootclasspath: -classpath . // run: backdoor class NoJavaLang { } diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/fatalErrors/NoJavaLangTest.java openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/fatalErrors/NoJavaLangTest.java --- openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/fatalErrors/NoJavaLangTest.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/fatalErrors/NoJavaLangTest.java 2021-09-13 23:27:15.000000000 +0000 @@ -58,7 +58,7 @@ List output = new ArrayList<>(); ToolBox.JavaToolArgs javacFailArgs = new ToolBox.JavaToolArgs(ToolBox.Expect.FAIL) - .setOptions("-bootclasspath", ".") + .setOptions("-bootclasspath", ".", "-classpath", ".") .setSources(noJavaLangSrc) .setErrOutput(output); diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.java openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.java --- openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.java 2021-09-13 23:27:15.000000000 +0000 @@ -0,0 +1,12 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8214345 + * @summary infinite recursion while checking super class + * + * @compile/fail/ref=ClassBoundCheckingOverflow.out -XDrawDiagnostics ClassBoundCheckingOverflow.java + */ + +public class ClassBoundCheckingOverflow { + abstract class InfiniteLoop1> extends E {} + abstract class InfiniteLoop2> implements E {} +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.out openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.out --- openjdk-8-8u292-b10/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.out 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/test/tools/javac/generics/ClassBoundCheckingOverflow.out 2021-09-13 23:27:15.000000000 +0000 @@ -0,0 +1,3 @@ +ClassBoundCheckingOverflow.java:10:70: compiler.err.type.found.req: (compiler.misc.type.parameter: E), (compiler.misc.type.req.class) +ClassBoundCheckingOverflow.java:11:73: compiler.err.type.found.req: (compiler.misc.type.parameter: E), (compiler.misc.type.req.class) +2 errors diff -Nru openjdk-8-8u292-b10/=unpacked-tar1=/THIRD_PARTY_README openjdk-8-8u312-b07/=unpacked-tar1=/THIRD_PARTY_README --- openjdk-8-8u292-b10/=unpacked-tar1=/THIRD_PARTY_README 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar1=/THIRD_PARTY_README 2021-10-20 10:12:18.000000000 +0000 @@ -3243,39 +3243,75 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to OASIS PKCS #11 Cryptographic Token -Interface v2.40, which may be included with JRE 8, JDK 8, and OpenJDK 8. +Interface v3.0, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- -Copyright (c) OASIS Open 2016. All Rights Reserved. +Copyright © OASIS Open 2020. All Rights Reserved. -All capitalized terms in the following text have the meanings assigned to them -in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The -full Policy may be found at the OASIS website: + All capitalized terms in the following text have the meanings +assigned to them in the OASIS Intellectual Property Rights Policy (the +"OASIS IPR Policy"). The full Policy may be found at the OASIS website: [http://www.oasis-open.org/policies-guidelines/ipr] -This document and translations of it may be copied and furnished to others, and -derivative works that comment on or otherwise explain it or assist in its -implementation may be prepared, copied, published, and distributed, in whole or -in part, without restriction of any kind, provided that the above copyright -notice and this section are included on all such copies and derivative works. -However, this document itself may not be modified in any way, including by -removing the copyright notice or references to OASIS, except as needed for the -purpose of developing any document or deliverable produced by an OASIS -Technical Committee (in which case the rules applicable to copyrights, as set -forth in the OASIS IPR Policy, must be followed) or as required to translate it -into languages other than English. - -The limited permissions granted above are perpetual and will not be revoked by -OASIS or its successors or assigns. - -This document and the information contained herein is provided on an "AS IS" -basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT -INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. OASIS AND ITS MEMBERS WILL NOT BE LIABLE FOR -ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE -OF THIS DOCUMENT OR ANY PART THEREOF. + This document and translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it or +assist in its implementation may be prepared, copied, published, and +distributed, in whole or in part, without restriction of any kind, +provided that the above copyright notice and this section are included +on all such copies and derivative works. However, this document itself +may not be modified in any way, including by removing the copyright +notice or references to OASIS, except as needed for the purpose of +developing any document or deliverable produced by an OASIS Technical +Committee (in which case the rules applicable to copyrights, as set +forth in the OASIS IPR Policy, must be followed) or as required to +translate it into languages other than English. + + The limited permissions granted above are perpetual and will not be +revoked by OASIS or its successors or assigns. + + This document and the information contained herein is provided on an +"AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE +INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. OASIS +AND ITS MEMBERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THIS DOCUMENT OR ANY +PART THEREOF. + + [OASIS requests that any OASIS Party or any other party that +believes it has patent claims that would necessarily be infringed by +implementations of this OASIS Standards Final Deliverable, to notify +OASIS TC Administrator and provide an indication of its willingness to +grant patent licenses to such patent claims in a manner consistent with +the IPR Mode of the OASIS Technical Committee that produced this +deliverable.] + + [OASIS invites any party to contact the OASIS TC Administrator if it +is aware of a claim of ownership of any patent claims that would +necessarily be infringed by implementations of this OASIS Standards +Final Deliverable by a patent holder that is not willing to provide a +license to such patent claims in a manner consistent with the IPR Mode +of the OASIS Technical Committee that produced this OASIS Standards +Final Deliverable. OASIS may include such claims on its website, but +disclaims any obligation to do so.] + + [OASIS takes no position regarding the validity or scope of any +intellectual property or other rights that might be claimed to pertain +to the implementation or use of the technology described in this OASIS +Standards Final Deliverable or the extent to which any license under +such rights might or might not be available; neither does it represent +that it has made any effort to identify any such rights. Information on +OASIS' procedures with respect to rights in any document or deliverable +produced by an OASIS Technical Committee can be found on the OASIS +website. Copies of claims of rights made available for publication and +any assurances of licenses to be made available, or the result of an +attempt made to obtain a general license or permission for the use of +such proprietary rights by implementers or users of this OASIS Standards +Final Deliverable, can be obtained from the OASIS TC Administrator. +OASIS makes no representation that any information or list of +intellectual property rights will at any time be complete, or that any +claims in such list are, in fact, Essential Claims.] --- end of LICENSE --- diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/.hg_archival.txt openjdk-8-8u312-b07/=unpacked-tar10=/.hg_archival.txt --- openjdk-8-8u292-b10/=unpacked-tar10=/.hg_archival.txt 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/.hg_archival.txt 2021-09-13 23:27:09.000000000 +0000 @@ -1,5 +1,5 @@ repo: 6ce5f4757bde08f7470cbb9f0b46da8f2f3d4f56 -node: 8246436d1c3bc32a5325e9a9e33c41d44150b045 +node: 0a8784c38f097207c4781230fb3dd942883b3f52 branch: default -tag: jdk8u292-b10 -tag: jdk8u292-ga +tag: jdk8u312-b07 +tag: jdk8u312-ga diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/.hgtags openjdk-8-8u312-b07/=unpacked-tar10=/.hgtags --- openjdk-8-8u292-b10/=unpacked-tar10=/.hgtags 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/.hgtags 2021-09-13 23:27:09.000000000 +0000 @@ -1086,3 +1086,22 @@ 1fe7316192d787d0c6846691259be4ab350b140f jdk8u292-b07 5a208ef2cc7cdbc50f0a3e50f892cea6572172f1 jdk8u292-b08 91c9a06b7ed01e7ad2489a0592c75fa19b64e76e jdk8u292-b09 +8246436d1c3bc32a5325e9a9e33c41d44150b045 jdk8u292-b10 +8246436d1c3bc32a5325e9a9e33c41d44150b045 jdk8u292-ga +031481db1646dcfd40025aa59ea7c9f070e88cc9 jdk8u302-b00 +f40783aba2727b313631df53fa31dfd87c9957cf jdk8u302-b01 +ea75b85dec8d82e5c0f881ced4c8569e8f5afaec jdk8u302-b02 +46a04b4c71749539a4b6c85f882bd275175babcb jdk8u302-b03 +dd6914b1b116cd8ab2ca18cf3ce2d4a15f4e5c30 jdk8u302-b04 +f529944cbf6ef83768b4acd787edc4a2aaab4398 jdk8u302-b05 +f529944cbf6ef83768b4acd787edc4a2aaab4398 jdk8u312-b00 +7443fa2f19b09a1eed10a8ca6a84c050281f94ac jdk8u302-b06 +5f019dc37164bc2615d4c3d04411b26da8f7f260 jdk8u302-b07 +41f3654e3404e5524dcbf1136acc5e6c09ffffab jdk8u302-b08 +41f3654e3404e5524dcbf1136acc5e6c09ffffab jdk8u302-ga +211ac8fe58f622ea94613323ea945a72c65b675f jdk8u312-b01 +4e6491f455d04226359e09e7d0e7d7640aa95d86 jdk8u312-b02 +6a8a5589afaaff3e5537fa53f413f828c1139d7b jdk8u312-b03 +ebcae27bdac1f676f11cee0edc8a66cb115db243 jdk8u312-b04 +f62968808184d12e6f17e398190a019baa431bbf jdk8u312-b05 +2ffc0e316b15cf3864c37051c863d4d7f65c5004 jdk8u312-b06 diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties --- openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties 2021-09-13 23:27:09.000000000 +0000 @@ -278,7 +278,7 @@ # Namespaces support # 4. Using Qualified Names - IllegalQName = Element or attribute do not match QName production: QName::=(NCName':')?NCName. + IllegalQName = Element or attribute \"{0}\" do not match QName production: QName::=(NCName':')?NCName. ElementXMLNSPrefix = Element \"{0}\" cannot have \"xmlns\" as its prefix. ElementPrefixUnbound = The prefix \"{0}\" for element \"{1}\" is not bound. AttributePrefixUnbound = The prefix \"{2}\" for attribute \"{1}\" associated with an element type \"{0}\" is not bound. diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java --- openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XML11EntityScanner.java 2021-09-13 23:27:09.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -40,6 +40,8 @@ * @author Michael Glavassevich, IBM * @author Neil Graham, IBM * @version $Id: XML11EntityScanner.java,v 1.5 2010-11-01 04:39:40 joehw Exp $ + * + * @LastModified: Apr 2021 */ public class XML11EntityScanner @@ -697,7 +699,7 @@ sawIncompleteSurrogatePair)){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "IllegalQName", - null, + new Object[]{rawname}, XMLErrorReporter.SEVERITY_FATAL_ERROR); } //check the result: localpart diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java --- openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xerces/internal/impl/XMLEntityScanner.java 2021-09-13 23:27:09.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -55,6 +55,7 @@ * @author Arnaud Le Hors, IBM * @author K.Venugopal Sun Microsystems * + * @LastModified: Apr 2021 */ public class XMLEntityScanner implements XMLLocator { @@ -860,6 +861,14 @@ prefix = fSymbolTable.addSymbol(fCurrentEntity.ch, offset, prefixLength); int len = length - prefixLength - 1; + int startLocal = index +1; + if (!XMLChar.isNCNameStart(fCurrentEntity.ch[startLocal])){ + fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, + "IllegalQName", + new Object[]{rawname}, + XMLErrorReporter.SEVERITY_FATAL_ERROR); + } + //check the result: localpart checkLimit(Limit.MAX_NAME_LIMIT, fCurrentEntity, index + 1, len); localpart = fSymbolTable.addSymbol(fCurrentEntity.ch, diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xml/internal/serializer/ToStream.java openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xml/internal/serializer/ToStream.java --- openjdk-8-8u292-b10/=unpacked-tar10=/src/com/sun/org/apache/xml/internal/serializer/ToStream.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/src/com/sun/org/apache/xml/internal/serializer/ToStream.java 2021-09-13 23:27:09.000000000 +0000 @@ -38,6 +38,7 @@ import com.sun.org.apache.xml.internal.serializer.utils.MsgKey; import com.sun.org.apache.xml.internal.serializer.utils.Utils; import com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException; +import jdk.xml.internal.JdkXmlUtils; import org.w3c.dom.Node; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; @@ -50,7 +51,7 @@ * serializers (xml, html, text ...) that write output to a stream. * * @xsl.usage internal - * @LastModified: Sept 2018 + * @LastModified: Apr 2021 */ abstract public class ToStream extends SerializerBase { @@ -1888,21 +1889,21 @@ String doctypeSystem = getDoctypeSystem(); if (null != doctypeSystem) { - if (null == doctypePublic) - writer.write(" SYSTEM \""); - else - writer.write(" \""); + char quote = JdkXmlUtils.getQuoteChar(doctypeSystem); + if (null == doctypePublic) { + writer.write(" SYSTEM"); + } + writer.write(" "); + writer.write(quote); writer.write(doctypeSystem); - + writer.write(quote); if (closeDecl) { - writer.write("\">"); + writer.write(">"); writer.write(m_lineSep, 0, m_lineSepLen); closeDecl = false; // done closing } - else - writer.write('\"'); } boolean dothis = false; if (dothis) diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/src/jdk/xml/internal/JdkXmlUtils.java openjdk-8-8u312-b07/=unpacked-tar10=/src/jdk/xml/internal/JdkXmlUtils.java --- openjdk-8-8u292-b10/=unpacked-tar10=/src/jdk/xml/internal/JdkXmlUtils.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/src/jdk/xml/internal/JdkXmlUtils.java 2021-09-13 23:27:09.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, 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 @@ -249,6 +249,22 @@ return tf; } + /** + * Returns the character to be used to quote the input content. Between + * single and double quotes, this method returns the one that is not found + * in the input. Returns double quote by default. + * + * @param s the input string + * @return returns the quote not found in the input + */ + public static char getQuoteChar(String s) { + if (s != null && s.indexOf('"') > -1) { + return '\''; + } else { + return '"'; + } + } + private static XMLReader getXMLReaderWSAXFactory(boolean overrideDefaultParser) { SAXParserFactory saxFactory = getSAXFactory(overrideDefaultParser); try { diff -Nru openjdk-8-8u292-b10/=unpacked-tar10=/THIRD_PARTY_README openjdk-8-8u312-b07/=unpacked-tar10=/THIRD_PARTY_README --- openjdk-8-8u292-b10/=unpacked-tar10=/THIRD_PARTY_README 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar10=/THIRD_PARTY_README 2021-10-20 10:12:18.000000000 +0000 @@ -3243,39 +3243,75 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to OASIS PKCS #11 Cryptographic Token -Interface v2.40, which may be included with JRE 8, JDK 8, and OpenJDK 8. +Interface v3.0, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- -Copyright (c) OASIS Open 2016. All Rights Reserved. +Copyright © OASIS Open 2020. All Rights Reserved. -All capitalized terms in the following text have the meanings assigned to them -in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The -full Policy may be found at the OASIS website: + All capitalized terms in the following text have the meanings +assigned to them in the OASIS Intellectual Property Rights Policy (the +"OASIS IPR Policy"). The full Policy may be found at the OASIS website: [http://www.oasis-open.org/policies-guidelines/ipr] -This document and translations of it may be copied and furnished to others, and -derivative works that comment on or otherwise explain it or assist in its -implementation may be prepared, copied, published, and distributed, in whole or -in part, without restriction of any kind, provided that the above copyright -notice and this section are included on all such copies and derivative works. -However, this document itself may not be modified in any way, including by -removing the copyright notice or references to OASIS, except as needed for the -purpose of developing any document or deliverable produced by an OASIS -Technical Committee (in which case the rules applicable to copyrights, as set -forth in the OASIS IPR Policy, must be followed) or as required to translate it -into languages other than English. - -The limited permissions granted above are perpetual and will not be revoked by -OASIS or its successors or assigns. - -This document and the information contained herein is provided on an "AS IS" -basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT -INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. OASIS AND ITS MEMBERS WILL NOT BE LIABLE FOR -ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE -OF THIS DOCUMENT OR ANY PART THEREOF. + This document and translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it or +assist in its implementation may be prepared, copied, published, and +distributed, in whole or in part, without restriction of any kind, +provided that the above copyright notice and this section are included +on all such copies and derivative works. However, this document itself +may not be modified in any way, including by removing the copyright +notice or references to OASIS, except as needed for the purpose of +developing any document or deliverable produced by an OASIS Technical +Committee (in which case the rules applicable to copyrights, as set +forth in the OASIS IPR Policy, must be followed) or as required to +translate it into languages other than English. + + The limited permissions granted above are perpetual and will not be +revoked by OASIS or its successors or assigns. + + This document and the information contained herein is provided on an +"AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE +INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. OASIS +AND ITS MEMBERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THIS DOCUMENT OR ANY +PART THEREOF. + + [OASIS requests that any OASIS Party or any other party that +believes it has patent claims that would necessarily be infringed by +implementations of this OASIS Standards Final Deliverable, to notify +OASIS TC Administrator and provide an indication of its willingness to +grant patent licenses to such patent claims in a manner consistent with +the IPR Mode of the OASIS Technical Committee that produced this +deliverable.] + + [OASIS invites any party to contact the OASIS TC Administrator if it +is aware of a claim of ownership of any patent claims that would +necessarily be infringed by implementations of this OASIS Standards +Final Deliverable by a patent holder that is not willing to provide a +license to such patent claims in a manner consistent with the IPR Mode +of the OASIS Technical Committee that produced this OASIS Standards +Final Deliverable. OASIS may include such claims on its website, but +disclaims any obligation to do so.] + + [OASIS takes no position regarding the validity or scope of any +intellectual property or other rights that might be claimed to pertain +to the implementation or use of the technology described in this OASIS +Standards Final Deliverable or the extent to which any license under +such rights might or might not be available; neither does it represent +that it has made any effort to identify any such rights. Information on +OASIS' procedures with respect to rights in any document or deliverable +produced by an OASIS Technical Committee can be found on the OASIS +website. Copies of claims of rights made available for publication and +any assurances of licenses to be made available, or the result of an +attempt made to obtain a general license or permission for the use of +such proprietary rights by implementers or users of this OASIS Standards +Final Deliverable, can be obtained from the OASIS TC Administrator. +OASIS makes no representation that any information or list of +intellectual property rights will at any time be complete, or that any +claims in such list are, in fact, Essential Claims.] --- end of LICENSE --- diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/.hg_archival.txt openjdk-8-8u312-b07/=unpacked-tar11=/.hg_archival.txt --- openjdk-8-8u292-b10/=unpacked-tar11=/.hg_archival.txt 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/.hg_archival.txt 2021-10-20 10:12:18.000000000 +0000 @@ -1,4 +1,5 @@ repo: a61af66fc99eb5ec9d50c05b0c599757b1289ceb -node: a324fe8ff0992309d9623a00df4153c5e466ec01 +node: 0879e6c777fd0a4db0f1a58be004f1985d74d685 branch: default -tag: jdk8u292-b09-aarch32-20210330 +tag: jdk8u312-b07-aarch32-20211101 +tag: jdk8u312-ga-aarch32-20210923 diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/.hgtags openjdk-8-8u312-b07/=unpacked-tar11=/.hgtags --- openjdk-8-8u292-b10/=unpacked-tar11=/.hgtags 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/.hgtags 2021-10-20 10:12:18.000000000 +0000 @@ -1446,3 +1446,43 @@ f206e4bfcef993ce5a75ed54612f045ca047abd3 jdk8u292-b07 d472fe27d65eea99ffdbdcdf31f6163fb34135d1 jdk8u292-b08-aarch32-20210318 85c5bc8157df45d7351c388f18ab65297b5bdd01 jdk8u292-b08 +a324fe8ff0992309d9623a00df4153c5e466ec01 jdk8u292-b09-aarch32-20210330 +65907019826ad9fe7d13df531e0c108cc1f179b0 jdk8u292-b09 +2a6952bb390975722d73580d1dc3cb6ac69b76b0 jdk8u292-b10 +2a6952bb390975722d73580d1dc3cb6ac69b76b0 jdk8u292-ga +fa977f20ebe018817da51a40e5dc4de9ffff71dd jdk8u292-b10-aarch32-20210423 +fa977f20ebe018817da51a40e5dc4de9ffff71dd jdk8u292-ga-aarch32-20210423 +a435c913c8ce30f0487d05cfec1d9be3fcc57f10 jdk8u302-b00 +d24969e49a6af3353c84b9a0f9aedd4736156b66 jdk8u302-b01 +a9bba04158c8030845c2200f096af636b402f035 jdk8u302-b01-aarch32-20210506 +52d6e6b0a14a12ce67ae2a25e8aaa3266b618953 jdk8u302-b02-aarch32-20210513 +8a152c8e9f14e3bdeebd7bf4e8eb2a6e8f9bbb7c jdk8u302-b02 +f637ff22ec1c783eeada8fb217c919714523e005 jdk8u302-b03-aarch32-20210521 +99e4a82f17e8debc5225d1c8834acdac673aa676 jdk8u302-b03 +465e2fa360f9518c1912d940201bc011cb918995 jdk8u302-b04-aarch32-20210531 +362d99aef38e6e179061f221df20bbb9f65b8f89 jdk8u302-b04 +00d9f55b6d01df5a6db79060e3f2f04d46497ee4 jdk8u302-b05-aarch32-20210607 +54326de2a1d7847ea63e7bcf4ebc1a9699cb8885 jdk8u302-b05 +6c2ceb9f24992fbef6d90fd182f9fc9c8a43f523 jdk8u302-b06-aarch32-20210630 +54326de2a1d7847ea63e7bcf4ebc1a9699cb8885 jdk8u312-b00 +782f3b88b5ba7d420e6c5894c19f9bf1980df239 jdk8u302-b06 +78dfe32cac588b01e28792d42e761fa35a80e8f9 jdk8u302-b07 +4b12059767b70e1155734c19f8dcf6336a457eaf jdk8u302-b07-aarch32-20210706 +a209b6f5b09af88bae12ffeebd382f3ef804b99f jdk8u302-b08 +a209b6f5b09af88bae12ffeebd382f3ef804b99f jdk8u302-ga +c7ceaaaa5d93ce7a645e72dcb2aa4b633f2c881b jdk8u302-b08-aarch32-20210726 +c7ceaaaa5d93ce7a645e72dcb2aa4b633f2c881b jdk8u302-ga-aarch32-20210726 +bb927f907209b1a5c2b88d0f8937af21ba8c5d94 jdk8u312-b01-aarch32-20210817 +2f7a380c9a0ac0cf20fdb17d7b6a135da05b5d04 jdk8u312-b01 +065415b80aa485a3727d4ce725b979b64237d826 jdk8u312-b02-aarch32-20210820 +4735f3031e239dfd76c0ed2ce25c8f1cc9bd7c1f jdk8u312-b02 +a6da205dfd9f0d71dae93a310652e29d830c95ee jdk8u312-b03 +8bcb1e3714349ee87c80c51808353b379c443a21 jdk8u312-b03-aarch32-20210827 +0f09ed184342b3f66119dd6d264736fe27474a56 jdk8u312-b04-aarch32-20210902 +21394894714b0fb17e6015483e4658f75e30bbc5 jdk8u312-b04 +e7fc0c4f478e78e2ef40b8d098c02a958e385227 jdk8u312-b05 +b2ed441458ec0b0d4fbbbaa1c13c961341bcafec jdk8u312-b05-aarch32-20210903 +e2ac513ec7b343f596861645f0696bc6f0fb4364 jdk8u312-b06 +15ff1c32911c8b4e9c347f906fdf9586101b2fae jdk8u312-b06-aarch32-20210923 +8aac6d08b58e31e4938a32c2662bf822d87a5440 jdk8u312-b07 +8aac6d08b58e31e4938a32c2662bf822d87a5440 jdk8u312-ga diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/defs.make openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/defs.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/defs.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/defs.make 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -142,36 +142,28 @@ OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif - ifeq ($(OBJCOPY),) - _JUNK_ := $(shell \ - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.") - ENABLE_FULL_DEBUG_SYMBOLS=0 - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") - else - _JUNK_ := $(shell \ - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") + _JUNK_ := $(shell \ + echo >&2 "INFO: AIX .debuginfo files will be produced by copying debug object.") - # Library stripping policies for .debuginfo configs: - # all_strip - strips everything from the library - # min_strip - strips most stuff from the library; leaves minimum symbols - # no_strip - does not strip the library at all - # - # Oracle security policy requires "all_strip". A waiver was granted on - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. - # - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. - # - STRIP_POLICY ?= min_strip + # Library stripping policies for .debuginfo configs: + # all_strip - strips everything from the library + # min_strip - strips most stuff from the library; leaves minimum symbols + # no_strip - does not strip the library at all + # + # Oracle security policy requires "all_strip". A waiver was granted on + # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. + # + # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. + # + STRIP_POLICY ?= min_strip - _JUNK_ := $(shell \ - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") + _JUNK_ := $(shell \ + echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") - ZIP_DEBUGINFO_FILES ?= 1 + ZIP_DEBUGINFO_FILES ?= 1 - _JUNK_ := $(shell \ - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") - endif + _JUNK_ := $(shell \ + echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") endif # ENABLE_FULL_DEBUG_SYMBOLS=1 endif # BUILD_FLAVOR endif # JDK_6_OR_EARLIER @@ -185,13 +177,13 @@ # client and server subdirectories have symbolic links to ../libjsig.so EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz -# else -# EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo -# endif -#endif +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz + else + EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo + endif +endif EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal @@ -199,25 +191,25 @@ ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true) EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) -# ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz -# else -# EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo -# endif -# endif + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz + else + EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo + endif + endif endif ifeq ($(JVM_VARIANT_CLIENT),true) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) -# ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz -# else -# EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo -# endif -# endif + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz + else + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo + endif + endif endif # Serviceability Binaries diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/jsig.make openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/jsig.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/jsig.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/jsig.make 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -64,9 +64,9 @@ $(QUIETLY) $(CXX) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(JSIG_OPT_FLAGS) -o $@ $< -ldl -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + # AIX produces .debuginfo from copy of -g compiled object prior to strip + $(QUIETLY) $(CP) $@ $(LIBJSIG_DEBUGINFO) # ifeq ($(STRIP_POLICY),all_strip) # $(QUIETLY) $(STRIP) $@ # else @@ -75,11 +75,13 @@ # # implied else here is no stripping at all # endif # endif -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) -# $(RM) $(LIBJSIG_DEBUGINFO) -# endif -#endif + ifneq ($(STRIP_POLICY),no_strip) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) + $(RM) $(LIBJSIG_DEBUGINFO) + endif + endif +endif install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/saproc.make openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/saproc.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/saproc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/saproc.make 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -88,16 +88,16 @@ -o $@ \ -lthread_db ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -g $@ - # implied else here is no stripping at all - endif - endif + # AIX produces .debuginfo from copy of -g compiled object prior to strip + $(QUIETLY) $(CP) $@ $(LIBJSIG_DEBUGINFO) +# ifeq ($(STRIP_POLICY),all_strip) +# $(QUIETLY) $(STRIP) $@ +# else +# ifeq ($(STRIP_POLICY),min_strip) +# $(QUIETLY) $(STRIP) -g $@ +# # implied else here is no stripping at all +# endif +# endif ifeq ($(ZIP_DEBUGINFO_FILES),1) $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(RM) $(LIBSAPROC_DEBUGINFO) diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/vm.make openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/vm.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/aix/makefiles/vm.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/aix/makefiles/vm.make 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2020 SAP SE. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -329,9 +329,9 @@ # fi \ # } -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + # AIX produces .debuginfo from copy of -g compiled object prior to strip + $(QUIETLY) $(CP) $@ $(LIBJVM_DEBUGINFO) # ifeq ($(STRIP_POLICY),all_strip) # $(QUIETLY) $(STRIP) $@ # else @@ -340,11 +340,13 @@ # # implied else here is no stripping at all # endif # endif -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) -# $(RM) $(LIBJVM_DEBUGINFO) -# endif -#endif + ifneq ($(STRIP_POLICY),no_strip) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) + $(RM) $(LIBJVM_DEBUGINFO) + endif + endif +endif DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR) DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM) diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/bsd/makefiles/gcc.make openjdk-8-8u312-b07/=unpacked-tar11=/make/bsd/makefiles/gcc.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/bsd/makefiles/gcc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/bsd/makefiles/gcc.make 2021-10-20 10:12:18.000000000 +0000 @@ -313,10 +313,10 @@ # Work around some compiler bugs. ifeq ($(USE_CLANG), true) - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) - OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) - OPT_CFLAGS/unsafe.o += -O1 - endif + # Known to fail with clang <= 7.0; + # do no optimize these on later clang until verified + OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) + OPT_CFLAGS/unsafe.o += -O1 else # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) @@ -362,7 +362,15 @@ # Linker flags # statically link libstdc++.so, work with gcc but ignored by g++ -STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +ifeq ($(OS_VENDOR), Darwin) + ifeq ($(USE_CLANG), true) + STATIC_STDCXX = -Wl,-Bstatic -lc++ -Wl,-Bdynamic + else + STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic + endif +else + STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +endif ifeq ($(USE_CLANG),) # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/bsd/makefiles/jsig.make openjdk-8-8u312-b07/=unpacked-tar11=/make/bsd/makefiles/jsig.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/bsd/makefiles/jsig.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/bsd/makefiles/jsig.make 2021-10-20 10:12:18.000000000 +0000 @@ -54,6 +54,11 @@ LFLAGS_JSIG += -D_GNU_SOURCE -pthread $(LDFLAGS_HASH_STYLE) $(EXTRA_LDFLAGS) +ifeq ($(OS_VENDOR), Darwin) +# bring in minimum version argument or we'll fail on OSX 10.10 +LFLAGS_JSIG += $(LFLAGS) +endif + # DEBUG_BINARIES overrides everything, use full -g debug information ifeq ($(DEBUG_BINARIES), true) JSIG_DEBUG_CFLAGS = -g diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/bsd/makefiles/saproc.make openjdk-8-8u312-b07/=unpacked-tar11=/make/bsd/makefiles/saproc.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/bsd/makefiles/saproc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/bsd/makefiles/saproc.make 2021-10-20 10:12:18.000000000 +0000 @@ -78,8 +78,10 @@ ifneq ($(SDKPATH),) SA_SYSROOT_FLAGS += -isysroot "$(SDKPATH)" -iframework"$(SDKPATH)/System/Library/Frameworks" endif - # always needed, even if SDKPATH is empty - SA_SYSROOT_FLAGS += -F"$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks" + ifneq ($(wildcard "$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks"), "") + # always needed, even if SDKPATH is empty + SA_SYSROOT_FLAGS += -F"$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks" + endif else SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c SALIBS = diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/make/linux/makefiles/gcc.make openjdk-8-8u312-b07/=unpacked-tar11=/make/linux/makefiles/gcc.make --- openjdk-8-8u292-b10/=unpacked-tar11=/make/linux/makefiles/gcc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/make/linux/makefiles/gcc.make 2021-10-20 10:12:18.000000000 +0000 @@ -227,6 +227,18 @@ # Special cases CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) +# On newer GCCs, the compiler complains about null being passed +# to the %s format specifier. The warning appears only on 8u, +# but the code is largely the same up to trunk. We disable +# the warning until the code is fixed, to allow builds with +# -Werror (the default). +# See JDK-8269388 and PR3798 in IcedTea: +# https://icedtea.wildebeest.org/hg/icedtea8-forest/hotspot/rev/9f2ceb42dc64 +# Option only exists on GCC 7 and later, checked by configure +ifeq ($(USE_FORMAT_OVERFLOW), 1) + CFLAGS_WARN/os_linux.o = $(CFLAGS_WARN/DEFAULT) -Wno-error=format-overflow +endif + # The flags to use for an Optimized g++ build OPT_CFLAGS/SIZE=-Os OPT_CFLAGS/SPEED=-O3 diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/aarch64.ad openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/aarch64.ad --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/aarch64.ad 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/aarch64.ad 2021-10-20 10:12:18.000000000 +0000 @@ -926,6 +926,8 @@ source_hpp %{ +#include "opto/addnode.hpp" + class CallStubImpl { //-------------------------------------------------------------- @@ -980,6 +982,9 @@ // predicate controlling translation of StoreCM bool unnecessary_storestore(const Node *storecm); + + // predicate controlling addressing modes + bool size_fits_all_mem_uses(AddPNode* addp, int shift); %} source %{ @@ -2159,6 +2164,26 @@ return FP_REG_mask(); } +bool size_fits_all_mem_uses(AddPNode* addp, int shift) { + for (DUIterator_Fast imax, i = addp->fast_outs(imax); i < imax; i++) { + Node* u = addp->fast_out(i); + if (u->is_LoadStore()) { + // On AArch64, LoadStoreNodes (i.e. compare and swap + // instructions) only take register indirect as an operand, so + // any attempt to use an AddPNode as an input to a LoadStoreNode + // must fail. + return false; + } + if (u->is_Mem()) { + int opsize = u->as_Mem()->memory_size(); + assert(opsize > 0, "unexpected memory operand size"); + if (u->as_Mem()->memory_size() != (1<as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP reg (LShiftL lreg scale)) off); op_cost(INSN_COST); @@ -4769,6 +4796,8 @@ operand indIndexScaledOffsetL(iRegP reg, iRegL lreg, immIScale scale, immLU12 off) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP reg (LShiftL lreg scale)) off); op_cost(INSN_COST); @@ -4797,6 +4826,8 @@ operand indIndexScaledOffsetI2L(iRegP reg, iRegI ireg, immIScale scale, immLU12 off) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP reg (LShiftL (ConvI2L ireg) scale)) off); op_cost(INSN_COST); @@ -4811,6 +4842,8 @@ operand indIndexScaledI2L(iRegP reg, iRegI ireg, immIScale scale) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP reg (LShiftL (ConvI2L ireg) scale)); op_cost(0); @@ -4825,6 +4858,8 @@ operand indIndexScaled(iRegP reg, iRegL lreg, immIScale scale) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP reg (LShiftL lreg scale)); op_cost(0); @@ -4980,7 +5015,9 @@ operand indIndexScaledOffsetIN(iRegN reg, iRegL lreg, immIScale scale, immIU12 off) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP (DecodeN reg) (LShiftL lreg scale)) off); op_cost(0); @@ -4995,7 +5032,9 @@ operand indIndexScaledOffsetLN(iRegN reg, iRegL lreg, immIScale scale, immLU12 off) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP (DecodeN reg) (LShiftL lreg scale)) off); op_cost(INSN_COST); @@ -5025,7 +5064,9 @@ operand indIndexScaledOffsetI2LN(iRegN reg, iRegI ireg, immIScale scale, immLU12 off) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP (DecodeN reg) (LShiftL (ConvI2L ireg) scale)) off); op_cost(INSN_COST); @@ -5040,7 +5081,9 @@ operand indIndexScaledI2LN(iRegN reg, iRegI ireg, immIScale scale) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (DecodeN reg) (LShiftL (ConvI2L ireg) scale)); op_cost(0); @@ -5055,7 +5098,9 @@ operand indIndexScaledN(iRegN reg, iRegL lreg, immIScale scale) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (DecodeN reg) (LShiftL lreg scale)); op_cost(0); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/assembler_aarch64.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/assembler_aarch64.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/assembler_aarch64.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/assembler_aarch64.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -1288,7 +1288,7 @@ INSN(ldrs, 0b00, 1); INSN(ldrd, 0b01, 1); - INSN(ldrq, 0x10, 1); + INSN(ldrq, 0b10, 1); #undef INSN @@ -1975,7 +1975,7 @@ public: enum SIMD_Arrangement { - T8B, T16B, T4H, T8H, T2S, T4S, T1D, T2D + T8B, T16B, T4H, T8H, T2S, T4S, T1D, T2D, T1Q }; enum SIMD_RegVariant { @@ -2306,14 +2306,16 @@ f(0b001111, 15, 10), rf(Vn, 5), rf(Xd, 0); } - // We do not handle the 1Q arrangement. void pmull(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { starti; - assert(Ta == T8H && (Tb == T8B || Tb == T16B), "Invalid Size specifier"); - f(0, 31), f(Tb & 1, 30), f(0b001110001, 29, 21), rf(Vm, 16), f(0b111000, 15, 10); - rf(Vn, 5), rf(Vd, 0); + assert((Ta == T1Q && (Tb == T1D || Tb == T2D)) || + (Ta == T8H && (Tb == T8B || Tb == T16B)), "Invalid Size specifier"); + int size = (Ta == T1Q) ? 0b11 : 0b00; + f(0, 31), f(Tb & 1, 30), f(0b001110, 29, 24), f(size, 23, 22); + f(1, 21), rf(Vm, 16), f(0b111000, 15, 10), rf(Vn, 5), rf(Vd, 0); } void pmull2(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { + assert(Tb == T2D || Tb == T16B, "pmull2 assumes T2D or T16B as the second size specifier"); pmull(Vd, Ta, Vn, Vm, Tb); } @@ -2326,15 +2328,6 @@ f(0b100001010010, 21, 10), rf(Vn, 5), rf(Vd, 0); } - void rev32(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) - { - starti; - assert(T <= T8H, "must be one of T8B, T16B, T4H, T8H"); - f(0, 31), f((int)T & 1, 30), f(0b101110, 29, 24); - f(T <= T16B ? 0b00 : 0b01, 23, 22), f(0b100000000010, 21, 10); - rf(Vn, 5), rf(Vd, 0); - } - void dup(FloatRegister Vd, SIMD_Arrangement T, Register Xs) { starti; @@ -2367,6 +2360,68 @@ #undef INSN + // Table vector lookup +#define INSN(NAME, op) \ + void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, unsigned registers, FloatRegister Vm) { \ + starti; \ + assert(T == T8B || T == T16B, "invalid arrangement"); \ + assert(0 < registers && registers <= 4, "invalid number of registers"); \ + f(0, 31), f((int)T & 1, 30), f(0b001110000, 29, 21), rf(Vm, 16), f(0, 15); \ + f(registers - 1, 14, 13), f(op, 12),f(0b00, 11, 10), rf(Vn, 5), rf(Vd, 0); \ + } + + INSN(tbl, 0); + INSN(tbx, 1); + +#undef INSN + + // AdvSIMD two-reg misc +#define INSN(NAME, U, opcode) \ + void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { \ + starti; \ + assert((ASSERTION), MSG); \ + f(0, 31), f((int)T & 1, 30), f(U, 29), f(0b01110, 28, 24); \ + f((int)(T >> 1), 23, 22), f(0b10000, 21, 17), f(opcode, 16, 12); \ + f(0b10, 11, 10), rf(Vn, 5), rf(Vd, 0); \ + } + +#define MSG "invalid arrangement" + +#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H || T == T2S || T == T4S) + INSN(rev64, 0, 0b00000); +#undef ASSERTION + +#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H) + INSN(rev32, 1, 0b00000); +private: + INSN(_rbit, 1, 0b00101); +public: + +#undef ASSERTION + +#define ASSERTION (T == T8B || T == T16B) + INSN(rev16, 0, 0b00001); + // RBIT only allows T8B and T16B but encodes them oddly. Argh... + void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { + assert((ASSERTION), MSG); + _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); + } +#undef ASSERTION + +#undef MSG + +#undef INSN + + void ext(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm, int index) + { + starti; + assert(T == T8B || T == T16B, "invalid arrangement"); + assert((T == T8B && index <= 0b0111) || (T == T16B && index <= 0b1111), "Invalid index value"); + f(0, 31), f((int)T & 1, 30), f(0b101110000, 29, 21); + rf(Vm, 16), f(0, 15), f(index, 14, 11); + f(0, 10), rf(Vn, 5), rf(Vd, 0); + } + Assembler(CodeBuffer* code) : AbstractAssembler(code) { } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -603,12 +603,12 @@ } else { assert (x->op() == Bytecodes::_imul, "expect imul"); if (right.is_constant()) { - int c = right.get_jint_constant(); - if (! is_power_of_2(c) && ! is_power_of_2(c + 1) && ! is_power_of_2(c - 1)) { - // Cannot use constant op. - right.load_item(); + jint c = right.get_jint_constant(); + if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) { + right_arg->dont_load_item(); } else { - right.dont_load_item(); + // Cannot use constant op. + right_arg->load_item(); } } else { right.load_item(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -143,9 +143,9 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) { // if there is any conflict use the stack if (arg1 == c_rarg2 || arg1 == c_rarg3 || - arg2 == c_rarg1 || arg1 == c_rarg3 || - arg3 == c_rarg1 || arg1 == c_rarg2) { - stp(arg3, arg2, Address(pre(sp, 2 * wordSize))); + arg2 == c_rarg1 || arg2 == c_rarg3 || + arg3 == c_rarg1 || arg3 == c_rarg2) { + stp(arg3, arg2, Address(pre(sp, -2 * wordSize))); stp(arg1, zr, Address(pre(sp, -2 * wordSize))); ldp(c_rarg1, zr, Address(post(sp, 2 * wordSize))); ldp(c_rarg3, c_rarg2, Address(post(sp, 2 * wordSize))); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -644,6 +644,11 @@ // do the call, remove parameters MacroAssembler::call_VM_leaf_base(entry_point, number_of_arguments, &l); + // lr could be poisoned with PAC signature during throw_pending_exception + // if it was tail-call optimized by compiler, since lr is not callee-saved + // reload it with proper value + adr(lr, l); + // reset last Java frame // Only interpreter should have to clear fp reset_last_Java_frame(true); @@ -1262,7 +1267,7 @@ stp(rscratch2, lr, Address(pre(sp, -2 * wordSize))); mov(r0, reg); - mov(rscratch1, (address)b); + movptr(rscratch1, (uintptr_t)(address)b); // call indirectly to solve generation ordering problem lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address())); @@ -1298,7 +1303,7 @@ } else { ldr(r0, addr); } - mov(rscratch1, (address)b); + movptr(rscratch1, (uintptr_t)(address)b); // call indirectly to solve generation ordering problem lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address())); @@ -1993,8 +1998,8 @@ void MacroAssembler::stop(const char* msg) { address ip = pc(); pusha(); - mov(c_rarg0, (address)msg); - mov(c_rarg1, (address)ip); + movptr(c_rarg0, (uintptr_t)(address)msg); + movptr(c_rarg1, (uintptr_t)(address)ip); mov(c_rarg2, sp); mov(c_rarg3, CAST_FROM_FN_PTR(address, MacroAssembler::debug64)); blr(c_rarg3); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,6 +1,6 @@ /* * Copyright (c) 2013, Red Hat Inc. - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. * All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1367,10 +1367,10 @@ __ ldr(temp, Address(a, rscratch2, Address::lsl(exact_log2(size)))); __ verify_oop(temp); } else { - __ ldrw(r16, Address(a, rscratch2, Address::lsl(exact_log2(size)))); + __ ldrw(temp, Address(a, rscratch2, Address::lsl(exact_log2(size)))); __ decode_heap_oop(temp); // calls verify_oop } - __ add(rscratch2, rscratch2, size); + __ add(rscratch2, rscratch2, 1); __ b(loop); __ bind(end); } @@ -3204,6 +3204,69 @@ return start; } + void ghash_multiply(FloatRegister result_lo, FloatRegister result_hi, + FloatRegister a, FloatRegister b, FloatRegister a1_xor_a0, + FloatRegister tmp1, FloatRegister tmp2, FloatRegister tmp3, FloatRegister tmp4) { + // Karatsuba multiplication performs a 128*128 -> 256-bit + // multiplication in three 128-bit multiplications and a few + // additions. + // + // (C1:C0) = A1*B1, (D1:D0) = A0*B0, (E1:E0) = (A0+A1)(B0+B1) + // (A1:A0)(B1:B0) = C1:(C0+C1+D1+E1):(D1+C0+D0+E0):D0 + // + // Inputs: + // + // A0 in a.d[0] (subkey) + // A1 in a.d[1] + // (A1+A0) in a1_xor_a0.d[0] + // + // B0 in b.d[0] (state) + // B1 in b.d[1] + + __ ext(tmp1, __ T16B, b, b, 0x08); + __ pmull2(result_hi, __ T1Q, b, a, __ T2D); // A1*B1 + __ eor(tmp1, __ T16B, tmp1, b); // (B1+B0) + __ pmull(result_lo, __ T1Q, b, a, __ T1D); // A0*B0 + __ pmull(tmp2, __ T1Q, tmp1, a1_xor_a0, __ T1D); // (A1+A0)(B1+B0) + + __ ext(tmp4, __ T16B, result_lo, result_hi, 0x08); + __ eor(tmp3, __ T16B, result_hi, result_lo); // A1*B1+A0*B0 + __ eor(tmp2, __ T16B, tmp2, tmp4); + __ eor(tmp2, __ T16B, tmp2, tmp3); + + // Register pair holds the result of carry-less multiplication + __ ins(result_hi, __ D, tmp2, 0, 1); + __ ins(result_lo, __ D, tmp2, 1, 0); + } + + void ghash_reduce(FloatRegister result, FloatRegister lo, FloatRegister hi, + FloatRegister p, FloatRegister z, FloatRegister t1) { + const FloatRegister t0 = result; + + // The GCM field polynomial f is z^128 + p(z), where p = + // z^7+z^2+z+1. + // + // z^128 === -p(z) (mod (z^128 + p(z))) + // + // so, given that the product we're reducing is + // a == lo + hi * z^128 + // substituting, + // === lo - hi * p(z) (mod (z^128 + p(z))) + // + // we reduce by multiplying hi by p(z) and subtracting the result + // from (i.e. XORing it with) lo. Because p has no nonzero high + // bits we can do this with two 64-bit multiplications, lo*p and + // hi*p. + + __ pmull2(t0, __ T1Q, hi, p, __ T2D); + __ ext(t1, __ T16B, t0, z, 8); + __ eor(hi, __ T16B, hi, t1); + __ ext(t1, __ T16B, z, t0, 8); + __ eor(lo, __ T16B, lo, t1); + __ pmull(t0, __ T1Q, hi, p, __ T1D); + __ eor(result, __ T16B, lo, t0); + } + /** * Arguments: * @@ -3244,6 +3307,93 @@ return start; } + /** + * Arguments: + * + * Input: + * c_rarg0 - current state address + * c_rarg1 - H key address + * c_rarg2 - data address + * c_rarg3 - number of blocks + * + * Output: + * Updated state at c_rarg0 + */ + address generate_ghash_processBlocks() { + // Bafflingly, GCM uses little-endian for the byte order, but + // big-endian for the bit order. For example, the polynomial 1 is + // represented as the 16-byte string 80 00 00 00 | 12 bytes of 00. + // + // So, we must either reverse the bytes in each word and do + // everything big-endian or reverse the bits in each byte and do + // it little-endian. On AArch64 it's more idiomatic to reverse + // the bits in each byte (we have an instruction, RBIT, to do + // that) and keep the data in little-endian bit order throught the + // calculation, bit-reversing the inputs and outputs. + + StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks"); + __ align(wordSize * 2); + address p = __ pc(); + __ emit_int64(0x87); // The low-order bits of the field + // polynomial (i.e. p = z^7+z^2+z+1) + // repeated in the low and high parts of a + // 128-bit vector + __ emit_int64(0x87); + + __ align(CodeEntryAlignment); + address start = __ pc(); + + Register state = c_rarg0; + Register subkeyH = c_rarg1; + Register data = c_rarg2; + Register blocks = c_rarg3; + + FloatRegister vzr = v30; + __ eor(vzr, __ T16B, vzr, vzr); // zero register + + __ ldrq(v0, Address(state)); + __ ldrq(v1, Address(subkeyH)); + + __ rev64(v0, __ T16B, v0); // Bit-reverse words in state and subkeyH + __ rbit(v0, __ T16B, v0); + __ rev64(v1, __ T16B, v1); + __ rbit(v1, __ T16B, v1); + + __ ldrq(v26, p); + + __ ext(v16, __ T16B, v1, v1, 0x08); // long-swap subkeyH into v1 + __ eor(v16, __ T16B, v16, v1); // xor subkeyH into subkeyL (Karatsuba: (A1+A0)) + + { + Label L_ghash_loop; + __ bind(L_ghash_loop); + + __ ldrq(v2, Address(__ post(data, 0x10))); // Load the data, bit + // reversing each byte + __ rbit(v2, __ T16B, v2); + __ eor(v2, __ T16B, v0, v2); // bit-swapped data ^ bit-swapped state + + // Multiply state in v2 by subkey in v1 + ghash_multiply(/*result_lo*/v5, /*result_hi*/v7, + /*a*/v1, /*b*/v2, /*a1_xor_a0*/v16, + /*temps*/v6, v20, v18, v21); + // Reduce v7:v5 by the field polynomial + ghash_reduce(v0, v5, v7, v26, vzr, v20); + + __ sub(blocks, blocks, 1); + __ cbnz(blocks, L_ghash_loop); + } + + // The bit-reversed result is at this point in v0 + __ rev64(v1, __ T16B, v0); + __ rbit(v1, __ T16B, v1); + + __ st1(v1, __ T16B, state); + __ ret(lr); + + return start; + } + // Continuation point for throwing of implicit exceptions that are // not handled in the current activation. Fabricates an exception // oop and initiates normal exception dispatching in this @@ -4253,6 +4403,11 @@ StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt(); } + // generate GHASH intrinsics code + if (UseGHASHIntrinsics) { + StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks(); + } + if (UseSHA1Intrinsics) { StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress"); StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/vm_version_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/vm_version_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/aarch64/vm/vm_version_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/aarch64/vm/vm_version_aarch64.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -41,6 +41,10 @@ #define HWCAP_AES (1<<3) #endif +#ifndef HWCAP_PMULL +#define HWCAP_PMULL (1<<4) +#endif + #ifndef HWCAP_SHA1 #define HWCAP_SHA1 (1<<5) #endif @@ -138,6 +142,17 @@ if (PrefetchCopyIntervalInBytes >= 32768) PrefetchCopyIntervalInBytes = 32760; } + + if (AllocatePrefetchDistance !=-1 && (AllocatePrefetchDistance & 7)) { + warning("AllocatePrefetchDistance must be multiple of 8"); + AllocatePrefetchDistance &= ~7; + } + + if (AllocatePrefetchStepSize & 7) { + warning("AllocatePrefetchStepSize must be multiple of 8"); + AllocatePrefetchStepSize &= ~7; + } + FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); unsigned long auxv = getauxval(AT_HWCAP); @@ -226,7 +241,11 @@ } } - if (UseGHASHIntrinsics) { + if (auxv & HWCAP_PMULL) { + if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) { + FLAG_SET_DEFAULT(UseGHASHIntrinsics, true); + } + } else if (UseGHASHIntrinsics) { warning("GHASH intrinsics are not available on this CPU"); FLAG_SET_DEFAULT(UseGHASHIntrinsics, false); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/ppc/vm/frame_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/ppc/vm/frame_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/ppc/vm/frame_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/ppc/vm/frame_ppc.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -67,8 +67,8 @@ return false; } - // Unextended sp must be within the stack and above or equal sp - bool unextended_sp_safe = (unextended_sp < thread->stack_base()) && (unextended_sp >= sp); + // Unextended sp must be within the stack + bool unextended_sp_safe = (unextended_sp < thread->stack_base()); if (!unextended_sp_safe) { return false; @@ -76,9 +76,10 @@ // An fp must be within the stack and above (but not equal) sp. bool fp_safe = (fp <= thread->stack_base()) && (fp > sp); - // an interpreter fp must be within the stack and above (but not equal) sp - bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && - ((fp - sp) >= (ijava_state_size + top_ijava_frame_abi_size)); + // An interpreter fp must be within the stack and above (but not equal) sp. + // Moreover, it must be at least the size of the ijava_state structure. + bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && + ((fp - sp) >= ijava_state_size); // We know sp/unextended_sp are safe, only fp is questionable here diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/sparc/vm/assembler_sparc.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/sparc/vm/assembler_sparc.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/sparc/vm/assembler_sparc.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/sparc/vm/assembler_sparc.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -363,6 +363,13 @@ return is_in_wdisp_range(a, b, 30); } + static bool is_simm5(intptr_t x) { return is_simm(x, 5); } + static bool is_simm11(intptr_t x) { return is_simm(x, 11); } + static bool is_simm12(intptr_t x) { return is_simm(x, 12); } + static bool is_simm13(intptr_t x) { return is_simm(x, 13); } + + static int min_simm13() { return -4096; } + enum ASIs { // page 72, v9 ASI_PRIMARY = 0x80, ASI_PRIMARY_NOFAULT = 0x82, diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/x86/vm/c1_Runtime1_x86.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/x86/vm/c1_Runtime1_x86.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/x86/vm/c1_Runtime1_x86.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/x86/vm/c1_Runtime1_x86.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -172,8 +172,8 @@ #ifdef _LP64 // if there is any conflict use the stack if (arg1 == c_rarg2 || arg1 == c_rarg3 || - arg2 == c_rarg1 || arg1 == c_rarg3 || - arg3 == c_rarg1 || arg1 == c_rarg2) { + arg2 == c_rarg1 || arg2 == c_rarg3 || + arg3 == c_rarg1 || arg3 == c_rarg2) { push(arg3); push(arg2); push(arg1); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/x86/vm/templateTable_x86_64.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/x86/vm/templateTable_x86_64.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/cpu/x86/vm/templateTable_x86_64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/cpu/x86/vm/templateTable_x86_64.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -107,10 +107,6 @@ return Address(rsp, Interpreter::expr_offset_in_bytes(2)); } -static inline Address at_tos_p3() { - return Address(rsp, Interpreter::expr_offset_in_bytes(3)); -} - // Condition conversion static Assembler::Condition j_not(TemplateTable::Condition cc) { switch (cc) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os/aix/vm/decoder_aix.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os/aix/vm/decoder_aix.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os/aix/vm/decoder_aix.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os/aix/vm/decoder_aix.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -32,7 +32,7 @@ AIXDecoder() { _decoder_status = no_error; } - ~AIXDecoder() {} + virtual ~AIXDecoder() {} virtual bool can_decode_C_frame_in_vm() const { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os/bsd/vm/decoder_machO.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os/bsd/vm/decoder_machO.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os/bsd/vm/decoder_machO.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os/bsd/vm/decoder_machO.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -34,7 +34,7 @@ class MachODecoder : public AbstractDecoder { public: MachODecoder() { } - ~MachODecoder() { } + virtual ~MachODecoder() { } virtual bool can_decode_C_frame_in_vm() const { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os/windows/vm/decoder_windows.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os/windows/vm/decoder_windows.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os/windows/vm/decoder_windows.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os/windows/vm/decoder_windows.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -56,7 +56,7 @@ public: WindowsDecoder(); - ~WindowsDecoder() { uninitialize(); }; + virtual ~WindowsDecoder() { uninitialize(); }; bool can_decode_C_frame_in_vm() const; bool demangle(const char* symbol, char *buf, int buflen); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -178,7 +178,7 @@ // avoid unnecessary crash when libjsig is not preloaded, try handle signals // that do not require siginfo/ucontext first. - if (sig == SIGPIPE) { + if (sig == SIGPIPE || sig == SIGXFSZ) { if (os::Aix::chained_handler(sig, info, ucVoid)) { return 1; } else { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -846,7 +846,7 @@ *size = pthread_get_stacksize_np(self); // workaround for OS X 10.9.0 (Mavericks) // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages - if (pthread_main_np() == 1) { + if (::pthread_main_np() == 1) { if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) { char kern_osrelease[256]; size_t kern_osrelease_size = sizeof(kern_osrelease); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -185,7 +185,7 @@ // avoid unnecessary crash when libjsig is not preloaded, try handle signals // that do not require siginfo/ucontext first. - if (sig == SIGPIPE) { + if (sig == SIGPIPE || sig == SIGXFSZ) { if (os::Linux::chained_handler(sig, info, ucVoid)) { return true; } else { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -51,21 +51,22 @@ } if (ret_frame.is_interpreted_frame()) { - frame::ijava_state* istate = ret_frame.get_ijava_state(); - if (!((Method*)(istate->method))->is_metaspace_object()) { - return false; - } - uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/]; - uint64_t istate_bcp = istate->bcp; - uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base()); - uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size()); - if (istate_bcp >= code_start && istate_bcp < code_end) { - // we have a valid bcp, don't touch it, do nothing - } else if (reg_bcp >= code_start && reg_bcp < code_end) { - istate->bcp = reg_bcp; + frame::ijava_state *istate = ret_frame.get_ijava_state(); + const Method *m = (const Method*)(istate->method); + if (m == NULL || !m->is_valid_method()) return false; + if (!Metaspace::contains((const void*)m)) return false; + + uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/]; + uint64_t istate_bcp = istate->bcp; + uint64_t code_start = (uint64_t)(m->code_base()); + uint64_t code_end = (uint64_t)(m->code_base() + m->code_size()); + if (istate_bcp >= code_start && istate_bcp < code_end) { + // we have a valid bcp, don't touch it, do nothing + } else if (reg_bcp >= code_start && reg_bcp < code_end) { + istate->bcp = reg_bcp; } else { - return false; - } + return false; + } } if (!ret_frame.safe_for_sender(this)) { // nothing else to try if the frame isn't good diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/tools/hsdis/hsdis.c openjdk-8-8u312-b07/=unpacked-tar11=/src/share/tools/hsdis/hsdis.c --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/tools/hsdis/hsdis.c 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/tools/hsdis/hsdis.c 2021-10-20 10:12:18.000000000 +0000 @@ -150,15 +150,15 @@ event_callback_t event_callback_arg, void* event_stream_arg, printf_callback_t printf_callback_arg, void* printf_stream_arg, const char* options) { - decode_instructions_virtual((uintptr_t)start_pv, - (uintptr_t)end_pv, - (unsigned char*)start_pv, - (uintptr_t)end_pv - (uintptr_t)start_pv, - event_callback_arg, - event_stream_arg, - printf_callback_arg, - printf_stream_arg, - options, false); + return decode_instructions_virtual((uintptr_t)start_pv, + (uintptr_t)end_pv, + (unsigned char*)start_pv, + (uintptr_t)end_pv - (uintptr_t)start_pv, + event_callback_arg, + event_stream_arg, + printf_callback_arg, + printf_stream_arg, + options, false); } static void* decode(struct hsdis_app_data* app_data, const char* options) { @@ -237,6 +237,7 @@ case dis_condjsr: type = "condjsr"; break; case dis_dref: type = "dref"; break; case dis_dref2: type = "dref2"; break; + case dis_noninsn: type = "noninsn"; break; } strcpy(buf, close); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/adlc/formssel.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/adlc/formssel.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/adlc/formssel.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/adlc/formssel.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -3396,7 +3396,7 @@ // Count occurrences of operands names in the leaves of the instruction // match rule. void MatchNode::count_instr_names( Dict &names ) { - if( !this ) return; + if( this == NULL ) return; if( _lChild ) _lChild->count_instr_names(names); if( _rChild ) _rChild->count_instr_names(names); if( !_lChild && !_rChild ) { @@ -3969,40 +3969,13 @@ } int MatchRule::is_ideal_copy() const { - if( _rChild ) { - const char *opType = _rChild->_opType; -#if 1 - if( strcmp(opType,"CastIP")==0 ) - return 1; -#else - if( strcmp(opType,"CastII")==0 ) - return 1; - // Do not treat *CastPP this way, because it - // may transfer a raw pointer to an oop. - // If the register allocator were to coalesce this - // into a single LRG, the GC maps would be incorrect. - //if( strcmp(opType,"CastPP")==0 ) - // return 1; - //if( strcmp(opType,"CheckCastPP")==0 ) - // return 1; - // - // Do not treat CastX2P or CastP2X this way, because - // raw pointers and int types are treated differently - // when saving local & stack info for safepoints in - // Output(). - //if( strcmp(opType,"CastX2P")==0 ) - // return 1; - //if( strcmp(opType,"CastP2X")==0 ) - // return 1; -#endif - } - if( is_chain_rule(_AD.globalNames()) && - _lChild && strncmp(_lChild->_opType,"stackSlot",9)==0 ) + if (is_chain_rule(_AD.globalNames()) && + _lChild && strncmp(_lChild->_opType, "stackSlot", 9) == 0) { return 1; + } return 0; } - int MatchRule::is_expensive() const { if( _rChild ) { const char *opType = _rChild->_opType; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/adlc/output_h.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/adlc/output_h.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/adlc/output_h.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/adlc/output_h.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2162,7 +2162,9 @@ public: OutputMachOpcodes(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD) : OutputMap(hpp, cpp, globals, AD, "MachOpcodes"), - begin_inst_chain_rule(-1), end_inst_chain_rule(-1), end_instructions(-1) + begin_inst_chain_rule(-1), end_inst_chain_rule(-1), + begin_rematerialize(-1), end_rematerialize(-1), + end_instructions(-1) {}; void declaration() { } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/asm/assembler.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/asm/assembler.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/asm/assembler.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/asm/assembler.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -298,28 +298,29 @@ void emit_double( jdouble x) { code_section()->emit_double( x); } void emit_address(address x) { code_section()->emit_address(x); } - // min and max values for signed immediate ranges - static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; } - static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; } - - // Define some: - static int min_simm10() { return min_simm(10); } - static int min_simm13() { return min_simm(13); } - static int min_simm16() { return min_simm(16); } - - // Test if x is within signed immediate range for nbits - static bool is_simm(intptr_t x, int nbits) { return min_simm(nbits) <= x && x <= max_simm(nbits); } - - // Define some: - static bool is_simm5( intptr_t x) { return is_simm(x, 5 ); } - static bool is_simm8( intptr_t x) { return is_simm(x, 8 ); } - static bool is_simm10(intptr_t x) { return is_simm(x, 10); } - static bool is_simm11(intptr_t x) { return is_simm(x, 11); } - static bool is_simm12(intptr_t x) { return is_simm(x, 12); } - static bool is_simm13(intptr_t x) { return is_simm(x, 13); } - static bool is_simm16(intptr_t x) { return is_simm(x, 16); } - static bool is_simm26(intptr_t x) { return is_simm(x, 26); } - static bool is_simm32(intptr_t x) { return is_simm(x, 32); } + enum { min_simm10 = -512 }; + + // Test if x is within signed immediate range for width. + static bool is_simm(int64_t x, uint w) { + precond(1 < w && w < 64); + int64_t limes = INT64_C(1) << (w - 1); + return -limes <= x && x < limes; + } + + static bool is_simm8(int64_t x) { return is_simm(x, 8); } + static bool is_simm9(int64_t x) { return is_simm(x, 9); } + static bool is_simm10(int64_t x) { return is_simm(x, 10); } + static bool is_simm16(int64_t x) { return is_simm(x, 16); } + static bool is_simm32(int64_t x) { return is_simm(x, 32); } + + // Test if x is within unsigned immediate range for width. + static bool is_uimm(uint64_t x, uint w) { + precond(0 < w && w < 64); + uint64_t limes = UINT64_C(1) << w; + return x < limes; + } + + static bool is_uimm12(uint64_t x) { return is_uimm(x, 12); } // Accessors CodeSection* code_section() const { return _code_section; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_Instruction.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_Instruction.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_Instruction.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_Instruction.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -2124,11 +2124,11 @@ // creation TableSwitch(Value tag, BlockList* sux, int lo_key, ValueStack* state_before, bool is_safepoint) : Switch(tag, sux, state_before, is_safepoint) - , _lo_key(lo_key) {} + , _lo_key(lo_key) { assert(_lo_key <= hi_key(), "integer overflow"); } // accessors int lo_key() const { return _lo_key; } - int hi_key() const { return _lo_key + length() - 1; } + int hi_key() const { return _lo_key + (length() - 1); } }; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_IR.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_IR.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_IR.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_IR.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -578,11 +578,8 @@ assert(is_visited(cur), "block must be visisted when block is active"); assert(parent != NULL, "must have parent"); - cur->set(BlockBegin::linear_scan_loop_header_flag); cur->set(BlockBegin::backward_branch_target_flag); - parent->set(BlockBegin::linear_scan_loop_end_flag); - // When a loop header is also the start of an exception handler, then the backward branch is // an exception edge. Because such edges are usually critical edges which cannot be split, the // loop must be excluded here from processing. @@ -591,6 +588,10 @@ _iterative_dominators = true; return; } + + cur->set(BlockBegin::linear_scan_loop_header_flag); + parent->set(BlockBegin::linear_scan_loop_end_flag); + assert(parent->number_of_sux() == 1 && parent->sux_at(0) == cur, "loop end blocks must have one successor (critical edges are split)"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_LIRGenerator.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_LIRGenerator.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_LIRGenerator.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_LIRGenerator.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2524,8 +2524,8 @@ move_to_phi(x->state()); int lo_key = x->lo_key(); - int hi_key = x->hi_key(); int len = x->length(); + assert(lo_key <= (lo_key + (len - 1)), "integer overflow"); LIR_Opr value = tag.result(); if (UseTableRanges) { do_SwitchRanges(create_lookup_ranges(x), value, x->default_sux()); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_RangeCheckElimination.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_RangeCheckElimination.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_RangeCheckElimination.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_RangeCheckElimination.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, 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 @@ -971,7 +971,7 @@ } else { // Has no upper bound Instruction *instr = ai->length(); - if (instr != NULL) instr = ai->array(); + if (instr == NULL) instr = ai->array(); update_bound(pushed, ai->index(), Instruction::lss, instr, 0); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_Runtime1.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_Runtime1.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_Runtime1.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_Runtime1.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -983,6 +983,7 @@ address copy_buff = stub_location - *byte_skip - *byte_count; address being_initialized_entry = stub_location - *being_initialized_entry_offset; if (TracePatching) { + ttyLocker ttyl; tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_ValueMap.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_ValueMap.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/c1/c1_ValueMap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/c1/c1_ValueMap.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -328,7 +328,7 @@ }; LoopInvariantCodeMotion::LoopInvariantCodeMotion(ShortLoopOptimizer *slo, GlobalValueNumbering* gvn, BlockBegin* loop_header, BlockList* loop_blocks) - : _gvn(gvn), _short_loop_optimizer(slo) { + : _gvn(gvn), _short_loop_optimizer(slo), _insertion_point(NULL), _state(NULL), _insert_is_pred(false) { TRACE_VALUE_NUMBERING(tty->print_cr("using loop invariant code motion loop_header = %d", loop_header->block_id())); TRACE_VALUE_NUMBERING(tty->print_cr("** loop invariant code motion for short loop B%d", loop_header->block_id())); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/classFileParser.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/classFileParser.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/classFileParser.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/classFileParser.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2801,8 +2801,7 @@ // Inner class index u2 inner_class_info_index = cfs->get_u2_fast(); check_property( - inner_class_info_index == 0 || - valid_klass_reference_at(inner_class_info_index), + valid_klass_reference_at(inner_class_info_index), "inner_class_info_index %u has bad constant type in class file %s", inner_class_info_index, CHECK_0); // Outer class index @@ -2812,6 +2811,13 @@ valid_klass_reference_at(outer_class_info_index), "outer_class_info_index %u has bad constant type in class file %s", outer_class_info_index, CHECK_0); + + if (outer_class_info_index != 0) { + const Symbol* const outer_class_name = cp->klass_name_at(outer_class_info_index); + char* bytes = (char*)outer_class_name->bytes(); + guarantee_property(bytes[0] != JVM_SIGNATURE_ARRAY, + "Outer class is an array class in class file %s", CHECK_0); + } // Inner class name u2 inner_name_index = cfs->get_u2_fast(); check_property( diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/classFileParser.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/classFileParser.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/classFileParser.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/classFileParser.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -139,7 +139,7 @@ u2 _contended_group; AnnotationCollector(Location location) - : _location(location), _annotations_present(0) + : _location(location), _annotations_present(0), _contended_group(0) { assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/classLoader.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/classLoader.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/classLoader.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/classLoader.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -39,7 +39,7 @@ int _num_meta_package_names; public: MetaIndex(char** meta_package_names, int num_meta_package_names); - ~MetaIndex(); + virtual ~MetaIndex(); bool may_contain(const char* class_name); }; @@ -61,6 +61,7 @@ virtual bool is_lazy(); // Constructor ClassPathEntry(); + virtual ~ClassPathEntry() {} // Attempt to locate file_name through this class path entry. // Returns a class file parsing stream if successfull. virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0; @@ -77,6 +78,7 @@ bool is_jar_file() { return false; } const char* name() { return _dir; } ClassPathDirEntry(const char* dir); + virtual ~ClassPathDirEntry() {} ClassFileStream* open_stream(const char* name, TRAPS); // Debugging NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) @@ -106,7 +108,7 @@ bool is_jar_file() { return true; } const char* name() { return _zip_name; } ClassPathZipEntry(jzfile* zip, const char* zip_name); - ~ClassPathZipEntry(); + virtual ~ClassPathZipEntry(); u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); void contents_do(void f(const char* name, void* context), void* context); @@ -134,6 +136,7 @@ bool is_jar_file(); const char* name() { return _path; } LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception); + virtual ~LazyClassPathEntry() {} u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/javaClasses.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/javaClasses.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/javaClasses.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/javaClasses.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1443,9 +1443,9 @@ method = mhandle(); } - _methods->short_at_put(_index, method->orig_method_idnum()); + _methods->ushort_at_put(_index, method->orig_method_idnum()); _bcis->int_at_put(_index, merge_bci_and_version(bci, method->constants()->version())); - _cprefs->short_at_put(_index, method->name_index()); + _cprefs->ushort_at_put(_index, method->name_index()); // We need to save the mirrors in the backtrace to keep the class // from being unloaded while we still have this stack trace. @@ -1562,10 +1562,10 @@ Handle mirror(THREAD, mirrors->obj_at(index)); // NULL mirror means end of stack trace if (mirror.is_null()) goto handle_cause; - int method = methods->short_at(index); + int method = methods->ushort_at(index); int version = version_at(bcis->int_at(index)); int bci = bci_at(bcis->int_at(index)); - int cpref = cprefs->short_at(index); + int cpref = cprefs->ushort_at(index); print_stack_element(st, mirror, method, version, bci, cpref); } result = objArrayHandle(THREAD, objArrayOop(result->obj_at(trace_next_offset))); @@ -1858,10 +1858,10 @@ assert(methods != NULL && bcis != NULL && mirrors != NULL, "sanity check"); - int method = methods->short_at(chunk_index); + int method = methods->ushort_at(chunk_index); int version = version_at(bcis->int_at(chunk_index)); int bci = bci_at(bcis->int_at(chunk_index)); - int cpref = cprefs->short_at(chunk_index); + int cpref = cprefs->ushort_at(chunk_index); Handle mirror(THREAD, mirrors->obj_at(chunk_index)); // Chunk can be partial full diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/verifier.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/verifier.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/classfile/verifier.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/classfile/verifier.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2145,6 +2145,7 @@ // Get field name and signature Symbol* field_name = cp->name_ref_at(index); Symbol* field_sig = cp->signature_ref_at(index); + bool is_getfield = false; if (!SignatureVerifier::is_valid_type_signature(field_sig)) { class_format_error( @@ -2195,11 +2196,9 @@ break; } case Bytecodes::_getfield: { + is_getfield = true; stack_object_type = current_frame->pop_stack( target_class_type, CHECK_VERIFY(this)); - for (int i = 0; i < n; i++) { - current_frame->push_stack(field_type[i], CHECK_VERIFY(this)); - } goto check_protected; } case Bytecodes::_putfield: { @@ -2229,6 +2228,15 @@ check_protected: { if (_this_type == stack_object_type) break; // stack_object_type must be assignable to _current_class_type + if (was_recursively_verified()) { + if (is_getfield) { + // Push field type for getfield. + for (int i = 0; i < n; i++) { + current_frame->push_stack(field_type[i], CHECK_VERIFY(this)); + } + } + return; + } Symbol* ref_class_name = cp->klass_name_at(cp->klass_ref_index_at(index)); if (!name_in_supers(ref_class_name, current_class())) @@ -2257,6 +2265,12 @@ } default: ShouldNotReachHere(); } + if (is_getfield) { + // Push field type for getfield after doing protection check. + for (int i = 0; i < n; i++) { + current_frame->push_stack(field_type[i], CHECK_VERIFY(this)); + } + } } // Look at the method's handlers. If the bci is in the handler's try block diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/codeBlob.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/codeBlob.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/codeBlob.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/codeBlob.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -201,6 +201,11 @@ return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); } +void CodeBlob::print_code() { + HandleMark hm; + ResourceMark m; + Disassembler::decode(this, tty); +} //---------------------------------------------------------------------------------------------------- // Implementation of BufferBlob diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/codeBlob.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/codeBlob.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/codeBlob.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/codeBlob.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -190,6 +190,7 @@ void print() const { print_on(tty); } virtual void print_on(outputStream* st) const; virtual void print_value_on(outputStream* st) const; + void print_code(); // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = ""); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/dependencies.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/dependencies.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/dependencies.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/dependencies.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -29,6 +29,7 @@ #include "ci/ciMethod.hpp" #include "code/dependencies.hpp" #include "compiler/compileLog.hpp" +#include "oops/klass.hpp" #include "oops/oop.inline.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" @@ -896,8 +897,9 @@ } else if (!k->oop_is_instance()) { return false; // no methods to find in an array type } else { - // Search class hierarchy first. - Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature); + // Search class hierarchy first, skipping private implementations + // as they never override any inherited methods + Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature, Klass::skip_private); if (!Dependencies::is_concrete_method(m, k)) { // Check for re-abstraction of method if (!k->is_interface() && m != NULL && m->is_abstract()) { @@ -907,7 +909,7 @@ ClassHierarchyWalker wf(_participants, _num_participants); Klass* w = wf.find_witness_subtype(k); if (w != NULL) { - Method* wm = InstanceKlass::cast(w)->find_instance_method(_name, _signature); + Method* wm = InstanceKlass::cast(w)->find_instance_method(_name, _signature, Klass::skip_private); if (!Dependencies::is_concrete_method(wm, w)) { // Found a concrete subtype 'w' which does not override abstract method 'm'. // Bail out because 'm' could be called with 'w' as receiver (leading to an @@ -967,8 +969,9 @@ // the spot-checking version: Klass* find_witness_in(KlassDepChange& changes, Klass* context_type, - bool participants_hide_witnesses); + bool participants_hide_witnesses); public: + bool witnessed_reabstraction_in_supers(Klass* k); Klass* find_witness_subtype(Klass* context_type, KlassDepChange* changes = NULL) { assert(doing_subtype_search(), "must set up a subtype search"); // When looking for unexpected concrete types, @@ -1042,7 +1045,6 @@ #define count_find_witness_calls() (0) #endif //PRODUCT - Klass* ClassHierarchyWalker::find_witness_in(KlassDepChange& changes, Klass* context_type, bool participants_hide_witnesses) { @@ -1080,15 +1082,13 @@ } } - if (is_witness(new_type) && - !ignore_witness(new_type)) { + if (is_witness(new_type) && !ignore_witness(new_type)) { return new_type; } return NULL; } - // Walk hierarchy under a context type, looking for unexpected types. // Do not report participant types, and recursively walk beneath // them only if participants_hide_witnesses is false. @@ -1207,6 +1207,32 @@ #undef ADD_SUBCLASS_CHAIN } +bool ClassHierarchyWalker::witnessed_reabstraction_in_supers(Klass* k) { + if (!k->oop_is_instance()) { + return false; // no methods to find in an array type + } else { + // Looking for a case when an abstract method is inherited into a concrete class. + if (Dependencies::is_concrete_klass(k) && !k->is_interface()) { + Method* m = InstanceKlass::cast(k)->find_instance_method(_name, _signature, Klass::skip_private); + if (m != NULL) { + return false; // no reabstraction possible: local method found + } + for (InstanceKlass* super = InstanceKlass::cast(k)->java_super(); super != NULL; super = super->java_super()) { + m = super->find_instance_method(_name, _signature, Klass::skip_private); + if (m != NULL) { // inherited method found + if (m->is_abstract() || m->is_overpass()) { + _found_methods[_num_participants] = m; + return true; // abstract method found + } + return false; + } + } + assert(false, "root method not found"); + return true; + } + return false; + } +} bool Dependencies::is_concrete_klass(Klass* k) { if (k->is_abstract()) return false; @@ -1442,16 +1468,109 @@ return num; } + +// Try to determine whether root method in some context is concrete or not based on the information about the unique method +// in that context. It exploits the fact that concrete root method is always inherited into the context when there's a unique method. +// Hence, unique method holder is always a supertype of the context class when root method is concrete. +// Examples for concrete_root_method +// C (C.m uniqm) +// | +// CX (ctxk) uniqm is inherited into context. +// +// CX (ctxk) (CX.m uniqm) here uniqm is defined in ctxk. +// Examples for !concrete_root_method +// CX (ctxk) +// | +// C (C.m uniqm) uniqm is in subtype of ctxk. +bool Dependencies::is_concrete_root_method(Method* uniqm, Klass* ctxk) { + if (uniqm == NULL) { + return false; // match Dependencies::is_concrete_method() behavior + } + // Theoretically, the "direction" of subtype check matters here. + // On one hand, in case of interface context with a single implementor, uniqm can be in a superclass of the implementor which + // is not related to context class. + // On another hand, uniqm could come from an interface unrelated to the context class, but right now it is not possible: + // it is required that uniqm->method_holder() is the participant (uniqm->method_holder() <: ctxk), hence a default method + // can't be used as unique. + if (ctxk->is_interface()) { + Klass* implementor = InstanceKlass::cast(ctxk)->implementor(); + assert(implementor != ctxk, "single implementor only"); // should have been invalidated earlier + ctxk = implementor; + } + InstanceKlass* holder = uniqm->method_holder(); + assert(!holder->is_interface(), "no default methods allowed"); + assert(ctxk->is_subclass_of(holder) || holder->is_subclass_of(ctxk), "not related"); + return ctxk->is_subclass_of(holder); +} + // If a class (or interface) has a unique concrete method uniqm, return NULL. // Otherwise, return a class that contains an interfering method. -Klass* Dependencies::check_unique_concrete_method(Klass* ctxk, Method* uniqm, - KlassDepChange* changes) { - // Here is a missing optimization: If uniqm->is_final(), - // we don't really need to search beneath it for overrides. - // This is probably not important, since we don't use dependencies - // to track final methods. (They can't be "definalized".) +Klass* Dependencies::check_unique_concrete_method(Klass* ctxk, + Method* uniqm, + KlassDepChange* changes) { ClassHierarchyWalker wf(uniqm->method_holder(), uniqm); - return wf.find_witness_definer(ctxk, changes); + Klass* witness = wf.find_witness_definer(ctxk, changes); + if (witness != NULL) { + return witness; + } + if (!Dependencies::is_concrete_root_method(uniqm, ctxk) || changes != NULL) { + Klass* conck = find_witness_AME(ctxk, uniqm, changes); + if (conck != NULL) { + // Found a concrete subtype 'conck' which does not override abstract root method. + return conck; + } + } + return NULL; +} + +// Search for AME. +// There are two version of checks. +// 1) Spot checking version(Classload time). Newly added class is checked for AME. +// Checks whether abstract/overpass method is inherited into/declared in newly added concrete class. +// 2) Compile time analysis for abstract/overpass(abstract klass) root_m. The non uniqm subtrees are checked for concrete classes. +Klass* Dependencies::find_witness_AME(Klass* ctxk, Method* m, KlassDepChange* changes) { + if (m != NULL) { + if (changes != NULL) { + // Spot checking version. + ClassHierarchyWalker wf(m); + Klass* new_type = changes->new_type(); + if (wf.witnessed_reabstraction_in_supers(new_type)) { + return new_type; + } + } else { + // Note: It is required that uniqm->method_holder() is the participant (see ClassHierarchyWalker::found_method()). + ClassHierarchyWalker wf(m->method_holder()); + Klass* conck = wf.find_witness_subtype(ctxk); + if (conck != NULL) { + Method* cm = InstanceKlass::cast(conck)->find_instance_method(m->name(), m->signature(), Klass::skip_private); + if (!Dependencies::is_concrete_method(cm, conck)) { + return conck; + } + } + } + } + return NULL; +} + +// This function is used by find_unique_concrete_method(non vtable based) +// to check whether subtype method overrides the base method. +static bool overrides(Method* sub_m, Method* base_m) { + assert(base_m != NULL, "base method should be non null"); + if (sub_m == NULL) { + return false; + } + /** + * If base_m is public or protected then sub_m always overrides. + * If base_m is !public, !protected and !private (i.e. base_m is package private) + * then sub_m should be in the same package as that of base_m. + * For package private base_m this is conservative approach as it allows only subset of all allowed cases in + * the jvm specification. + **/ + if (base_m->is_public() || base_m->is_protected() || + base_m->method_holder()->is_same_class_package(sub_m->method_holder())) { + return true; + } + return false; } // Find the set of all non-abstract methods under ctxk that match m. @@ -1474,7 +1593,14 @@ // (This can happen if m is inherited into ctxk and fm overrides it.) return NULL; } + } else if (Dependencies::find_witness_AME(ctxk, fm) != NULL) { + // Found a concrete subtype which does not override abstract root method. + return NULL; + } else if (!overrides(fm, m)) { + // Found method doesn't override abstract root method. + return NULL; } + assert(Dependencies::is_concrete_root_method(fm, ctxk) == Dependencies::is_concrete_method(m, ctxk), "mismatch"); #ifndef PRODUCT // Make sure the dependency mechanism will pass this discovery: if (VerifyDependencies && fm != NULL) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/dependencies.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/dependencies.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/dependencies.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/dependencies.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -290,6 +290,9 @@ static bool is_concrete_method(Method* m, Klass* k); // m is invocable static Klass* find_finalizable_subclass(Klass* k); + static bool is_concrete_root_method(Method* uniqm, Klass* ctxk); + static Klass* find_witness_AME(Klass* ctxk, Method* m, KlassDepChange* changes = NULL); + // These versions of the concreteness queries work through the CI. // The CI versions are allowed to skew sometimes from the VM // (oop-based) versions. The cost of such a difference is a diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/nmethod.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/nmethod.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/nmethod.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/nmethod.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2612,6 +2612,7 @@ ResourceMark rm(thread); CodeBlob* cb = CodeCache::find_blob(pc); assert(cb != NULL && cb == this, ""); + ttyLocker ttyl; tty->print_cr("implicit exception happened at " INTPTR_FORMAT, pc); print(); method()->print_codes(); @@ -2933,13 +2934,6 @@ nul_chk_table_size()); } -void nmethod::print_code() { - HandleMark hm; - ResourceMark m; - Disassembler::decode(this); -} - - #ifndef PRODUCT void nmethod::print_scopes() { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/nmethod.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/nmethod.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/code/nmethod.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/code/nmethod.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -695,7 +695,6 @@ // printing support void print() const; - void print_code(); void print_relocations() PRODUCT_RETURN; void print_pcs() PRODUCT_RETURN; void print_scopes() PRODUCT_RETURN; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/compiler/disassembler.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/compiler/disassembler.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/compiler/disassembler.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/compiler/disassembler.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -92,7 +92,7 @@ { // Match "jvm[^/]*" in jvm_path. const char* base = buf; - const char* p = strrchr(buf, '/'); + const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) lib_offset = p - base + 1; p = strstr(p ? p : base, "jvm"); if (p != NULL) jvm_offset = p - base; @@ -117,7 +117,7 @@ if (_library == NULL) { // 3. /jre/lib//hsdis-.so buf[lib_offset - 1] = '\0'; - const char* p = strrchr(buf, '/'); + const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) { lib_offset = p - buf + 1; strcpy(&buf[lib_offset], hsdis_library_name); @@ -507,6 +507,7 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) { + ttyLocker ttyl; if (!load_library()) return; decode_env env(cb, st); env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, cb); @@ -514,12 +515,14 @@ } void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) { + ttyLocker ttyl; if (!load_library()) return; decode_env env(CodeCache::find_blob_unsafe(start), st, c); env.decode_instructions(start, end); } void Disassembler::decode(nmethod* nm, outputStream* st) { + ttyLocker ttyl; if (!load_library()) return; decode_env env(nm, st); env.output()->print_cr("Decoding compiled method " PTR_FORMAT ":", nm); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -22,10 +22,6 @@ * */ -#if !defined(__clang_major__) && defined(__GNUC__) -#define ATTRIBUTE_PRINTF(x,y) // FIXME, formats are a mess. -#endif - #include "precompiled.hpp" #include "classfile/metadataOnStackMark.hpp" #include "code/codeCache.hpp" @@ -232,7 +228,7 @@ if (!curr->is_young()) { gclog_or_tty->print_cr("### YOUNG REGION " PTR_FORMAT "-" PTR_FORMAT " " "incorrectly tagged (y: %d, surv: %d)", - curr->bottom(), curr->end(), + p2i(curr->bottom()), p2i(curr->end()), curr->is_young(), curr->is_survivor()); ret = false; } @@ -361,8 +357,8 @@ while (curr != NULL) { gclog_or_tty->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT ", N: " PTR_FORMAT ", age: %4d", HR_FORMAT_PARAMS(curr), - curr->prev_top_at_mark_start(), - curr->next_top_at_mark_start(), + p2i(curr->prev_top_at_mark_start()), + p2i(curr->next_top_at_mark_start()), curr->age_in_surv_rate_group_cond()); curr = curr->get_next_young_region(); } @@ -487,7 +483,7 @@ RedirtyLoggedCardTableEntryClosure redirty; dcqs.apply_closure_to_all_completed_buffers(&redirty); dcqs.iterate_closure_all_threads(&redirty, false); - gclog_or_tty->print_cr("Log entries = %d, dirty cards = %d.", + gclog_or_tty->print_cr("Log entries = " SIZE_FORMAT ", dirty cards = %d.", clear.num_processed(), orig_count); guarantee(redirty.num_processed() == clear.num_processed(), err_msg("Redirtied " SIZE_FORMAT " cards, bug cleared " SIZE_FORMAT, @@ -2690,8 +2686,8 @@ gclog_or_tty->print_cr("Region " HR_FORMAT ", " "HS = " PTR_FORMAT ", should be " PTR_FORMAT, HR_FORMAT_PARAMS(r), - r->humongous_start_region(), - _sh_region); + p2i(r->humongous_start_region()), + p2i(_sh_region)); ++_failures; } } @@ -3002,9 +2998,9 @@ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); if (_g1h->is_obj_dead_cond(obj, _vo)) { gclog_or_tty->print_cr("Root location " PTR_FORMAT " " - "points to dead obj " PTR_FORMAT, p, (void*) obj); + "points to dead obj " PTR_FORMAT, p2i(p), p2i(obj)); if (_vo == VerifyOption_G1UseMarkWord) { - gclog_or_tty->print_cr(" Mark word: " PTR_FORMAT, (void*)(obj->mark())); + gclog_or_tty->print_cr(" Mark word: " INTPTR_FORMAT, (intptr_t)obj->mark()); } obj->print_on(gclog_or_tty); _failures = true; @@ -3052,9 +3048,9 @@ // contains the nmethod if (!hrrs->strong_code_roots_list_contains(_nm)) { gclog_or_tty->print_cr("Code root location " PTR_FORMAT " " - "from nmethod " PTR_FORMAT " not in strong " - "code roots for region [" PTR_FORMAT "," PTR_FORMAT ")", - p, _nm, hr->bottom(), hr->end()); + "from nmethod " PTR_FORMAT " not in strong " + "code roots for region [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(p), p2i(_nm), p2i(hr->bottom()), p2i(hr->end())); _failures = true; } } @@ -3110,7 +3106,7 @@ _young_ref_counter_closure.reset_count(); k->oops_do(&_young_ref_counter_closure); if (_young_ref_counter_closure.count() > 0) { - guarantee(k->has_modified_oops(), err_msg("Klass %p, has young refs but is not dirty.", k)); + guarantee(k->has_modified_oops(), err_msg("Klass " PTR_FORMAT ", has young refs but is not dirty.", p2i(k))); } } }; @@ -3185,7 +3181,7 @@ size_t word_sz = o->size(); gclog_or_tty->print("\nPrinting obj " PTR_FORMAT " of size " SIZE_FORMAT " isMarkedPrev %d isMarkedNext %d isAllocSince %d\n", - (void*) o, word_sz, + p2i(o), word_sz, _g1->isMarkedPrev(o), _g1->isMarkedNext(o), _hr->obj_allocated_since_prev_marking(o)); @@ -3194,7 +3190,7 @@ int *val; for (cur = start; cur < end; cur++) { val = (int *) cur; - gclog_or_tty->print("\t " PTR_FORMAT ":" PTR_FORMAT "\n", val, *val); + gclog_or_tty->print("\t " PTR_FORMAT ": %d\n", p2i(val), *val); } } } @@ -3232,7 +3228,7 @@ gclog_or_tty->print_cr("[" PTR_FORMAT "," PTR_FORMAT "] " "max_live_bytes " SIZE_FORMAT " " "< calculated " SIZE_FORMAT, - r->bottom(), r->end(), + p2i(r->bottom()), p2i(r->end()), r->max_live_bytes(), not_dead_yet_cl.live_bytes()); _failures = true; @@ -3449,10 +3445,10 @@ st->print(" %-20s", "garbage-first heap"); st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", capacity()/K, used_unlocked()/K); - st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - _hrm.reserved().start(), - _hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords, - _hrm.reserved().end()); + st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", + p2i(_hrm.reserved().start()), + p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords), + p2i(_hrm.reserved().end())); st->cr(); st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K); uint young_regions = _young_list->length(); @@ -3470,7 +3466,7 @@ // Print the per-region information. st->cr(); - st->print_cr("Heap Regions: (Y=young(eden), SU=young(survivor), " + st->print_cr("Heap Regions: (E=young(eden), S=young(survivor), O=old, " "HS=humongous(starts), HC=humongous(continues), " "CS=collection set, F=free, TS=gc time stamp, " "PTAMS=previous top-at-mark-start, " @@ -4450,7 +4446,7 @@ oop old) { assert(obj_in_cs(old), err_msg("obj: " PTR_FORMAT " should still be in the CSet", - (HeapWord*) old)); + p2i(old))); markOop m = old->mark(); oop forward_ptr = old->forward_to_atomic(old); if (forward_ptr == NULL) { @@ -4485,7 +4481,7 @@ assert(old == forward_ptr || !obj_in_cs(forward_ptr), err_msg("obj: " PTR_FORMAT " forwarded to: " PTR_FORMAT " " "should not be in the CSet", - (HeapWord*) old, (HeapWord*) forward_ptr)); + p2i(old), p2i(forward_ptr))); return forward_ptr; } } @@ -5379,8 +5375,7 @@ _par_scan_state->push_on_queue(p); } else { assert(!Metaspace::contains((const void*)p), - err_msg("Unexpectedly found a pointer from metadata: " - PTR_FORMAT, p)); + err_msg("Unexpectedly found a pointer from metadata: " PTR_FORMAT, p2i(p))); _copy_non_heap_obj_cl->do_oop(p); } } @@ -6062,14 +6057,14 @@ bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap, HeapWord* tams, HeapWord* end) { guarantee(tams <= end, - err_msg("tams: " PTR_FORMAT " end: " PTR_FORMAT, tams, end)); + err_msg("tams: " PTR_FORMAT " end: " PTR_FORMAT, p2i(tams), p2i(end))); HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end); if (result < end) { gclog_or_tty->cr(); gclog_or_tty->print_cr("## wrong marked address on %s bitmap: " PTR_FORMAT, - bitmap_name, result); + bitmap_name, p2i(result)); gclog_or_tty->print_cr("## %s tams: " PTR_FORMAT " end: " PTR_FORMAT, - bitmap_name, tams, end); + bitmap_name, p2i(tams), p2i(end)); return false; } return true; @@ -6406,10 +6401,10 @@ !r->rem_set()->is_empty()) { if (G1TraceEagerReclaimHumongousObjects) { - gclog_or_tty->print_cr("Live humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length " UINT32_FORMAT " with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", + gclog_or_tty->print_cr("Live humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length %u with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", region_idx, - obj->size()*HeapWordSize, - r->bottom(), + (size_t)obj->size()*HeapWordSize, + p2i(r->bottom()), r->region_num(), r->rem_set()->occupied(), r->rem_set()->strong_code_roots_list_length(), @@ -6425,13 +6420,13 @@ guarantee(obj->is_typeArray(), err_msg("Only eagerly reclaiming type arrays is supported, but the object " PTR_FORMAT " is not.", - r->bottom())); + p2i(r->bottom()))); if (G1TraceEagerReclaimHumongousObjects) { - gclog_or_tty->print_cr("Dead humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length " UINT32_FORMAT " with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", + gclog_or_tty->print_cr("Dead humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length %u with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", region_idx, - obj->size()*HeapWordSize, - r->bottom(), + (size_t)obj->size()*HeapWordSize, + p2i(r->bottom()), r->region_num(), r->rem_set()->occupied(), r->rem_set()->strong_code_roots_list_length(), @@ -6585,7 +6580,7 @@ bool doHeapRegion(HeapRegion* r) { if (r->is_young()) { gclog_or_tty->print_cr("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young", - r->bottom(), r->end()); + p2i(r->bottom()), p2i(r->end())); _success = false; } return false; @@ -6936,7 +6931,7 @@ assert(!hr->continuesHumongous(), err_msg("trying to add code root " PTR_FORMAT " in continuation of humongous region " HR_FORMAT " starting at " HR_FORMAT, - _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); + p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); // HeapRegion::add_strong_code_root_locked() avoids adding duplicate entries. hr->add_strong_code_root_locked(_nm); @@ -6963,7 +6958,7 @@ assert(!hr->continuesHumongous(), err_msg("trying to remove code root " PTR_FORMAT " in continuation of humongous region " HR_FORMAT " starting at " HR_FORMAT, - _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); + p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); hr->remove_strong_code_root(_nm); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -44,6 +44,7 @@ #include "memory/barrierSet.hpp" #include "memory/memRegion.hpp" #include "memory/sharedHeap.hpp" +#include "utilities/macros.hpp" #include "utilities/stack.hpp" // A "G1CollectedHeap" is an implementation of a java heap for HotSpot. @@ -1150,21 +1151,11 @@ // Do sanity check on the contents of the in-cset fast test table. bool check_cset_fast_test() PRODUCT_RETURN_( return true; ); - // verify_region_sets() performs verification over the region - // lists. It will be compiled in the product code to be used when - // necessary (i.e., during heap verification). void verify_region_sets(); // verify_region_sets_optional() is planted in the code for - // list verification in non-product builds (and it can be enabled in - // product builds by defining HEAP_REGION_SET_FORCE_VERIFY to be 1). -#if HEAP_REGION_SET_FORCE_VERIFY - void verify_region_sets_optional() { - verify_region_sets(); - } -#else // HEAP_REGION_SET_FORCE_VERIFY - void verify_region_sets_optional() { } -#endif // HEAP_REGION_SET_FORCE_VERIFY + // list verification in debug builds. + void verify_region_sets_optional() { DEBUG_ONLY(verify_region_sets();) } #ifdef ASSERT bool is_on_master_free_list(HeapRegion* hr) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -22,10 +22,6 @@ * */ -#ifndef __clang_major__ -#define ATTRIBUTE_PRINTF(x,y) // FIXME, formats are a mess. -#endif - #include "precompiled.hpp" #include "gc_implementation/g1/concurrentG1Refine.hpp" #include "gc_implementation/g1/concurrentMark.hpp" @@ -288,7 +284,7 @@ if (confidence_perc > 100) { confidence_perc = 100; warning("G1ConfidencePercent is set to a value that is too large, " - "it's been updated to %u", confidence_perc); + "it's been updated to " UINTX_FORMAT, confidence_perc); } _sigma = (double) confidence_perc / 100.0; @@ -310,7 +306,7 @@ if (reserve_perc > 50) { reserve_perc = 50; warning("G1ReservePercent is set to a value that is too large, " - "it's been updated to %u", reserve_perc); + "it's been updated to " UINTX_FORMAT, reserve_perc); } _reserve_factor = (double) reserve_perc / 100.0; // This will be set when the heap is expanded @@ -1853,7 +1849,7 @@ assert(csr->in_collection_set(), "bad CS"); st->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT "N: " PTR_FORMAT ", age: %4d", HR_FORMAT_PARAMS(csr), - csr->prev_top_at_mark_start(), csr->next_top_at_mark_start(), + p2i(csr->prev_top_at_mark_start()), p2i(csr->next_top_at_mark_start()), csr->age_in_surv_rate_group_cond()); csr = next; } @@ -2219,7 +2215,7 @@ void TraceGen0TimeData::print_summary_sd(const char* str, const NumberSeq* seq) const { print_summary(str, seq); - gclog_or_tty->print_cr("%+45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", + gclog_or_tty->print_cr("%45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", "(num", seq->num(), seq->sd(), seq->maximum()); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -160,40 +160,43 @@ } while (0) -#define ergo_verbose(_tag_, _action_) \ - ergo_verbose_common(_tag_, _action_, "", 0, 0, 0, 0, 0, 0) +#define ergo_verbose6(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ + ergo_verbose_common(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) -#define ergo_verbose0(_tag_, _action_, _extra_format_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, 0, 0, 0, 0, 0, 0) +#define ergo_verbose5(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \ + ergo_verbose6(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, "") -#define ergo_verbose1(_tag_, _action_, _extra_format_, \ - _arg0_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, 0, 0, 0, 0, 0) +#define ergo_verbose4(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_) \ + ergo_verbose5(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, _arg2_, _arg3_, "") + +#define ergo_verbose3(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_) \ + ergo_verbose4(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, _arg2_, "") #define ergo_verbose2(_tag_, _action_, _extra_format_, \ _arg0_, _arg1_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, 0, 0, 0, 0) + ergo_verbose3(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, "") -#define ergo_verbose3(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, 0, 0, 0) +#define ergo_verbose1(_tag_, _action_, _extra_format_, \ + _arg0_) \ + ergo_verbose2(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, "") -#define ergo_verbose4(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, 0, 0) -#define ergo_verbose5(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, 0) +#define ergo_verbose0(_tag_, _action_, _extra_format_) \ + ergo_verbose1(_tag_, _action_, _extra_format_ "%s", \ + "") + +#define ergo_verbose(_tag_, _action_) \ + ergo_verbose0(_tag_, _action_, "") -#define ergo_verbose6(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -33,7 +33,7 @@ bool doHeapRegion(HeapRegion* r) { EventG1HeapRegionInformation evt; evt.set_index(r->hrm_index()); - // XXX TODO evt.set_type(r->get_trace_type()); + evt.set_type(r->get_trace_type()); evt.set_start((uintptr_t)r->bottom()); evt.set_used(r->used()); evt.commit(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -26,18 +26,12 @@ #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_HPP #include "gc_implementation/g1/heapRegion.hpp" +#include "utilities/macros.hpp" // Large buffer for some cases where the output might be larger than normal. #define HRS_ERR_MSG_BUFSZ 512 typedef FormatBuffer hrs_err_msg; -// Set verification will be forced either if someone defines -// HEAP_REGION_SET_FORCE_VERIFY to be 1, or in builds in which -// asserts are compiled in. -#ifndef HEAP_REGION_SET_FORCE_VERIFY -#define HEAP_REGION_SET_FORCE_VERIFY defined(ASSERT) -#endif // HEAP_REGION_SET_FORCE_VERIFY - class hrs_ext_msg; class HRSMtSafeChecker : public CHeapObj { @@ -145,13 +139,7 @@ void verify_next_region(HeapRegion* hr); void verify_end(); -#if HEAP_REGION_SET_FORCE_VERIFY - void verify_optional() { - verify(); - } -#else // HEAP_REGION_SET_FORCE_VERIFY - void verify_optional() { } -#endif // HEAP_REGION_SET_FORCE_VERIFY + void verify_optional() { DEBUG_ONLY(verify();) } virtual void print_on(outputStream* out, bool print_contents = false); }; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2021, 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 @@ -401,7 +401,9 @@ start_array()->set_covered_region(new_memregion); Universe::heap()->barrier_set()->resize_covered_region(new_memregion); - // ALWAYS do this last!! + // The update of the space's end is done by this call. As that + // makes the new space available for concurrent allocation, this + // must be the last step when expanding. object_space()->initialize(new_memregion, SpaceDecorator::DontClear, SpaceDecorator::DontMangle); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -38,6 +38,7 @@ // we need to ensure that it is copied (see comment in // ParScanClosure::do_oop_work). Klass* objK = obj->klass(); + OrderAccess::loadload(); markOop m = obj->mark(); oop new_obj; if (m->is_marked()) { // Contains forwarding pointer. @@ -101,6 +102,7 @@ // overwritten with an overflow next pointer after the object is // forwarded. Klass* objK = obj->klass(); + OrderAccess::loadload(); markOop m = obj->mark(); oop new_obj; if (m->is_marked()) { // Contains forwarding pointer. diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/shared/mutableSpace.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/shared/mutableSpace.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/gc_implementation/shared/mutableSpace.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/gc_implementation/shared/mutableSpace.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2021, 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 @@ -28,6 +28,7 @@ #include "gc_implementation/shared/mutableSpace.hpp" #include "gc_implementation/shared/spaceDecorator.hpp" #include "oops/oop.inline.hpp" +#include "runtime/orderAccess.hpp" #include "runtime/safepoint.hpp" #include "runtime/thread.hpp" #endif // INCLUDE_ALL_GCS @@ -124,7 +125,11 @@ } set_bottom(mr.start()); - set_end(mr.end()); + // When expanding concurrently with callers of cas_allocate, setting end + // makes the new space available for allocation by other threads. So this + // assignment must follow all other configuration and initialization that + // might be done for expansion. + OrderAccess::release_store_ptr(end_addr(), mr.end()); if (clear_space) { clear(mangle_space); @@ -192,7 +197,11 @@ // This version is lock-free. HeapWord* MutableSpace::cas_allocate(size_t size) { do { - HeapWord* obj = top(); + // Read top before end, else the range check may pass when it shouldn't. + // If end is read first, other threads may advance end and top such that + // current top > old end and current top + size > current end. Then + // pointer_delta underflows, allowing installation of top > current end. + HeapWord* obj = (HeapWord*)OrderAccess::load_ptr_acquire(top_addr()); if (pointer_delta(end(), obj) >= size) { HeapWord* new_top = obj + size; HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/interpreter/interpreterRuntime.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/interpreter/interpreterRuntime.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/interpreter/interpreterRuntime.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/interpreter/interpreterRuntime.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1209,6 +1209,7 @@ } else { // debugging suppport if (PrintSignatureHandlers) { + ttyLocker ttyl; tty->cr(); tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)", _handlers->length(), diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -238,6 +238,10 @@ JfrJavaLog::log(tag_set, level, message, thread); JVM_END +JVM_ENTRY_NO_ENV(jboolean, jfr_should_log(JNIEnv* env, jobject jvm, jint level)) + return JfrJavaLog::should_log(level, thread) ? JNI_TRUE : JNI_FALSE; +JVM_END + JVM_ENTRY_NO_ENV(void, jfr_subscribe_log_level(JNIEnv* env, jobject jvm, jobject log_tag, jint id)) JfrJavaLog::subscribe_log_level(log_tag, id, thread); JVM_END diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethod.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -67,6 +67,8 @@ void JNICALL jfr_log(JNIEnv* env, jobject jvm, jint tag_set, jint level, jstring message); +jboolean JNICALL jfr_should_log(JNIEnv* env, jobject jvm, jint level); + void JNICALL jfr_retransform_classes(JNIEnv* env, jobject jvm, jobjectArray classes); void JNICALL jfr_set_enabled(JNIEnv* env, jobject jvm, jlong event_type_id, jboolean enabled); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -49,6 +49,7 @@ (char*)"getTicksFrequency", (char*)"()J", (void*)jfr_elapsed_frequency, (char*)"subscribeLogLevel", (char*)"(Ljdk/jfr/internal/LogTag;I)V", (void*)jfr_subscribe_log_level, (char*)"log", (char*)"(IILjava/lang/String;)V", (void*)jfr_log, + (char*)"shouldLog", (char*)"(I)Z", (void*)jfr_should_log, (char*)"retransformClasses", (char*)"([Ljava/lang/Class;)V", (void*)jfr_retransform_classes, (char*)"setEnabled", (char*)"(JZ)V", (void*)jfr_set_enabled, (char*)"setFileNotification", (char*)"(J)V", (void*)jfr_set_file_notification, diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -151,13 +151,12 @@ } void MonitorInflateCauseConstant::serialize(JfrCheckpointWriter& writer) { - // XXX no such counters. implement? -// static const u4 nof_entries = ObjectSynchronizer::inflate_cause_nof; -// writer.write_count(nof_entries); -// for (u4 i = 0; i < nof_entries; ++i) { -// writer.write_key(i); -// writer.write(ObjectSynchronizer::inflate_cause_name((ObjectSynchronizer::InflateCause)i)); -// } + static const u4 nof_entries = ObjectSynchronizer::inflate_cause_nof; + writer.write_count(nof_entries); + for (u4 i = 0; i < nof_entries; ++i) { + writer.write_key(i); + writer.write(ObjectSynchronizer::inflate_cause_name((ObjectSynchronizer::InflateCause)i)); + } } void GCCauseConstant::serialize(JfrCheckpointWriter& writer) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ const julong MAX_ADJUSTED_GLOBAL_BUFFER_SIZE = 1 * M; const julong MIN_ADJUSTED_GLOBAL_BUFFER_SIZE_CUTOFF = 512 * K; const julong MIN_GLOBAL_BUFFER_SIZE = 64 * K; +const julong MAX_GLOBAL_BUFFER_SIZE = 2 * G; // implies at least 2 * MIN_GLOBAL_BUFFER SIZE const julong MIN_BUFFER_COUNT = 2; // MAX global buffer count open ended @@ -36,6 +37,7 @@ // MAX thread local buffer size == size of a single global buffer (runtime determined) // DEFAULT thread local buffer size = 2 * os page size (runtime determined) const julong MIN_THREAD_BUFFER_SIZE = 4 * K; +const julong MAX_THREAD_BUFFER_SIZE = 2 * G; const julong MIN_MEMORY_SIZE = 1 * M; const julong DEFAULT_MEMORY_SIZE = 10 * M; @@ -304,6 +306,11 @@ options->global_buffer_size = div_total_by_units(options->memory_size, options->buffer_count); if (options->thread_buffer_size > options->global_buffer_size) { options->global_buffer_size = options->thread_buffer_size; + if (options->memory_size_configured) { + options->buffer_count = div_total_by_per_unit(options->memory_size, options->global_buffer_size); + } else { + options->memory_size = multiply(options->global_buffer_size, options->buffer_count); + } options->buffer_count = div_total_by_per_unit(options->memory_size, options->global_buffer_size); } assert(options->global_buffer_size >= options->thread_buffer_size, "invariant"); @@ -323,7 +330,8 @@ assert(options->memory_size % os::vm_page_size() == 0, "invariant"); assert(options->global_buffer_size % os::vm_page_size() == 0, "invariant"); assert(options->thread_buffer_size % os::vm_page_size() == 0, "invariant"); - assert(options->buffer_count > 0, "invariant"); + assert(options->buffer_count >= MIN_BUFFER_COUNT, "invariant"); + assert(options->global_buffer_size >= options->thread_buffer_size, "invariant"); } #endif @@ -428,6 +436,10 @@ default: default_size(options); } + if (options->buffer_count < MIN_BUFFER_COUNT || + options->global_buffer_size < options->thread_buffer_size) { + return false; + } DEBUG_ONLY(assert_post_condition(options);) return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, 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,6 +32,8 @@ extern const julong MIN_GLOBAL_BUFFER_SIZE; extern const julong MIN_MEMORY_SIZE; extern const julong MIN_THREAD_BUFFER_SIZE; +extern const julong MAX_GLOBAL_BUFFER_SIZE; +extern const julong MAX_THREAD_BUFFER_SIZE; struct JfrMemoryOptions { julong memory_size; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, 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 @@ -390,34 +390,41 @@ return value; } -template -static void log_lower_than_min_value(Argument& memory_argument, julong min_value) { +static const char higher_than_msg[] = "This value is higher than the maximum size limited "; +static const char lower_than_msg[] = "This value is lower than the minimum size required "; +template +static void log_out_of_range_value(Argument& memory_argument, julong min_value) { + const char* msg = lower ? lower_than_msg : higher_than_msg; if (memory_argument.value()._size != memory_argument.value()._val) { // has multiplier tty->print_cr( - "This value is lower than the minimum size required " JULONG_FORMAT "%c", + "%s" JULONG_FORMAT "%c", msg, divide_with_user_unit(memory_argument, min_value), memory_argument.value()._multiplier); return; } tty->print_cr( - "This value is lower than the minimum size required " JULONG_FORMAT, + "%s" JULONG_FORMAT, msg, divide_with_user_unit(memory_argument, min_value)); } +static const char default_val_msg[] = "Value default for option "; +static const char specified_val_msg[] = "Value specified for option "; template static void log_set_value(Argument& memory_argument) { if (memory_argument.value()._size != memory_argument.value()._val) { // has multiplier tty->print_cr( - "Value specified for option \"%s\" is " JULONG_FORMAT "%c", + "%s\"%s\" is " JULONG_FORMAT "%c", + memory_argument.is_set() ? specified_val_msg: default_val_msg, memory_argument.name(), memory_argument.value()._val, memory_argument.value()._multiplier); return; } tty->print_cr( - "Value specified for option \"%s\" is " JULONG_FORMAT, + "%s\"%s\" is " JULONG_FORMAT, + memory_argument.is_set() ? specified_val_msg: default_val_msg, memory_argument.name(), memory_argument.value()._val); } @@ -538,6 +545,10 @@ return false; } } + } else if (options.thread_buffer_size_configured && options.memory_size_configured) { + if (!ensure_first_gteq_second(_dcmd_memorysize, _dcmd_threadbuffersize)) { + return false; + } } return true; } @@ -606,7 +617,7 @@ static bool ensure_gteq(Argument& memory_argument, const jlong value) { if ((jlong)memory_argument.value()._size < value) { log_set_value(memory_argument); - log_lower_than_min_value(memory_argument, value); + log_out_of_range_value(memory_argument, value); return false; } return true; @@ -637,6 +648,30 @@ return true; } +template +static bool ensure_lteq(Argument& memory_argument, const jlong value) { + if ((jlong)memory_argument.value()._size > value) { + log_set_value(memory_argument); + log_out_of_range_value(memory_argument, value); + return false; + } + return true; +} + +static bool ensure_valid_maximum_sizes() { + if (_dcmd_globalbuffersize.is_set()) { + if (!ensure_lteq(_dcmd_globalbuffersize, MAX_GLOBAL_BUFFER_SIZE)) { + return false; + } + } + if (_dcmd_threadbuffersize.is_set()) { + if (!ensure_lteq(_dcmd_threadbuffersize, MAX_THREAD_BUFFER_SIZE)) { + return false; + } + } + return true; +} + /** * Starting with the initial set of memory values from the user, * sanitize, enforce min/max rules and adjust to a set of consistent options. @@ -644,7 +679,7 @@ * Adjusted memory sizes will be page aligned. */ bool JfrOptionSet::adjust_memory_options() { - if (!ensure_valid_minimum_sizes()) { + if (!ensure_valid_minimum_sizes() || !ensure_valid_maximum_sizes()) { return false; } JfrMemoryOptions options; @@ -653,6 +688,24 @@ return false; } if (!JfrMemorySizer::adjust_options(&options)) { + if (options.buffer_count < MIN_BUFFER_COUNT || options.global_buffer_size < options.thread_buffer_size) { + log_set_value(_dcmd_memorysize); + log_set_value(_dcmd_globalbuffersize); + tty->print_cr("%s \"%s\" is " JLONG_FORMAT, + _dcmd_numglobalbuffers.is_set() ? specified_val_msg: default_val_msg, + _dcmd_numglobalbuffers.name(), _dcmd_numglobalbuffers.value()); + log_set_value(_dcmd_threadbuffersize); + if (options.buffer_count < MIN_BUFFER_COUNT) { + tty->print_cr("numglobalbuffers " JULONG_FORMAT " is less than minimal value " JULONG_FORMAT, + options.buffer_count, MIN_BUFFER_COUNT); + tty->print_cr("Decrease globalbuffersize/threadbuffersize or increase memorysize"); + } else { + tty->print_cr("globalbuffersize " JULONG_FORMAT " is less than threadbuffersize" JULONG_FORMAT, + options.global_buffer_size, options.thread_buffer_size); + tty->print_cr("Decrease globalbuffersize or increase memorysize or adjust global/threadbuffersize"); + } + return false; + } if (!check_for_ambiguity(_dcmd_memorysize, _dcmd_globalbuffersize, _dcmd_numglobalbuffers)) { return false; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -139,3 +139,7 @@ // log_tag_sets[tag_set].log_tag_set->log((LogLevelType)level, s); tty->print_cr("JFR: %s", s); } + +bool JfrJavaLog::should_log(jint level, TRAPS) { + return LogJFR; +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/jfr/utilities/jfrJavaLog.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -43,6 +43,7 @@ public: static void subscribe_log_level(jobject log_tag, jint id, TRAPS); static void log(jint tag_set, jint level, jstring message, TRAPS); + static bool should_log(jint level, TRAPS); }; #endif // SHARE_VM_JFR_UTILITIES_JFRJAVALOG_HPP diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/libadt/set.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/libadt/set.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/libadt/set.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/libadt/set.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -66,7 +66,7 @@ // The caller must deallocate the string. char *Set::setstr() const { - if( !this ) return os::strdup("{no set}"); + if( this == NULL ) return os::strdup("{no set}"); Set &set = clone(); // Virtually copy the basic set. set.Sort(); // Sort elements for in-order retrieval diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -45,9 +45,6 @@ //////////////////////////////////////////////////////////////////////////////// template -size_t TreeChunk::_min_tree_chunk_size = sizeof(TreeChunk)/HeapWordSize; - -template TreeChunk* TreeChunk::as_TreeChunk(Chunk_t* fc) { // Do some assertion checking here. return (TreeChunk*) fc; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/binaryTreeDictionary.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -163,15 +163,17 @@ Chunk_t* prev() const { return Chunk_t::prev(); } size_t size() const volatile { return Chunk_t::size(); } - static size_t min_size() { - return _min_tree_chunk_size; - } + static size_t min_size(); // debugging void verify_tree_chunk_list() const; void assert_is_mangled() const; }; +template +size_t TreeChunk::_min_tree_chunk_size = sizeof(TreeChunk)/HeapWordSize; +template +size_t TreeChunk::min_size() { return _min_tree_chunk_size; } template class BinaryTreeDictionary: public FreeBlockDictionary { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/filemap.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/filemap.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/filemap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/filemap.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -452,7 +452,7 @@ // close and remove the file. See bug 6372906. close(); remove(_full_path); - fail_stop("Unable to write to shared archive file.", NULL); + fail_stop("Unable to write to shared archive file."); } } _file_offset += nbytes; @@ -471,7 +471,7 @@ // that the written file is the correct length. _file_offset -= 1; if (lseek(_fd, (long)_file_offset, SEEK_SET) < 0) { - fail_stop("Unable to seek.", NULL); + fail_stop("Unable to seek."); } char zero = 0; write_bytes(&zero, 1); @@ -542,7 +542,7 @@ // other reserved memory (like the code cache). ReservedSpace rs(size, os::vm_allocation_granularity(), false, requested_addr); if (!rs.is_reserved()) { - fail_continue(err_msg("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr)); + fail_continue("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr); return rs; } // the reserved virtual memory is for mapping class data sharing archive @@ -566,7 +566,7 @@ requested_addr, size, si->_read_only, si->_allow_exec); if (base == NULL || base != si->_base) { - fail_continue(err_msg("Unable to map %s shared space at required address.", shared_region_name[i])); + fail_continue("Unable to map %s shared space at required address.", shared_region_name[i]); return NULL; } #ifdef _WINDOWS @@ -605,7 +605,7 @@ void FileMapInfo::assert_mark(bool check) { if (!check) { - fail_stop("Mark mismatch while restoring from shared file.", NULL); + fail_stop("Mark mismatch while restoring from shared file."); } } @@ -748,7 +748,7 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) { FileMapInfo *map_info = FileMapInfo::current_info(); if (map_info) { - map_info->fail_continue(msg); + map_info->fail_continue("%s", msg); for (int i = 0; i < MetaspaceShared::n_regions; i++) { if (map_info->_header->_space[i]._base != NULL) { map_info->unmap_region(i); @@ -756,6 +756,6 @@ } } } else if (DumpSharedSpaces) { - fail_stop(msg, NULL); + fail_stop("%s", msg); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/filemap.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/filemap.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/memory/filemap.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/memory/filemap.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -196,8 +196,8 @@ bool remap_shared_readonly_as_readwrite(); // Errors. - static void fail_stop(const char *msg, ...); - static void fail_continue(const char *msg, ...); + static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); + static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); // Return true if given address is in the mapped shared space. bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/oops/instanceKlass.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/oops/instanceKlass.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/oops/instanceKlass.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/oops/instanceKlass.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1494,18 +1494,22 @@ // find_instance_method looks up the name/signature in the local methods array // and skips over static methods -Method* InstanceKlass::find_instance_method( - Array* methods, Symbol* name, Symbol* signature) { +Method* InstanceKlass::find_instance_method(Array* methods, + Symbol* name, + Symbol* signature, + PrivateLookupMode private_mode) { Method* meth = InstanceKlass::find_method_impl(methods, name, signature, - find_overpass, skip_static, find_private); + find_overpass, skip_static, private_mode); assert(((meth == NULL) || !meth->is_static()), "find_instance_method should have skipped statics"); return meth; } // find_instance_method looks up the name/signature in the local methods array // and skips over static methods -Method* InstanceKlass::find_instance_method(Symbol* name, Symbol* signature) { - return InstanceKlass::find_instance_method(methods(), name, signature); +Method* InstanceKlass::find_instance_method(Symbol* name, + Symbol* signature, + PrivateLookupMode private_mode) { + return InstanceKlass::find_instance_method(methods(), name, signature, private_mode); } // Find looks up the name/signature in the local methods array diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/oops/instanceKlass.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/oops/instanceKlass.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/oops/instanceKlass.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/oops/instanceKlass.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -526,8 +526,11 @@ static Method* find_method(Array* methods, Symbol* name, Symbol* signature); // find a local method, but skip static methods - Method* find_instance_method(Symbol* name, Symbol* signature); - static Method* find_instance_method(Array* methods, Symbol* name, Symbol* signature); + Method* find_instance_method(Symbol* name, Symbol* signature, + PrivateLookupMode private_mode); + static Method* find_instance_method(Array* methods, + Symbol* name, Symbol* signature, + PrivateLookupMode private_mode); // find a local method (returns NULL if not found) Method* find_local_method(Symbol* name, Symbol* signature, diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/chaitin.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/chaitin.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/chaitin.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/chaitin.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2084,7 +2084,7 @@ // Dump a register name into a buffer. Be intelligent if we get called // before allocation is complete. char *PhaseChaitin::dump_register( const Node *n, char *buf ) const { - if( !this ) { // Not got anything? + if( this == NULL ) { // Not got anything? sprintf(buf,"N%d",n->_idx); // Then use Node index } else if( _node_regs ) { // Post allocation, use direct mappings, no LRG info available diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/compile.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/compile.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/compile.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/compile.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2086,13 +2086,16 @@ // They were inserted during parsing (see add_safepoint()) to make // infinite loops without calls or exceptions visible to root, i.e., // useful. -void Compile::remove_root_to_sfpts_edges() { +void Compile::remove_root_to_sfpts_edges(PhaseIterGVN& igvn) { Node *r = root(); if (r != NULL) { for (uint i = r->req(); i < r->len(); ++i) { Node *n = r->in(i); if (n != NULL && n->is_SafePoint()) { r->rm_prec(i); + if (n->outcnt() == 0) { + igvn.remove_dead_node(n); + } --i; } } @@ -2156,7 +2159,7 @@ // Now that all inlining is over, cut edge from root to loop // safepoints - remove_root_to_sfpts_edges(); + remove_root_to_sfpts_edges(igvn); // Remove the speculative part of types and clean up the graph from // the extra CastPP nodes whose only purpose is to carry them. Do diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/compile.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/compile.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/compile.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/compile.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -959,7 +959,7 @@ void inline_incrementally(PhaseIterGVN& igvn); void inline_string_calls(bool parse_time); void inline_boxing_calls(PhaseIterGVN& igvn); - void remove_root_to_sfpts_edges(); + void remove_root_to_sfpts_edges(PhaseIterGVN& igvn); // Matching, CFG layout, allocation, code generation PhaseCFG* cfg() { return _cfg; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/output.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/output.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/opto/output.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/opto/output.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -28,6 +28,7 @@ #include "code/debugInfo.hpp" #include "code/debugInfoRec.hpp" #include "compiler/compileBroker.hpp" +#include "compiler/disassembler.hpp" #include "compiler/oopMap.hpp" #include "memory/allocation.inline.hpp" #include "opto/callnode.hpp" @@ -1510,8 +1511,17 @@ } #ifdef ASSERT - if (n->size(_regalloc) < (current_offset-instr_offset)) { + uint n_size = n->size(_regalloc); + if (n_size < (current_offset-instr_offset)) { + MachNode* mach = n->as_Mach(); n->dump(); + mach->dump_format(_regalloc, tty); + tty->print_cr(" n_size (%d), current_offset (%d), instr_offset (%d)", n_size, current_offset, instr_offset); + Disassembler::decode(cb->insts_begin() + instr_offset, cb->insts_begin() + current_offset + 1, tty); + tty->print_cr(" ------------------- "); + BufferBlob* blob = this->scratch_buffer_blob(); + address blob_begin = blob->content_begin(); + Disassembler::decode(blob_begin, blob_begin + n_size + 1, tty); assert(false, "wrong size of mach node"); } #endif diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jni.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jni.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jni.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jni.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1454,7 +1454,7 @@ env, clazz, (uintptr_t) methodID); #endif /* USDT2 */ jobject obj = NULL; - DT_RETURN_MARK(NewObjectA, jobject, (const jobject)obj); + DT_RETURN_MARK(NewObjectA, jobject, (const jobject&)obj); instanceOop i = alloc_object(clazz, CHECK_NULL); obj = JNIHandles::make_local(env, i); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvm.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvm.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvm.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvm.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1772,6 +1772,18 @@ found = (k() == inner_klass); if (found && ooff != 0) { ok = i_cp->klass_at(ooff, CHECK_NULL); + if (!ok->oop_is_instance()) { + // If the outer class is not an instance klass then it cannot have + // declared any inner classes. + ResourceMark rm(THREAD); + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_IncompatibleClassChangeError(), + "%s and %s disagree on InnerClasses attribute", + ok->external_name(), + k->external_name()); + return NULL; + } outer_klass = instanceKlassHandle(thread, ok); *inner_is_member = true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvmtiEnvBase.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvmtiEnvBase.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvmtiEnvBase.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvmtiEnvBase.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1092,7 +1092,7 @@ // If the monitor has no owner, then a non-suspended contending // thread could potentially change the state of the monitor by // entering it. The JVM/TI spec doesn't allow this. - if (owning_thread == NULL && !at_safepoint & + if (owning_thread == NULL && !at_safepoint && !JvmtiEnv::is_thread_fully_suspended(pending_thread, true, &debug_bits)) { if (ret.owner != NULL) { destroy_jni_reference(calling_thread, ret.owner); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvmtiImpl.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvmtiImpl.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvmtiImpl.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvmtiImpl.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -64,6 +64,7 @@ class GrowableElement : public CHeapObj { public: + virtual ~GrowableElement() {} virtual address getCacheValue() =0; virtual bool equals(GrowableElement* e) =0; virtual bool lessThan(GrowableElement *e)=0; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvmtiTagMap.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvmtiTagMap.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/jvmtiTagMap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/jvmtiTagMap.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -2805,6 +2805,7 @@ return true; } +#ifdef ASSERT // verify that a static oop field is in range static inline bool verify_static_oop(InstanceKlass* ik, oop mirror, int offset) { @@ -2819,6 +2820,7 @@ return false; } } +#endif // #ifdef ASSERT // a class references its super class, interfaces, class loader, ... // and finally its static fields diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/methodHandles.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/methodHandles.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/prims/methodHandles.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/prims/methodHandles.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -972,6 +972,13 @@ return mname; } } + + if (new_index < len) { + assert(JNIHandles::resolve(this->at(new_index)) == NULL, "sanity"); + // destroy the old handle + JNIHandles::destroy_weak_global(this->at(new_index)); + } + // Not found, push the new one, or reuse empty slot this->at_put_grow(new_index, mem_name_wref); return new_mem_name; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/arguments.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/arguments.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/arguments.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/arguments.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -3314,6 +3314,12 @@ } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); + } else if (match_option(option, "-XX:+ErrorFileToStderr", &tail)) { + FLAG_SET_CMDLINE(bool, ErrorFileToStdout, false); + FLAG_SET_CMDLINE(bool, ErrorFileToStderr, true); + } else if (match_option(option, "-XX:+ErrorFileToStdout", &tail)) { + FLAG_SET_CMDLINE(bool, ErrorFileToStderr, false); + FLAG_SET_CMDLINE(bool, ErrorFileToStdout, true); } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { #if defined(DTRACE_ENABLED) FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/globals.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/globals.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/globals.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/globals.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -2712,6 +2712,12 @@ product(bool, DisplayVMOutputToStdout, false, \ "If DisplayVMOutput is true, display all VM output to stdout") \ \ + product(bool, ErrorFileToStderr, false, \ + "If true, error data is printed to stderr instead of a file") \ + \ + product(bool, ErrorFileToStdout, false, \ + "If true, error data is printed to stdout instead of a file") \ + \ product(bool, UseHeavyMonitors, false, \ "use heavyweight instead of lightweight Java monitors") \ \ diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/mutex.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/mutex.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/mutex.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/mutex.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -283,16 +283,6 @@ return x & 0x7FFFFFFF ; } -static inline jint MarsagliaXOR (jint * const a) { - jint x = *a ; - if (x == 0) x = UNS(a)|1 ; - x ^= x << 6; - x ^= ((unsigned)x) >> 21; - x ^= x << 7 ; - *a = x ; - return x & 0x7FFFFFFF ; -} - static int Stall (int its) { static volatile jint rv = 1 ; volatile int OnFrame = 0 ; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/perfData.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/perfData.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/perfData.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/perfData.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -288,7 +288,7 @@ void *_valuep; PerfData(CounterNS ns, const char* name, Units u, Variability v); - ~PerfData(); + virtual ~PerfData(); // create the entry for the PerfData item in the PerfData memory region. // this region is maintained separately from the PerfData objects to diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/safepoint.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/safepoint.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/safepoint.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/safepoint.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -1122,6 +1122,7 @@ if( nm->is_at_poll_return(real_return_addr) ) { // See if return type is an oop. bool return_oop = nm->method()->is_returning_oop(); + HandleMark hm(thread()); Handle return_value; if (return_oop) { // The oop result has been saved on the stack together with all diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/sharedRuntime.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/sharedRuntime.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/sharedRuntime.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/sharedRuntime.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -720,6 +720,7 @@ #endif if (t == NULL) { + ttyLocker ttyl; tty->print_cr("MISSING EXCEPTION HANDLER for pc " INTPTR_FORMAT " and handler bci %d", ret_pc, handler_bci); tty->print_cr(" Exception:"); exception->print(); @@ -2637,8 +2638,8 @@ BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache if (buf != NULL) { CodeBuffer buffer(buf); - double locs_buf[20]; - buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); + struct { double data[20]; } locs_buf; + buffer.insts()->initialize_shared_locs((relocInfo*)&locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); MacroAssembler _masm(&buffer); // Fill in the signature array, for the calling-convention call. diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/synchronizer.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/synchronizer.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/synchronizer.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/synchronizer.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -216,7 +216,9 @@ } } - ObjectSynchronizer::inflate(THREAD, object)->exit (true, THREAD) ; + ObjectSynchronizer::inflate(THREAD, + object, + inflate_cause_vm_internal)->exit(true, THREAD); } // ----------------------------------------------------------------------------- @@ -258,7 +260,9 @@ // must be non-zero to avoid looking like a re-entrant lock, // and must not look locked either. lock->set_displaced_header(markOopDesc::unused_mark()); - ObjectSynchronizer::inflate(THREAD, obj())->enter(THREAD); + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_monitor_enter)->enter(THREAD); } // This routine is used to handle interpreter/compiler slow case @@ -288,7 +292,9 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_vm_internal); return monitor->complete_exit(THREAD); } @@ -301,7 +307,9 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_vm_internal); monitor->reenter(recursion, THREAD); } @@ -316,7 +324,7 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } THREAD->set_current_pending_monitor_is_from_java(false); - ObjectSynchronizer::inflate(THREAD, obj())->enter(THREAD); + ObjectSynchronizer::inflate(THREAD, obj(), inflate_cause_jni_enter)->enter(THREAD); THREAD->set_current_pending_monitor_is_from_java(true); } @@ -342,7 +350,9 @@ } assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj, + inflate_cause_jni_exit); // If this thread has locked the object, exit the monitor. Note: can't use // monitor->check(CHECK); must exit even if an exception is pending. if (monitor->check(THREAD)) { @@ -385,7 +395,10 @@ TEVENT (wait - throw IAX) ; THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); } - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_wait); + DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), THREAD, millis); monitor->wait(millis, true, THREAD); @@ -404,7 +417,9 @@ TEVENT (wait - throw IAX) ; THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); } - ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD) ; + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_wait)->wait(millis, false, THREAD) ; } void ObjectSynchronizer::notify(Handle obj, TRAPS) { @@ -417,7 +432,9 @@ if (mark->has_locker() && THREAD->is_lock_owned((address)mark->locker())) { return; } - ObjectSynchronizer::inflate(THREAD, obj())->notify(THREAD); + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_notify)->notify(THREAD); } // NOTE: see comment of notify() @@ -431,7 +448,9 @@ if (mark->has_locker() && THREAD->is_lock_owned((address)mark->locker())) { return; } - ObjectSynchronizer::inflate(THREAD, obj())->notifyAll(THREAD); + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_notify)->notifyAll(THREAD); } // ----------------------------------------------------------------------------- @@ -686,7 +705,7 @@ } // Inflate the monitor to set hash code - monitor = ObjectSynchronizer::inflate(Self, obj); + monitor = ObjectSynchronizer::inflate(Self, obj, inflate_cause_hash_code); // Load displaced header and check it has hash code mark = monitor->header(); assert (mark->is_neutral(), "invariant") ; @@ -1183,12 +1202,29 @@ TEVENT (omFlush) ; } +const char* ObjectSynchronizer::inflate_cause_name(const InflateCause cause) { + switch (cause) { + case inflate_cause_vm_internal: return "VM Internal"; + case inflate_cause_monitor_enter: return "Monitor Enter"; + case inflate_cause_wait: return "Monitor Wait"; + case inflate_cause_notify: return "Monitor Notify"; + case inflate_cause_hash_code: return "Monitor Hash Code"; + case inflate_cause_jni_enter: return "JNI Monitor Enter"; + case inflate_cause_jni_exit: return "JNI Monitor Exit"; + default: + ShouldNotReachHere(); + } + return "Unknown"; +} + static void post_monitor_inflate_event(EventJavaMonitorInflate* event, - const oop obj) { + const oop obj, + const ObjectSynchronizer::InflateCause cause) { assert(event != NULL, "invariant"); assert(event->should_commit(), "invariant"); event->set_monitorClass(obj->klass()); event->set_address((uintptr_t)(void*)obj); + event->set_cause((u1)cause); event->commit(); } @@ -1200,7 +1236,9 @@ assert(mark->monitor()->header()->is_neutral(), "monitor must record a good object header"); return mark->monitor(); } - return ObjectSynchronizer::inflate(Thread::current(), obj); + return ObjectSynchronizer::inflate(Thread::current(), + obj, + inflate_cause_vm_internal); } @@ -1208,7 +1246,9 @@ // multiple locks occupy the same $ line. Padding might be appropriate. -ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) { +ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, + oop object, + const InflateCause cause) { // Inflate mutates the heap ... // Relaxing assertion for bug 6320749. assert (Universe::verify_in_progress() || @@ -1347,7 +1387,7 @@ } } if (event.should_commit()) { - post_monitor_inflate_event(&event, object); + post_monitor_inflate_event(&event, object, cause); } return m ; } @@ -1400,7 +1440,7 @@ } } if (event.should_commit()) { - post_monitor_inflate_event(&event, object); + post_monitor_inflate_event(&event, object, cause); } return m ; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/synchronizer.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/synchronizer.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/synchronizer.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/synchronizer.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -42,6 +42,18 @@ owner_none, owner_other } LockOwnership; + + typedef enum { + inflate_cause_vm_internal = 0, + inflate_cause_monitor_enter = 1, + inflate_cause_wait = 2, + inflate_cause_notify = 3, + inflate_cause_hash_code = 4, + inflate_cause_jni_enter = 5, + inflate_cause_jni_exit = 6, + inflate_cause_nof = 7 // Number of causes + } InflateCause; + // exit must be implemented non-blocking, since the compiler cannot easily handle // deoptimization at monitor exit. Hence, it does not take a Handle argument. @@ -90,9 +102,10 @@ static void omFlush (Thread * Self) ; // Inflate light weight monitor to heavy weight monitor - static ObjectMonitor* inflate(Thread * Self, oop obj); + static ObjectMonitor* inflate(Thread * Self, oop obj, const InflateCause cause); // This version is only for internal use static ObjectMonitor* inflate_helper(oop obj); + static const char* inflate_cause_name(const InflateCause cause); // Returns the identity hash value for an oop // NOTE: It may cause monitor inflation diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/vframe.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/vframe.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/runtime/vframe.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/runtime/vframe.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -397,6 +397,7 @@ // as it were a native compiled frame (no Java-level assumptions). #ifdef ASSERT if (WizardMode) { + ttyLocker ttyl; tty->print_cr("Error in fill_from_frame: pc_desc for " INTPTR_FORMAT " not found or invalid at %d", p2i(_frame.pc()), decode_offset); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/debug.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/debug.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/debug.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/debug.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -447,12 +447,13 @@ extern "C" void disnm(intptr_t p) { Command c("disnm"); CodeBlob* cb = CodeCache::find_blob((address) p); - nmethod* nm = cb->as_nmethod_or_null(); - if (nm) { - nm->print(); - Disassembler::decode(nm); - } else { - cb->print(); + if (cb != NULL) { + nmethod* nm = cb->as_nmethod_or_null(); + if (nm != NULL) { + nm->print(); + } else { + cb->print(); + } Disassembler::decode(cb); } } @@ -687,6 +688,7 @@ tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g."); tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or"); tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or"); + tty->print_cr(" pns($sp, $fp, $pc) on Linux/AArch64 or"); tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or"); tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC"); tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/debug.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/debug.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/debug.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/debug.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -156,6 +156,9 @@ #define assert_if_no_error(cond,msg) #endif // #ifdef ASSERT +#define precond(p) assert(p, "precond") +#define postcond(p) assert(p, "postcond") + // guarantee is like assert except it's always executed -- use it for // cheap tests that catch errors that would otherwise be hard to find. // guarantee is also used for Verify options. diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/decoder_elf.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/decoder_elf.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/decoder_elf.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/decoder_elf.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -37,7 +37,7 @@ _opened_elf_files = NULL; _decoder_status = no_error; } - ~ElfDecoder(); + virtual ~ElfDecoder(); bool can_decode_C_frame_in_vm() const { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/decoder.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/decoder.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/decoder.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/decoder.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -32,6 +32,7 @@ class AbstractDecoder : public CHeapObj { public: + virtual ~AbstractDecoder() {} // status code for decoding native C frame enum decoder_status { not_available = -10, // real decoder is not available @@ -78,7 +79,7 @@ _decoder_status = not_available; } - ~NullDecoder() {}; + virtual ~NullDecoder() {}; virtual bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -29,6 +29,11 @@ #define __STDC_FORMAT_MACROS #endif +// Needed for INT64_C and UINT64_C with ISO C99 libraries (see JDK-8272214) +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS +#endif + #ifdef TARGET_COMPILER_gcc # include "utilities/globalDefinitions_gcc.hpp" #endif diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions_visCPP.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions_visCPP.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions_visCPP.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/globalDefinitions_visCPP.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -77,6 +77,15 @@ // pointer is stored as integer value. #define NULL_WORD NULL +// Some MS Visual Studio versions do not seem to have INT64_C and UINT64_C +// even with __STDC_CONSTANT_MACROS defined. +#ifndef INT64_C +#define INT64_C(c) (c ## i64) +#endif +#ifndef UINT64_C +#define UINT64_C(c) (c ## ui64) +#endif + // Compiler-specific primitive types typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/hashtable.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/hashtable.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/hashtable.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/hashtable.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -94,8 +94,6 @@ return false; } -template juint RehashableHashtable::_seed = 0; - // Create a new table and using alternate hash code, populate the new table // with the existing elements. This can be used to change the hash code // and could in the future change the size of the table. @@ -219,7 +217,7 @@ if (*top + entry_size() > end) { report_out_of_shared_space(SharedMiscData); } - *p = (BasicHashtableEntry*)memcpy(*top, *p, entry_size()); + *p = (BasicHashtableEntry*)memcpy(*top, (void*)*p, entry_size()); *top += entry_size(); } } @@ -333,7 +331,7 @@ if (*top + len > end) { report_out_of_shared_space(SharedMiscData); } - _buckets = (HashtableBucket*)memcpy(*top, _buckets, len); + _buckets = (HashtableBucket*)memcpy(*top, (void*)_buckets, len); *top += len; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/hashtable.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/hashtable.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/hashtable.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/hashtable.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -314,8 +314,8 @@ // Function to move these elements into the new table. void move_to(RehashableHashtable* new_table); - static bool use_alternate_hashcode() { return _seed != 0; } - static juint seed() { return _seed; } + static bool use_alternate_hashcode(); + static juint seed(); static int literal_size(Symbol *symbol); static int literal_size(oop oop); @@ -333,6 +333,9 @@ static juint _seed; }; +template juint RehashableHashtable::_seed = 0; +template juint RehashableHashtable::seed() { return _seed; }; +template bool RehashableHashtable::use_alternate_hashcode() { return _seed != 0; }; // Verions of hashtable where two handles are used to compute the index. diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/ostream.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/ostream.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/ostream.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/ostream.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -673,7 +673,10 @@ static int vsnprintf_wrapper(char* buf, size_t len, const char* fmt, ...) { va_list args; va_start(args, fmt); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL int result = os::vsnprintf(buf, len, fmt, args); +PRAGMA_DIAG_POP va_end(args); return result; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/taskqueue.hpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/taskqueue.hpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/taskqueue.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/taskqueue.hpp 2021-10-20 10:12:18.000000000 +0000 @@ -430,9 +430,7 @@ } template -GenericTaskQueue::~GenericTaskQueue() { - FREE_C_HEAP_ARRAY(E, _elems, F); -} +GenericTaskQueue::~GenericTaskQueue() {} // OverflowTaskQueue is a TaskQueue that also includes an overflow stack for // elements that do not fit in the TaskQueue. diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/vmError.cpp openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/vmError.cpp --- openjdk-8-8u292-b10/=unpacked-tar11=/src/share/vm/utilities/vmError.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/src/share/vm/utilities/vmError.cpp 2021-10-20 10:12:18.000000000 +0000 @@ -984,12 +984,16 @@ } } - // print to screen + // Part 1: print an abbreviated version (the '#' section) to stdout. if (!out_done) { first_error->_verbose = false; - staticBufferStream sbs(buffer, sizeof(buffer), &out); - first_error->report(&sbs); + // Suppress this output if we plan to print Part 2 to stdout too. + // No need to have the "#" section twice. + if (!(ErrorFileToStdout && out.fd() == 1)) { + staticBufferStream sbs(buffer, sizeof(buffer), &out); + first_error->report(&sbs); + } out_done = true; @@ -997,6 +1001,7 @@ first_error->_current_step_info = ""; // reset current_step string } + // Part 2: print a full error log file (optionally to stdout or stderr). // print to error log file if (!log_done) { first_error->_verbose = true; @@ -1004,19 +1009,26 @@ // see if log file is already open if (!log.is_open()) { // open log file - int fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer)); - if (fd != -1) { - out.print_raw("# An error report file with more information is saved as:\n# "); - out.print_raw_cr(buffer); - - log.set_fd(fd); + int fd; + if (ErrorFileToStdout) { + fd = 1; + } else if (ErrorFileToStderr) { + fd = 2; } else { - out.print_raw_cr("# Can not save log file, dump to screen.."); - log.set_fd(defaultStream::output_fd()); - /* Error reporting currently needs dumpfile. - * Maybe implement direct streaming in the future.*/ - transmit_report_done = true; + fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer)); + if (fd != -1) { + out.print_raw("# An error report file with more information is saved as:\n# "); + out.print_raw_cr(buffer); + + } else { + out.print_raw_cr("# Can not save log file, dump to screen.."); + fd = defaultStream::output_fd(); + /* Error reporting currently needs dumpfile. + * Maybe implement direct streaming in the future.*/ + transmit_report_done = true; + } } + log.set_fd(fd); } staticBufferStream sbs(buffer, O_BUFLEN, &log); @@ -1034,7 +1046,7 @@ } } - if (log.fd() != defaultStream::output_fd()) { + if (log.fd() > 3) { close(log.fd()); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm --- openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm 2021-10-20 10:12:18.000000000 +0000 @@ -0,0 +1,89 @@ +/* + * 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. + * + */ + +super public class TestRangeCheckExceptionHandlerLoop + version 51:0 +{ + + +public Method "":"()V" + stack 1 locals 1 +{ + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; +} + +/* This method has an irreducible loop, with 2 entries, one is the exception handler + + static void test(boolean flag, int[] array, Exception exception) throws Exception { + int i = 0; + if (flag) { + try { + throw exception; + } catch(Exception e) { + array[i] = 0; + i++; + } + } + if (i < 10) { + throw exception; // caught by exception handler above as well + } + } +*/ +public static Method test:"(Z[ILjava/lang/Exception;)V" + throws java/lang/Exception + stack 3 locals 5 +{ + iconst_0; + istore_3; + iload_0; + ifeq L17; + try t0; + aload_2; + athrow; + endtry t0; + catch t0 java/lang/Exception; + catch t1 java/lang/Exception; + stack_frame_type full; + locals_map int, class "[I", class java/lang/Exception, int; + stack_map class java/lang/Exception; + astore 4; + aload_1; + iload_3; + iconst_0; + iastore; + iinc 3, 1; + L17: stack_frame_type same; + iload_3; + bipush 10; + if_icmpge L25; + try t1; + aload_2; + athrow; + endtry t1; + L25: stack_frame_type same; + return; +} +} // end Class TestRangeCheckExceptionHandlerLoop diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java 2021-10-20 10:12:18.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * 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 + * @bug 8134883 + * @summary C1's range check elimination breaks with a non-natural loop that an exception handler as one entry + * @compile TestRangeCheckExceptionHandlerLoop.jasm + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckExceptionHandlerLoopMain + */ + +public class TestRangeCheckExceptionHandlerLoopMain { + public static void main(String[] args) throws Exception { + Exception exception = new Exception(); + int[] array = new int[10]; + for (int i = 0; i < 20000; i++) { + TestRangeCheckExceptionHandlerLoop.test(false, array, exception); + } + } +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/stringopts/TestStringObjectInitialization.java openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/stringopts/TestStringObjectInitialization.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/stringopts/TestStringObjectInitialization.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/stringopts/TestStringObjectInitialization.java 2021-10-20 10:12:18.000000000 +0000 @@ -59,6 +59,11 @@ // Trigger C2's string concatenation optimization add(s + Arrays.toString(sArray) + " const "); } + + public void reset() { + // Reset string to avoid OOMEs + myString = ""; + } } class Runner implements Runnable { @@ -70,8 +75,9 @@ public void run(){ String[] array = {"a", "b", "c"}; - for (int i = 0; i < 10000; ++i) { + for (int i = 0; i < 100_000; ++i) { test.run("a", array); + test.reset(); } } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java 2021-10-20 10:12:18.000000000 +0000 @@ -25,7 +25,7 @@ * @test * @bug 8031752 * @summary speculative traps need to be cleaned up at GC - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx1M TestSpecTrapClassUnloading + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx512M TestSpecTrapClassUnloading * */ @@ -45,7 +45,7 @@ MemoryChunk other; long[] array; MemoryChunk(MemoryChunk other) { - other = other; + this.other = other; array = new long[1024 * 1024 * 1024]; } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/gc/arguments/TestAggressiveHeap.java openjdk-8-8u312-b07/=unpacked-tar11=/test/gc/arguments/TestAggressiveHeap.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/gc/arguments/TestAggressiveHeap.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/gc/arguments/TestAggressiveHeap.java 2021-10-20 10:12:18.000000000 +0000 @@ -51,13 +51,18 @@ // Option requires at least 256M, else error during option processing. private static final long minMemory = 256 * 1024 * 1024; + // Setting the heap to half of the physical memory is not suitable for + // a test environment with many tests running concurrently, setting to + // half of the required size instead. + private static final String heapSizeOption = "-Xmx128M"; + // bool UseParallelGC := true {product} private static final String parallelGCPattern = " *bool +UseParallelGC *:= *true +\\{product\\}"; private static void testFlag() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - option, "-XX:+PrintFlagsFinal", "-version"); + option, heapSizeOption, "-XX:+PrintFlagsFinal", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/gc/g1/TestHumongousShrinkHeap.java openjdk-8-8u312-b07/=unpacked-tar11=/test/gc/g1/TestHumongousShrinkHeap.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/gc/g1/TestHumongousShrinkHeap.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/gc/g1/TestHumongousShrinkHeap.java 2021-10-20 10:12:18.000000000 +0000 @@ -49,19 +49,29 @@ private static final int REGION_SIZE = 1024 * 1024; // 1M private static final int LISTS_COUNT = 10; private static final int HUMON_SIZE = Math.round(.9f * REGION_SIZE); - private static final long AVAILABLE_MEMORY - = Runtime.getRuntime().freeMemory(); - private static final int HUMON_COUNT - = (int) ((AVAILABLE_MEMORY / HUMON_SIZE) - / LISTS_COUNT); + private static final long TOTAL_MEMORY = Runtime.getRuntime().totalMemory(); + private static final long MAX_MEMORY = Runtime.getRuntime().maxMemory(); + + private static final int HUMON_COUNT = (int) ((TOTAL_MEMORY / HUMON_SIZE) / LISTS_COUNT); public static void main(String[] args) { - System.out.format("Running with %s max heap size. " - + "Will allocate humongous object of %s size %d times.%n", - MemoryUsagePrinter.humanReadableByteCount(AVAILABLE_MEMORY, false), - MemoryUsagePrinter.humanReadableByteCount(HUMON_SIZE, false), - HUMON_COUNT + if (HUMON_COUNT == 0) { + System.out.println("Skipped. Heap is too small"); + return; + } + + if (TOTAL_MEMORY + REGION_SIZE * HUMON_COUNT > MAX_MEMORY) { + System.out.println("Skipped. Initial heap size is to close to max heap size."); + return; + } + + System.out.format("Running with %s initial heap size of %s maximum heap size. " + + "Will allocate humongous object of %s size %d times.%n", + MemoryUsagePrinter.humanReadableByteCount(TOTAL_MEMORY, false), + MemoryUsagePrinter.humanReadableByteCount(MAX_MEMORY, false), + MemoryUsagePrinter.humanReadableByteCount(HUMON_SIZE, false), + HUMON_COUNT ); new TestHumongousShrinkHeap().test(); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java openjdk-8-8u312-b07/=unpacked-tar11=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2021-10-20 10:12:18.000000000 +0000 @@ -96,11 +96,18 @@ .getActualMemoryUsage(); test.allocate(); - for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; - i++) { + for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; i++) { SurvivorAlignmentTestMain.WHITE_BOX.youngGC(); } + // Sometimes we see that data unrelated to the test has been allocated during + // the loop. This data is included in the expectedMemoryUsage since we look + // through all threads to see what they allocated. If this data is still in + // the survivor area however, it should not be included in expectedMemoryUsage + // since the verification below only look at what's in tenured space. + expectedMemoryUsage -= SurvivorAlignmentTestMain.getAlignmentHelper( + SurvivorAlignmentTestMain.HeapSpace.SURVIVOR) + .getActualMemoryUsage(); test.verifyMemoryUsage(expectedMemoryUsage); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/Makefile openjdk-8-8u312-b07/=unpacked-tar11=/test/Makefile --- openjdk-8-8u292-b10/=unpacked-tar11=/test/Makefile 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/Makefile 2021-10-20 10:12:18.000000000 +0000 @@ -288,6 +288,9 @@ # Ignore tests are not run and completely silent about it JTREG_IGNORE_OPTION = -ignore:quiet JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) +# Multiply by 4 the timeout factor +JTREG_TIMEOUT_OPTION = -timeoutFactor:4 +JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION) # Add any extra options JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) # Set other vm and test options diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/8001071/Test8001071.java openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/8001071/Test8001071.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/8001071/Test8001071.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/8001071/Test8001071.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +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. - */ - -import sun.misc.Unsafe; -import java.lang.reflect.Field; - -@SuppressWarnings("sunapi") -public class Test8001071 { - public static Unsafe unsafe; - - static { - try { - Field f = Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe) f.get(null); - } catch ( Exception e ) { - e.printStackTrace(); - } - } - - public static void main(String args[]) { - unsafe.getObject(new Test8001071(), Short.MAX_VALUE); - } - -} diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/8001071/Test8001071.sh openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/8001071/Test8001071.sh --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/8001071/Test8001071.sh 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/8001071/Test8001071.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -#!/bin/sh - -# 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 -## @bug 8001071 -## @summary Add simple range check into VM implemenation of Unsafe access methods -## @compile Test8001071.java -## @run shell Test8001071.sh -## @author filipp.zhinkin@oracle.com - -VERSION=`${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>&1` - -if [ -n "`echo $VERSION | grep debug`" -o -n "`echo $VERSION | grep jvmg`" ]; then - echo "Build type check passed" - echo "Continue testing" -else - echo "Fastdebug build is required for this test" - exit 0 -fi - -${TESTJAVA}/bin/java -cp ${TESTCLASSES} ${TESTVMOPTS} Test8001071 2>&1 - -HS_ERR_FILE=hs_err_pid*.log - -if [ ! -f $HS_ERR_FILE ] -then - echo "hs_err_pid log file was not found" - echo "Test failed" - exit 1 -fi - -grep "assert(byte_offset < p_size) failed: Unsafe access: offset.*> object's size.*" $HS_ERR_FILE - -if [ "0" = "$?" ]; -then - echo "Range check assertion failed as expected" - echo "Test passed" - exit 0 -else - echo "Range check assertion was not failed" - echo "Test failed" - exit 1 -fi diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/CompressedOops/CompressedClassPointers.java openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/CompressedOops/CompressedClassPointers.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/CompressedOops/CompressedClassPointers.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/CompressedOops/CompressedClassPointers.java 2021-10-20 10:12:18.000000000 +0000 @@ -44,10 +44,10 @@ output.shouldHaveExitValue(0); } - public static void smallHeapTestWith3G() throws Exception { + public static void smallHeapTestWith1G() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", - "-XX:CompressedClassSpaceSize=3g", + "-XX:CompressedClassSpaceSize=1g", "-Xmx128m", "-XX:+PrintCompressedOopsMode", "-XX:+VerifyBeforeGC", "-version"); @@ -128,7 +128,7 @@ } } smallHeapTest(); - smallHeapTestWith3G(); + smallHeapTestWith1G(); largeHeapTest(); largePagesTest(); sharingTest(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java 2021-10-20 10:12:18.000000000 +0000 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, SAP. 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 8220786 + * @summary Test ErrorFileToStderr and ErrorFileToStdout + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.Platform; +import com.oracle.java.testlibrary.ProcessTools; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.util.Map; +import java.util.regex.Pattern; + +public class ErrorFileRedirectTest { + + public static void do_test(boolean redirectStdout, boolean redirectStderr) throws Exception { + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx64M", + "-XX:ErrorHandlerTest=12", + "-XX:" + (redirectStdout ? "+" : "-") + "ErrorFileToStdout", + "-XX:" + (redirectStderr ? "+" : "-") + "ErrorFileToStderr", + "-version"); + + OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); + + // we should have crashed with a SIGSEGV + output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*"); + output_detail.shouldMatch("# +(?:SIGSEGV|EXCEPTION_ACCESS_VIOLATION).*"); + + // If no redirection happened, we should find a mention of the file in the output. + String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1); + if (redirectStdout == false && redirectStderr == false) { + if (hs_err_file == null) { + throw new RuntimeException("Expected hs-err file but none found."); + } else { + System.out.println("Found hs error file mentioned as expected: " + hs_err_file); + } + } else { + if (hs_err_file != null) { + throw new RuntimeException("Found unexpected mention of hs-err file (we did redirect the output so no file should have been written)."); + } else { + System.out.println("No mention of an hs-err file - ok! "); + } + } + + // Check the output. Note that since stderr was specified last it has preference if both are set. + if (redirectStdout == true && redirectStderr == false) { + output_detail.stdoutShouldContain("--------------- T H R E A D ---------------"); + output_detail.stderrShouldNotContain("--------------- T H R E A D ---------------"); + System.out.println("Found report on stderr - ok! "); + } else if (redirectStderr == true) { + output_detail.stderrShouldContain("--------------- T H R E A D ---------------"); + output_detail.stdoutShouldNotContain("--------------- T H R E A D ---------------"); + System.out.println("Found report on stdout - ok! "); + } + + System.out.println("OK."); + + } + + public static void main(String[] args) throws Exception { + if (!Platform.isDebugBuild()) { + System.out.println("Skip on non-debug builds since we need '-XX:ErrorHandlerTest'"); + return; + } + do_test(false, false); + do_test(false, true); + do_test(true, false); + do_test(true, true); + } + +} + + diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/Metaspace/FragmentMetaspace.java openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/Metaspace/FragmentMetaspace.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/Metaspace/FragmentMetaspace.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/Metaspace/FragmentMetaspace.java 2021-10-20 10:12:18.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,7 +25,7 @@ * @test * @library /runtime/testlibrary * @build GeneratedClassLoader - * @run main/othervm/timeout=200 FragmentMetaspace + * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace */ import java.io.IOException; @@ -38,25 +38,34 @@ */ public class FragmentMetaspace { + public static Class c; + public static void main(String... args) { - runGrowing(Long.valueOf(System.getProperty("time", "80000"))); + runGrowing(Long.valueOf(System.getProperty("time", "80000")), + Integer.valueOf(System.getProperty("iterations", "200"))); // try to clean up and unload classes to decrease // class verification time in debug vm System.gc(); } - private static void runGrowing(long time) { + private static void runGrowing(long time, int iterations) { long startTime = System.currentTimeMillis(); - for (int i = 0; System.currentTimeMillis() < startTime + time; ++i) { + for (int i = 0; System.currentTimeMillis() < startTime + time && i < iterations; ++i) { try { GeneratedClassLoader gcl = new GeneratedClassLoader(); - Class c = gcl.getGeneratedClasses(i, 100)[0]; + // getGeneratedClasses throws a RuntimeException in cases where + // the javac exit code is not 0. If the original reason for the exception is + // a "java.lang.OutOfMemoryError: Java heap space", + // increase the heap size in the @run tag and rerun the test. + // The heap can be exhausted by this test, but heap exhaustion + // is not a failure mode of this test and should be ignored. + c = gcl.getGeneratedClasses(i, 100)[0]; c.newInstance(); c = null; gcl = null; - } catch (IOException|InstantiationException|IllegalAccessException ex) { + } catch (IOException | InstantiationException | IllegalAccessException ex) { throw new RuntimeException(ex); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/StackGap/testme.sh openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/StackGap/testme.sh --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/StackGap/testme.sh 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/StackGap/testme.sh 2021-10-20 10:12:18.000000000 +0000 @@ -49,7 +49,10 @@ exit 0; fi -CFLAGS="-m${VM_BITS}" +if [ "x${VM_CPU}" != "xaarch64" ]; +then + CFLAGS="-m${VM_BITS}" +fi LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH @@ -67,7 +70,8 @@ $gcc_cmd -DLINUX ${CFLAGS} -o stack-gap \ -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ -L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \ - -ljvm -lpthread exestack-gap.c + exestack-gap.c \ + -ljvm -lpthread ./stack-gap || exit $? ./stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $? diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/StackTrace/LargeClassTest.java openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/StackTrace/LargeClassTest.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/StackTrace/LargeClassTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/StackTrace/LargeClassTest.java 2021-10-20 10:12:18.000000000 +0000 @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2018, 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 8194246 + * @summary JVM crashes on stack trace for large number of methods. + * @library /testlibrary + * @run main LargeClassTest + */ + +import java.io.File; +import java.io.FileOutputStream; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.FieldVisitor; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.AnnotationVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; + +import com.oracle.java.testlibrary.ProcessTools; +import com.oracle.java.testlibrary.OutputAnalyzer; + +public class LargeClassTest implements Opcodes { + public static void main(String... args) throws Exception { + writeClassFile(); + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".", "Large"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } + + // Writes a Large class with > signed 16 bit int methods + public static void writeClassFile() throws Exception { + + ClassWriter cw = new ClassWriter(0); + FieldVisitor fv; + MethodVisitor mv; + AnnotationVisitor av0; + + cw.visit(52, ACC_PUBLIC + ACC_SUPER, "Large", null, "java/lang/Object", null); + + { + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + { + // public static void main(String[] args) { + // Large large = new Large(); + // large.f_1(55); + // } + mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); + mv.visitCode(); + mv.visitTypeInsn(NEW, "Large"); + mv.visitInsn(DUP); + mv.visitMethodInsn(INVOKESPECIAL, "Large", "", "()V", false); + mv.visitVarInsn(ASTORE, 1); + mv.visitVarInsn(ALOAD, 1); + mv.visitIntInsn(BIPUSH, 55); + mv.visitMethodInsn(INVOKEVIRTUAL, "Large", "f_1", "(I)I", false); + mv.visitInsn(POP); + mv.visitInsn(RETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + + // Write 33560 methods called f_$i + for (int i = 1000; i < 34560; i++) + { + mv = cw.visitMethod(ACC_PUBLIC, "f_" + i, "()V", null, null); + mv.visitCode(); + mv.visitInsn(RETURN); + mv.visitMaxs(0, 1); + mv.visitEnd(); + } + { + // public int f_1(int prior) { + // int total = prior + new java.util.Random(1).nextInt(); + // return total + f_2(total); + // } + mv = cw.visitMethod(ACC_PUBLIC, "f_1", "(I)I", null, null); + mv.visitCode(); + mv.visitVarInsn(ILOAD, 1); + mv.visitTypeInsn(NEW, "java/util/Random"); + mv.visitInsn(DUP); + mv.visitInsn(LCONST_1); + mv.visitMethodInsn(INVOKESPECIAL, "java/util/Random", "", "(J)V", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Random", "nextInt", "()I", false); + mv.visitInsn(IADD); + mv.visitVarInsn(ISTORE, 2); + mv.visitVarInsn(ILOAD, 2); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 2); + mv.visitMethodInsn(INVOKEVIRTUAL, "Large", "f_2", "(I)I", false); + mv.visitInsn(IADD); + mv.visitInsn(IRETURN); + mv.visitMaxs(5, 3); + mv.visitEnd(); + } + { + // public int f_2(int total) { + // System.out.println(java.util.Arrays.toString(Thread.currentThread().getStackTrace())); + // return 10; + // } + mv = cw.visitMethod(ACC_PUBLIC, "f_2", "(I)I", null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Thread", "currentThread", "()Ljava/lang/Thread;", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Thread", "getStackTrace", "()[Ljava/lang/StackTraceElement;", false); + mv.visitMethodInsn(INVOKESTATIC, "java/util/Arrays", "toString", "([Ljava/lang/Object;)Ljava/lang/String;", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); + mv.visitIntInsn(BIPUSH, 10); + mv.visitInsn(IRETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + cw.visitEnd(); + + try (FileOutputStream fos = new FileOutputStream(new File("Large.class"))) { + fos.write(cw.toByteArray()); + } + } +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/Unsafe/RangeCheck.java openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/Unsafe/RangeCheck.java --- openjdk-8-8u292-b10/=unpacked-tar11=/test/runtime/Unsafe/RangeCheck.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/test/runtime/Unsafe/RangeCheck.java 2021-10-20 10:12:18.000000000 +0000 @@ -0,0 +1,58 @@ +/* + * 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 8001071 + * @summary Add simple range check into VM implemenation of Unsafe access methods + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.*; +import sun.misc.Unsafe; + +public class RangeCheck { + + public static void main(String args[]) throws Exception { + if (!Platform.isDebugBuild()) { + System.out.println("Testing assert which requires a debug build. Passing silently."); + return; + } + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + true, + "-Xmx32m", + "-XX:-TransmitErrorReport", + DummyClassWithMainRangeCheck.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldMatch("assert\\(byte_offset < p_size\\) failed: Unsafe access: offset \\d+ > object's size \\d+"); + } + + public static class DummyClassWithMainRangeCheck { + public static void main(String args[]) throws Exception { + Unsafe unsafe = Utils.getUnsafe(); + unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE); + } + } +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar11=/THIRD_PARTY_README openjdk-8-8u312-b07/=unpacked-tar11=/THIRD_PARTY_README --- openjdk-8-8u292-b10/=unpacked-tar11=/THIRD_PARTY_README 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar11=/THIRD_PARTY_README 2021-10-20 10:12:18.000000000 +0000 @@ -3243,39 +3243,75 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to OASIS PKCS #11 Cryptographic Token -Interface v2.40, which may be included with JRE 8, JDK 8, and OpenJDK 8. +Interface v3.0, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- -Copyright (c) OASIS Open 2016. All Rights Reserved. +Copyright © OASIS Open 2020. All Rights Reserved. -All capitalized terms in the following text have the meanings assigned to them -in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The -full Policy may be found at the OASIS website: + All capitalized terms in the following text have the meanings +assigned to them in the OASIS Intellectual Property Rights Policy (the +"OASIS IPR Policy"). The full Policy may be found at the OASIS website: [http://www.oasis-open.org/policies-guidelines/ipr] -This document and translations of it may be copied and furnished to others, and -derivative works that comment on or otherwise explain it or assist in its -implementation may be prepared, copied, published, and distributed, in whole or -in part, without restriction of any kind, provided that the above copyright -notice and this section are included on all such copies and derivative works. -However, this document itself may not be modified in any way, including by -removing the copyright notice or references to OASIS, except as needed for the -purpose of developing any document or deliverable produced by an OASIS -Technical Committee (in which case the rules applicable to copyrights, as set -forth in the OASIS IPR Policy, must be followed) or as required to translate it -into languages other than English. - -The limited permissions granted above are perpetual and will not be revoked by -OASIS or its successors or assigns. - -This document and the information contained herein is provided on an "AS IS" -basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT -INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. OASIS AND ITS MEMBERS WILL NOT BE LIABLE FOR -ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE -OF THIS DOCUMENT OR ANY PART THEREOF. + This document and translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it or +assist in its implementation may be prepared, copied, published, and +distributed, in whole or in part, without restriction of any kind, +provided that the above copyright notice and this section are included +on all such copies and derivative works. However, this document itself +may not be modified in any way, including by removing the copyright +notice or references to OASIS, except as needed for the purpose of +developing any document or deliverable produced by an OASIS Technical +Committee (in which case the rules applicable to copyrights, as set +forth in the OASIS IPR Policy, must be followed) or as required to +translate it into languages other than English. + + The limited permissions granted above are perpetual and will not be +revoked by OASIS or its successors or assigns. + + This document and the information contained herein is provided on an +"AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE +INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. OASIS +AND ITS MEMBERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THIS DOCUMENT OR ANY +PART THEREOF. + + [OASIS requests that any OASIS Party or any other party that +believes it has patent claims that would necessarily be infringed by +implementations of this OASIS Standards Final Deliverable, to notify +OASIS TC Administrator and provide an indication of its willingness to +grant patent licenses to such patent claims in a manner consistent with +the IPR Mode of the OASIS Technical Committee that produced this +deliverable.] + + [OASIS invites any party to contact the OASIS TC Administrator if it +is aware of a claim of ownership of any patent claims that would +necessarily be infringed by implementations of this OASIS Standards +Final Deliverable by a patent holder that is not willing to provide a +license to such patent claims in a manner consistent with the IPR Mode +of the OASIS Technical Committee that produced this OASIS Standards +Final Deliverable. OASIS may include such claims on its website, but +disclaims any obligation to do so.] + + [OASIS takes no position regarding the validity or scope of any +intellectual property or other rights that might be claimed to pertain +to the implementation or use of the technology described in this OASIS +Standards Final Deliverable or the extent to which any license under +such rights might or might not be available; neither does it represent +that it has made any effort to identify any such rights. Information on +OASIS' procedures with respect to rights in any document or deliverable +produced by an OASIS Technical Committee can be found on the OASIS +website. Copies of claims of rights made available for publication and +any assurances of licenses to be made available, or the result of an +attempt made to obtain a general license or permission for the use of +such proprietary rights by implementers or users of this OASIS Standards +Final Deliverable, can be obtained from the OASIS TC Administrator. +OASIS makes no representation that any information or list of +intellectual property rights will at any time be complete, or that any +claims in such list are, in fact, Essential Claims.] --- end of LICENSE --- diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/.hg_archival.txt openjdk-8-8u312-b07/=unpacked-tar2=/.hg_archival.txt --- openjdk-8-8u292-b10/=unpacked-tar2=/.hg_archival.txt 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/.hg_archival.txt 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ repo: a61af66fc99eb5ec9d50c05b0c599757b1289ceb -node: 2a6952bb390975722d73580d1dc3cb6ac69b76b0 +node: 8aac6d08b58e31e4938a32c2662bf822d87a5440 branch: default -tag: jdk8u292-b10 -tag: jdk8u292-ga +tag: jdk8u312-b07 +tag: jdk8u312-ga diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/.hgtags openjdk-8-8u312-b07/=unpacked-tar2=/.hgtags --- openjdk-8-8u292-b10/=unpacked-tar2=/.hgtags 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/.hgtags 2021-08-09 15:12:52.000000000 +0000 @@ -1355,3 +1355,22 @@ f206e4bfcef993ce5a75ed54612f045ca047abd3 jdk8u292-b07 85c5bc8157df45d7351c388f18ab65297b5bdd01 jdk8u292-b08 65907019826ad9fe7d13df531e0c108cc1f179b0 jdk8u292-b09 +2a6952bb390975722d73580d1dc3cb6ac69b76b0 jdk8u292-b10 +2a6952bb390975722d73580d1dc3cb6ac69b76b0 jdk8u292-ga +a435c913c8ce30f0487d05cfec1d9be3fcc57f10 jdk8u302-b00 +d24969e49a6af3353c84b9a0f9aedd4736156b66 jdk8u302-b01 +8a152c8e9f14e3bdeebd7bf4e8eb2a6e8f9bbb7c jdk8u302-b02 +99e4a82f17e8debc5225d1c8834acdac673aa676 jdk8u302-b03 +362d99aef38e6e179061f221df20bbb9f65b8f89 jdk8u302-b04 +54326de2a1d7847ea63e7bcf4ebc1a9699cb8885 jdk8u302-b05 +54326de2a1d7847ea63e7bcf4ebc1a9699cb8885 jdk8u312-b00 +782f3b88b5ba7d420e6c5894c19f9bf1980df239 jdk8u302-b06 +78dfe32cac588b01e28792d42e761fa35a80e8f9 jdk8u302-b07 +a209b6f5b09af88bae12ffeebd382f3ef804b99f jdk8u302-b08 +a209b6f5b09af88bae12ffeebd382f3ef804b99f jdk8u302-ga +2f7a380c9a0ac0cf20fdb17d7b6a135da05b5d04 jdk8u312-b01 +4735f3031e239dfd76c0ed2ce25c8f1cc9bd7c1f jdk8u312-b02 +a6da205dfd9f0d71dae93a310652e29d830c95ee jdk8u312-b03 +21394894714b0fb17e6015483e4658f75e30bbc5 jdk8u312-b04 +e7fc0c4f478e78e2ef40b8d098c02a958e385227 jdk8u312-b05 +e2ac513ec7b343f596861645f0696bc6f0fb4364 jdk8u312-b06 diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/defs.make openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/defs.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/defs.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/defs.make 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -142,36 +142,28 @@ OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY)) endif - ifeq ($(OBJCOPY),) - _JUNK_ := $(shell \ - echo >&2 "INFO: no objcopy cmd found so cannot create .debuginfo files. You may need to set ALT_OBJCOPY.") - ENABLE_FULL_DEBUG_SYMBOLS=0 - _JUNK_ := $(shell \ - echo >&2 "INFO: ENABLE_FULL_DEBUG_SYMBOLS=$(ENABLE_FULL_DEBUG_SYMBOLS)") - else - _JUNK_ := $(shell \ - echo >&2 "INFO: $(OBJCOPY) cmd found so will create .debuginfo files.") + _JUNK_ := $(shell \ + echo >&2 "INFO: AIX .debuginfo files will be produced by copying debug object.") - # Library stripping policies for .debuginfo configs: - # all_strip - strips everything from the library - # min_strip - strips most stuff from the library; leaves minimum symbols - # no_strip - does not strip the library at all - # - # Oracle security policy requires "all_strip". A waiver was granted on - # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. - # - # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. - # - STRIP_POLICY ?= min_strip + # Library stripping policies for .debuginfo configs: + # all_strip - strips everything from the library + # min_strip - strips most stuff from the library; leaves minimum symbols + # no_strip - does not strip the library at all + # + # Oracle security policy requires "all_strip". A waiver was granted on + # 2011.09.01 that permits using "min_strip" in the Java JDK and Java JRE. + # + # Currently, STRIP_POLICY is only used when Full Debug Symbols is enabled. + # + STRIP_POLICY ?= min_strip - _JUNK_ := $(shell \ - echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") + _JUNK_ := $(shell \ + echo >&2 "INFO: STRIP_POLICY=$(STRIP_POLICY)") - ZIP_DEBUGINFO_FILES ?= 1 + ZIP_DEBUGINFO_FILES ?= 1 - _JUNK_ := $(shell \ - echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") - endif + _JUNK_ := $(shell \ + echo >&2 "INFO: ZIP_DEBUGINFO_FILES=$(ZIP_DEBUGINFO_FILES)") endif # ENABLE_FULL_DEBUG_SYMBOLS=1 endif # BUILD_FLAVOR endif # JDK_6_OR_EARLIER @@ -185,13 +177,13 @@ # client and server subdirectories have symbolic links to ../libjsig.so EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.$(LIBRARY_SUFFIX) -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz -# else -# EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo -# endif -#endif +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.diz + else + EXPORT_LIST += $(EXPORT_JRE_LIB_ARCH_DIR)/libjsig.debuginfo + endif +endif EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client EXPORT_MINIMAL_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/minimal @@ -199,25 +191,25 @@ ifeq ($(findstring true, $(JVM_VARIANT_SERVER) $(JVM_VARIANT_ZERO) $(JVM_VARIANT_ZEROSHARK) $(JVM_VARIANT_CORE)), true) EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) -# ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz -# else -# EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo -# endif -# endif + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.diz + else + EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.debuginfo + endif + endif endif ifeq ($(JVM_VARIANT_CLIENT),true) EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) -# ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz -# else -# EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo -# endif -# endif + ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.diz + else + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.debuginfo + endif + endif endif # Serviceability Binaries diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/jsig.make openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/jsig.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/jsig.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/jsig.make 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -64,9 +64,9 @@ $(QUIETLY) $(CXX) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \ $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(JSIG_OPT_FLAGS) -o $@ $< -ldl -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO) -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@ +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + # AIX produces .debuginfo from copy of -g compiled object prior to strip + $(QUIETLY) $(CP) $@ $(LIBJSIG_DEBUGINFO) # ifeq ($(STRIP_POLICY),all_strip) # $(QUIETLY) $(STRIP) $@ # else @@ -75,11 +75,13 @@ # # implied else here is no stripping at all # endif # endif -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) -# $(RM) $(LIBJSIG_DEBUGINFO) -# endif -#endif + ifneq ($(STRIP_POLICY),no_strip) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + $(ZIPEXE) -q -y $(LIBJSIG_DIZ) $(LIBJSIG_DEBUGINFO) + $(RM) $(LIBJSIG_DEBUGINFO) + endif + endif +endif install_jsig: $(LIBJSIG) @echo "Copying $(LIBJSIG) to $(DEST_JSIG)" diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/saproc.make openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/saproc.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/saproc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/saproc.make 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright 2012, 2013 SAP AG. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -88,16 +88,16 @@ -o $@ \ -lthread_db ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) - $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO) - $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@ - ifeq ($(STRIP_POLICY),all_strip) - $(QUIETLY) $(STRIP) $@ - else - ifeq ($(STRIP_POLICY),min_strip) - $(QUIETLY) $(STRIP) -g $@ - # implied else here is no stripping at all - endif - endif + # AIX produces .debuginfo from copy of -g compiled object prior to strip + $(QUIETLY) $(CP) $@ $(LIBJSIG_DEBUGINFO) +# ifeq ($(STRIP_POLICY),all_strip) +# $(QUIETLY) $(STRIP) $@ +# else +# ifeq ($(STRIP_POLICY),min_strip) +# $(QUIETLY) $(STRIP) -g $@ +# # implied else here is no stripping at all +# endif +# endif ifeq ($(ZIP_DEBUGINFO_FILES),1) $(ZIPEXE) -q -y $(LIBSAPROC_DIZ) $(LIBSAPROC_DEBUGINFO) $(RM) $(LIBSAPROC_DEBUGINFO) diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/vm.make openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/vm.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/aix/makefiles/vm.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/aix/makefiles/vm.make 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2020 SAP SE. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # @@ -329,9 +329,9 @@ # fi \ # } -#ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) -# $(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO) -# $(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@ +ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1) + # AIX produces .debuginfo from copy of -g compiled object prior to strip + $(QUIETLY) $(CP) $@ $(LIBJVM_DEBUGINFO) # ifeq ($(STRIP_POLICY),all_strip) # $(QUIETLY) $(STRIP) $@ # else @@ -340,11 +340,13 @@ # # implied else here is no stripping at all # endif # endif -# ifeq ($(ZIP_DEBUGINFO_FILES),1) -# $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) -# $(RM) $(LIBJVM_DEBUGINFO) -# endif -#endif + ifneq ($(STRIP_POLICY),no_strip) + ifeq ($(ZIP_DEBUGINFO_FILES),1) + $(ZIPEXE) -q -y $(LIBJVM_DIZ) $(LIBJVM_DEBUGINFO) + $(RM) $(LIBJVM_DEBUGINFO) + endif + endif +endif DEST_SUBDIR = $(JDK_LIBDIR)/$(VM_SUBDIR) DEST_JVM = $(DEST_SUBDIR)/$(LIBJVM) diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/bsd/makefiles/gcc.make openjdk-8-8u312-b07/=unpacked-tar2=/make/bsd/makefiles/gcc.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/bsd/makefiles/gcc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/bsd/makefiles/gcc.make 2021-08-09 15:12:52.000000000 +0000 @@ -313,10 +313,10 @@ # Work around some compiler bugs. ifeq ($(USE_CLANG), true) - ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1) - OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) - OPT_CFLAGS/unsafe.o += -O1 - endif + # Known to fail with clang <= 7.0; + # do no optimize these on later clang until verified + OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT) + OPT_CFLAGS/unsafe.o += -O1 else # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1) @@ -362,7 +362,15 @@ # Linker flags # statically link libstdc++.so, work with gcc but ignored by g++ -STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +ifeq ($(OS_VENDOR), Darwin) + ifeq ($(USE_CLANG), true) + STATIC_STDCXX = -Wl,-Bstatic -lc++ -Wl,-Bdynamic + else + STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic + endif +else + STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic +endif ifeq ($(USE_CLANG),) # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x. diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/bsd/makefiles/jsig.make openjdk-8-8u312-b07/=unpacked-tar2=/make/bsd/makefiles/jsig.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/bsd/makefiles/jsig.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/bsd/makefiles/jsig.make 2021-08-09 15:12:52.000000000 +0000 @@ -54,6 +54,11 @@ LFLAGS_JSIG += -D_GNU_SOURCE -pthread $(LDFLAGS_HASH_STYLE) $(EXTRA_LDFLAGS) +ifeq ($(OS_VENDOR), Darwin) +# bring in minimum version argument or we'll fail on OSX 10.10 +LFLAGS_JSIG += $(LFLAGS) +endif + # DEBUG_BINARIES overrides everything, use full -g debug information ifeq ($(DEBUG_BINARIES), true) JSIG_DEBUG_CFLAGS = -g diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/bsd/makefiles/saproc.make openjdk-8-8u312-b07/=unpacked-tar2=/make/bsd/makefiles/saproc.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/bsd/makefiles/saproc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/bsd/makefiles/saproc.make 2021-08-09 15:12:52.000000000 +0000 @@ -78,8 +78,10 @@ ifneq ($(SDKPATH),) SA_SYSROOT_FLAGS += -isysroot "$(SDKPATH)" -iframework"$(SDKPATH)/System/Library/Frameworks" endif - # always needed, even if SDKPATH is empty - SA_SYSROOT_FLAGS += -F"$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks" + ifneq ($(wildcard "$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks"), "") + # always needed, even if SDKPATH is empty + SA_SYSROOT_FLAGS += -F"$(SDKPATH)/System/Library/Frameworks/JavaVM.framework/Frameworks" + endif else SASRCFILES = $(SASRCDIR)/StubDebuggerLocal.c SALIBS = diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/make/linux/makefiles/gcc.make openjdk-8-8u312-b07/=unpacked-tar2=/make/linux/makefiles/gcc.make --- openjdk-8-8u292-b10/=unpacked-tar2=/make/linux/makefiles/gcc.make 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/make/linux/makefiles/gcc.make 2021-08-09 15:12:52.000000000 +0000 @@ -226,6 +226,18 @@ # Special cases CFLAGS_WARN/BYFILE = $(CFLAGS_WARN/$@)$(CFLAGS_WARN/DEFAULT$(CFLAGS_WARN/$@)) +# On newer GCCs, the compiler complains about null being passed +# to the %s format specifier. The warning appears only on 8u, +# but the code is largely the same up to trunk. We disable +# the warning until the code is fixed, to allow builds with +# -Werror (the default). +# See JDK-8269388 and PR3798 in IcedTea: +# https://icedtea.wildebeest.org/hg/icedtea8-forest/hotspot/rev/9f2ceb42dc64 +# Option only exists on GCC 7 and later, checked by configure +ifeq ($(USE_FORMAT_OVERFLOW), 1) + CFLAGS_WARN/os_linux.o = $(CFLAGS_WARN/DEFAULT) -Wno-error=format-overflow +endif + # The flags to use for an Optimized g++ build OPT_CFLAGS/SIZE=-Os OPT_CFLAGS/SPEED=-O3 diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/aarch64.ad openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/aarch64.ad --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/aarch64.ad 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/aarch64.ad 2021-08-09 15:12:52.000000000 +0000 @@ -926,6 +926,8 @@ source_hpp %{ +#include "opto/addnode.hpp" + class CallStubImpl { //-------------------------------------------------------------- @@ -980,6 +982,9 @@ // predicate controlling translation of StoreCM bool unnecessary_storestore(const Node *storecm); + + // predicate controlling addressing modes + bool size_fits_all_mem_uses(AddPNode* addp, int shift); %} source %{ @@ -2159,6 +2164,26 @@ return FP_REG_mask(); } +bool size_fits_all_mem_uses(AddPNode* addp, int shift) { + for (DUIterator_Fast imax, i = addp->fast_outs(imax); i < imax; i++) { + Node* u = addp->fast_out(i); + if (u->is_LoadStore()) { + // On AArch64, LoadStoreNodes (i.e. compare and swap + // instructions) only take register indirect as an operand, so + // any attempt to use an AddPNode as an input to a LoadStoreNode + // must fail. + return false; + } + if (u->is_Mem()) { + int opsize = u->as_Mem()->memory_size(); + assert(opsize > 0, "unexpected memory operand size"); + if (u->as_Mem()->memory_size() != (1<as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP reg (LShiftL lreg scale)) off); op_cost(INSN_COST); @@ -4769,6 +4796,8 @@ operand indIndexScaledOffsetL(iRegP reg, iRegL lreg, immIScale scale, immLU12 off) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP reg (LShiftL lreg scale)) off); op_cost(INSN_COST); @@ -4797,6 +4826,8 @@ operand indIndexScaledOffsetI2L(iRegP reg, iRegI ireg, immIScale scale, immLU12 off) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP reg (LShiftL (ConvI2L ireg) scale)) off); op_cost(INSN_COST); @@ -4811,6 +4842,8 @@ operand indIndexScaledI2L(iRegP reg, iRegI ireg, immIScale scale) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP reg (LShiftL (ConvI2L ireg) scale)); op_cost(0); @@ -4825,6 +4858,8 @@ operand indIndexScaled(iRegP reg, iRegL lreg, immIScale scale) %{ + predicate(size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP reg (LShiftL lreg scale)); op_cost(0); @@ -4980,7 +5015,9 @@ operand indIndexScaledOffsetIN(iRegN reg, iRegL lreg, immIScale scale, immIU12 off) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP (DecodeN reg) (LShiftL lreg scale)) off); op_cost(0); @@ -4995,7 +5032,9 @@ operand indIndexScaledOffsetLN(iRegN reg, iRegL lreg, immIScale scale, immLU12 off) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP (DecodeN reg) (LShiftL lreg scale)) off); op_cost(INSN_COST); @@ -5025,7 +5064,9 @@ operand indIndexScaledOffsetI2LN(iRegN reg, iRegI ireg, immIScale scale, immLU12 off) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Address)->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (AddP (DecodeN reg) (LShiftL (ConvI2L ireg) scale)) off); op_cost(INSN_COST); @@ -5040,7 +5081,9 @@ operand indIndexScaledI2LN(iRegN reg, iRegI ireg, immIScale scale) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (DecodeN reg) (LShiftL (ConvI2L ireg) scale)); op_cost(0); @@ -5055,7 +5098,9 @@ operand indIndexScaledN(iRegN reg, iRegL lreg, immIScale scale) %{ - predicate(Universe::narrow_oop_shift() == 0); + predicate(Universe::narrow_oop_shift() == 0 && + size_fits_all_mem_uses(n->as_AddP(), + n->in(AddPNode::Offset)->in(2)->get_int())); constraint(ALLOC_IN_RC(ptr_reg)); match(AddP (DecodeN reg) (LShiftL lreg scale)); op_cost(0); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/assembler_aarch64.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/assembler_aarch64.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/assembler_aarch64.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/assembler_aarch64.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -1288,7 +1288,7 @@ INSN(ldrs, 0b00, 1); INSN(ldrd, 0b01, 1); - INSN(ldrq, 0x10, 1); + INSN(ldrq, 0b10, 1); #undef INSN @@ -1975,7 +1975,7 @@ public: enum SIMD_Arrangement { - T8B, T16B, T4H, T8H, T2S, T4S, T1D, T2D + T8B, T16B, T4H, T8H, T2S, T4S, T1D, T2D, T1Q }; enum SIMD_RegVariant { @@ -2306,14 +2306,16 @@ f(0b001111, 15, 10), rf(Vn, 5), rf(Xd, 0); } - // We do not handle the 1Q arrangement. void pmull(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { starti; - assert(Ta == T8H && (Tb == T8B || Tb == T16B), "Invalid Size specifier"); - f(0, 31), f(Tb & 1, 30), f(0b001110001, 29, 21), rf(Vm, 16), f(0b111000, 15, 10); - rf(Vn, 5), rf(Vd, 0); + assert((Ta == T1Q && (Tb == T1D || Tb == T2D)) || + (Ta == T8H && (Tb == T8B || Tb == T16B)), "Invalid Size specifier"); + int size = (Ta == T1Q) ? 0b11 : 0b00; + f(0, 31), f(Tb & 1, 30), f(0b001110, 29, 24), f(size, 23, 22); + f(1, 21), rf(Vm, 16), f(0b111000, 15, 10), rf(Vn, 5), rf(Vd, 0); } void pmull2(FloatRegister Vd, SIMD_Arrangement Ta, FloatRegister Vn, FloatRegister Vm, SIMD_Arrangement Tb) { + assert(Tb == T2D || Tb == T16B, "pmull2 assumes T2D or T16B as the second size specifier"); pmull(Vd, Ta, Vn, Vm, Tb); } @@ -2326,15 +2328,6 @@ f(0b100001010010, 21, 10), rf(Vn, 5), rf(Vd, 0); } - void rev32(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) - { - starti; - assert(T <= T8H, "must be one of T8B, T16B, T4H, T8H"); - f(0, 31), f((int)T & 1, 30), f(0b101110, 29, 24); - f(T <= T16B ? 0b00 : 0b01, 23, 22), f(0b100000000010, 21, 10); - rf(Vn, 5), rf(Vd, 0); - } - void dup(FloatRegister Vd, SIMD_Arrangement T, Register Xs) { starti; @@ -2367,6 +2360,68 @@ #undef INSN + // Table vector lookup +#define INSN(NAME, op) \ + void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, unsigned registers, FloatRegister Vm) { \ + starti; \ + assert(T == T8B || T == T16B, "invalid arrangement"); \ + assert(0 < registers && registers <= 4, "invalid number of registers"); \ + f(0, 31), f((int)T & 1, 30), f(0b001110000, 29, 21), rf(Vm, 16), f(0, 15); \ + f(registers - 1, 14, 13), f(op, 12),f(0b00, 11, 10), rf(Vn, 5), rf(Vd, 0); \ + } + + INSN(tbl, 0); + INSN(tbx, 1); + +#undef INSN + + // AdvSIMD two-reg misc +#define INSN(NAME, U, opcode) \ + void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { \ + starti; \ + assert((ASSERTION), MSG); \ + f(0, 31), f((int)T & 1, 30), f(U, 29), f(0b01110, 28, 24); \ + f((int)(T >> 1), 23, 22), f(0b10000, 21, 17), f(opcode, 16, 12); \ + f(0b10, 11, 10), rf(Vn, 5), rf(Vd, 0); \ + } + +#define MSG "invalid arrangement" + +#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H || T == T2S || T == T4S) + INSN(rev64, 0, 0b00000); +#undef ASSERTION + +#define ASSERTION (T == T8B || T == T16B || T == T4H || T == T8H) + INSN(rev32, 1, 0b00000); +private: + INSN(_rbit, 1, 0b00101); +public: + +#undef ASSERTION + +#define ASSERTION (T == T8B || T == T16B) + INSN(rev16, 0, 0b00001); + // RBIT only allows T8B and T16B but encodes them oddly. Argh... + void rbit(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { + assert((ASSERTION), MSG); + _rbit(Vd, SIMD_Arrangement(T & 1 | 0b010), Vn); + } +#undef ASSERTION + +#undef MSG + +#undef INSN + + void ext(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn, FloatRegister Vm, int index) + { + starti; + assert(T == T8B || T == T16B, "invalid arrangement"); + assert((T == T8B && index <= 0b0111) || (T == T16B && index <= 0b1111), "Invalid index value"); + f(0, 31), f((int)T & 1, 30), f(0b101110000, 29, 21); + rf(Vm, 16), f(0, 15), f(index, 14, 11); + f(0, 10), rf(Vn, 5), rf(Vd, 0); + } + Assembler(CodeBuffer* code) : AbstractAssembler(code) { } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/c1_LIRGenerator_aarch64.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -603,12 +603,12 @@ } else { assert (x->op() == Bytecodes::_imul, "expect imul"); if (right.is_constant()) { - int c = right.get_jint_constant(); - if (! is_power_of_2(c) && ! is_power_of_2(c + 1) && ! is_power_of_2(c - 1)) { - // Cannot use constant op. - right.load_item(); + jint c = right.get_jint_constant(); + if (c > 0 && c < max_jint && (is_power_of_2(c) || is_power_of_2(c - 1) || is_power_of_2(c + 1))) { + right_arg->dont_load_item(); } else { - right.dont_load_item(); + // Cannot use constant op. + right_arg->load_item(); } } else { right.load_item(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/c1_Runtime1_aarch64.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -143,9 +143,9 @@ int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry, Register arg1, Register arg2, Register arg3) { // if there is any conflict use the stack if (arg1 == c_rarg2 || arg1 == c_rarg3 || - arg2 == c_rarg1 || arg1 == c_rarg3 || - arg3 == c_rarg1 || arg1 == c_rarg2) { - stp(arg3, arg2, Address(pre(sp, 2 * wordSize))); + arg2 == c_rarg1 || arg2 == c_rarg3 || + arg3 == c_rarg1 || arg3 == c_rarg2) { + stp(arg3, arg2, Address(pre(sp, -2 * wordSize))); stp(arg1, zr, Address(pre(sp, -2 * wordSize))); ldp(c_rarg1, zr, Address(post(sp, 2 * wordSize))); ldp(c_rarg3, c_rarg2, Address(post(sp, 2 * wordSize))); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -644,6 +644,11 @@ // do the call, remove parameters MacroAssembler::call_VM_leaf_base(entry_point, number_of_arguments, &l); + // lr could be poisoned with PAC signature during throw_pending_exception + // if it was tail-call optimized by compiler, since lr is not callee-saved + // reload it with proper value + adr(lr, l); + // reset last Java frame // Only interpreter should have to clear fp reset_last_Java_frame(true); @@ -1262,7 +1267,7 @@ stp(rscratch2, lr, Address(pre(sp, -2 * wordSize))); mov(r0, reg); - mov(rscratch1, (address)b); + movptr(rscratch1, (uintptr_t)(address)b); // call indirectly to solve generation ordering problem lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address())); @@ -1298,7 +1303,7 @@ } else { ldr(r0, addr); } - mov(rscratch1, (address)b); + movptr(rscratch1, (uintptr_t)(address)b); // call indirectly to solve generation ordering problem lea(rscratch2, ExternalAddress(StubRoutines::verify_oop_subroutine_entry_address())); @@ -1993,8 +1998,8 @@ void MacroAssembler::stop(const char* msg) { address ip = pc(); pusha(); - mov(c_rarg0, (address)msg); - mov(c_rarg1, (address)ip); + movptr(c_rarg0, (uintptr_t)(address)msg); + movptr(c_rarg1, (uintptr_t)(address)ip); mov(c_rarg2, sp); mov(c_rarg3, CAST_FROM_FN_PTR(address, MacroAssembler::debug64)); blr(c_rarg3); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,6 +1,6 @@ /* * Copyright (c) 2013, Red Hat Inc. - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. + * Copyright (c) 2003, 2015, Oracle and/or its affiliates. * All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1367,10 +1367,10 @@ __ ldr(temp, Address(a, rscratch2, Address::lsl(exact_log2(size)))); __ verify_oop(temp); } else { - __ ldrw(r16, Address(a, rscratch2, Address::lsl(exact_log2(size)))); + __ ldrw(temp, Address(a, rscratch2, Address::lsl(exact_log2(size)))); __ decode_heap_oop(temp); // calls verify_oop } - __ add(rscratch2, rscratch2, size); + __ add(rscratch2, rscratch2, 1); __ b(loop); __ bind(end); } @@ -3204,6 +3204,69 @@ return start; } + void ghash_multiply(FloatRegister result_lo, FloatRegister result_hi, + FloatRegister a, FloatRegister b, FloatRegister a1_xor_a0, + FloatRegister tmp1, FloatRegister tmp2, FloatRegister tmp3, FloatRegister tmp4) { + // Karatsuba multiplication performs a 128*128 -> 256-bit + // multiplication in three 128-bit multiplications and a few + // additions. + // + // (C1:C0) = A1*B1, (D1:D0) = A0*B0, (E1:E0) = (A0+A1)(B0+B1) + // (A1:A0)(B1:B0) = C1:(C0+C1+D1+E1):(D1+C0+D0+E0):D0 + // + // Inputs: + // + // A0 in a.d[0] (subkey) + // A1 in a.d[1] + // (A1+A0) in a1_xor_a0.d[0] + // + // B0 in b.d[0] (state) + // B1 in b.d[1] + + __ ext(tmp1, __ T16B, b, b, 0x08); + __ pmull2(result_hi, __ T1Q, b, a, __ T2D); // A1*B1 + __ eor(tmp1, __ T16B, tmp1, b); // (B1+B0) + __ pmull(result_lo, __ T1Q, b, a, __ T1D); // A0*B0 + __ pmull(tmp2, __ T1Q, tmp1, a1_xor_a0, __ T1D); // (A1+A0)(B1+B0) + + __ ext(tmp4, __ T16B, result_lo, result_hi, 0x08); + __ eor(tmp3, __ T16B, result_hi, result_lo); // A1*B1+A0*B0 + __ eor(tmp2, __ T16B, tmp2, tmp4); + __ eor(tmp2, __ T16B, tmp2, tmp3); + + // Register pair holds the result of carry-less multiplication + __ ins(result_hi, __ D, tmp2, 0, 1); + __ ins(result_lo, __ D, tmp2, 1, 0); + } + + void ghash_reduce(FloatRegister result, FloatRegister lo, FloatRegister hi, + FloatRegister p, FloatRegister z, FloatRegister t1) { + const FloatRegister t0 = result; + + // The GCM field polynomial f is z^128 + p(z), where p = + // z^7+z^2+z+1. + // + // z^128 === -p(z) (mod (z^128 + p(z))) + // + // so, given that the product we're reducing is + // a == lo + hi * z^128 + // substituting, + // === lo - hi * p(z) (mod (z^128 + p(z))) + // + // we reduce by multiplying hi by p(z) and subtracting the result + // from (i.e. XORing it with) lo. Because p has no nonzero high + // bits we can do this with two 64-bit multiplications, lo*p and + // hi*p. + + __ pmull2(t0, __ T1Q, hi, p, __ T2D); + __ ext(t1, __ T16B, t0, z, 8); + __ eor(hi, __ T16B, hi, t1); + __ ext(t1, __ T16B, z, t0, 8); + __ eor(lo, __ T16B, lo, t1); + __ pmull(t0, __ T1Q, hi, p, __ T1D); + __ eor(result, __ T16B, lo, t0); + } + /** * Arguments: * @@ -3244,6 +3307,93 @@ return start; } + /** + * Arguments: + * + * Input: + * c_rarg0 - current state address + * c_rarg1 - H key address + * c_rarg2 - data address + * c_rarg3 - number of blocks + * + * Output: + * Updated state at c_rarg0 + */ + address generate_ghash_processBlocks() { + // Bafflingly, GCM uses little-endian for the byte order, but + // big-endian for the bit order. For example, the polynomial 1 is + // represented as the 16-byte string 80 00 00 00 | 12 bytes of 00. + // + // So, we must either reverse the bytes in each word and do + // everything big-endian or reverse the bits in each byte and do + // it little-endian. On AArch64 it's more idiomatic to reverse + // the bits in each byte (we have an instruction, RBIT, to do + // that) and keep the data in little-endian bit order throught the + // calculation, bit-reversing the inputs and outputs. + + StubCodeMark mark(this, "StubRoutines", "ghash_processBlocks"); + __ align(wordSize * 2); + address p = __ pc(); + __ emit_int64(0x87); // The low-order bits of the field + // polynomial (i.e. p = z^7+z^2+z+1) + // repeated in the low and high parts of a + // 128-bit vector + __ emit_int64(0x87); + + __ align(CodeEntryAlignment); + address start = __ pc(); + + Register state = c_rarg0; + Register subkeyH = c_rarg1; + Register data = c_rarg2; + Register blocks = c_rarg3; + + FloatRegister vzr = v30; + __ eor(vzr, __ T16B, vzr, vzr); // zero register + + __ ldrq(v0, Address(state)); + __ ldrq(v1, Address(subkeyH)); + + __ rev64(v0, __ T16B, v0); // Bit-reverse words in state and subkeyH + __ rbit(v0, __ T16B, v0); + __ rev64(v1, __ T16B, v1); + __ rbit(v1, __ T16B, v1); + + __ ldrq(v26, p); + + __ ext(v16, __ T16B, v1, v1, 0x08); // long-swap subkeyH into v1 + __ eor(v16, __ T16B, v16, v1); // xor subkeyH into subkeyL (Karatsuba: (A1+A0)) + + { + Label L_ghash_loop; + __ bind(L_ghash_loop); + + __ ldrq(v2, Address(__ post(data, 0x10))); // Load the data, bit + // reversing each byte + __ rbit(v2, __ T16B, v2); + __ eor(v2, __ T16B, v0, v2); // bit-swapped data ^ bit-swapped state + + // Multiply state in v2 by subkey in v1 + ghash_multiply(/*result_lo*/v5, /*result_hi*/v7, + /*a*/v1, /*b*/v2, /*a1_xor_a0*/v16, + /*temps*/v6, v20, v18, v21); + // Reduce v7:v5 by the field polynomial + ghash_reduce(v0, v5, v7, v26, vzr, v20); + + __ sub(blocks, blocks, 1); + __ cbnz(blocks, L_ghash_loop); + } + + // The bit-reversed result is at this point in v0 + __ rev64(v1, __ T16B, v0); + __ rbit(v1, __ T16B, v1); + + __ st1(v1, __ T16B, state); + __ ret(lr); + + return start; + } + // Continuation point for throwing of implicit exceptions that are // not handled in the current activation. Fabricates an exception // oop and initiates normal exception dispatching in this @@ -4253,6 +4403,11 @@ StubRoutines::_cipherBlockChaining_decryptAESCrypt = generate_cipherBlockChaining_decryptAESCrypt(); } + // generate GHASH intrinsics code + if (UseGHASHIntrinsics) { + StubRoutines::_ghash_processBlocks = generate_ghash_processBlocks(); + } + if (UseSHA1Intrinsics) { StubRoutines::_sha1_implCompress = generate_sha1_implCompress(false, "sha1_implCompress"); StubRoutines::_sha1_implCompressMB = generate_sha1_implCompress(true, "sha1_implCompressMB"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/vm_version_aarch64.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/vm_version_aarch64.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/aarch64/vm/vm_version_aarch64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/aarch64/vm/vm_version_aarch64.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -41,6 +41,10 @@ #define HWCAP_AES (1<<3) #endif +#ifndef HWCAP_PMULL +#define HWCAP_PMULL (1<<4) +#endif + #ifndef HWCAP_SHA1 #define HWCAP_SHA1 (1<<5) #endif @@ -138,6 +142,17 @@ if (PrefetchCopyIntervalInBytes >= 32768) PrefetchCopyIntervalInBytes = 32760; } + + if (AllocatePrefetchDistance !=-1 && (AllocatePrefetchDistance & 7)) { + warning("AllocatePrefetchDistance must be multiple of 8"); + AllocatePrefetchDistance &= ~7; + } + + if (AllocatePrefetchStepSize & 7) { + warning("AllocatePrefetchStepSize must be multiple of 8"); + AllocatePrefetchStepSize &= ~7; + } + FLAG_SET_DEFAULT(UseSSE42Intrinsics, true); unsigned long auxv = getauxval(AT_HWCAP); @@ -226,7 +241,11 @@ } } - if (UseGHASHIntrinsics) { + if (auxv & HWCAP_PMULL) { + if (FLAG_IS_DEFAULT(UseGHASHIntrinsics)) { + FLAG_SET_DEFAULT(UseGHASHIntrinsics, true); + } + } else if (UseGHASHIntrinsics) { warning("GHASH intrinsics are not available on this CPU"); FLAG_SET_DEFAULT(UseGHASHIntrinsics, false); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/ppc/vm/frame_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/ppc/vm/frame_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/ppc/vm/frame_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/ppc/vm/frame_ppc.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -67,8 +67,8 @@ return false; } - // Unextended sp must be within the stack and above or equal sp - bool unextended_sp_safe = (unextended_sp < thread->stack_base()) && (unextended_sp >= sp); + // Unextended sp must be within the stack + bool unextended_sp_safe = (unextended_sp < thread->stack_base()); if (!unextended_sp_safe) { return false; @@ -76,9 +76,10 @@ // An fp must be within the stack and above (but not equal) sp. bool fp_safe = (fp <= thread->stack_base()) && (fp > sp); - // an interpreter fp must be within the stack and above (but not equal) sp - bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && - ((fp - sp) >= (ijava_state_size + top_ijava_frame_abi_size)); + // An interpreter fp must be within the stack and above (but not equal) sp. + // Moreover, it must be at least the size of the ijava_state structure. + bool fp_interp_safe = (fp <= thread->stack_base()) && (fp > sp) && + ((fp - sp) >= ijava_state_size); // We know sp/unextended_sp are safe, only fp is questionable here diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/sparc/vm/assembler_sparc.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/sparc/vm/assembler_sparc.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/sparc/vm/assembler_sparc.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/sparc/vm/assembler_sparc.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -363,6 +363,13 @@ return is_in_wdisp_range(a, b, 30); } + static bool is_simm5(intptr_t x) { return is_simm(x, 5); } + static bool is_simm11(intptr_t x) { return is_simm(x, 11); } + static bool is_simm12(intptr_t x) { return is_simm(x, 12); } + static bool is_simm13(intptr_t x) { return is_simm(x, 13); } + + static int min_simm13() { return -4096; } + enum ASIs { // page 72, v9 ASI_PRIMARY = 0x80, ASI_PRIMARY_NOFAULT = 0x82, diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/x86/vm/c1_Runtime1_x86.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/x86/vm/c1_Runtime1_x86.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/x86/vm/c1_Runtime1_x86.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/x86/vm/c1_Runtime1_x86.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -172,8 +172,8 @@ #ifdef _LP64 // if there is any conflict use the stack if (arg1 == c_rarg2 || arg1 == c_rarg3 || - arg2 == c_rarg1 || arg1 == c_rarg3 || - arg3 == c_rarg1 || arg1 == c_rarg2) { + arg2 == c_rarg1 || arg2 == c_rarg3 || + arg3 == c_rarg1 || arg3 == c_rarg2) { push(arg3); push(arg2); push(arg1); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/x86/vm/templateTable_x86_64.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/x86/vm/templateTable_x86_64.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/cpu/x86/vm/templateTable_x86_64.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/cpu/x86/vm/templateTable_x86_64.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -107,10 +107,6 @@ return Address(rsp, Interpreter::expr_offset_in_bytes(2)); } -static inline Address at_tos_p3() { - return Address(rsp, Interpreter::expr_offset_in_bytes(3)); -} - // Condition conversion static Assembler::Condition j_not(TemplateTable::Condition cc) { switch (cc) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os/aix/vm/decoder_aix.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os/aix/vm/decoder_aix.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os/aix/vm/decoder_aix.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os/aix/vm/decoder_aix.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -32,7 +32,7 @@ AIXDecoder() { _decoder_status = no_error; } - ~AIXDecoder() {} + virtual ~AIXDecoder() {} virtual bool can_decode_C_frame_in_vm() const { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os/bsd/vm/decoder_machO.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os/bsd/vm/decoder_machO.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os/bsd/vm/decoder_machO.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os/bsd/vm/decoder_machO.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -34,7 +34,7 @@ class MachODecoder : public AbstractDecoder { public: MachODecoder() { } - ~MachODecoder() { } + virtual ~MachODecoder() { } virtual bool can_decode_C_frame_in_vm() const { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os/windows/vm/decoder_windows.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os/windows/vm/decoder_windows.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os/windows/vm/decoder_windows.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os/windows/vm/decoder_windows.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -56,7 +56,7 @@ public: WindowsDecoder(); - ~WindowsDecoder() { uninitialize(); }; + virtual ~WindowsDecoder() { uninitialize(); }; bool can_decode_C_frame_in_vm() const; bool demangle(const char* symbol, char *buf, int buflen); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/aix_ppc/vm/os_aix_ppc.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -178,7 +178,7 @@ // avoid unnecessary crash when libjsig is not preloaded, try handle signals // that do not require siginfo/ucontext first. - if (sig == SIGPIPE) { + if (sig == SIGPIPE || sig == SIGXFSZ) { if (os::Aix::chained_handler(sig, info, ucVoid)) { return 1; } else { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/bsd_x86/vm/os_bsd_x86.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -846,7 +846,7 @@ *size = pthread_get_stacksize_np(self); // workaround for OS X 10.9.0 (Mavericks) // pthread_get_stacksize_np returns 128 pages even though the actual size is 2048 pages - if (pthread_main_np() == 1) { + if (::pthread_main_np() == 1) { if ((*size) < (DEFAULT_MAIN_THREAD_STACK_PAGES * (size_t)getpagesize())) { char kern_osrelease[256]; size_t kern_osrelease_size = sizeof(kern_osrelease); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -185,7 +185,7 @@ // avoid unnecessary crash when libjsig is not preloaded, try handle signals // that do not require siginfo/ucontext first. - if (sig == SIGPIPE) { + if (sig == SIGPIPE || sig == SIGXFSZ) { if (os::Linux::chained_handler(sig, info, ucVoid)) { return true; } else { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/os_cpu/linux_ppc/vm/thread_linux_ppc.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -51,21 +51,22 @@ } if (ret_frame.is_interpreted_frame()) { - frame::ijava_state* istate = ret_frame.get_ijava_state(); - if (!((Method*)(istate->method))->is_metaspace_object()) { - return false; - } - uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/]; - uint64_t istate_bcp = istate->bcp; - uint64_t code_start = (uint64_t)(((Method*)(istate->method))->code_base()); - uint64_t code_end = (uint64_t)(((Method*)istate->method)->code_base() + ((Method*)istate->method)->code_size()); - if (istate_bcp >= code_start && istate_bcp < code_end) { - // we have a valid bcp, don't touch it, do nothing - } else if (reg_bcp >= code_start && reg_bcp < code_end) { - istate->bcp = reg_bcp; + frame::ijava_state *istate = ret_frame.get_ijava_state(); + const Method *m = (const Method*)(istate->method); + if (m == NULL || !m->is_valid_method()) return false; + if (!Metaspace::contains((const void*)m)) return false; + + uint64_t reg_bcp = uc->uc_mcontext.regs->gpr[14/*R14_bcp*/]; + uint64_t istate_bcp = istate->bcp; + uint64_t code_start = (uint64_t)(m->code_base()); + uint64_t code_end = (uint64_t)(m->code_base() + m->code_size()); + if (istate_bcp >= code_start && istate_bcp < code_end) { + // we have a valid bcp, don't touch it, do nothing + } else if (reg_bcp >= code_start && reg_bcp < code_end) { + istate->bcp = reg_bcp; } else { - return false; - } + return false; + } } if (!ret_frame.safe_for_sender(this)) { // nothing else to try if the frame isn't good diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/tools/hsdis/hsdis.c openjdk-8-8u312-b07/=unpacked-tar2=/src/share/tools/hsdis/hsdis.c --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/tools/hsdis/hsdis.c 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/tools/hsdis/hsdis.c 2021-08-09 15:12:52.000000000 +0000 @@ -150,15 +150,15 @@ event_callback_t event_callback_arg, void* event_stream_arg, printf_callback_t printf_callback_arg, void* printf_stream_arg, const char* options) { - decode_instructions_virtual((uintptr_t)start_pv, - (uintptr_t)end_pv, - (unsigned char*)start_pv, - (uintptr_t)end_pv - (uintptr_t)start_pv, - event_callback_arg, - event_stream_arg, - printf_callback_arg, - printf_stream_arg, - options, false); + return decode_instructions_virtual((uintptr_t)start_pv, + (uintptr_t)end_pv, + (unsigned char*)start_pv, + (uintptr_t)end_pv - (uintptr_t)start_pv, + event_callback_arg, + event_stream_arg, + printf_callback_arg, + printf_stream_arg, + options, false); } static void* decode(struct hsdis_app_data* app_data, const char* options) { @@ -237,6 +237,7 @@ case dis_condjsr: type = "condjsr"; break; case dis_dref: type = "dref"; break; case dis_dref2: type = "dref2"; break; + case dis_noninsn: type = "noninsn"; break; } strcpy(buf, close); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/adlc/formssel.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/adlc/formssel.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/adlc/formssel.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/adlc/formssel.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -3396,7 +3396,7 @@ // Count occurrences of operands names in the leaves of the instruction // match rule. void MatchNode::count_instr_names( Dict &names ) { - if( !this ) return; + if( this == NULL ) return; if( _lChild ) _lChild->count_instr_names(names); if( _rChild ) _rChild->count_instr_names(names); if( !_lChild && !_rChild ) { @@ -3969,40 +3969,13 @@ } int MatchRule::is_ideal_copy() const { - if( _rChild ) { - const char *opType = _rChild->_opType; -#if 1 - if( strcmp(opType,"CastIP")==0 ) - return 1; -#else - if( strcmp(opType,"CastII")==0 ) - return 1; - // Do not treat *CastPP this way, because it - // may transfer a raw pointer to an oop. - // If the register allocator were to coalesce this - // into a single LRG, the GC maps would be incorrect. - //if( strcmp(opType,"CastPP")==0 ) - // return 1; - //if( strcmp(opType,"CheckCastPP")==0 ) - // return 1; - // - // Do not treat CastX2P or CastP2X this way, because - // raw pointers and int types are treated differently - // when saving local & stack info for safepoints in - // Output(). - //if( strcmp(opType,"CastX2P")==0 ) - // return 1; - //if( strcmp(opType,"CastP2X")==0 ) - // return 1; -#endif - } - if( is_chain_rule(_AD.globalNames()) && - _lChild && strncmp(_lChild->_opType,"stackSlot",9)==0 ) + if (is_chain_rule(_AD.globalNames()) && + _lChild && strncmp(_lChild->_opType, "stackSlot", 9) == 0) { return 1; + } return 0; } - int MatchRule::is_expensive() const { if( _rChild ) { const char *opType = _rChild->_opType; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/adlc/output_h.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/adlc/output_h.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/adlc/output_h.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/adlc/output_h.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2162,7 +2162,9 @@ public: OutputMachOpcodes(FILE *hpp, FILE *cpp, FormDict &globals, ArchDesc &AD) : OutputMap(hpp, cpp, globals, AD, "MachOpcodes"), - begin_inst_chain_rule(-1), end_inst_chain_rule(-1), end_instructions(-1) + begin_inst_chain_rule(-1), end_inst_chain_rule(-1), + begin_rematerialize(-1), end_rematerialize(-1), + end_instructions(-1) {}; void declaration() { } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/asm/assembler.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/asm/assembler.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/asm/assembler.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/asm/assembler.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -294,28 +294,29 @@ void emit_double( jdouble x) { code_section()->emit_double( x); } void emit_address(address x) { code_section()->emit_address(x); } - // min and max values for signed immediate ranges - static int min_simm(int nbits) { return -(intptr_t(1) << (nbits - 1)) ; } - static int max_simm(int nbits) { return (intptr_t(1) << (nbits - 1)) - 1; } - - // Define some: - static int min_simm10() { return min_simm(10); } - static int min_simm13() { return min_simm(13); } - static int min_simm16() { return min_simm(16); } - - // Test if x is within signed immediate range for nbits - static bool is_simm(intptr_t x, int nbits) { return min_simm(nbits) <= x && x <= max_simm(nbits); } - - // Define some: - static bool is_simm5( intptr_t x) { return is_simm(x, 5 ); } - static bool is_simm8( intptr_t x) { return is_simm(x, 8 ); } - static bool is_simm10(intptr_t x) { return is_simm(x, 10); } - static bool is_simm11(intptr_t x) { return is_simm(x, 11); } - static bool is_simm12(intptr_t x) { return is_simm(x, 12); } - static bool is_simm13(intptr_t x) { return is_simm(x, 13); } - static bool is_simm16(intptr_t x) { return is_simm(x, 16); } - static bool is_simm26(intptr_t x) { return is_simm(x, 26); } - static bool is_simm32(intptr_t x) { return is_simm(x, 32); } + enum { min_simm10 = -512 }; + + // Test if x is within signed immediate range for width. + static bool is_simm(int64_t x, uint w) { + precond(1 < w && w < 64); + int64_t limes = INT64_C(1) << (w - 1); + return -limes <= x && x < limes; + } + + static bool is_simm8(int64_t x) { return is_simm(x, 8); } + static bool is_simm9(int64_t x) { return is_simm(x, 9); } + static bool is_simm10(int64_t x) { return is_simm(x, 10); } + static bool is_simm16(int64_t x) { return is_simm(x, 16); } + static bool is_simm32(int64_t x) { return is_simm(x, 32); } + + // Test if x is within unsigned immediate range for width. + static bool is_uimm(uint64_t x, uint w) { + precond(0 < w && w < 64); + uint64_t limes = UINT64_C(1) << w; + return x < limes; + } + + static bool is_uimm12(uint64_t x) { return is_uimm(x, 12); } // Accessors CodeSection* code_section() const { return _code_section; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_Instruction.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_Instruction.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_Instruction.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_Instruction.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -2124,11 +2124,11 @@ // creation TableSwitch(Value tag, BlockList* sux, int lo_key, ValueStack* state_before, bool is_safepoint) : Switch(tag, sux, state_before, is_safepoint) - , _lo_key(lo_key) {} + , _lo_key(lo_key) { assert(_lo_key <= hi_key(), "integer overflow"); } // accessors int lo_key() const { return _lo_key; } - int hi_key() const { return _lo_key + length() - 1; } + int hi_key() const { return _lo_key + (length() - 1); } }; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_IR.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_IR.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_IR.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_IR.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -578,11 +578,8 @@ assert(is_visited(cur), "block must be visisted when block is active"); assert(parent != NULL, "must have parent"); - cur->set(BlockBegin::linear_scan_loop_header_flag); cur->set(BlockBegin::backward_branch_target_flag); - parent->set(BlockBegin::linear_scan_loop_end_flag); - // When a loop header is also the start of an exception handler, then the backward branch is // an exception edge. Because such edges are usually critical edges which cannot be split, the // loop must be excluded here from processing. @@ -591,6 +588,10 @@ _iterative_dominators = true; return; } + + cur->set(BlockBegin::linear_scan_loop_header_flag); + parent->set(BlockBegin::linear_scan_loop_end_flag); + assert(parent->number_of_sux() == 1 && parent->sux_at(0) == cur, "loop end blocks must have one successor (critical edges are split)"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_LIRGenerator.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_LIRGenerator.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_LIRGenerator.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_LIRGenerator.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2520,8 +2520,8 @@ move_to_phi(x->state()); int lo_key = x->lo_key(); - int hi_key = x->hi_key(); int len = x->length(); + assert(lo_key <= (lo_key + (len - 1)), "integer overflow"); LIR_Opr value = tag.result(); if (UseTableRanges) { do_SwitchRanges(create_lookup_ranges(x), value, x->default_sux()); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_RangeCheckElimination.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_RangeCheckElimination.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_RangeCheckElimination.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_RangeCheckElimination.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, 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 @@ -971,7 +971,7 @@ } else { // Has no upper bound Instruction *instr = ai->length(); - if (instr != NULL) instr = ai->array(); + if (instr == NULL) instr = ai->array(); update_bound(pushed, ai->index(), Instruction::lss, instr, 0); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_Runtime1.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_Runtime1.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_Runtime1.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_Runtime1.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -983,6 +983,7 @@ address copy_buff = stub_location - *byte_skip - *byte_count; address being_initialized_entry = stub_location - *being_initialized_entry_offset; if (TracePatching) { + ttyLocker ttyl; tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_ValueMap.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_ValueMap.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/c1/c1_ValueMap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/c1/c1_ValueMap.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -328,7 +328,7 @@ }; LoopInvariantCodeMotion::LoopInvariantCodeMotion(ShortLoopOptimizer *slo, GlobalValueNumbering* gvn, BlockBegin* loop_header, BlockList* loop_blocks) - : _gvn(gvn), _short_loop_optimizer(slo) { + : _gvn(gvn), _short_loop_optimizer(slo), _insertion_point(NULL), _state(NULL), _insert_is_pred(false) { TRACE_VALUE_NUMBERING(tty->print_cr("using loop invariant code motion loop_header = %d", loop_header->block_id())); TRACE_VALUE_NUMBERING(tty->print_cr("** loop invariant code motion for short loop B%d", loop_header->block_id())); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/classFileParser.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/classFileParser.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/classFileParser.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/classFileParser.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2801,8 +2801,7 @@ // Inner class index u2 inner_class_info_index = cfs->get_u2_fast(); check_property( - inner_class_info_index == 0 || - valid_klass_reference_at(inner_class_info_index), + valid_klass_reference_at(inner_class_info_index), "inner_class_info_index %u has bad constant type in class file %s", inner_class_info_index, CHECK_0); // Outer class index @@ -2812,6 +2811,13 @@ valid_klass_reference_at(outer_class_info_index), "outer_class_info_index %u has bad constant type in class file %s", outer_class_info_index, CHECK_0); + + if (outer_class_info_index != 0) { + const Symbol* const outer_class_name = cp->klass_name_at(outer_class_info_index); + char* bytes = (char*)outer_class_name->bytes(); + guarantee_property(bytes[0] != JVM_SIGNATURE_ARRAY, + "Outer class is an array class in class file %s", CHECK_0); + } // Inner class name u2 inner_name_index = cfs->get_u2_fast(); check_property( diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/classFileParser.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/classFileParser.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/classFileParser.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/classFileParser.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -139,7 +139,7 @@ u2 _contended_group; AnnotationCollector(Location location) - : _location(location), _annotations_present(0) + : _location(location), _annotations_present(0), _contended_group(0) { assert((int)_annotation_LIMIT <= (int)sizeof(_annotations_present) * BitsPerByte, ""); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/classLoader.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/classLoader.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/classLoader.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/classLoader.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -39,7 +39,7 @@ int _num_meta_package_names; public: MetaIndex(char** meta_package_names, int num_meta_package_names); - ~MetaIndex(); + virtual ~MetaIndex(); bool may_contain(const char* class_name); }; @@ -61,6 +61,7 @@ virtual bool is_lazy(); // Constructor ClassPathEntry(); + virtual ~ClassPathEntry() {} // Attempt to locate file_name through this class path entry. // Returns a class file parsing stream if successfull. virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0; @@ -77,6 +78,7 @@ bool is_jar_file() { return false; } const char* name() { return _dir; } ClassPathDirEntry(const char* dir); + virtual ~ClassPathDirEntry() {} ClassFileStream* open_stream(const char* name, TRAPS); // Debugging NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);) @@ -106,7 +108,7 @@ bool is_jar_file() { return true; } const char* name() { return _zip_name; } ClassPathZipEntry(jzfile* zip, const char* zip_name); - ~ClassPathZipEntry(); + virtual ~ClassPathZipEntry(); u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); void contents_do(void f(const char* name, void* context), void* context); @@ -134,6 +136,7 @@ bool is_jar_file(); const char* name() { return _path; } LazyClassPathEntry(const char* path, const struct stat* st, bool throw_exception); + virtual ~LazyClassPathEntry() {} u1* open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS); ClassFileStream* open_stream(const char* name, TRAPS); void set_meta_index(MetaIndex* meta_index) { _meta_index = meta_index; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/javaClasses.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/javaClasses.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/javaClasses.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/javaClasses.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1443,9 +1443,9 @@ method = mhandle(); } - _methods->short_at_put(_index, method->orig_method_idnum()); + _methods->ushort_at_put(_index, method->orig_method_idnum()); _bcis->int_at_put(_index, merge_bci_and_version(bci, method->constants()->version())); - _cprefs->short_at_put(_index, method->name_index()); + _cprefs->ushort_at_put(_index, method->name_index()); // We need to save the mirrors in the backtrace to keep the class // from being unloaded while we still have this stack trace. @@ -1562,10 +1562,10 @@ Handle mirror(THREAD, mirrors->obj_at(index)); // NULL mirror means end of stack trace if (mirror.is_null()) goto handle_cause; - int method = methods->short_at(index); + int method = methods->ushort_at(index); int version = version_at(bcis->int_at(index)); int bci = bci_at(bcis->int_at(index)); - int cpref = cprefs->short_at(index); + int cpref = cprefs->ushort_at(index); print_stack_element(st, mirror, method, version, bci, cpref); } result = objArrayHandle(THREAD, objArrayOop(result->obj_at(trace_next_offset))); @@ -1858,10 +1858,10 @@ assert(methods != NULL && bcis != NULL && mirrors != NULL, "sanity check"); - int method = methods->short_at(chunk_index); + int method = methods->ushort_at(chunk_index); int version = version_at(bcis->int_at(chunk_index)); int bci = bci_at(bcis->int_at(chunk_index)); - int cpref = cprefs->short_at(chunk_index); + int cpref = cprefs->ushort_at(chunk_index); Handle mirror(THREAD, mirrors->obj_at(chunk_index)); // Chunk can be partial full diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/verifier.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/verifier.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/classfile/verifier.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/classfile/verifier.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2142,6 +2142,7 @@ // Get field name and signature Symbol* field_name = cp->name_ref_at(index); Symbol* field_sig = cp->signature_ref_at(index); + bool is_getfield = false; if (!SignatureVerifier::is_valid_type_signature(field_sig)) { class_format_error( @@ -2192,11 +2193,9 @@ break; } case Bytecodes::_getfield: { + is_getfield = true; stack_object_type = current_frame->pop_stack( target_class_type, CHECK_VERIFY(this)); - for (int i = 0; i < n; i++) { - current_frame->push_stack(field_type[i], CHECK_VERIFY(this)); - } goto check_protected; } case Bytecodes::_putfield: { @@ -2226,6 +2225,15 @@ check_protected: { if (_this_type == stack_object_type) break; // stack_object_type must be assignable to _current_class_type + if (was_recursively_verified()) { + if (is_getfield) { + // Push field type for getfield. + for (int i = 0; i < n; i++) { + current_frame->push_stack(field_type[i], CHECK_VERIFY(this)); + } + } + return; + } Symbol* ref_class_name = cp->klass_name_at(cp->klass_ref_index_at(index)); if (!name_in_supers(ref_class_name, current_class())) @@ -2254,6 +2262,12 @@ } default: ShouldNotReachHere(); } + if (is_getfield) { + // Push field type for getfield after doing protection check. + for (int i = 0; i < n; i++) { + current_frame->push_stack(field_type[i], CHECK_VERIFY(this)); + } + } } // Look at the method's handlers. If the bci is in the handler's try block diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/codeBlob.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/codeBlob.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/codeBlob.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/codeBlob.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -198,6 +198,11 @@ return oop_maps()->find_map_at_offset((intptr_t) return_address - (intptr_t) code_begin()); } +void CodeBlob::print_code() { + HandleMark hm; + ResourceMark m; + Disassembler::decode(this, tty); +} //---------------------------------------------------------------------------------------------------- // Implementation of BufferBlob diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/codeBlob.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/codeBlob.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/codeBlob.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/codeBlob.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -190,6 +190,7 @@ void print() const { print_on(tty); } virtual void print_on(outputStream* st) const; virtual void print_value_on(outputStream* st) const; + void print_code(); // Deal with Disassembler, VTune, Forte, JvmtiExport, MemoryService. static void trace_new_stub(CodeBlob* blob, const char* name1, const char* name2 = ""); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/dependencies.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/dependencies.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/dependencies.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/dependencies.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -969,9 +969,9 @@ // the spot-checking version: Klass* find_witness_in(KlassDepChange& changes, Klass* context_type, - bool participants_hide_witnesses); - bool witnessed_reabstraction_in_supers(Klass* k); + bool participants_hide_witnesses); public: + bool witnessed_reabstraction_in_supers(Klass* k); Klass* find_witness_subtype(Klass* context_type, KlassDepChange* changes = NULL) { assert(doing_subtype_search(), "must set up a subtype search"); // When looking for unexpected concrete types, @@ -1082,15 +1082,8 @@ } } - if (is_witness(new_type)) { - if (!ignore_witness(new_type)) { - return new_type; - } - } else if (!doing_subtype_search()) { - // No witness found, but is_witness() doesn't detect method re-abstraction in case of spot-checking. - if (witnessed_reabstraction_in_supers(new_type)) { - return new_type; - } + if (is_witness(new_type) && !ignore_witness(new_type)) { + return new_type; } return NULL; @@ -1475,16 +1468,109 @@ return num; } + +// Try to determine whether root method in some context is concrete or not based on the information about the unique method +// in that context. It exploits the fact that concrete root method is always inherited into the context when there's a unique method. +// Hence, unique method holder is always a supertype of the context class when root method is concrete. +// Examples for concrete_root_method +// C (C.m uniqm) +// | +// CX (ctxk) uniqm is inherited into context. +// +// CX (ctxk) (CX.m uniqm) here uniqm is defined in ctxk. +// Examples for !concrete_root_method +// CX (ctxk) +// | +// C (C.m uniqm) uniqm is in subtype of ctxk. +bool Dependencies::is_concrete_root_method(Method* uniqm, Klass* ctxk) { + if (uniqm == NULL) { + return false; // match Dependencies::is_concrete_method() behavior + } + // Theoretically, the "direction" of subtype check matters here. + // On one hand, in case of interface context with a single implementor, uniqm can be in a superclass of the implementor which + // is not related to context class. + // On another hand, uniqm could come from an interface unrelated to the context class, but right now it is not possible: + // it is required that uniqm->method_holder() is the participant (uniqm->method_holder() <: ctxk), hence a default method + // can't be used as unique. + if (ctxk->is_interface()) { + Klass* implementor = InstanceKlass::cast(ctxk)->implementor(); + assert(implementor != ctxk, "single implementor only"); // should have been invalidated earlier + ctxk = implementor; + } + InstanceKlass* holder = uniqm->method_holder(); + assert(!holder->is_interface(), "no default methods allowed"); + assert(ctxk->is_subclass_of(holder) || holder->is_subclass_of(ctxk), "not related"); + return ctxk->is_subclass_of(holder); +} + // If a class (or interface) has a unique concrete method uniqm, return NULL. // Otherwise, return a class that contains an interfering method. -Klass* Dependencies::check_unique_concrete_method(Klass* ctxk, Method* uniqm, - KlassDepChange* changes) { - // Here is a missing optimization: If uniqm->is_final(), - // we don't really need to search beneath it for overrides. - // This is probably not important, since we don't use dependencies - // to track final methods. (They can't be "definalized".) +Klass* Dependencies::check_unique_concrete_method(Klass* ctxk, + Method* uniqm, + KlassDepChange* changes) { ClassHierarchyWalker wf(uniqm->method_holder(), uniqm); - return wf.find_witness_definer(ctxk, changes); + Klass* witness = wf.find_witness_definer(ctxk, changes); + if (witness != NULL) { + return witness; + } + if (!Dependencies::is_concrete_root_method(uniqm, ctxk) || changes != NULL) { + Klass* conck = find_witness_AME(ctxk, uniqm, changes); + if (conck != NULL) { + // Found a concrete subtype 'conck' which does not override abstract root method. + return conck; + } + } + return NULL; +} + +// Search for AME. +// There are two version of checks. +// 1) Spot checking version(Classload time). Newly added class is checked for AME. +// Checks whether abstract/overpass method is inherited into/declared in newly added concrete class. +// 2) Compile time analysis for abstract/overpass(abstract klass) root_m. The non uniqm subtrees are checked for concrete classes. +Klass* Dependencies::find_witness_AME(Klass* ctxk, Method* m, KlassDepChange* changes) { + if (m != NULL) { + if (changes != NULL) { + // Spot checking version. + ClassHierarchyWalker wf(m); + Klass* new_type = changes->new_type(); + if (wf.witnessed_reabstraction_in_supers(new_type)) { + return new_type; + } + } else { + // Note: It is required that uniqm->method_holder() is the participant (see ClassHierarchyWalker::found_method()). + ClassHierarchyWalker wf(m->method_holder()); + Klass* conck = wf.find_witness_subtype(ctxk); + if (conck != NULL) { + Method* cm = InstanceKlass::cast(conck)->find_instance_method(m->name(), m->signature(), Klass::skip_private); + if (!Dependencies::is_concrete_method(cm, conck)) { + return conck; + } + } + } + } + return NULL; +} + +// This function is used by find_unique_concrete_method(non vtable based) +// to check whether subtype method overrides the base method. +static bool overrides(Method* sub_m, Method* base_m) { + assert(base_m != NULL, "base method should be non null"); + if (sub_m == NULL) { + return false; + } + /** + * If base_m is public or protected then sub_m always overrides. + * If base_m is !public, !protected and !private (i.e. base_m is package private) + * then sub_m should be in the same package as that of base_m. + * For package private base_m this is conservative approach as it allows only subset of all allowed cases in + * the jvm specification. + **/ + if (base_m->is_public() || base_m->is_protected() || + base_m->method_holder()->is_same_class_package(sub_m->method_holder())) { + return true; + } + return false; } // Find the set of all non-abstract methods under ctxk that match m. @@ -1507,7 +1593,14 @@ // (This can happen if m is inherited into ctxk and fm overrides it.) return NULL; } + } else if (Dependencies::find_witness_AME(ctxk, fm) != NULL) { + // Found a concrete subtype which does not override abstract root method. + return NULL; + } else if (!overrides(fm, m)) { + // Found method doesn't override abstract root method. + return NULL; } + assert(Dependencies::is_concrete_root_method(fm, ctxk) == Dependencies::is_concrete_method(m, ctxk), "mismatch"); #ifndef PRODUCT // Make sure the dependency mechanism will pass this discovery: if (VerifyDependencies && fm != NULL) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/dependencies.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/dependencies.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/dependencies.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/dependencies.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -290,6 +290,9 @@ static bool is_concrete_method(Method* m, Klass* k); // m is invocable static Klass* find_finalizable_subclass(Klass* k); + static bool is_concrete_root_method(Method* uniqm, Klass* ctxk); + static Klass* find_witness_AME(Klass* ctxk, Method* m, KlassDepChange* changes = NULL); + // These versions of the concreteness queries work through the CI. // The CI versions are allowed to skew sometimes from the VM // (oop-based) versions. The cost of such a difference is a diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/nmethod.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/nmethod.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/nmethod.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/nmethod.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2612,6 +2612,7 @@ ResourceMark rm(thread); CodeBlob* cb = CodeCache::find_blob(pc); assert(cb != NULL && cb == this, ""); + ttyLocker ttyl; tty->print_cr("implicit exception happened at " INTPTR_FORMAT, pc); print(); method()->print_codes(); @@ -2933,13 +2934,6 @@ nul_chk_table_size()); } -void nmethod::print_code() { - HandleMark hm; - ResourceMark m; - Disassembler::decode(this); -} - - #ifndef PRODUCT void nmethod::print_scopes() { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/nmethod.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/nmethod.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/code/nmethod.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/code/nmethod.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -695,7 +695,6 @@ // printing support void print() const; - void print_code(); void print_relocations() PRODUCT_RETURN; void print_pcs() PRODUCT_RETURN; void print_scopes() PRODUCT_RETURN; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/compiler/disassembler.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/compiler/disassembler.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/compiler/disassembler.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/compiler/disassembler.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -89,7 +89,7 @@ { // Match "jvm[^/]*" in jvm_path. const char* base = buf; - const char* p = strrchr(buf, '/'); + const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) lib_offset = p - base + 1; p = strstr(p ? p : base, "jvm"); if (p != NULL) jvm_offset = p - base; @@ -114,7 +114,7 @@ if (_library == NULL) { // 3. /jre/lib//hsdis-.so buf[lib_offset - 1] = '\0'; - const char* p = strrchr(buf, '/'); + const char* p = strrchr(buf, *os::file_separator()); if (p != NULL) { lib_offset = p - buf + 1; strcpy(&buf[lib_offset], hsdis_library_name); @@ -504,6 +504,7 @@ void Disassembler::decode(CodeBlob* cb, outputStream* st) { + ttyLocker ttyl; if (!load_library()) return; decode_env env(cb, st); env.output()->print_cr("Decoding CodeBlob " PTR_FORMAT, cb); @@ -511,12 +512,14 @@ } void Disassembler::decode(address start, address end, outputStream* st, CodeStrings c) { + ttyLocker ttyl; if (!load_library()) return; decode_env env(CodeCache::find_blob_unsafe(start), st, c); env.decode_instructions(start, end); } void Disassembler::decode(nmethod* nm, outputStream* st) { + ttyLocker ttyl; if (!load_library()) return; decode_env env(nm, st); env.output()->print_cr("Decoding compiled method " PTR_FORMAT ":", nm); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -22,10 +22,6 @@ * */ -#if !defined(__clang_major__) && defined(__GNUC__) -#define ATTRIBUTE_PRINTF(x,y) // FIXME, formats are a mess. -#endif - #include "precompiled.hpp" #include "classfile/metadataOnStackMark.hpp" #include "code/codeCache.hpp" @@ -232,7 +228,7 @@ if (!curr->is_young()) { gclog_or_tty->print_cr("### YOUNG REGION " PTR_FORMAT "-" PTR_FORMAT " " "incorrectly tagged (y: %d, surv: %d)", - curr->bottom(), curr->end(), + p2i(curr->bottom()), p2i(curr->end()), curr->is_young(), curr->is_survivor()); ret = false; } @@ -361,8 +357,8 @@ while (curr != NULL) { gclog_or_tty->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT ", N: " PTR_FORMAT ", age: %4d", HR_FORMAT_PARAMS(curr), - curr->prev_top_at_mark_start(), - curr->next_top_at_mark_start(), + p2i(curr->prev_top_at_mark_start()), + p2i(curr->next_top_at_mark_start()), curr->age_in_surv_rate_group_cond()); curr = curr->get_next_young_region(); } @@ -487,7 +483,7 @@ RedirtyLoggedCardTableEntryClosure redirty; dcqs.apply_closure_to_all_completed_buffers(&redirty); dcqs.iterate_closure_all_threads(&redirty, false); - gclog_or_tty->print_cr("Log entries = %d, dirty cards = %d.", + gclog_or_tty->print_cr("Log entries = " SIZE_FORMAT ", dirty cards = %d.", clear.num_processed(), orig_count); guarantee(redirty.num_processed() == clear.num_processed(), err_msg("Redirtied " SIZE_FORMAT " cards, bug cleared " SIZE_FORMAT, @@ -2690,8 +2686,8 @@ gclog_or_tty->print_cr("Region " HR_FORMAT ", " "HS = " PTR_FORMAT ", should be " PTR_FORMAT, HR_FORMAT_PARAMS(r), - r->humongous_start_region(), - _sh_region); + p2i(r->humongous_start_region()), + p2i(_sh_region)); ++_failures; } } @@ -3002,9 +2998,9 @@ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); if (_g1h->is_obj_dead_cond(obj, _vo)) { gclog_or_tty->print_cr("Root location " PTR_FORMAT " " - "points to dead obj " PTR_FORMAT, p, (void*) obj); + "points to dead obj " PTR_FORMAT, p2i(p), p2i(obj)); if (_vo == VerifyOption_G1UseMarkWord) { - gclog_or_tty->print_cr(" Mark word: " PTR_FORMAT, (void*)(obj->mark())); + gclog_or_tty->print_cr(" Mark word: " INTPTR_FORMAT, (intptr_t)obj->mark()); } obj->print_on(gclog_or_tty); _failures = true; @@ -3052,9 +3048,9 @@ // contains the nmethod if (!hrrs->strong_code_roots_list_contains(_nm)) { gclog_or_tty->print_cr("Code root location " PTR_FORMAT " " - "from nmethod " PTR_FORMAT " not in strong " - "code roots for region [" PTR_FORMAT "," PTR_FORMAT ")", - p, _nm, hr->bottom(), hr->end()); + "from nmethod " PTR_FORMAT " not in strong " + "code roots for region [" PTR_FORMAT "," PTR_FORMAT ")", + p2i(p), p2i(_nm), p2i(hr->bottom()), p2i(hr->end())); _failures = true; } } @@ -3110,7 +3106,7 @@ _young_ref_counter_closure.reset_count(); k->oops_do(&_young_ref_counter_closure); if (_young_ref_counter_closure.count() > 0) { - guarantee(k->has_modified_oops(), err_msg("Klass %p, has young refs but is not dirty.", k)); + guarantee(k->has_modified_oops(), err_msg("Klass " PTR_FORMAT ", has young refs but is not dirty.", p2i(k))); } } }; @@ -3185,7 +3181,7 @@ size_t word_sz = o->size(); gclog_or_tty->print("\nPrinting obj " PTR_FORMAT " of size " SIZE_FORMAT " isMarkedPrev %d isMarkedNext %d isAllocSince %d\n", - (void*) o, word_sz, + p2i(o), word_sz, _g1->isMarkedPrev(o), _g1->isMarkedNext(o), _hr->obj_allocated_since_prev_marking(o)); @@ -3194,7 +3190,7 @@ int *val; for (cur = start; cur < end; cur++) { val = (int *) cur; - gclog_or_tty->print("\t " PTR_FORMAT ":" PTR_FORMAT "\n", val, *val); + gclog_or_tty->print("\t " PTR_FORMAT ": %d\n", p2i(val), *val); } } } @@ -3232,7 +3228,7 @@ gclog_or_tty->print_cr("[" PTR_FORMAT "," PTR_FORMAT "] " "max_live_bytes " SIZE_FORMAT " " "< calculated " SIZE_FORMAT, - r->bottom(), r->end(), + p2i(r->bottom()), p2i(r->end()), r->max_live_bytes(), not_dead_yet_cl.live_bytes()); _failures = true; @@ -3449,10 +3445,10 @@ st->print(" %-20s", "garbage-first heap"); st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K", capacity()/K, used_unlocked()/K); - st->print(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", - _hrm.reserved().start(), - _hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords, - _hrm.reserved().end()); + st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")", + p2i(_hrm.reserved().start()), + p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords), + p2i(_hrm.reserved().end())); st->cr(); st->print(" region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K); uint young_regions = _young_list->length(); @@ -3470,7 +3466,7 @@ // Print the per-region information. st->cr(); - st->print_cr("Heap Regions: (Y=young(eden), SU=young(survivor), " + st->print_cr("Heap Regions: (E=young(eden), S=young(survivor), O=old, " "HS=humongous(starts), HC=humongous(continues), " "CS=collection set, F=free, TS=gc time stamp, " "PTAMS=previous top-at-mark-start, " @@ -4450,7 +4446,7 @@ oop old) { assert(obj_in_cs(old), err_msg("obj: " PTR_FORMAT " should still be in the CSet", - (HeapWord*) old)); + p2i(old))); markOop m = old->mark(); oop forward_ptr = old->forward_to_atomic(old); if (forward_ptr == NULL) { @@ -4485,7 +4481,7 @@ assert(old == forward_ptr || !obj_in_cs(forward_ptr), err_msg("obj: " PTR_FORMAT " forwarded to: " PTR_FORMAT " " "should not be in the CSet", - (HeapWord*) old, (HeapWord*) forward_ptr)); + p2i(old), p2i(forward_ptr))); return forward_ptr; } } @@ -5379,8 +5375,7 @@ _par_scan_state->push_on_queue(p); } else { assert(!Metaspace::contains((const void*)p), - err_msg("Unexpectedly found a pointer from metadata: " - PTR_FORMAT, p)); + err_msg("Unexpectedly found a pointer from metadata: " PTR_FORMAT, p2i(p))); _copy_non_heap_obj_cl->do_oop(p); } } @@ -6062,14 +6057,14 @@ bool G1CollectedHeap::verify_no_bits_over_tams(const char* bitmap_name, CMBitMapRO* bitmap, HeapWord* tams, HeapWord* end) { guarantee(tams <= end, - err_msg("tams: " PTR_FORMAT " end: " PTR_FORMAT, tams, end)); + err_msg("tams: " PTR_FORMAT " end: " PTR_FORMAT, p2i(tams), p2i(end))); HeapWord* result = bitmap->getNextMarkedWordAddress(tams, end); if (result < end) { gclog_or_tty->cr(); gclog_or_tty->print_cr("## wrong marked address on %s bitmap: " PTR_FORMAT, - bitmap_name, result); + bitmap_name, p2i(result)); gclog_or_tty->print_cr("## %s tams: " PTR_FORMAT " end: " PTR_FORMAT, - bitmap_name, tams, end); + bitmap_name, p2i(tams), p2i(end)); return false; } return true; @@ -6406,10 +6401,10 @@ !r->rem_set()->is_empty()) { if (G1TraceEagerReclaimHumongousObjects) { - gclog_or_tty->print_cr("Live humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length " UINT32_FORMAT " with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", + gclog_or_tty->print_cr("Live humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length %u with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", region_idx, - obj->size()*HeapWordSize, - r->bottom(), + (size_t)obj->size()*HeapWordSize, + p2i(r->bottom()), r->region_num(), r->rem_set()->occupied(), r->rem_set()->strong_code_roots_list_length(), @@ -6425,13 +6420,13 @@ guarantee(obj->is_typeArray(), err_msg("Only eagerly reclaiming type arrays is supported, but the object " PTR_FORMAT " is not.", - r->bottom())); + p2i(r->bottom()))); if (G1TraceEagerReclaimHumongousObjects) { - gclog_or_tty->print_cr("Dead humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length " UINT32_FORMAT " with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", + gclog_or_tty->print_cr("Dead humongous region %u size " SIZE_FORMAT " start " PTR_FORMAT " length %u with remset " SIZE_FORMAT " code roots " SIZE_FORMAT " is marked %d reclaim candidate %d type array %d", region_idx, - obj->size()*HeapWordSize, - r->bottom(), + (size_t)obj->size()*HeapWordSize, + p2i(r->bottom()), r->region_num(), r->rem_set()->occupied(), r->rem_set()->strong_code_roots_list_length(), @@ -6585,7 +6580,7 @@ bool doHeapRegion(HeapRegion* r) { if (r->is_young()) { gclog_or_tty->print_cr("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young", - r->bottom(), r->end()); + p2i(r->bottom()), p2i(r->end())); _success = false; } return false; @@ -6936,7 +6931,7 @@ assert(!hr->continuesHumongous(), err_msg("trying to add code root " PTR_FORMAT " in continuation of humongous region " HR_FORMAT " starting at " HR_FORMAT, - _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); + p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); // HeapRegion::add_strong_code_root_locked() avoids adding duplicate entries. hr->add_strong_code_root_locked(_nm); @@ -6963,7 +6958,7 @@ assert(!hr->continuesHumongous(), err_msg("trying to remove code root " PTR_FORMAT " in continuation of humongous region " HR_FORMAT " starting at " HR_FORMAT, - _nm, HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); + p2i(_nm), HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()))); hr->remove_strong_code_root(_nm); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -44,6 +44,7 @@ #include "memory/barrierSet.hpp" #include "memory/memRegion.hpp" #include "memory/sharedHeap.hpp" +#include "utilities/macros.hpp" #include "utilities/stack.hpp" // A "G1CollectedHeap" is an implementation of a java heap for HotSpot. @@ -1150,21 +1151,11 @@ // Do sanity check on the contents of the in-cset fast test table. bool check_cset_fast_test() PRODUCT_RETURN_( return true; ); - // verify_region_sets() performs verification over the region - // lists. It will be compiled in the product code to be used when - // necessary (i.e., during heap verification). void verify_region_sets(); // verify_region_sets_optional() is planted in the code for - // list verification in non-product builds (and it can be enabled in - // product builds by defining HEAP_REGION_SET_FORCE_VERIFY to be 1). -#if HEAP_REGION_SET_FORCE_VERIFY - void verify_region_sets_optional() { - verify_region_sets(); - } -#else // HEAP_REGION_SET_FORCE_VERIFY - void verify_region_sets_optional() { } -#endif // HEAP_REGION_SET_FORCE_VERIFY + // list verification in debug builds. + void verify_region_sets_optional() { DEBUG_ONLY(verify_region_sets();) } #ifdef ASSERT bool is_on_master_free_list(HeapRegion* hr) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -22,10 +22,6 @@ * */ -#ifndef __clang_major__ -#define ATTRIBUTE_PRINTF(x,y) // FIXME, formats are a mess. -#endif - #include "precompiled.hpp" #include "gc_implementation/g1/concurrentG1Refine.hpp" #include "gc_implementation/g1/concurrentMark.hpp" @@ -288,7 +284,7 @@ if (confidence_perc > 100) { confidence_perc = 100; warning("G1ConfidencePercent is set to a value that is too large, " - "it's been updated to %u", confidence_perc); + "it's been updated to " UINTX_FORMAT, confidence_perc); } _sigma = (double) confidence_perc / 100.0; @@ -310,7 +306,7 @@ if (reserve_perc > 50) { reserve_perc = 50; warning("G1ReservePercent is set to a value that is too large, " - "it's been updated to %u", reserve_perc); + "it's been updated to " UINTX_FORMAT, reserve_perc); } _reserve_factor = (double) reserve_perc / 100.0; // This will be set when the heap is expanded @@ -1853,7 +1849,7 @@ assert(csr->in_collection_set(), "bad CS"); st->print_cr(" " HR_FORMAT ", P: " PTR_FORMAT "N: " PTR_FORMAT ", age: %4d", HR_FORMAT_PARAMS(csr), - csr->prev_top_at_mark_start(), csr->next_top_at_mark_start(), + p2i(csr->prev_top_at_mark_start()), p2i(csr->next_top_at_mark_start()), csr->age_in_surv_rate_group_cond()); csr = next; } @@ -2219,7 +2215,7 @@ void TraceGen0TimeData::print_summary_sd(const char* str, const NumberSeq* seq) const { print_summary(str, seq); - gclog_or_tty->print_cr("%+45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", + gclog_or_tty->print_cr("%45s = %5d, std dev = %8.2lf ms, max = %8.2lf ms)", "(num", seq->num(), seq->sd(), seq->maximum()); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -160,40 +160,43 @@ } while (0) -#define ergo_verbose(_tag_, _action_) \ - ergo_verbose_common(_tag_, _action_, "", 0, 0, 0, 0, 0, 0) +#define ergo_verbose6(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ + ergo_verbose_common(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) -#define ergo_verbose0(_tag_, _action_, _extra_format_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, 0, 0, 0, 0, 0, 0) +#define ergo_verbose5(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \ + ergo_verbose6(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, "") -#define ergo_verbose1(_tag_, _action_, _extra_format_, \ - _arg0_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, 0, 0, 0, 0, 0) +#define ergo_verbose4(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_, _arg3_) \ + ergo_verbose5(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, _arg2_, _arg3_, "") + +#define ergo_verbose3(_tag_, _action_, _extra_format_, \ + _arg0_, _arg1_, _arg2_) \ + ergo_verbose4(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, _arg2_, "") #define ergo_verbose2(_tag_, _action_, _extra_format_, \ _arg0_, _arg1_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, 0, 0, 0, 0) + ergo_verbose3(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, _arg1_, "") -#define ergo_verbose3(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, 0, 0, 0) +#define ergo_verbose1(_tag_, _action_, _extra_format_, \ + _arg0_) \ + ergo_verbose2(_tag_, _action_, _extra_format_ "%s", \ + _arg0_, "") -#define ergo_verbose4(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, 0, 0) -#define ergo_verbose5(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, 0) +#define ergo_verbose0(_tag_, _action_, _extra_format_) \ + ergo_verbose1(_tag_, _action_, _extra_format_ "%s", \ + "") + +#define ergo_verbose(_tag_, _action_) \ + ergo_verbose0(_tag_, _action_, "") -#define ergo_verbose6(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) \ - ergo_verbose_common(_tag_, _action_, _extra_format_, \ - _arg0_, _arg1_, _arg2_, _arg3_, _arg4_, _arg5_) #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1ERGOVERBOSE_HPP diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/g1HeapRegionEventSender.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -33,7 +33,7 @@ bool doHeapRegion(HeapRegion* r) { EventG1HeapRegionInformation evt; evt.set_index(r->hrm_index()); - // XXX TODO evt.set_type(r->get_trace_type()); + evt.set_type(r->get_trace_type()); evt.set_start((uintptr_t)r->bottom()); evt.set_used(r->used()); evt.commit(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/g1/heapRegionSet.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -26,18 +26,12 @@ #define SHARE_VM_GC_IMPLEMENTATION_G1_HEAPREGIONSET_HPP #include "gc_implementation/g1/heapRegion.hpp" +#include "utilities/macros.hpp" // Large buffer for some cases where the output might be larger than normal. #define HRS_ERR_MSG_BUFSZ 512 typedef FormatBuffer hrs_err_msg; -// Set verification will be forced either if someone defines -// HEAP_REGION_SET_FORCE_VERIFY to be 1, or in builds in which -// asserts are compiled in. -#ifndef HEAP_REGION_SET_FORCE_VERIFY -#define HEAP_REGION_SET_FORCE_VERIFY defined(ASSERT) -#endif // HEAP_REGION_SET_FORCE_VERIFY - class hrs_ext_msg; class HRSMtSafeChecker : public CHeapObj { @@ -145,13 +139,7 @@ void verify_next_region(HeapRegion* hr); void verify_end(); -#if HEAP_REGION_SET_FORCE_VERIFY - void verify_optional() { - verify(); - } -#else // HEAP_REGION_SET_FORCE_VERIFY - void verify_optional() { } -#endif // HEAP_REGION_SET_FORCE_VERIFY + void verify_optional() { DEBUG_ONLY(verify();) } virtual void print_on(outputStream* out, bool print_contents = false); }; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/parallelScavenge/psOldGen.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2021, 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 @@ -401,7 +401,9 @@ start_array()->set_covered_region(new_memregion); Universe::heap()->barrier_set()->resize_covered_region(new_memregion); - // ALWAYS do this last!! + // The update of the space's end is done by this call. As that + // makes the new space available for concurrent allocation, this + // must be the last step when expanding. object_space()->initialize(new_memregion, SpaceDecorator::DontClear, SpaceDecorator::DontMangle); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -38,6 +38,7 @@ // we need to ensure that it is copied (see comment in // ParScanClosure::do_oop_work). Klass* objK = obj->klass(); + OrderAccess::loadload(); markOop m = obj->mark(); oop new_obj; if (m->is_marked()) { // Contains forwarding pointer. @@ -101,6 +102,7 @@ // overwritten with an overflow next pointer after the object is // forwarded. Klass* objK = obj->klass(); + OrderAccess::loadload(); markOop m = obj->mark(); oop new_obj; if (m->is_marked()) { // Contains forwarding pointer. diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/shared/mutableSpace.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/shared/mutableSpace.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/gc_implementation/shared/mutableSpace.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/gc_implementation/shared/mutableSpace.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2021, 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 @@ -28,6 +28,7 @@ #include "gc_implementation/shared/mutableSpace.hpp" #include "gc_implementation/shared/spaceDecorator.hpp" #include "oops/oop.inline.hpp" +#include "runtime/orderAccess.hpp" #include "runtime/safepoint.hpp" #include "runtime/thread.hpp" #endif // INCLUDE_ALL_GCS @@ -124,7 +125,11 @@ } set_bottom(mr.start()); - set_end(mr.end()); + // When expanding concurrently with callers of cas_allocate, setting end + // makes the new space available for allocation by other threads. So this + // assignment must follow all other configuration and initialization that + // might be done for expansion. + OrderAccess::release_store_ptr(end_addr(), mr.end()); if (clear_space) { clear(mangle_space); @@ -192,7 +197,11 @@ // This version is lock-free. HeapWord* MutableSpace::cas_allocate(size_t size) { do { - HeapWord* obj = top(); + // Read top before end, else the range check may pass when it shouldn't. + // If end is read first, other threads may advance end and top such that + // current top > old end and current top + size > current end. Then + // pointer_delta underflows, allowing installation of top > current end. + HeapWord* obj = (HeapWord*)OrderAccess::load_ptr_acquire(top_addr()); if (pointer_delta(end(), obj) >= size) { HeapWord* new_top = obj + size; HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/interpreter/interpreterRuntime.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/interpreter/interpreterRuntime.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/interpreter/interpreterRuntime.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/interpreter/interpreterRuntime.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1206,6 +1206,7 @@ } else { // debugging suppport if (PrintSignatureHandlers) { + ttyLocker ttyl; tty->cr(); tty->print_cr("argument handler #%d for: %s %s (fingerprint = " UINT64_FORMAT ", %d bytes generated)", _handlers->length(), diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -238,6 +238,10 @@ JfrJavaLog::log(tag_set, level, message, thread); JVM_END +JVM_ENTRY_NO_ENV(jboolean, jfr_should_log(JNIEnv* env, jobject jvm, jint level)) + return JfrJavaLog::should_log(level, thread) ? JNI_TRUE : JNI_FALSE; +JVM_END + JVM_ENTRY_NO_ENV(void, jfr_subscribe_log_level(JNIEnv* env, jobject jvm, jobject log_tag, jint id)) JfrJavaLog::subscribe_log_level(log_tag, id, thread); JVM_END diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethod.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -67,6 +67,8 @@ void JNICALL jfr_log(JNIEnv* env, jobject jvm, jint tag_set, jint level, jstring message); +jboolean JNICALL jfr_should_log(JNIEnv* env, jobject jvm, jint level); + void JNICALL jfr_retransform_classes(JNIEnv* env, jobject jvm, jobjectArray classes); void JNICALL jfr_set_enabled(JNIEnv* env, jobject jvm, jlong event_type_id, jboolean enabled); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/jni/jfrJniMethodRegistration.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -49,6 +49,7 @@ (char*)"getTicksFrequency", (char*)"()J", (void*)jfr_elapsed_frequency, (char*)"subscribeLogLevel", (char*)"(Ljdk/jfr/internal/LogTag;I)V", (void*)jfr_subscribe_log_level, (char*)"log", (char*)"(IILjava/lang/String;)V", (void*)jfr_log, + (char*)"shouldLog", (char*)"(I)Z", (void*)jfr_should_log, (char*)"retransformClasses", (char*)"([Ljava/lang/Class;)V", (void*)jfr_retransform_classes, (char*)"setEnabled", (char*)"(JZ)V", (void*)jfr_set_enabled, (char*)"setFileNotification", (char*)"(J)V", (void*)jfr_set_file_notification, diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/checkpoint/types/jfrType.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -151,13 +151,12 @@ } void MonitorInflateCauseConstant::serialize(JfrCheckpointWriter& writer) { - // XXX no such counters. implement? -// static const u4 nof_entries = ObjectSynchronizer::inflate_cause_nof; -// writer.write_count(nof_entries); -// for (u4 i = 0; i < nof_entries; ++i) { -// writer.write_key(i); -// writer.write(ObjectSynchronizer::inflate_cause_name((ObjectSynchronizer::InflateCause)i)); -// } + static const u4 nof_entries = ObjectSynchronizer::inflate_cause_nof; + writer.write_count(nof_entries); + for (u4 i = 0; i < nof_entries; ++i) { + writer.write_key(i); + writer.write(ObjectSynchronizer::inflate_cause_name((ObjectSynchronizer::InflateCause)i)); + } } void GCCauseConstant::serialize(JfrCheckpointWriter& writer) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -29,6 +29,7 @@ const julong MAX_ADJUSTED_GLOBAL_BUFFER_SIZE = 1 * M; const julong MIN_ADJUSTED_GLOBAL_BUFFER_SIZE_CUTOFF = 512 * K; const julong MIN_GLOBAL_BUFFER_SIZE = 64 * K; +const julong MAX_GLOBAL_BUFFER_SIZE = 2 * G; // implies at least 2 * MIN_GLOBAL_BUFFER SIZE const julong MIN_BUFFER_COUNT = 2; // MAX global buffer count open ended @@ -36,6 +37,7 @@ // MAX thread local buffer size == size of a single global buffer (runtime determined) // DEFAULT thread local buffer size = 2 * os page size (runtime determined) const julong MIN_THREAD_BUFFER_SIZE = 4 * K; +const julong MAX_THREAD_BUFFER_SIZE = 2 * G; const julong MIN_MEMORY_SIZE = 1 * M; const julong DEFAULT_MEMORY_SIZE = 10 * M; @@ -304,6 +306,11 @@ options->global_buffer_size = div_total_by_units(options->memory_size, options->buffer_count); if (options->thread_buffer_size > options->global_buffer_size) { options->global_buffer_size = options->thread_buffer_size; + if (options->memory_size_configured) { + options->buffer_count = div_total_by_per_unit(options->memory_size, options->global_buffer_size); + } else { + options->memory_size = multiply(options->global_buffer_size, options->buffer_count); + } options->buffer_count = div_total_by_per_unit(options->memory_size, options->global_buffer_size); } assert(options->global_buffer_size >= options->thread_buffer_size, "invariant"); @@ -323,7 +330,8 @@ assert(options->memory_size % os::vm_page_size() == 0, "invariant"); assert(options->global_buffer_size % os::vm_page_size() == 0, "invariant"); assert(options->thread_buffer_size % os::vm_page_size() == 0, "invariant"); - assert(options->buffer_count > 0, "invariant"); + assert(options->buffer_count >= MIN_BUFFER_COUNT, "invariant"); + assert(options->global_buffer_size >= options->thread_buffer_size, "invariant"); } #endif @@ -428,6 +436,10 @@ default: default_size(options); } + if (options->buffer_count < MIN_BUFFER_COUNT || + options->global_buffer_size < options->thread_buffer_size) { + return false; + } DEBUG_ONLY(assert_post_condition(options);) return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrMemorySizer.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, 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,6 +32,8 @@ extern const julong MIN_GLOBAL_BUFFER_SIZE; extern const julong MIN_MEMORY_SIZE; extern const julong MIN_THREAD_BUFFER_SIZE; +extern const julong MAX_GLOBAL_BUFFER_SIZE; +extern const julong MAX_THREAD_BUFFER_SIZE; struct JfrMemoryOptions { julong memory_size; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/recorder/service/jfrOptionSet.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2021, 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 @@ -390,34 +390,41 @@ return value; } -template -static void log_lower_than_min_value(Argument& memory_argument, julong min_value) { +static const char higher_than_msg[] = "This value is higher than the maximum size limited "; +static const char lower_than_msg[] = "This value is lower than the minimum size required "; +template +static void log_out_of_range_value(Argument& memory_argument, julong min_value) { + const char* msg = lower ? lower_than_msg : higher_than_msg; if (memory_argument.value()._size != memory_argument.value()._val) { // has multiplier tty->print_cr( - "This value is lower than the minimum size required " JULONG_FORMAT "%c", + "%s" JULONG_FORMAT "%c", msg, divide_with_user_unit(memory_argument, min_value), memory_argument.value()._multiplier); return; } tty->print_cr( - "This value is lower than the minimum size required " JULONG_FORMAT, + "%s" JULONG_FORMAT, msg, divide_with_user_unit(memory_argument, min_value)); } +static const char default_val_msg[] = "Value default for option "; +static const char specified_val_msg[] = "Value specified for option "; template static void log_set_value(Argument& memory_argument) { if (memory_argument.value()._size != memory_argument.value()._val) { // has multiplier tty->print_cr( - "Value specified for option \"%s\" is " JULONG_FORMAT "%c", + "%s\"%s\" is " JULONG_FORMAT "%c", + memory_argument.is_set() ? specified_val_msg: default_val_msg, memory_argument.name(), memory_argument.value()._val, memory_argument.value()._multiplier); return; } tty->print_cr( - "Value specified for option \"%s\" is " JULONG_FORMAT, + "%s\"%s\" is " JULONG_FORMAT, + memory_argument.is_set() ? specified_val_msg: default_val_msg, memory_argument.name(), memory_argument.value()._val); } @@ -538,6 +545,10 @@ return false; } } + } else if (options.thread_buffer_size_configured && options.memory_size_configured) { + if (!ensure_first_gteq_second(_dcmd_memorysize, _dcmd_threadbuffersize)) { + return false; + } } return true; } @@ -606,7 +617,7 @@ static bool ensure_gteq(Argument& memory_argument, const jlong value) { if ((jlong)memory_argument.value()._size < value) { log_set_value(memory_argument); - log_lower_than_min_value(memory_argument, value); + log_out_of_range_value(memory_argument, value); return false; } return true; @@ -637,6 +648,30 @@ return true; } +template +static bool ensure_lteq(Argument& memory_argument, const jlong value) { + if ((jlong)memory_argument.value()._size > value) { + log_set_value(memory_argument); + log_out_of_range_value(memory_argument, value); + return false; + } + return true; +} + +static bool ensure_valid_maximum_sizes() { + if (_dcmd_globalbuffersize.is_set()) { + if (!ensure_lteq(_dcmd_globalbuffersize, MAX_GLOBAL_BUFFER_SIZE)) { + return false; + } + } + if (_dcmd_threadbuffersize.is_set()) { + if (!ensure_lteq(_dcmd_threadbuffersize, MAX_THREAD_BUFFER_SIZE)) { + return false; + } + } + return true; +} + /** * Starting with the initial set of memory values from the user, * sanitize, enforce min/max rules and adjust to a set of consistent options. @@ -644,7 +679,7 @@ * Adjusted memory sizes will be page aligned. */ bool JfrOptionSet::adjust_memory_options() { - if (!ensure_valid_minimum_sizes()) { + if (!ensure_valid_minimum_sizes() || !ensure_valid_maximum_sizes()) { return false; } JfrMemoryOptions options; @@ -653,6 +688,24 @@ return false; } if (!JfrMemorySizer::adjust_options(&options)) { + if (options.buffer_count < MIN_BUFFER_COUNT || options.global_buffer_size < options.thread_buffer_size) { + log_set_value(_dcmd_memorysize); + log_set_value(_dcmd_globalbuffersize); + tty->print_cr("%s \"%s\" is " JLONG_FORMAT, + _dcmd_numglobalbuffers.is_set() ? specified_val_msg: default_val_msg, + _dcmd_numglobalbuffers.name(), _dcmd_numglobalbuffers.value()); + log_set_value(_dcmd_threadbuffersize); + if (options.buffer_count < MIN_BUFFER_COUNT) { + tty->print_cr("numglobalbuffers " JULONG_FORMAT " is less than minimal value " JULONG_FORMAT, + options.buffer_count, MIN_BUFFER_COUNT); + tty->print_cr("Decrease globalbuffersize/threadbuffersize or increase memorysize"); + } else { + tty->print_cr("globalbuffersize " JULONG_FORMAT " is less than threadbuffersize" JULONG_FORMAT, + options.global_buffer_size, options.thread_buffer_size); + tty->print_cr("Decrease globalbuffersize or increase memorysize or adjust global/threadbuffersize"); + } + return false; + } if (!check_for_ambiguity(_dcmd_memorysize, _dcmd_globalbuffersize, _dcmd_numglobalbuffers)) { return false; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -139,3 +139,7 @@ // log_tag_sets[tag_set].log_tag_set->log((LogLevelType)level, s); tty->print_cr("JFR: %s", s); } + +bool JfrJavaLog::should_log(jint level, TRAPS) { + return LogJFR; +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/jfr/utilities/jfrJavaLog.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -43,6 +43,7 @@ public: static void subscribe_log_level(jobject log_tag, jint id, TRAPS); static void log(jint tag_set, jint level, jstring message, TRAPS); + static bool should_log(jint level, TRAPS); }; #endif // SHARE_VM_JFR_UTILITIES_JFRJAVALOG_HPP diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/libadt/set.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/libadt/set.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/libadt/set.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/libadt/set.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -66,7 +66,7 @@ // The caller must deallocate the string. char *Set::setstr() const { - if( !this ) return os::strdup("{no set}"); + if( this == NULL ) return os::strdup("{no set}"); Set &set = clone(); // Virtually copy the basic set. set.Sort(); // Sort elements for in-order retrieval diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -45,9 +45,6 @@ //////////////////////////////////////////////////////////////////////////////// template -size_t TreeChunk::_min_tree_chunk_size = sizeof(TreeChunk)/HeapWordSize; - -template TreeChunk* TreeChunk::as_TreeChunk(Chunk_t* fc) { // Do some assertion checking here. return (TreeChunk*) fc; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/binaryTreeDictionary.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -163,15 +163,17 @@ Chunk_t* prev() const { return Chunk_t::prev(); } size_t size() const volatile { return Chunk_t::size(); } - static size_t min_size() { - return _min_tree_chunk_size; - } + static size_t min_size(); // debugging void verify_tree_chunk_list() const; void assert_is_mangled() const; }; +template +size_t TreeChunk::_min_tree_chunk_size = sizeof(TreeChunk)/HeapWordSize; +template +size_t TreeChunk::min_size() { return _min_tree_chunk_size; } template class BinaryTreeDictionary: public FreeBlockDictionary { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/filemap.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/filemap.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/filemap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/filemap.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -452,7 +452,7 @@ // close and remove the file. See bug 6372906. close(); remove(_full_path); - fail_stop("Unable to write to shared archive file.", NULL); + fail_stop("Unable to write to shared archive file."); } } _file_offset += nbytes; @@ -471,7 +471,7 @@ // that the written file is the correct length. _file_offset -= 1; if (lseek(_fd, (long)_file_offset, SEEK_SET) < 0) { - fail_stop("Unable to seek.", NULL); + fail_stop("Unable to seek."); } char zero = 0; write_bytes(&zero, 1); @@ -542,7 +542,7 @@ // other reserved memory (like the code cache). ReservedSpace rs(size, os::vm_allocation_granularity(), false, requested_addr); if (!rs.is_reserved()) { - fail_continue(err_msg("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr)); + fail_continue("Unable to reserve shared space at required address " INTPTR_FORMAT, requested_addr); return rs; } // the reserved virtual memory is for mapping class data sharing archive @@ -566,7 +566,7 @@ requested_addr, size, si->_read_only, si->_allow_exec); if (base == NULL || base != si->_base) { - fail_continue(err_msg("Unable to map %s shared space at required address.", shared_region_name[i])); + fail_continue("Unable to map %s shared space at required address.", shared_region_name[i]); return NULL; } #ifdef _WINDOWS @@ -605,7 +605,7 @@ void FileMapInfo::assert_mark(bool check) { if (!check) { - fail_stop("Mark mismatch while restoring from shared file.", NULL); + fail_stop("Mark mismatch while restoring from shared file."); } } @@ -748,7 +748,7 @@ void FileMapInfo::stop_sharing_and_unmap(const char* msg) { FileMapInfo *map_info = FileMapInfo::current_info(); if (map_info) { - map_info->fail_continue(msg); + map_info->fail_continue("%s", msg); for (int i = 0; i < MetaspaceShared::n_regions; i++) { if (map_info->_header->_space[i]._base != NULL) { map_info->unmap_region(i); @@ -756,6 +756,6 @@ } } } else if (DumpSharedSpaces) { - fail_stop(msg, NULL); + fail_stop("%s", msg); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/filemap.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/filemap.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/memory/filemap.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/memory/filemap.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -196,8 +196,8 @@ bool remap_shared_readonly_as_readwrite(); // Errors. - static void fail_stop(const char *msg, ...); - static void fail_continue(const char *msg, ...); + static void fail_stop(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); + static void fail_continue(const char *msg, ...) ATTRIBUTE_PRINTF(1, 2); // Return true if given address is in the mapped shared space. bool is_in_shared_space(const void* p) NOT_CDS_RETURN_(false); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/chaitin.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/chaitin.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/chaitin.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/chaitin.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2084,7 +2084,7 @@ // Dump a register name into a buffer. Be intelligent if we get called // before allocation is complete. char *PhaseChaitin::dump_register( const Node *n, char *buf ) const { - if( !this ) { // Not got anything? + if( this == NULL ) { // Not got anything? sprintf(buf,"N%d",n->_idx); // Then use Node index } else if( _node_regs ) { // Post allocation, use direct mappings, no LRG info available diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/compile.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/compile.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/compile.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/compile.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2084,13 +2084,16 @@ // They were inserted during parsing (see add_safepoint()) to make // infinite loops without calls or exceptions visible to root, i.e., // useful. -void Compile::remove_root_to_sfpts_edges() { +void Compile::remove_root_to_sfpts_edges(PhaseIterGVN& igvn) { Node *r = root(); if (r != NULL) { for (uint i = r->req(); i < r->len(); ++i) { Node *n = r->in(i); if (n != NULL && n->is_SafePoint()) { r->rm_prec(i); + if (n->outcnt() == 0) { + igvn.remove_dead_node(n); + } --i; } } @@ -2154,7 +2157,7 @@ // Now that all inlining is over, cut edge from root to loop // safepoints - remove_root_to_sfpts_edges(); + remove_root_to_sfpts_edges(igvn); // Remove the speculative part of types and clean up the graph from // the extra CastPP nodes whose only purpose is to carry them. Do diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/compile.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/compile.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/compile.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/compile.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -959,7 +959,7 @@ void inline_incrementally(PhaseIterGVN& igvn); void inline_string_calls(bool parse_time); void inline_boxing_calls(PhaseIterGVN& igvn); - void remove_root_to_sfpts_edges(); + void remove_root_to_sfpts_edges(PhaseIterGVN& igvn); // Matching, CFG layout, allocation, code generation PhaseCFG* cfg() { return _cfg; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/output.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/output.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/opto/output.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/opto/output.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -28,6 +28,7 @@ #include "code/debugInfo.hpp" #include "code/debugInfoRec.hpp" #include "compiler/compileBroker.hpp" +#include "compiler/disassembler.hpp" #include "compiler/oopMap.hpp" #include "memory/allocation.inline.hpp" #include "opto/callnode.hpp" @@ -1510,8 +1511,17 @@ } #ifdef ASSERT - if (n->size(_regalloc) < (current_offset-instr_offset)) { + uint n_size = n->size(_regalloc); + if (n_size < (current_offset-instr_offset)) { + MachNode* mach = n->as_Mach(); n->dump(); + mach->dump_format(_regalloc, tty); + tty->print_cr(" n_size (%d), current_offset (%d), instr_offset (%d)", n_size, current_offset, instr_offset); + Disassembler::decode(cb->insts_begin() + instr_offset, cb->insts_begin() + current_offset + 1, tty); + tty->print_cr(" ------------------- "); + BufferBlob* blob = this->scratch_buffer_blob(); + address blob_begin = blob->content_begin(); + Disassembler::decode(blob_begin, blob_begin + n_size + 1, tty); assert(false, "wrong size of mach node"); } #endif diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jni.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jni.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jni.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jni.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1454,7 +1454,7 @@ env, clazz, (uintptr_t) methodID); #endif /* USDT2 */ jobject obj = NULL; - DT_RETURN_MARK(NewObjectA, jobject, (const jobject)obj); + DT_RETURN_MARK(NewObjectA, jobject, (const jobject&)obj); instanceOop i = alloc_object(clazz, CHECK_NULL); obj = JNIHandles::make_local(env, i); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvm.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvm.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvm.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvm.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1772,6 +1772,18 @@ found = (k() == inner_klass); if (found && ooff != 0) { ok = i_cp->klass_at(ooff, CHECK_NULL); + if (!ok->oop_is_instance()) { + // If the outer class is not an instance klass then it cannot have + // declared any inner classes. + ResourceMark rm(THREAD); + Exceptions::fthrow( + THREAD_AND_LOCATION, + vmSymbols::java_lang_IncompatibleClassChangeError(), + "%s and %s disagree on InnerClasses attribute", + ok->external_name(), + k->external_name()); + return NULL; + } outer_klass = instanceKlassHandle(thread, ok); *inner_is_member = true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvmtiEnvBase.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvmtiEnvBase.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvmtiEnvBase.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvmtiEnvBase.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1092,7 +1092,7 @@ // If the monitor has no owner, then a non-suspended contending // thread could potentially change the state of the monitor by // entering it. The JVM/TI spec doesn't allow this. - if (owning_thread == NULL && !at_safepoint & + if (owning_thread == NULL && !at_safepoint && !JvmtiEnv::is_thread_fully_suspended(pending_thread, true, &debug_bits)) { if (ret.owner != NULL) { destroy_jni_reference(calling_thread, ret.owner); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvmtiImpl.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvmtiImpl.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvmtiImpl.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvmtiImpl.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -64,6 +64,7 @@ class GrowableElement : public CHeapObj { public: + virtual ~GrowableElement() {} virtual address getCacheValue() =0; virtual bool equals(GrowableElement* e) =0; virtual bool lessThan(GrowableElement *e)=0; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvmtiTagMap.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvmtiTagMap.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/jvmtiTagMap.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/jvmtiTagMap.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -2805,6 +2805,7 @@ return true; } +#ifdef ASSERT // verify that a static oop field is in range static inline bool verify_static_oop(InstanceKlass* ik, oop mirror, int offset) { @@ -2819,6 +2820,7 @@ return false; } } +#endif // #ifdef ASSERT // a class references its super class, interfaces, class loader, ... // and finally its static fields diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/methodHandles.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/methodHandles.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/prims/methodHandles.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/prims/methodHandles.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -972,6 +972,13 @@ return mname; } } + + if (new_index < len) { + assert(JNIHandles::resolve(this->at(new_index)) == NULL, "sanity"); + // destroy the old handle + JNIHandles::destroy_weak_global(this->at(new_index)); + } + // Not found, push the new one, or reuse empty slot this->at_put_grow(new_index, mem_name_wref); return new_mem_name; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/arguments.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/arguments.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/arguments.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/arguments.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -3314,6 +3314,12 @@ } else if (match_option(option, "-XX:+DisplayVMOutputToStdout", &tail)) { FLAG_SET_CMDLINE(bool, DisplayVMOutputToStderr, false); FLAG_SET_CMDLINE(bool, DisplayVMOutputToStdout, true); + } else if (match_option(option, "-XX:+ErrorFileToStderr", &tail)) { + FLAG_SET_CMDLINE(bool, ErrorFileToStdout, false); + FLAG_SET_CMDLINE(bool, ErrorFileToStderr, true); + } else if (match_option(option, "-XX:+ErrorFileToStdout", &tail)) { + FLAG_SET_CMDLINE(bool, ErrorFileToStderr, false); + FLAG_SET_CMDLINE(bool, ErrorFileToStdout, true); } else if (match_option(option, "-XX:+ExtendedDTraceProbes", &tail)) { #if defined(DTRACE_ENABLED) FLAG_SET_CMDLINE(bool, ExtendedDTraceProbes, true); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/globals.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/globals.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/globals.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/globals.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -2699,6 +2699,12 @@ product(bool, DisplayVMOutputToStdout, false, \ "If DisplayVMOutput is true, display all VM output to stdout") \ \ + product(bool, ErrorFileToStderr, false, \ + "If true, error data is printed to stderr instead of a file") \ + \ + product(bool, ErrorFileToStdout, false, \ + "If true, error data is printed to stdout instead of a file") \ + \ product(bool, UseHeavyMonitors, false, \ "use heavyweight instead of lightweight Java monitors") \ \ diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/mutex.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/mutex.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/mutex.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/mutex.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -283,16 +283,6 @@ return x & 0x7FFFFFFF ; } -static inline jint MarsagliaXOR (jint * const a) { - jint x = *a ; - if (x == 0) x = UNS(a)|1 ; - x ^= x << 6; - x ^= ((unsigned)x) >> 21; - x ^= x << 7 ; - *a = x ; - return x & 0x7FFFFFFF ; -} - static int Stall (int its) { static volatile jint rv = 1 ; volatile int OnFrame = 0 ; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/perfData.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/perfData.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/perfData.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/perfData.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -288,7 +288,7 @@ void *_valuep; PerfData(CounterNS ns, const char* name, Units u, Variability v); - ~PerfData(); + virtual ~PerfData(); // create the entry for the PerfData item in the PerfData memory region. // this region is maintained separately from the PerfData objects to diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/safepoint.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/safepoint.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/safepoint.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/safepoint.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -1118,6 +1118,7 @@ if( nm->is_at_poll_return(real_return_addr) ) { // See if return type is an oop. bool return_oop = nm->method()->is_returning_oop(); + HandleMark hm(thread()); Handle return_value; if (return_oop) { // The oop result has been saved on the stack together with all diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/sharedRuntime.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/sharedRuntime.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/sharedRuntime.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/sharedRuntime.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -716,6 +716,7 @@ #endif if (t == NULL) { + ttyLocker ttyl; tty->print_cr("MISSING EXCEPTION HANDLER for pc " INTPTR_FORMAT " and handler bci %d", ret_pc, handler_bci); tty->print_cr(" Exception:"); exception->print(); @@ -2633,8 +2634,8 @@ BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache if (buf != NULL) { CodeBuffer buffer(buf); - double locs_buf[20]; - buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); + struct { double data[20]; } locs_buf; + buffer.insts()->initialize_shared_locs((relocInfo*)&locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); MacroAssembler _masm(&buffer); // Fill in the signature array, for the calling-convention call. diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/synchronizer.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/synchronizer.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/synchronizer.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/synchronizer.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -216,7 +216,9 @@ } } - ObjectSynchronizer::inflate(THREAD, object)->exit (true, THREAD) ; + ObjectSynchronizer::inflate(THREAD, + object, + inflate_cause_vm_internal)->exit(true, THREAD); } // ----------------------------------------------------------------------------- @@ -258,7 +260,9 @@ // must be non-zero to avoid looking like a re-entrant lock, // and must not look locked either. lock->set_displaced_header(markOopDesc::unused_mark()); - ObjectSynchronizer::inflate(THREAD, obj())->enter(THREAD); + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_monitor_enter)->enter(THREAD); } // This routine is used to handle interpreter/compiler slow case @@ -288,7 +292,9 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_vm_internal); return monitor->complete_exit(THREAD); } @@ -301,7 +307,9 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_vm_internal); monitor->reenter(recursion, THREAD); } @@ -316,7 +324,7 @@ assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); } THREAD->set_current_pending_monitor_is_from_java(false); - ObjectSynchronizer::inflate(THREAD, obj())->enter(THREAD); + ObjectSynchronizer::inflate(THREAD, obj(), inflate_cause_jni_enter)->enter(THREAD); THREAD->set_current_pending_monitor_is_from_java(true); } @@ -342,7 +350,9 @@ } assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now"); - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj, + inflate_cause_jni_exit); // If this thread has locked the object, exit the monitor. Note: can't use // monitor->check(CHECK); must exit even if an exception is pending. if (monitor->check(THREAD)) { @@ -385,7 +395,10 @@ TEVENT (wait - throw IAX) ; THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); } - ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, obj()); + ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_wait); + DTRACE_MONITOR_WAIT_PROBE(monitor, obj(), THREAD, millis); monitor->wait(millis, true, THREAD); @@ -404,7 +417,9 @@ TEVENT (wait - throw IAX) ; THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative"); } - ObjectSynchronizer::inflate(THREAD, obj()) -> wait(millis, false, THREAD) ; + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_wait)->wait(millis, false, THREAD) ; } void ObjectSynchronizer::notify(Handle obj, TRAPS) { @@ -417,7 +432,9 @@ if (mark->has_locker() && THREAD->is_lock_owned((address)mark->locker())) { return; } - ObjectSynchronizer::inflate(THREAD, obj())->notify(THREAD); + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_notify)->notify(THREAD); } // NOTE: see comment of notify() @@ -431,7 +448,9 @@ if (mark->has_locker() && THREAD->is_lock_owned((address)mark->locker())) { return; } - ObjectSynchronizer::inflate(THREAD, obj())->notifyAll(THREAD); + ObjectSynchronizer::inflate(THREAD, + obj(), + inflate_cause_notify)->notifyAll(THREAD); } // ----------------------------------------------------------------------------- @@ -686,7 +705,7 @@ } // Inflate the monitor to set hash code - monitor = ObjectSynchronizer::inflate(Self, obj); + monitor = ObjectSynchronizer::inflate(Self, obj, inflate_cause_hash_code); // Load displaced header and check it has hash code mark = monitor->header(); assert (mark->is_neutral(), "invariant") ; @@ -1183,12 +1202,29 @@ TEVENT (omFlush) ; } +const char* ObjectSynchronizer::inflate_cause_name(const InflateCause cause) { + switch (cause) { + case inflate_cause_vm_internal: return "VM Internal"; + case inflate_cause_monitor_enter: return "Monitor Enter"; + case inflate_cause_wait: return "Monitor Wait"; + case inflate_cause_notify: return "Monitor Notify"; + case inflate_cause_hash_code: return "Monitor Hash Code"; + case inflate_cause_jni_enter: return "JNI Monitor Enter"; + case inflate_cause_jni_exit: return "JNI Monitor Exit"; + default: + ShouldNotReachHere(); + } + return "Unknown"; +} + static void post_monitor_inflate_event(EventJavaMonitorInflate* event, - const oop obj) { + const oop obj, + const ObjectSynchronizer::InflateCause cause) { assert(event != NULL, "invariant"); assert(event->should_commit(), "invariant"); event->set_monitorClass(obj->klass()); event->set_address((uintptr_t)(void*)obj); + event->set_cause((u1)cause); event->commit(); } @@ -1200,7 +1236,9 @@ assert(mark->monitor()->header()->is_neutral(), "monitor must record a good object header"); return mark->monitor(); } - return ObjectSynchronizer::inflate(Thread::current(), obj); + return ObjectSynchronizer::inflate(Thread::current(), + obj, + inflate_cause_vm_internal); } @@ -1208,7 +1246,9 @@ // multiple locks occupy the same $ line. Padding might be appropriate. -ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, oop object) { +ObjectMonitor * ATTR ObjectSynchronizer::inflate (Thread * Self, + oop object, + const InflateCause cause) { // Inflate mutates the heap ... // Relaxing assertion for bug 6320749. assert (Universe::verify_in_progress() || @@ -1347,7 +1387,7 @@ } } if (event.should_commit()) { - post_monitor_inflate_event(&event, object); + post_monitor_inflate_event(&event, object, cause); } return m ; } @@ -1400,7 +1440,7 @@ } } if (event.should_commit()) { - post_monitor_inflate_event(&event, object); + post_monitor_inflate_event(&event, object, cause); } return m ; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/synchronizer.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/synchronizer.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/synchronizer.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/synchronizer.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -42,6 +42,18 @@ owner_none, owner_other } LockOwnership; + + typedef enum { + inflate_cause_vm_internal = 0, + inflate_cause_monitor_enter = 1, + inflate_cause_wait = 2, + inflate_cause_notify = 3, + inflate_cause_hash_code = 4, + inflate_cause_jni_enter = 5, + inflate_cause_jni_exit = 6, + inflate_cause_nof = 7 // Number of causes + } InflateCause; + // exit must be implemented non-blocking, since the compiler cannot easily handle // deoptimization at monitor exit. Hence, it does not take a Handle argument. @@ -90,9 +102,10 @@ static void omFlush (Thread * Self) ; // Inflate light weight monitor to heavy weight monitor - static ObjectMonitor* inflate(Thread * Self, oop obj); + static ObjectMonitor* inflate(Thread * Self, oop obj, const InflateCause cause); // This version is only for internal use static ObjectMonitor* inflate_helper(oop obj); + static const char* inflate_cause_name(const InflateCause cause); // Returns the identity hash value for an oop // NOTE: It may cause monitor inflation diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/vframe.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/vframe.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/runtime/vframe.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/runtime/vframe.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -397,6 +397,7 @@ // as it were a native compiled frame (no Java-level assumptions). #ifdef ASSERT if (WizardMode) { + ttyLocker ttyl; tty->print_cr("Error in fill_from_frame: pc_desc for " INTPTR_FORMAT " not found or invalid at %d", p2i(_frame.pc()), decode_offset); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/debug.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/debug.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/debug.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/debug.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -447,12 +447,13 @@ extern "C" void disnm(intptr_t p) { Command c("disnm"); CodeBlob* cb = CodeCache::find_blob((address) p); - nmethod* nm = cb->as_nmethod_or_null(); - if (nm) { - nm->print(); - Disassembler::decode(nm); - } else { - cb->print(); + if (cb != NULL) { + nmethod* nm = cb->as_nmethod_or_null(); + if (nm != NULL) { + nm->print(); + } else { + cb->print(); + } Disassembler::decode(cb); } } @@ -687,6 +688,7 @@ tty->print_cr(" pns(void* sp, void* fp, void* pc) - print native (i.e. mixed) stack trace. E.g."); tty->print_cr(" pns($sp, $rbp, $pc) on Linux/amd64 and Solaris/amd64 or"); tty->print_cr(" pns($sp, $ebp, $pc) on Linux/x86 or"); + tty->print_cr(" pns($sp, $fp, $pc) on Linux/AArch64 or"); tty->print_cr(" pns($sp, 0, $pc) on Linux/ppc64 or"); tty->print_cr(" pns($sp + 0x7ff, 0, $pc) on Solaris/SPARC"); tty->print_cr(" - in gdb do 'set overload-resolution off' before calling pns()"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/debug.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/debug.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/debug.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/debug.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -156,6 +156,9 @@ #define assert_if_no_error(cond,msg) #endif // #ifdef ASSERT +#define precond(p) assert(p, "precond") +#define postcond(p) assert(p, "postcond") + // guarantee is like assert except it's always executed -- use it for // cheap tests that catch errors that would otherwise be hard to find. // guarantee is also used for Verify options. diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/decoder_elf.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/decoder_elf.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/decoder_elf.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/decoder_elf.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -37,7 +37,7 @@ _opened_elf_files = NULL; _decoder_status = no_error; } - ~ElfDecoder(); + virtual ~ElfDecoder(); bool can_decode_C_frame_in_vm() const { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/decoder.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/decoder.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/decoder.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/decoder.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -32,6 +32,7 @@ class AbstractDecoder : public CHeapObj { public: + virtual ~AbstractDecoder() {} // status code for decoding native C frame enum decoder_status { not_available = -10, // real decoder is not available @@ -78,7 +79,7 @@ _decoder_status = not_available; } - ~NullDecoder() {}; + virtual ~NullDecoder() {}; virtual bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -29,6 +29,11 @@ #define __STDC_FORMAT_MACROS #endif +// Needed for INT64_C and UINT64_C with ISO C99 libraries (see JDK-8272214) +#ifndef __STDC_CONSTANT_MACROS +#define __STDC_CONSTANT_MACROS +#endif + #ifdef TARGET_COMPILER_gcc # include "utilities/globalDefinitions_gcc.hpp" #endif diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions_visCPP.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions_visCPP.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions_visCPP.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/globalDefinitions_visCPP.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -77,6 +77,15 @@ // pointer is stored as integer value. #define NULL_WORD NULL +// Some MS Visual Studio versions do not seem to have INT64_C and UINT64_C +// even with __STDC_CONSTANT_MACROS defined. +#ifndef INT64_C +#define INT64_C(c) (c ## i64) +#endif +#ifndef UINT64_C +#define UINT64_C(c) (c ## ui64) +#endif + // Compiler-specific primitive types typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/hashtable.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/hashtable.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/hashtable.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/hashtable.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -94,8 +94,6 @@ return false; } -template juint RehashableHashtable::_seed = 0; - // Create a new table and using alternate hash code, populate the new table // with the existing elements. This can be used to change the hash code // and could in the future change the size of the table. @@ -219,7 +217,7 @@ if (*top + entry_size() > end) { report_out_of_shared_space(SharedMiscData); } - *p = (BasicHashtableEntry*)memcpy(*top, *p, entry_size()); + *p = (BasicHashtableEntry*)memcpy(*top, (void*)*p, entry_size()); *top += entry_size(); } } @@ -333,7 +331,7 @@ if (*top + len > end) { report_out_of_shared_space(SharedMiscData); } - _buckets = (HashtableBucket*)memcpy(*top, _buckets, len); + _buckets = (HashtableBucket*)memcpy(*top, (void*)_buckets, len); *top += len; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/hashtable.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/hashtable.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/hashtable.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/hashtable.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -314,8 +314,8 @@ // Function to move these elements into the new table. void move_to(RehashableHashtable* new_table); - static bool use_alternate_hashcode() { return _seed != 0; } - static juint seed() { return _seed; } + static bool use_alternate_hashcode(); + static juint seed(); static int literal_size(Symbol *symbol); static int literal_size(oop oop); @@ -333,6 +333,9 @@ static juint _seed; }; +template juint RehashableHashtable::_seed = 0; +template juint RehashableHashtable::seed() { return _seed; }; +template bool RehashableHashtable::use_alternate_hashcode() { return _seed != 0; }; // Verions of hashtable where two handles are used to compute the index. diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/ostream.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/ostream.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/ostream.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/ostream.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -673,7 +673,10 @@ static int vsnprintf_wrapper(char* buf, size_t len, const char* fmt, ...) { va_list args; va_start(args, fmt); +PRAGMA_DIAG_PUSH +PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL int result = os::vsnprintf(buf, len, fmt, args); +PRAGMA_DIAG_POP va_end(args); return result; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/taskqueue.hpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/taskqueue.hpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/taskqueue.hpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/taskqueue.hpp 2021-08-09 15:12:52.000000000 +0000 @@ -430,9 +430,7 @@ } template -GenericTaskQueue::~GenericTaskQueue() { - FREE_C_HEAP_ARRAY(E, _elems, F); -} +GenericTaskQueue::~GenericTaskQueue() {} // OverflowTaskQueue is a TaskQueue that also includes an overflow stack for // elements that do not fit in the TaskQueue. diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/vmError.cpp openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/vmError.cpp --- openjdk-8-8u292-b10/=unpacked-tar2=/src/share/vm/utilities/vmError.cpp 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/src/share/vm/utilities/vmError.cpp 2021-08-09 15:12:52.000000000 +0000 @@ -984,12 +984,16 @@ } } - // print to screen + // Part 1: print an abbreviated version (the '#' section) to stdout. if (!out_done) { first_error->_verbose = false; - staticBufferStream sbs(buffer, sizeof(buffer), &out); - first_error->report(&sbs); + // Suppress this output if we plan to print Part 2 to stdout too. + // No need to have the "#" section twice. + if (!(ErrorFileToStdout && out.fd() == 1)) { + staticBufferStream sbs(buffer, sizeof(buffer), &out); + first_error->report(&sbs); + } out_done = true; @@ -997,6 +1001,7 @@ first_error->_current_step_info = ""; // reset current_step string } + // Part 2: print a full error log file (optionally to stdout or stderr). // print to error log file if (!log_done) { first_error->_verbose = true; @@ -1004,19 +1009,26 @@ // see if log file is already open if (!log.is_open()) { // open log file - int fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer)); - if (fd != -1) { - out.print_raw("# An error report file with more information is saved as:\n# "); - out.print_raw_cr(buffer); - - log.set_fd(fd); + int fd; + if (ErrorFileToStdout) { + fd = 1; + } else if (ErrorFileToStderr) { + fd = 2; } else { - out.print_raw_cr("# Can not save log file, dump to screen.."); - log.set_fd(defaultStream::output_fd()); - /* Error reporting currently needs dumpfile. - * Maybe implement direct streaming in the future.*/ - transmit_report_done = true; + fd = prepare_log_file(ErrorFile, "hs_err_pid%p.log", buffer, sizeof(buffer)); + if (fd != -1) { + out.print_raw("# An error report file with more information is saved as:\n# "); + out.print_raw_cr(buffer); + + } else { + out.print_raw_cr("# Can not save log file, dump to screen.."); + fd = defaultStream::output_fd(); + /* Error reporting currently needs dumpfile. + * Maybe implement direct streaming in the future.*/ + transmit_report_done = true; + } } + log.set_fd(fd); } staticBufferStream sbs(buffer, O_BUFLEN, &log); @@ -1034,7 +1046,7 @@ } } - if (log.fd() != defaultStream::output_fd()) { + if (log.fd() > 3) { close(log.fd()); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm --- openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoop.jasm 2021-08-09 15:12:52.000000000 +0000 @@ -0,0 +1,89 @@ +/* + * 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. + * + */ + +super public class TestRangeCheckExceptionHandlerLoop + version 51:0 +{ + + +public Method "":"()V" + stack 1 locals 1 +{ + aload_0; + invokespecial Method java/lang/Object."":"()V"; + return; +} + +/* This method has an irreducible loop, with 2 entries, one is the exception handler + + static void test(boolean flag, int[] array, Exception exception) throws Exception { + int i = 0; + if (flag) { + try { + throw exception; + } catch(Exception e) { + array[i] = 0; + i++; + } + } + if (i < 10) { + throw exception; // caught by exception handler above as well + } + } +*/ +public static Method test:"(Z[ILjava/lang/Exception;)V" + throws java/lang/Exception + stack 3 locals 5 +{ + iconst_0; + istore_3; + iload_0; + ifeq L17; + try t0; + aload_2; + athrow; + endtry t0; + catch t0 java/lang/Exception; + catch t1 java/lang/Exception; + stack_frame_type full; + locals_map int, class "[I", class java/lang/Exception, int; + stack_map class java/lang/Exception; + astore 4; + aload_1; + iload_3; + iconst_0; + iastore; + iinc 3, 1; + L17: stack_frame_type same; + iload_3; + bipush 10; + if_icmpge L25; + try t1; + aload_2; + athrow; + endtry t1; + L25: stack_frame_type same; + return; +} +} // end Class TestRangeCheckExceptionHandlerLoop diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/rangechecks/TestRangeCheckExceptionHandlerLoopMain.java 2021-08-09 15:12:52.000000000 +0000 @@ -0,0 +1,41 @@ +/* + * 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 + * @bug 8134883 + * @summary C1's range check elimination breaks with a non-natural loop that an exception handler as one entry + * @compile TestRangeCheckExceptionHandlerLoop.jasm + * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestRangeCheckExceptionHandlerLoopMain + */ + +public class TestRangeCheckExceptionHandlerLoopMain { + public static void main(String[] args) throws Exception { + Exception exception = new Exception(); + int[] array = new int[10]; + for (int i = 0; i < 20000; i++) { + TestRangeCheckExceptionHandlerLoop.test(false, array, exception); + } + } +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/stringopts/TestStringObjectInitialization.java openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/stringopts/TestStringObjectInitialization.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/stringopts/TestStringObjectInitialization.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/stringopts/TestStringObjectInitialization.java 2021-08-09 15:12:52.000000000 +0000 @@ -59,6 +59,11 @@ // Trigger C2's string concatenation optimization add(s + Arrays.toString(sArray) + " const "); } + + public void reset() { + // Reset string to avoid OOMEs + myString = ""; + } } class Runner implements Runnable { @@ -70,8 +75,9 @@ public void run(){ String[] array = {"a", "b", "c"}; - for (int i = 0; i < 10000; ++i) { + for (int i = 0; i < 100_000; ++i) { test.run("a", array); + test.reset(); } } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/compiler/uncommontrap/TestSpecTrapClassUnloading.java 2021-08-09 15:12:52.000000000 +0000 @@ -25,7 +25,7 @@ * @test * @bug 8031752 * @summary speculative traps need to be cleaned up at GC - * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx1M TestSpecTrapClassUnloading + * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:+UseTypeSpeculation -XX:TypeProfileLevel=222 -XX:CompileCommand=exclude,java.lang.reflect.Method::invoke -XX:CompileCommand=exclude,sun.reflect.DelegatingMethodAccessorImpl::invoke -Xmx512M TestSpecTrapClassUnloading * */ @@ -45,7 +45,7 @@ MemoryChunk other; long[] array; MemoryChunk(MemoryChunk other) { - other = other; + this.other = other; array = new long[1024 * 1024 * 1024]; } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/gc/arguments/TestAggressiveHeap.java openjdk-8-8u312-b07/=unpacked-tar2=/test/gc/arguments/TestAggressiveHeap.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/gc/arguments/TestAggressiveHeap.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/gc/arguments/TestAggressiveHeap.java 2021-08-09 15:12:52.000000000 +0000 @@ -51,13 +51,18 @@ // Option requires at least 256M, else error during option processing. private static final long minMemory = 256 * 1024 * 1024; + // Setting the heap to half of the physical memory is not suitable for + // a test environment with many tests running concurrently, setting to + // half of the required size instead. + private static final String heapSizeOption = "-Xmx128M"; + // bool UseParallelGC := true {product} private static final String parallelGCPattern = " *bool +UseParallelGC *:= *true +\\{product\\}"; private static void testFlag() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - option, "-XX:+PrintFlagsFinal", "-version"); + option, heapSizeOption, "-XX:+PrintFlagsFinal", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/gc/g1/TestHumongousShrinkHeap.java openjdk-8-8u312-b07/=unpacked-tar2=/test/gc/g1/TestHumongousShrinkHeap.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/gc/g1/TestHumongousShrinkHeap.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/gc/g1/TestHumongousShrinkHeap.java 2021-08-09 15:12:52.000000000 +0000 @@ -49,19 +49,29 @@ private static final int REGION_SIZE = 1024 * 1024; // 1M private static final int LISTS_COUNT = 10; private static final int HUMON_SIZE = Math.round(.9f * REGION_SIZE); - private static final long AVAILABLE_MEMORY - = Runtime.getRuntime().freeMemory(); - private static final int HUMON_COUNT - = (int) ((AVAILABLE_MEMORY / HUMON_SIZE) - / LISTS_COUNT); + private static final long TOTAL_MEMORY = Runtime.getRuntime().totalMemory(); + private static final long MAX_MEMORY = Runtime.getRuntime().maxMemory(); + + private static final int HUMON_COUNT = (int) ((TOTAL_MEMORY / HUMON_SIZE) / LISTS_COUNT); public static void main(String[] args) { - System.out.format("Running with %s max heap size. " - + "Will allocate humongous object of %s size %d times.%n", - MemoryUsagePrinter.humanReadableByteCount(AVAILABLE_MEMORY, false), - MemoryUsagePrinter.humanReadableByteCount(HUMON_SIZE, false), - HUMON_COUNT + if (HUMON_COUNT == 0) { + System.out.println("Skipped. Heap is too small"); + return; + } + + if (TOTAL_MEMORY + REGION_SIZE * HUMON_COUNT > MAX_MEMORY) { + System.out.println("Skipped. Initial heap size is to close to max heap size."); + return; + } + + System.out.format("Running with %s initial heap size of %s maximum heap size. " + + "Will allocate humongous object of %s size %d times.%n", + MemoryUsagePrinter.humanReadableByteCount(TOTAL_MEMORY, false), + MemoryUsagePrinter.humanReadableByteCount(MAX_MEMORY, false), + MemoryUsagePrinter.humanReadableByteCount(HUMON_SIZE, false), + HUMON_COUNT ); new TestHumongousShrinkHeap().test(); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java openjdk-8-8u312-b07/=unpacked-tar2=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java 2021-08-09 15:12:52.000000000 +0000 @@ -96,11 +96,18 @@ .getActualMemoryUsage(); test.allocate(); - for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; - i++) { + for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD; i++) { SurvivorAlignmentTestMain.WHITE_BOX.youngGC(); } + // Sometimes we see that data unrelated to the test has been allocated during + // the loop. This data is included in the expectedMemoryUsage since we look + // through all threads to see what they allocated. If this data is still in + // the survivor area however, it should not be included in expectedMemoryUsage + // since the verification below only look at what's in tenured space. + expectedMemoryUsage -= SurvivorAlignmentTestMain.getAlignmentHelper( + SurvivorAlignmentTestMain.HeapSpace.SURVIVOR) + .getActualMemoryUsage(); test.verifyMemoryUsage(expectedMemoryUsage); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/Makefile openjdk-8-8u312-b07/=unpacked-tar2=/test/Makefile --- openjdk-8-8u292-b10/=unpacked-tar2=/test/Makefile 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/Makefile 2021-08-09 15:12:52.000000000 +0000 @@ -288,6 +288,9 @@ # Ignore tests are not run and completely silent about it JTREG_IGNORE_OPTION = -ignore:quiet JTREG_BASIC_OPTIONS += $(JTREG_IGNORE_OPTION) +# Multiply by 4 the timeout factor +JTREG_TIMEOUT_OPTION = -timeoutFactor:4 +JTREG_BASIC_OPTIONS += $(JTREG_TIMEOUT_OPTION) # Add any extra options JTREG_BASIC_OPTIONS += $(EXTRA_JTREG_OPTIONS) # Set other vm and test options diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/8001071/Test8001071.java openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/8001071/Test8001071.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/8001071/Test8001071.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/8001071/Test8001071.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +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. - */ - -import sun.misc.Unsafe; -import java.lang.reflect.Field; - -@SuppressWarnings("sunapi") -public class Test8001071 { - public static Unsafe unsafe; - - static { - try { - Field f = Unsafe.class.getDeclaredField("theUnsafe"); - f.setAccessible(true); - unsafe = (Unsafe) f.get(null); - } catch ( Exception e ) { - e.printStackTrace(); - } - } - - public static void main(String args[]) { - unsafe.getObject(new Test8001071(), Short.MAX_VALUE); - } - -} diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/8001071/Test8001071.sh openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/8001071/Test8001071.sh --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/8001071/Test8001071.sh 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/8001071/Test8001071.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -#!/bin/sh - -# 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 -## @bug 8001071 -## @summary Add simple range check into VM implemenation of Unsafe access methods -## @compile Test8001071.java -## @run shell Test8001071.sh -## @author filipp.zhinkin@oracle.com - -VERSION=`${TESTJAVA}/bin/java ${TESTVMOPTS} -version 2>&1` - -if [ -n "`echo $VERSION | grep debug`" -o -n "`echo $VERSION | grep jvmg`" ]; then - echo "Build type check passed" - echo "Continue testing" -else - echo "Fastdebug build is required for this test" - exit 0 -fi - -${TESTJAVA}/bin/java -cp ${TESTCLASSES} ${TESTVMOPTS} Test8001071 2>&1 - -HS_ERR_FILE=hs_err_pid*.log - -if [ ! -f $HS_ERR_FILE ] -then - echo "hs_err_pid log file was not found" - echo "Test failed" - exit 1 -fi - -grep "assert(byte_offset < p_size) failed: Unsafe access: offset.*> object's size.*" $HS_ERR_FILE - -if [ "0" = "$?" ]; -then - echo "Range check assertion failed as expected" - echo "Test passed" - exit 0 -else - echo "Range check assertion was not failed" - echo "Test failed" - exit 1 -fi diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/CompressedOops/CompressedClassPointers.java openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/CompressedOops/CompressedClassPointers.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/CompressedOops/CompressedClassPointers.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/CompressedOops/CompressedClassPointers.java 2021-08-09 15:12:52.000000000 +0000 @@ -44,10 +44,10 @@ output.shouldHaveExitValue(0); } - public static void smallHeapTestWith3G() throws Exception { + public static void smallHeapTestWith1G() throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( "-XX:+UnlockDiagnosticVMOptions", - "-XX:CompressedClassSpaceSize=3g", + "-XX:CompressedClassSpaceSize=1g", "-Xmx128m", "-XX:+PrintCompressedOopsMode", "-XX:+VerifyBeforeGC", "-version"); @@ -128,7 +128,7 @@ } } smallHeapTest(); - smallHeapTestWith3G(); + smallHeapTestWith1G(); largeHeapTest(); largePagesTest(); sharingTest(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/ErrorHandling/ErrorFileRedirectTest.java 2021-08-09 15:12:52.000000000 +0000 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, SAP. 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 8220786 + * @summary Test ErrorFileToStderr and ErrorFileToStdout + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.OutputAnalyzer; +import com.oracle.java.testlibrary.Platform; +import com.oracle.java.testlibrary.ProcessTools; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.util.Map; +import java.util.regex.Pattern; + +public class ErrorFileRedirectTest { + + public static void do_test(boolean redirectStdout, boolean redirectStderr) throws Exception { + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-Xmx64M", + "-XX:ErrorHandlerTest=12", + "-XX:" + (redirectStdout ? "+" : "-") + "ErrorFileToStdout", + "-XX:" + (redirectStderr ? "+" : "-") + "ErrorFileToStderr", + "-version"); + + OutputAnalyzer output_detail = new OutputAnalyzer(pb.start()); + + // we should have crashed with a SIGSEGV + output_detail.shouldMatch("# A fatal error has been detected by the Java Runtime Environment:.*"); + output_detail.shouldMatch("# +(?:SIGSEGV|EXCEPTION_ACCESS_VIOLATION).*"); + + // If no redirection happened, we should find a mention of the file in the output. + String hs_err_file = output_detail.firstMatch("# *(\\S*hs_err_pid\\d+\\.log)", 1); + if (redirectStdout == false && redirectStderr == false) { + if (hs_err_file == null) { + throw new RuntimeException("Expected hs-err file but none found."); + } else { + System.out.println("Found hs error file mentioned as expected: " + hs_err_file); + } + } else { + if (hs_err_file != null) { + throw new RuntimeException("Found unexpected mention of hs-err file (we did redirect the output so no file should have been written)."); + } else { + System.out.println("No mention of an hs-err file - ok! "); + } + } + + // Check the output. Note that since stderr was specified last it has preference if both are set. + if (redirectStdout == true && redirectStderr == false) { + output_detail.stdoutShouldContain("--------------- T H R E A D ---------------"); + output_detail.stderrShouldNotContain("--------------- T H R E A D ---------------"); + System.out.println("Found report on stderr - ok! "); + } else if (redirectStderr == true) { + output_detail.stderrShouldContain("--------------- T H R E A D ---------------"); + output_detail.stdoutShouldNotContain("--------------- T H R E A D ---------------"); + System.out.println("Found report on stdout - ok! "); + } + + System.out.println("OK."); + + } + + public static void main(String[] args) throws Exception { + if (!Platform.isDebugBuild()) { + System.out.println("Skip on non-debug builds since we need '-XX:ErrorHandlerTest'"); + return; + } + do_test(false, false); + do_test(false, true); + do_test(true, false); + do_test(true, true); + } + +} + + diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/Metaspace/FragmentMetaspace.java openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/Metaspace/FragmentMetaspace.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/Metaspace/FragmentMetaspace.java 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/Metaspace/FragmentMetaspace.java 2021-08-09 15:12:52.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 @@ -25,7 +25,7 @@ * @test * @library /runtime/testlibrary * @build GeneratedClassLoader - * @run main/othervm/timeout=200 FragmentMetaspace + * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace */ import java.io.IOException; @@ -38,25 +38,34 @@ */ public class FragmentMetaspace { + public static Class c; + public static void main(String... args) { - runGrowing(Long.valueOf(System.getProperty("time", "80000"))); + runGrowing(Long.valueOf(System.getProperty("time", "80000")), + Integer.valueOf(System.getProperty("iterations", "200"))); // try to clean up and unload classes to decrease // class verification time in debug vm System.gc(); } - private static void runGrowing(long time) { + private static void runGrowing(long time, int iterations) { long startTime = System.currentTimeMillis(); - for (int i = 0; System.currentTimeMillis() < startTime + time; ++i) { + for (int i = 0; System.currentTimeMillis() < startTime + time && i < iterations; ++i) { try { GeneratedClassLoader gcl = new GeneratedClassLoader(); - Class c = gcl.getGeneratedClasses(i, 100)[0]; + // getGeneratedClasses throws a RuntimeException in cases where + // the javac exit code is not 0. If the original reason for the exception is + // a "java.lang.OutOfMemoryError: Java heap space", + // increase the heap size in the @run tag and rerun the test. + // The heap can be exhausted by this test, but heap exhaustion + // is not a failure mode of this test and should be ignored. + c = gcl.getGeneratedClasses(i, 100)[0]; c.newInstance(); c = null; gcl = null; - } catch (IOException|InstantiationException|IllegalAccessException ex) { + } catch (IOException | InstantiationException | IllegalAccessException ex) { throw new RuntimeException(ex); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/StackGap/testme.sh openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/StackGap/testme.sh --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/StackGap/testme.sh 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/StackGap/testme.sh 2021-08-09 15:12:52.000000000 +0000 @@ -49,7 +49,10 @@ exit 0; fi -CFLAGS="-m${VM_BITS}" +if [ "x${VM_CPU}" != "xaarch64" ]; +then + CFLAGS="-m${VM_BITS}" +fi LD_LIBRARY_PATH=.:${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE}:/usr/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH @@ -67,7 +70,8 @@ $gcc_cmd -DLINUX ${CFLAGS} -o stack-gap \ -I${COMPILEJAVA}/include -I${COMPILEJAVA}/include/linux \ -L${COMPILEJAVA}/jre/lib/${VM_CPU}/${VM_TYPE} \ - -ljvm -lpthread exestack-gap.c + exestack-gap.c \ + -ljvm -lpthread ./stack-gap || exit $? ./stack-gap -XX:+DisablePrimordialThreadGuardPages || exit $? diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/StackTrace/LargeClassTest.java openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/StackTrace/LargeClassTest.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/StackTrace/LargeClassTest.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/StackTrace/LargeClassTest.java 2021-08-09 15:12:52.000000000 +0000 @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2018, 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 8194246 + * @summary JVM crashes on stack trace for large number of methods. + * @library /testlibrary + * @run main LargeClassTest + */ + +import java.io.File; +import java.io.FileOutputStream; +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.MethodVisitor; +import jdk.internal.org.objectweb.asm.FieldVisitor; +import jdk.internal.org.objectweb.asm.Label; +import jdk.internal.org.objectweb.asm.AnnotationVisitor; +import jdk.internal.org.objectweb.asm.Opcodes; + +import com.oracle.java.testlibrary.ProcessTools; +import com.oracle.java.testlibrary.OutputAnalyzer; + +public class LargeClassTest implements Opcodes { + public static void main(String... args) throws Exception { + writeClassFile(); + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(true, "-cp", ".", "Large"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldHaveExitValue(0); + } + + // Writes a Large class with > signed 16 bit int methods + public static void writeClassFile() throws Exception { + + ClassWriter cw = new ClassWriter(0); + FieldVisitor fv; + MethodVisitor mv; + AnnotationVisitor av0; + + cw.visit(52, ACC_PUBLIC + ACC_SUPER, "Large", null, "java/lang/Object", null); + + { + mv = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); + mv.visitCode(); + mv.visitVarInsn(ALOAD, 0); + mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V", false); + mv.visitInsn(RETURN); + mv.visitMaxs(1, 1); + mv.visitEnd(); + } + { + // public static void main(String[] args) { + // Large large = new Large(); + // large.f_1(55); + // } + mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "main", "([Ljava/lang/String;)V", null, null); + mv.visitCode(); + mv.visitTypeInsn(NEW, "Large"); + mv.visitInsn(DUP); + mv.visitMethodInsn(INVOKESPECIAL, "Large", "", "()V", false); + mv.visitVarInsn(ASTORE, 1); + mv.visitVarInsn(ALOAD, 1); + mv.visitIntInsn(BIPUSH, 55); + mv.visitMethodInsn(INVOKEVIRTUAL, "Large", "f_1", "(I)I", false); + mv.visitInsn(POP); + mv.visitInsn(RETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + + // Write 33560 methods called f_$i + for (int i = 1000; i < 34560; i++) + { + mv = cw.visitMethod(ACC_PUBLIC, "f_" + i, "()V", null, null); + mv.visitCode(); + mv.visitInsn(RETURN); + mv.visitMaxs(0, 1); + mv.visitEnd(); + } + { + // public int f_1(int prior) { + // int total = prior + new java.util.Random(1).nextInt(); + // return total + f_2(total); + // } + mv = cw.visitMethod(ACC_PUBLIC, "f_1", "(I)I", null, null); + mv.visitCode(); + mv.visitVarInsn(ILOAD, 1); + mv.visitTypeInsn(NEW, "java/util/Random"); + mv.visitInsn(DUP); + mv.visitInsn(LCONST_1); + mv.visitMethodInsn(INVOKESPECIAL, "java/util/Random", "", "(J)V", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/util/Random", "nextInt", "()I", false); + mv.visitInsn(IADD); + mv.visitVarInsn(ISTORE, 2); + mv.visitVarInsn(ILOAD, 2); + mv.visitVarInsn(ALOAD, 0); + mv.visitVarInsn(ILOAD, 2); + mv.visitMethodInsn(INVOKEVIRTUAL, "Large", "f_2", "(I)I", false); + mv.visitInsn(IADD); + mv.visitInsn(IRETURN); + mv.visitMaxs(5, 3); + mv.visitEnd(); + } + { + // public int f_2(int total) { + // System.out.println(java.util.Arrays.toString(Thread.currentThread().getStackTrace())); + // return 10; + // } + mv = cw.visitMethod(ACC_PUBLIC, "f_2", "(I)I", null, null); + mv.visitCode(); + mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); + mv.visitMethodInsn(INVOKESTATIC, "java/lang/Thread", "currentThread", "()Ljava/lang/Thread;", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Thread", "getStackTrace", "()[Ljava/lang/StackTraceElement;", false); + mv.visitMethodInsn(INVOKESTATIC, "java/util/Arrays", "toString", "([Ljava/lang/Object;)Ljava/lang/String;", false); + mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V", false); + mv.visitIntInsn(BIPUSH, 10); + mv.visitInsn(IRETURN); + mv.visitMaxs(2, 2); + mv.visitEnd(); + } + cw.visitEnd(); + + try (FileOutputStream fos = new FileOutputStream(new File("Large.class"))) { + fos.write(cw.toByteArray()); + } + } +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/Unsafe/RangeCheck.java openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/Unsafe/RangeCheck.java --- openjdk-8-8u292-b10/=unpacked-tar2=/test/runtime/Unsafe/RangeCheck.java 1970-01-01 00:00:00.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/test/runtime/Unsafe/RangeCheck.java 2021-08-09 15:12:52.000000000 +0000 @@ -0,0 +1,58 @@ +/* + * 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 8001071 + * @summary Add simple range check into VM implemenation of Unsafe access methods + * @library /testlibrary + */ + +import com.oracle.java.testlibrary.*; +import sun.misc.Unsafe; + +public class RangeCheck { + + public static void main(String args[]) throws Exception { + if (!Platform.isDebugBuild()) { + System.out.println("Testing assert which requires a debug build. Passing silently."); + return; + } + + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + true, + "-Xmx32m", + "-XX:-TransmitErrorReport", + DummyClassWithMainRangeCheck.class.getName()); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldMatch("assert\\(byte_offset < p_size\\) failed: Unsafe access: offset \\d+ > object's size \\d+"); + } + + public static class DummyClassWithMainRangeCheck { + public static void main(String args[]) throws Exception { + Unsafe unsafe = Utils.getUnsafe(); + unsafe.getObject(new DummyClassWithMainRangeCheck(), Short.MAX_VALUE); + } + } +} diff -Nru openjdk-8-8u292-b10/=unpacked-tar2=/THIRD_PARTY_README openjdk-8-8u312-b07/=unpacked-tar2=/THIRD_PARTY_README --- openjdk-8-8u292-b10/=unpacked-tar2=/THIRD_PARTY_README 2021-03-01 10:34:41.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar2=/THIRD_PARTY_README 2021-10-20 10:12:18.000000000 +0000 @@ -3243,39 +3243,75 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to OASIS PKCS #11 Cryptographic Token -Interface v2.40, which may be included with JRE 8, JDK 8, and OpenJDK 8. +Interface v3.0, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- -Copyright (c) OASIS Open 2016. All Rights Reserved. +Copyright © OASIS Open 2020. All Rights Reserved. -All capitalized terms in the following text have the meanings assigned to them -in the OASIS Intellectual Property Rights Policy (the "OASIS IPR Policy"). The -full Policy may be found at the OASIS website: + All capitalized terms in the following text have the meanings +assigned to them in the OASIS Intellectual Property Rights Policy (the +"OASIS IPR Policy"). The full Policy may be found at the OASIS website: [http://www.oasis-open.org/policies-guidelines/ipr] -This document and translations of it may be copied and furnished to others, and -derivative works that comment on or otherwise explain it or assist in its -implementation may be prepared, copied, published, and distributed, in whole or -in part, without restriction of any kind, provided that the above copyright -notice and this section are included on all such copies and derivative works. -However, this document itself may not be modified in any way, including by -removing the copyright notice or references to OASIS, except as needed for the -purpose of developing any document or deliverable produced by an OASIS -Technical Committee (in which case the rules applicable to copyrights, as set -forth in the OASIS IPR Policy, must be followed) or as required to translate it -into languages other than English. - -The limited permissions granted above are perpetual and will not be revoked by -OASIS or its successors or assigns. - -This document and the information contained herein is provided on an "AS IS" -basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT -LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT -INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR -FITNESS FOR A PARTICULAR PURPOSE. OASIS AND ITS MEMBERS WILL NOT BE LIABLE FOR -ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE -OF THIS DOCUMENT OR ANY PART THEREOF. + This document and translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it or +assist in its implementation may be prepared, copied, published, and +distributed, in whole or in part, without restriction of any kind, +provided that the above copyright notice and this section are included +on all such copies and derivative works. However, this document itself +may not be modified in any way, including by removing the copyright +notice or references to OASIS, except as needed for the purpose of +developing any document or deliverable produced by an OASIS Technical +Committee (in which case the rules applicable to copyrights, as set +forth in the OASIS IPR Policy, must be followed) or as required to +translate it into languages other than English. + + The limited permissions granted above are perpetual and will not be +revoked by OASIS or its successors or assigns. + + This document and the information contained herein is provided on an +"AS IS" basis and OASIS DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE +INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED +WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. OASIS +AND ITS MEMBERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THIS DOCUMENT OR ANY +PART THEREOF. + + [OASIS requests that any OASIS Party or any other party that +believes it has patent claims that would necessarily be infringed by +implementations of this OASIS Standards Final Deliverable, to notify +OASIS TC Administrator and provide an indication of its willingness to +grant patent licenses to such patent claims in a manner consistent with +the IPR Mode of the OASIS Technical Committee that produced this +deliverable.] + + [OASIS invites any party to contact the OASIS TC Administrator if it +is aware of a claim of ownership of any patent claims that would +necessarily be infringed by implementations of this OASIS Standards +Final Deliverable by a patent holder that is not willing to provide a +license to such patent claims in a manner consistent with the IPR Mode +of the OASIS Technical Committee that produced this OASIS Standards +Final Deliverable. OASIS may include such claims on its website, but +disclaims any obligation to do so.] + + [OASIS takes no position regarding the validity or scope of any +intellectual property or other rights that might be claimed to pertain +to the implementation or use of the technology described in this OASIS +Standards Final Deliverable or the extent to which any license under +such rights might or might not be available; neither does it represent +that it has made any effort to identify any such rights. Information on +OASIS' procedures with respect to rights in any document or deliverable +produced by an OASIS Technical Committee can be found on the OASIS +website. Copies of claims of rights made available for publication and +any assurances of licenses to be made available, or the result of an +attempt made to obtain a general license or permission for the use of +such proprietary rights by implementers or users of this OASIS Standards +Final Deliverable, can be obtained from the OASIS TC Administrator. +OASIS makes no representation that any information or list of +intellectual property rights will at any time be complete, or that any +claims in such list are, in fact, Essential Claims.] --- end of LICENSE --- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/.hg_archival.txt openjdk-8-8u312-b07/=unpacked-tar3=/.hg_archival.txt --- openjdk-8-8u292-b10/=unpacked-tar3=/.hg_archival.txt 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/.hg_archival.txt 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ repo: 37a05a11f281b4d238e2f9e7ebb67c63f64d0e77 -node: 4eae74c62a511317a50759f5faad3e748d34be95 +node: 132377e2edb21c55beb9dee2806e27979363977e branch: default -tag: jdk8u292-b10 -tag: jdk8u292-ga +tag: jdk8u312-b07 +tag: jdk8u312-ga diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/.hgtags openjdk-8-8u312-b07/=unpacked-tar3=/.hgtags --- openjdk-8-8u292-b10/=unpacked-tar3=/.hgtags 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/.hgtags 2021-09-01 14:33:15.000000000 +0000 @@ -1081,3 +1081,22 @@ 99b8202e7f718c01393f373609615a9c2721abe3 jdk8u292-b07 d103481ecd91690051bbd06e4eb4d3f3b4938dfc jdk8u292-b08 364cf530fbd346293f4fe51e725b1b3a807fd30f jdk8u292-b09 +4eae74c62a511317a50759f5faad3e748d34be95 jdk8u292-b10 +4eae74c62a511317a50759f5faad3e748d34be95 jdk8u292-ga +7c8bbbfe6acbe08eadae04e1ec46d94e9f98b743 jdk8u302-b00 +73584fe56769e5aefc6ecb752a4df786c03d6780 jdk8u302-b01 +04fb823d2094591cc63418967b8cfcc1b23dc516 jdk8u302-b02 +0056610eefad4cffedcc1443efdff8145d2a0135 jdk8u302-b03 +6a07e2cb5bdb7a4983ee89e7ed715435c722d9b3 jdk8u302-b04 +d727e88aa12a29c4a217d774d72cbfeb48648f09 jdk8u302-b05 +d727e88aa12a29c4a217d774d72cbfeb48648f09 jdk8u312-b00 +80412c5440236d4cd3f671690dd4d4d46c12e691 jdk8u302-b06 +7762468ad65060d9445413975cd7142f89792bbd jdk8u302-b07 +06b4012edc724ba45b1c1a8593d00ca989baa284 jdk8u302-b08 +06b4012edc724ba45b1c1a8593d00ca989baa284 jdk8u302-ga +52d602b87c1d0ff8325e2e8b58fcdca1d8c302a5 jdk8u312-b01 +cc5ddc374b2432b666120e5140dfc70b891a626a jdk8u312-b02 +61729ad5f50ea3875c9774cb7610f3b725f12670 jdk8u312-b03 +40bb77912d3f411365573c280c43c257a44948a9 jdk8u312-b04 +991bbb9501e2b295a17e1072292df75c5e814836 jdk8u312-b05 +ece88aba26eb66ce321e0da344ce2bb148ec9d1e jdk8u312-b06 diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/CompileLaunchers.gmk openjdk-8-8u312-b07/=unpacked-tar3=/make/CompileLaunchers.gmk --- openjdk-8-8u292-b10/=unpacked-tar3=/make/CompileLaunchers.gmk 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/CompileLaunchers.gmk 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2021, 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 @@ -556,7 +556,9 @@ $(call install-file) $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(DEBUGINFO_EXT): $(BUILD_UNPACKEXE) - $(call install-file) + $(MKDIR) -p $(@D) + $(RM) $@ + $(CP) -R $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR)/unpack200$(DEBUGINFO_EXT) $@ BUILD_LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX) ifeq ($(ENABLE_DEBUG_SYMBOLS), true) diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/soneraclass2ca openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/soneraclass2ca --- openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/soneraclass2ca 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/soneraclass2ca 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Owner: CN=Sonera Class2 CA, O=Sonera, C=FI -Issuer: CN=Sonera Class2 CA, O=Sonera, C=FI -Serial number: 1d -Valid from: Fri Apr 06 07:29:40 GMT 2001 until: Tue Apr 06 07:29:40 GMT 2021 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 2048-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEP -MA0GA1UEChMGU29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAx -MDQwNjA3Mjk0MFoXDTIxMDQwNjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNV -BAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJhIENsYXNzMiBDQTCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3/Ei9vX+ALTU74W+o -Z6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybTdXnt -5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s -3TmVToMGf+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2Ej -vOr7nQKV0ba5cTppCD8PtOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu -8nYybieDwnPz3BjotJPqdURrBGAgcVeHnfO+oJAjPYok4doh28MCAwEAAaMzMDEw -DwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITTXjwwCwYDVR0PBAQDAgEG -MA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt0jSv9zil -zqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/ -3DEIcbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvD -FNr450kkkdAdavphOe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6 -Tk6ezAyNlNzZRZxe7EJQY670XcSxEtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2 -ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLHllpwrN9M ------END CERTIFICATE----- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/thawtepremiumserverca openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/thawtepremiumserverca --- openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/thawtepremiumserverca 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/thawtepremiumserverca 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -Owner: EMAILADDRESS=premium-server@thawte.com, CN=Thawte Premium Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA -Issuer: EMAILADDRESS=premium-server@thawte.com, CN=Thawte Premium Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, ST=Western Cape, C=ZA -Serial number: 36122296c5e338a520a1d25f4cd70954 -Valid from: Thu Aug 01 00:00:00 GMT 1996 until: Fri Jan 01 23:59:59 GMT 2021 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 1024-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIDNjCCAp+gAwIBAgIQNhIilsXjOKUgodJfTNcJVDANBgkqhkiG9w0BAQUFADCB -zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ -Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE -CxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhh -d3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNl -cnZlckB0aGF3dGUuY29tMB4XDTk2MDgwMTAwMDAwMFoXDTIxMDEwMTIzNTk1OVow -gc4xCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcT -CUNhcGUgVG93bjEdMBsGA1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNV -BAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRo -YXd0ZSBQcmVtaXVtIFNlcnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1z -ZXJ2ZXJAdGhhd3RlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2 -aovXwlue2oFBYo847kkEVdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560 -ZXUCTe/LCaIhUdib0GfQug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j -+ao6hnO2RlNYyIkFvYMRuHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/ -BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBlkKyID1bZ5jA01CbH0FDxkt5r1DmI -CSLGpmODA/eZd9iy5Ri4XWPz1HP7bJyZePFLeH0ZJMMrAoT4vCLZiiLXoPxx7JGH -IPG47LHlVYCsPVLIOQ7C8MAFT9aCdYy9X9LcdpoFEsmvcsPcJX6kTY4XpeCHf+Ga -WuFg3GQjPEIuTQ== ------END CERTIFICATE----- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisignclass2g2ca openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisignclass2g2ca --- openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisignclass2g2ca 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisignclass2g2ca 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Owner: OU=VeriSign Trust Network, OU="(c) 1998 VeriSign, Inc. - For authorized use only", OU=Class 2 Public Primary Certification Authority - G2, O="VeriSign, Inc.", C=US -Issuer: OU=VeriSign Trust Network, OU="(c) 1998 VeriSign, Inc. - For authorized use only", OU=Class 2 Public Primary Certification Authority - G2, O="VeriSign, Inc.", C=US -Serial number: b92f60cc889fa17a4609b85b706c8aaf -Valid from: Mon May 18 00:00:00 GMT 1998 until: Tue Aug 01 23:59:59 GMT 2028 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 1024-bit RSA key -Version: 1 ------BEGIN CERTIFICATE----- -MIIDAzCCAmwCEQC5L2DMiJ+hekYJuFtwbIqvMA0GCSqGSIb3DQEBBQUAMIHBMQsw -CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0Ns -YXNzIDIgUHVibGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH -MjE6MDgGA1UECxMxKGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9y -aXplZCB1c2Ugb25seTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazAe -Fw05ODA1MTgwMDAwMDBaFw0yODA4MDEyMzU5NTlaMIHBMQswCQYDVQQGEwJVUzEX -MBUGA1UEChMOVmVyaVNpZ24sIEluYy4xPDA6BgNVBAsTM0NsYXNzIDIgUHVibGlj -IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjE6MDgGA1UECxMx -KGMpIDE5OTggVmVyaVNpZ24sIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s -eTEfMB0GA1UECxMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAp4gBIXQs5xoD8JjhlzwPIQjxnNuX6Zr8wgQGE75fUsjM -HiwSViy4AWkszJkfrbCWrnkE8hM5wXuYuggs6MKEEyyqaekJ9MepAqRCwiNPStjw -DqL7MWzJ5m+ZJwf15vRMeJ5t60aG+rmGyVTyssSv1EYcWskVMP8NbPUtDm3Of3cC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQByLvl/0fFx+8Se9sVeUYpAmLho+Jscg9ji -nb3/7aHmZuovCfTK1+qlK5X2JGCGTUQug6XELaDTrnhpb3LabK4I8GOSN+a7xDAX -rXfMSTWqz9iP0b63GJZHc2pUIjRkLbYWm1lbtFFZOrMLFPQS32eg9K0yZF6xRnIn -jBJ7xUS0rg== ------END CERTIFICATE----- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisignclass3ca openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisignclass3ca --- openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisignclass3ca 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisignclass3ca 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ -Owner: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US -Issuer: OU=Class 3 Public Primary Certification Authority, O="VeriSign, Inc.", C=US -Serial number: 3c9131cb1ff6d01b0e9ab8d044bf12be -Valid from: Mon Jan 29 00:00:00 GMT 1996 until: Wed Aug 02 23:59:59 GMT 2028 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 1024-bit RSA key -Version: 1 ------BEGIN CERTIFICATE----- -MIICPDCCAaUCEDyRMcsf9tAbDpq40ES/Er4wDQYJKoZIhvcNAQEFBQAwXzELMAkG -A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz -cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 -MDEyOTAwMDAwMFoXDTI4MDgwMjIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV -BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt -YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN -ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE -BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is -I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G -CSqGSIb3DQEBBQUAA4GBABByUqkFFBkyCEHwxWsKzH4PIRnN5GfcX6kb5sroc50i -2JhucwNhkcV8sEVAbkSdjbCxlnRhLQ2pRdKkkirWmnWXbj9T/UWZYB2oK0z5XqcJ -2HUw19JlYD1n1khVdWk/kfVIC0dpImmClr7JyDiGSnoscxlIaU5rfGW/D/xwzoiQ ------END CERTIFICATE----- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisignclass3g2ca openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisignclass3g2ca --- openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisignclass3g2ca 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisignclass3g2ca 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -Owner: OU=VeriSign Trust Network, OU="(c) 1998 VeriSign, Inc. - For authorized use only", OU=Class 3 Public Primary Certification Authority - G2, O="VeriSign, Inc.", C=US -Issuer: OU=VeriSign Trust Network, OU="(c) 1998 VeriSign, Inc. - For authorized use only", OU=Class 3 Public Primary Certification Authority - G2, O="VeriSign, Inc.", C=US -Serial number: 7dd9fe07cfa81eb7107967fba78934c6 -Valid from: Mon May 18 00:00:00 GMT 1998 until: Tue Aug 01 23:59:59 GMT 2028 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 1024-bit RSA key -Version: 1 ------BEGIN CERTIFICATE----- -MIIDAjCCAmsCEH3Z/gfPqB63EHln+6eJNMYwDQYJKoZIhvcNAQEFBQAwgcExCzAJ -BgNVBAYTAlVTMRcwFQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xh -c3MgMyBQdWJsaWMgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcy -MTowOAYDVQQLEzEoYykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3Jp -emVkIHVzZSBvbmx5MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMB4X -DTk4MDUxODAwMDAwMFoXDTI4MDgwMTIzNTk1OVowgcExCzAJBgNVBAYTAlVTMRcw -FQYDVQQKEw5WZXJpU2lnbiwgSW5jLjE8MDoGA1UECxMzQ2xhc3MgMyBQdWJsaWMg -UHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMTowOAYDVQQLEzEo -YykgMTk5OCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVzZSBvbmx5 -MR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3b3JrMIGfMA0GCSqGSIb3DQEB -AQUAA4GNADCBiQKBgQDMXtERXVxp0KvTuWpMmR9ZmDCOFoUgRm1HP9SFIIThbbP4 -pO0M8RcPO/mn+SXXwc+EY/J8Y8+iR/LGWzOOZEAEaMGAuWQcRXfH2G71lSk8UOg0 -13gfqLptQ5GVj0VXXn7F+8qkBOvqlzdUMG+7AUcyM83cV5tkaWH4mx0ciU9cZwID -AQABMA0GCSqGSIb3DQEBBQUAA4GBAFFNzb5cy5gZnBWyATl4Lk0PZ3BwmcYQWpSk -U01UbSuvDV1Ai2TT1+7eVmGSX6bEHRBhNtMsJzzoKQm5EWR0zLVznxxIqbxhAe7i -F6YM40AIOw7n60RzKprxaZLvcRTDOaxxp5EJb+RxBrO6WVcmeQD2+A2iMzAo1KpY -oJ2daZH9 ------END CERTIFICATE----- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisigntsaca openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisigntsaca --- openjdk-8-8u292-b10/=unpacked-tar3=/make/data/cacerts/verisigntsaca 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/data/cacerts/verisigntsaca 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -Owner: CN=Thawte Timestamping CA, OU=Thawte Certification, O=Thawte, L=Durbanville, ST=Western Cape, C=ZA -Issuer: CN=Thawte Timestamping CA, OU=Thawte Certification, O=Thawte, L=Durbanville, ST=Western Cape, C=ZA -Serial number: 67c8e1e8e3be1cbdfc913b8ea6238749 -Valid from: Wed Jan 01 00:00:00 GMT 1997 until: Fri Jan 01 23:59:59 GMT 2021 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 1024-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIICsDCCAhmgAwIBAgIQZ8jh6OO+HL38kTuOpiOHSTANBgkqhkiG9w0BAQUFADCB -izELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIGA1UEBxML -RHVyYmFudmlsbGUxDzANBgNVBAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhhd3RlIENl -cnRpZmljYXRpb24xHzAdBgNVBAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcgQ0EwHhcN -OTcwMTAxMDAwMDAwWhcNMjEwMTAxMjM1OTU5WjCBizELMAkGA1UEBhMCWkExFTAT -BgNVBAgTDFdlc3Rlcm4gQ2FwZTEUMBIGA1UEBxMLRHVyYmFudmlsbGUxDzANBgNV -BAoTBlRoYXd0ZTEdMBsGA1UECxMUVGhhd3RlIENlcnRpZmljYXRpb24xHzAdBgNV -BAMTFlRoYXd0ZSBUaW1lc3RhbXBpbmcgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0A -MIGJAoGBANYrWHhhRYZT6jR7UZztsOYuGA7+4F+oJ9O0yeB8WU4WDnNUYMF/9p8u -6TqFJBU820cEY8OexJQaWt9MevPZQx08EHp5JduQ/vBR5zDWQQD9nyjfeb6Uu522 -FOMjhdepQeBMpHmwKxqL8vg7ij5FrHGSALSQQZj7X+36ty6K+Ig3AgMBAAGjEzAR -MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAS+mqF4EF+3kKMZ/F -QfRWVKvpwuWXjhj+kckMPiZkyaFMJ2SnvQGTVXFuF0853BvcSTUQOSP/ypvIz2Y/ -3Ewa1IEGQlIf4SaxFhe65nByMUToTo1b5NP50OOPJWQx5yr4GIg2GlLFDUE1G2m3 -JvUXzMEZXkt8XOKDgJH6L/uatxY= ------END CERTIFICATE----- diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/Images.gmk openjdk-8-8u312-b07/=unpacked-tar3=/make/Images.gmk --- openjdk-8-8u292-b10/=unpacked-tar3=/make/Images.gmk 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/Images.gmk 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2011, 2021, 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 @@ -139,7 +139,7 @@ clhsdb$(EXE_SUFFIX) \ hsdb$(EXE_SUFFIX) \ jfr$(EXE_SUFFIX) - NOT_JRE_DEBUGINFO_FILES := $(patsubst %$(EXE_SUFFIX),%$(DEBUGINFO_EXT),$(NOT_JRE_BIN_FILES)) + NOT_JRE_BIN_DEBUGINFO_FILES := $(patsubst %$(EXE_SUFFIX),%$(DEBUGINFO_EXT),$(NOT_JRE_BIN_FILES)) endif WINDOWS_JDK_BIN_FILES = \ @@ -157,17 +157,8 @@ # Prevent sjavac from entering the images. ALL_BIN_LIST := $(filter-out %/sjavac, $(ALL_BIN_LIST)) -ifeq ($(OPENJDK_TARGET_OS), windows) - # On windows, the libraries are in the bin dir, only filter out debuginfo files - # for executables. "java" is both a library and executable. - ALL_BIN_EXEC_FILES := $(filter-out java.exe, $(notdir $(filter %.exe, $(ALL_BIN_LIST)))) - ALL_BIN_DEBUG_FILTER := $(addprefix %, $(patsubst %.exe, %.debuginfo, $(ALL_BIN_EXEC_FILES)) \ - $(patsubst %.exe, %.diz, $(ALL_BIN_EXEC_FILES))) %.pdb - ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER), $(ALL_BIN_LIST)) -endif - -JDKJRE_BIN_LIST := $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST)) -JRE_BIN_LIST := $(filter-out $(addprefix %, $(WINDOWS_JDKJRE_BIN_FILES)) $(addprefix %, $(NOT_JRE_DEBUGINFO_FILES)), $(JDKJRE_BIN_LIST)) +JDKJRE_BIN_LIST := $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES)) $(addprefix %, $(NOT_JRE_BIN_DEBUGINFO_FILES)), $(ALL_BIN_LIST)) +JRE_BIN_LIST := $(filter-out $(addprefix %, $(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST)) ifeq ($(OPENJDK_TARGET_OS), windows) JDK_BIN_LIST := $(filter $(addprefix %, $(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST)) diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/lib/CoreLibraries.gmk openjdk-8-8u312-b07/=unpacked-tar3=/make/lib/CoreLibraries.gmk --- openjdk-8-8u292-b10/=unpacked-tar3=/make/lib/CoreLibraries.gmk 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/lib/CoreLibraries.gmk 2021-09-01 14:33:15.000000000 +0000 @@ -409,6 +409,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx) LIBJLI_CFLAGS += -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" + LIBJLI_CFLAGS += -mmacosx-version-min=$(MACOSX_VERSION_MIN) endif ifneq ($(USE_EXTERNAL_LIBZ), true) @@ -442,7 +443,7 @@ $(call SET_SHARED_LIBRARY_ORIGIN), \ LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \ LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \ - LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices, \ + LDFLAGS_macosx := -framework Cocoa -framework Security -framework ApplicationServices -mmacosx-version-min=$(MACOSX_VERSION_MIN), \ LDFLAGS_SUFFIX_solaris := $(LIBZ) $(LIBDL) -lc, \ LDFLAGS_SUFFIX_linux := $(LIBZ) $(LIBDL) -lc -lpthread, \ LDFLAGS_SUFFIX_aix := $(LIBZ) $(LIBDL),\ @@ -503,7 +504,7 @@ LANG := C, \ OPTIMIZATION := HIGH, \ CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \ - LDFLAGS := -nostdlib -r, \ + LDFLAGS := -nostdlib -r -mmacosx-version-min=$(MACOSX_VERSION_MIN), \ OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \ DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/lib/SecurityLibraries.gmk openjdk-8-8u312-b07/=unpacked-tar3=/make/lib/SecurityLibraries.gmk --- openjdk-8-8u292-b10/=unpacked-tar3=/make/lib/SecurityLibraries.gmk 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/lib/SecurityLibraries.gmk 2021-09-01 14:33:15.000000000 +0000 @@ -133,6 +133,8 @@ endif ifneq ($(BUILD_LIBKRB5_NAME), ) + # libosxkrb5 needs to call deprecated krb5 APIs so that java + # can use the native credentials cache. $(eval $(call SetupNativeCompilation,BUILD_LIBKRB5, \ LIBRARY := $(BUILD_LIBKRB5_NAME), \ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/lib/ServiceabilityLibraries.gmk openjdk-8-8u312-b07/=unpacked-tar3=/make/lib/ServiceabilityLibraries.gmk --- openjdk-8-8u292-b10/=unpacked-tar3=/make/lib/ServiceabilityLibraries.gmk 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/lib/ServiceabilityLibraries.gmk 2021-09-01 14:33:15.000000000 +0000 @@ -53,7 +53,7 @@ EXCLUDE_FILES := $(LIBATTACH_EXCLUDE_FILES), \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS), \ CFLAGS_windows := /Gy, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \ VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \ @@ -83,7 +83,7 @@ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ -I$(JDK_TOPDIR)/src/share/transport/socket \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/socket \ @@ -119,7 +119,7 @@ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DUSE_MMAP \ -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \ -I$(JDK_TOPDIR)/src/share/transport/shmem \ -I$(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/transport/shmem \ @@ -148,7 +148,7 @@ SRC := $(JDK_TOPDIR)/src/share/back $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/back, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \ -I$(JDK_TOPDIR)/src/share/transport/export \ -I$(JDK_TOPDIR)/src/share/back/export \ -I$(JDK_TOPDIR)/src/share/npt \ @@ -183,7 +183,7 @@ $(JDK_TOPDIR)/src/$(OPENJDK_TARGET_OS_API_DIR)/native/sun/tracing/dtrace, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/share/native/sun/tracing/dtrace, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -252,7 +252,7 @@ INCLUDE_FILES := $(LIBINSTRUMENT_FILES), \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(LIBINSTRUMENT_CFLAGS), \ + CFLAGS := $(LIBINSTRUMENT_CFLAGS) $(CFLAGS_WARNINGS_ARE_ERRORS), \ CFLAGS_debug := -DJPLIS_LOGGING, \ CFLAGS_release := -DNO_JPLIS_LOGGING, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libinstrument/mapfile-vers, \ @@ -327,7 +327,7 @@ EXCLUDE_FILES := $(BUILD_LIBMANAGEMENT_EXCLUDES), \ LANG := C, \ OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBMANAGEMENT_CFLAGS), \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) $(BUILD_LIBMANAGEMENT_CFLAGS), \ MAPFILE := $(LIBMANAGEMENT_MAPFILE), \ LDFLAGS := $(LDFLAGS_JDKLIB) \ $(call SET_SHARED_LIBRARY_ORIGIN), \ @@ -375,7 +375,7 @@ SRC := $(BUILD_LIBHPROF_SRC), \ LANG := C, \ OPTIMIZATION := $(LIBHPROF_OPTIMIZATION), \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ $(BUILD_LIBHPROF_CFLAGS), \ CFLAGS_debug := -DHPROF_LOGGING, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libhprof/mapfile-vers, \ @@ -403,7 +403,7 @@ SRC := $(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/share/demo/jvmti/java_crw_demo, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava_crw_demo/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -430,7 +430,7 @@ SRC := $(JDK_TOPDIR)/src/closed/share/native/oracle/jfr, \ LANG := C, \ OPTIMIZATION := LOW, \ - CFLAGS := $(CFLAGS_JDKLIB) \ + CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \ -I$(JDK_TOPDIR)/src/closed/share/javavm/export, \ MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjfr/mapfile-vers, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libawt/mapfile-mawt-vers openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libawt/mapfile-mawt-vers --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libawt/mapfile-mawt-vers 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libawt/mapfile-mawt-vers 2021-09-01 14:33:15.000000000 +0000 @@ -196,7 +196,6 @@ Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; Java_sun_java2d_opengl_GLXSurfaceData_initOps; - Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer; Java_sun_print_CUPSPrinter_initIDs; Java_sun_print_CUPSPrinter_getCupsServer; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libawt_xawt/mapfile-vers openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libawt_xawt/mapfile-vers --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libawt_xawt/mapfile-vers 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libawt_xawt/mapfile-vers 2021-09-01 14:33:15.000000000 +0000 @@ -338,7 +338,6 @@ Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; Java_sun_java2d_opengl_GLXSurfaceData_initOps; - Java_sun_java2d_opengl_GLXSurfaceData_initPbuffer; Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libmanagement/mapfile-vers openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libmanagement/mapfile-vers --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libmanagement/mapfile-vers 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libmanagement/mapfile-vers 2021-09-01 14:33:15.000000000 +0000 @@ -27,19 +27,21 @@ SUNWprivate_1.1 { global: - Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize; + Java_sun_management_OperatingSystemImpl_getCommittedVirtualMemorySize0; Java_sun_management_OperatingSystemImpl_getFreePhysicalMemorySize0; Java_sun_management_OperatingSystemImpl_getFreeSwapSpaceSize0; - Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount; - Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount; - Java_sun_management_OperatingSystemImpl_getProcessCpuLoad; - Java_sun_management_OperatingSystemImpl_getProcessCpuTime; + Java_sun_management_OperatingSystemImpl_getMaxFileDescriptorCount0; + Java_sun_management_OperatingSystemImpl_getOpenFileDescriptorCount0; + Java_sun_management_OperatingSystemImpl_getProcessCpuLoad0; + Java_sun_management_OperatingSystemImpl_getProcessCpuTime0; Java_sun_management_OperatingSystemImpl_getSystemCpuLoad0; Java_sun_management_OperatingSystemImpl_getTotalPhysicalMemorySize0; Java_sun_management_OperatingSystemImpl_getTotalSwapSpaceSize0; Java_sun_management_OperatingSystemImpl_getSingleCpuLoad0; Java_sun_management_OperatingSystemImpl_getHostConfiguredCpuCount0; - Java_sun_management_OperatingSystemImpl_initialize; + Java_sun_management_OperatingSystemImpl_getHostOnlineCpuCount0; + Java_sun_management_OperatingSystemImpl_getHostTotalCpuTicks0; + Java_sun_management_OperatingSystemImpl_initialize0; Java_sun_management_ClassLoadingImpl_setVerboseClass; Java_sun_management_DiagnosticCommandImpl_executeDiagnosticCommand; Java_sun_management_DiagnosticCommandImpl_getDiagnosticCommands; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/mapfile-vers openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/mapfile-vers --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/mapfile-vers 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/mapfile-vers 2021-09-01 14:33:15.000000000 +0000 @@ -66,6 +66,7 @@ Java_java_util_zip_ZipFile_open; Java_java_util_zip_ZipFile_read; Java_java_util_zip_ZipFile_startsWithLOC; + Java_java_util_zip_ZipFile_getManifestNum; ZIP_Close; ZIP_CRC32; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparc openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparc --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparc 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparc 2021-09-01 14:33:15.000000000 +0000 @@ -19,6 +19,7 @@ text: .text%Java_java_util_zip_ZipFile_open; text: .text%Java_java_util_zip_ZipFile_getTotal; text: .text%Java_java_util_zip_ZipFile_startsWithLOC; +text: .text%Java_java_util_zip_ZipFile_getManifestNum; text: .text%Java_java_util_zip_ZipFile_getEntry; text: .text%Java_java_util_zip_ZipFile_freeEntry; text: .text%Java_java_util_zip_ZipFile_getEntryTime; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparcv9 openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparcv9 --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparcv9 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/reorder-sparcv9 2021-09-01 14:33:15.000000000 +0000 @@ -19,6 +19,7 @@ text: .text%Java_java_util_zip_ZipFile_open; text: .text%Java_java_util_zip_ZipFile_getTotal; text: .text%Java_java_util_zip_ZipFile_startsWithLOC; +text: .text%Java_java_util_zip_ZipFile_getManifestNum; text: .text%Java_java_util_zip_ZipFile_getEntry; text: .text%Java_java_util_zip_ZipFile_freeEntry; text: .text%Java_java_util_zip_ZipFile_getEntryTime; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/reorder-x86 openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/reorder-x86 --- openjdk-8-8u292-b10/=unpacked-tar3=/make/mapfiles/libzip/reorder-x86 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/make/mapfiles/libzip/reorder-x86 2021-09-01 14:33:15.000000000 +0000 @@ -20,6 +20,7 @@ text: .text%Java_java_util_zip_ZipFile_open; text: .text%Java_java_util_zip_ZipFile_getTotal; text: .text%Java_java_util_zip_ZipFile_startsWithLOC; +text: .text%Java_java_util_zip_ZipFile_getManifestNum; text: .text%Java_java_util_zip_ZipFile_getEntry; text: .text%Java_java_util_zip_ZipFile_freeEntry; text: .text%Java_java_util_zip_ZipFile_getEntryTime; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java openjdk-8-8u312-b07/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java 2021-09-01 14:33:15.000000000 +0000 @@ -116,7 +116,10 @@ try (Stream lines = readFilePrivileged(Paths.get("/proc/self/cgroup"))) { - lines.map(line -> line.split(":")) + // The limit value of 3 is because /proc/self/cgroup contains three + // colon-separated tokens per line. The last token, cgroup path, might + // contain a ':'. + lines.map(line -> line.split(":", 3)) .filter(line -> (line.length >= 3)) .forEach(line -> setSubSystemPath(metrics, line)); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java openjdk-8-8u312-b07/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java 2021-09-01 14:33:15.000000000 +0000 @@ -27,6 +27,7 @@ import java.io.BufferedReader; import java.io.IOException; +import java.math.BigInteger; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; @@ -156,7 +157,18 @@ public static long convertStringToLong(String strval) { if (strval == null) return 0L; - long retval = Long.parseLong(strval); + long retval = 0; + + try { + retval = Long.parseLong(strval); + } catch (NumberFormatException e) { + // For some properties (e.g. memory.limit_in_bytes) we may overflow the range of signed long. + // In this case, return Long.max + BigInteger b = new BigInteger(strval); + if (b.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { + return Long.MAX_VALUE; + } + } return retval; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -379,23 +379,11 @@ public VolatileImage createCompatibleVolatileImage(int width, int height, int transparency, int type) { - if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED || - transparency == Transparency.BITMASK) - { + if ((type != FBOBJECT && type != TEXTURE) + || transparency == Transparency.BITMASK + || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) { return null; } - - if (type == FBOBJECT) { - if (!isCapPresent(CAPS_EXT_FBOBJECT)) { - return null; - } - } else if (type == PBUFFER) { - boolean isOpaque = transparency == Transparency.OPAQUE; - if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) { - return null; - } - } - SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height, transparency, type); Surface sd = vi.getDestSurface(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java 2021-09-01 14:33:15.000000000 +0000 @@ -52,9 +52,6 @@ long pPeerData, long layerPtr, int xoff, int yoff, boolean isOpaque); - protected native boolean initPbuffer(long pData, long pConfigInfo, - boolean isOpaque, int width, int height); - protected CGLSurfaceData(CGLGraphicsConfig gc, ColorModel cm, int type, int width, int height) { super(gc, cm, type); @@ -140,7 +137,7 @@ /** * Creates a SurfaceData object representing an off-screen buffer (either a - * Pbuffer or Texture). + * FBO or Texture). */ public static CGLOffScreenSurfaceData createData(CGLGraphicsConfig gc, int width, int height, ColorModel cm, Image image, int type) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/classes/sun/java2d/opengl/CGLVolatileSurfaceManager.java 2021-09-01 14:33:15.000000000 +0000 @@ -44,7 +44,7 @@ public class CGLVolatileSurfaceManager extends VolatileSurfaceManager { - private boolean accelerationEnabled; + private final boolean accelerationEnabled; public CGLVolatileSurfaceManager(SunVolatileImage vImg, Object context) { super(vImg, context); @@ -52,18 +52,13 @@ /* * We will attempt to accelerate this image only under the * following conditions: - * - the image is opaque OR - * - the image is translucent AND - * - the GraphicsConfig supports the FBO extension OR - * - the GraphicsConfig has a stored alpha channel + * - the image is not bitmask AND the GraphicsConfig supports the FBO + * extension */ int transparency = vImg.getTransparency(); - CGLGraphicsConfig gc = (CGLGraphicsConfig)vImg.getGraphicsConfig(); - accelerationEnabled = - (transparency == Transparency.OPAQUE) || - ((transparency == Transparency.TRANSLUCENT) && - (gc.isCapPresent(CAPS_EXT_FBOBJECT) || - gc.isCapPresent(CAPS_STORED_ALPHA))); + CGLGraphicsConfig gc = (CGLGraphicsConfig) vImg.getGraphicsConfig(); + accelerationEnabled = gc.isCapPresent(CAPS_EXT_FBOBJECT) + && transparency != Transparency.BITMASK; } protected boolean isAccelerationEnabled() { @@ -71,7 +66,7 @@ } /** - * Create a pbuffer-based SurfaceData object (or init the backbuffer + * Create a FBO-based SurfaceData object (or init the backbuffer * of an existing window if this is a double buffered GraphicsConfig) */ protected SurfaceData initAcceleratedSurface() { @@ -111,10 +106,9 @@ ColorModel cm = gc.getColorModel(vImg.getTransparency()); int type = vImg.getForcedAccelSurfaceType(); // if acceleration type is forced (type != UNDEFINED) then - // use the forced type, otherwise choose one based on caps + // use the forced type, otherwise choose FBOBJECT if (type == OGLSurfaceData.UNDEFINED) { - type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? - OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER; + type = OGLSurfaceData.FBOBJECT; } if (createVSynced) { // TODO: modify parameter to delegate diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/apple/applescript/AppleScriptExecutionContext.m openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/apple/applescript/AppleScriptExecutionContext.m --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/apple/applescript/AppleScriptExecutionContext.m 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/apple/applescript/AppleScriptExecutionContext.m 2021-09-01 14:33:15.000000000 +0000 @@ -26,6 +26,7 @@ #import "AppleScriptExecutionContext.h" #import +#import #import "AS_NS_ConversionUtils.h" diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/awt/AWTWindow.m openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/awt/AWTWindow.m --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/awt/AWTWindow.m 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/awt/AWTWindow.m 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2021, 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 @@ -1037,7 +1037,8 @@ screenContentRect.origin.y - frame.origin.y, screenContentRect.size.width, screenContentRect.size.height); - nsWindow.contentView.frame = contentFrame; + NSView* view = (NSView*)nsWindow.contentView; + view.frame = contentFrame; resized = YES; } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -63,7 +63,7 @@ CGLCtxInfo *ctxinfo = (CGLCtxInfo *)oglc->ctxInfo; if (ctxinfo != NULL) { - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [NSOpenGLContext clearCurrentContext]; [ctxinfo->context clearDrawable]; [ctxinfo->context release]; @@ -339,18 +339,10 @@ if (value != 0) { caps |= CAPS_DOUBLEBUFFERED; } - [sharedPixelFormat - getValues: &value - forAttribute: NSOpenGLPFAAlphaSize - forVirtualScreen: contextVirtualScreen]; - if (value != 0) { - caps |= CAPS_STORED_ALPHA; - } - J2dRlsTraceLn2(J2D_TRACE_INFO, - "CGLGraphicsConfig_getCGLConfigInfo: db=%d alpha=%d", - (caps & CAPS_DOUBLEBUFFERED) != 0, - (caps & CAPS_STORED_ALPHA) != 0); + J2dRlsTraceLn1(J2D_TRACE_INFO, + "CGLGraphicsConfig_getCGLConfigInfo: db=%d", + (caps & CAPS_DOUBLEBUFFERED) != 0); // remove before shipping (?) #if 1 diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.h openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.h --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.h 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.h 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -39,7 +39,6 @@ AWTView *peerData; CGLLayer *layer; GLclampf argb[4]; // background clear color - NSOpenGLPixelBuffer *pbuffer; CGLGraphicsConfigInfo *configInfo; } CGLSDOps; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -109,9 +109,7 @@ /** * This function disposes of any native windowing system resources associated - * with this surface. For instance, if the given OGLSDOps is of type - * OGLSD_PBUFFER, this method implementation will destroy the actual pbuffer - * surface. + * with this surface. */ void OGLSD_DestroyOGLSurface(JNIEnv *env, OGLSDOps *oglsdo) @@ -121,16 +119,7 @@ JNF_COCOA_ENTER(env); CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps; - if (oglsdo->drawableType == OGLSD_PBUFFER) { - if (oglsdo->textureID != 0) { - j2d_glDeleteTextures(1, &oglsdo->textureID); - oglsdo->textureID = 0; - } - if (cglsdo->pbuffer != NULL) { - [cglsdo->pbuffer release]; - cglsdo->pbuffer = NULL; - } - } else if (oglsdo->drawableType == OGLSD_WINDOW) { + if (oglsdo->drawableType == OGLSD_WINDOW) { // detach the NSView from the NSOpenGLContext CGLGraphicsConfigInfo *cglInfo = cglsdo->configInfo; OGLContext *oglc = cglInfo->context; @@ -251,23 +240,12 @@ JNF_COCOA_ENTER(env); - // set the current surface - if (dstOps->drawableType == OGLSD_PBUFFER) { - // REMIND: pbuffers are not fully tested yet... - [ctxinfo->context clearDrawable]; + CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps; + NSView *nsView = (NSView *)cglsdo->peerData; + + if ([ctxinfo->context view] != nsView) { [ctxinfo->context makeCurrentContext]; - [ctxinfo->context setPixelBuffer: dstCGLOps->pbuffer - cubeMapFace: 0 - mipMapLevel: 0 - currentVirtualScreen: [ctxinfo->context currentVirtualScreen]]; - } else { - CGLSDOps *cglsdo = (CGLSDOps *)dstOps->privOps; - NSView *nsView = (NSView *)cglsdo->peerData; - - if ([ctxinfo->context view] != nsView) { - [ctxinfo->context makeCurrentContext]; - [ctxinfo->context setView: nsView]; - } + [ctxinfo->context setView: nsView]; } if (OGLC_IS_CAP_PRESENT(oglc, CAPS_EXT_FBOBJECT)) { @@ -277,16 +255,6 @@ j2d_glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); } - if ((srcOps != dstOps) && (srcOps->drawableType == OGLSD_PBUFFER)) { - // bind pbuffer to the render texture object (since we are preparing - // to copy from the pbuffer) - CGLSDOps *srcCGLOps = (CGLSDOps *)srcOps->privOps; - j2d_glBindTexture(GL_TEXTURE_2D, srcOps->textureID); - [ctxinfo->context - setTextureImageToPixelBuffer: srcCGLOps->pbuffer - colorBuffer: GL_FRONT]; - } - JNF_COCOA_EXIT(env); return oglc; @@ -452,105 +420,6 @@ cglsdo->layer = NULL; } -JNIEXPORT jboolean JNICALL -Java_sun_java2d_opengl_CGLSurfaceData_initPbuffer - (JNIEnv *env, jobject cglsd, - jlong pData, jlong pConfigInfo, jboolean isOpaque, - jint width, jint height) -{ - J2dTraceLn3(J2D_TRACE_INFO, "CGLSurfaceData_initPbuffer: w=%d h=%d opq=%d", width, height, isOpaque); - - OGLSDOps *oglsdo = (OGLSDOps *)jlong_to_ptr(pData); - if (oglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: ops are null"); - return JNI_FALSE; - } - - CGLSDOps *cglsdo = (CGLSDOps *)oglsdo->privOps; - if (cglsdo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: cgl ops are null"); - return JNI_FALSE; - } - - CGLGraphicsConfigInfo *cglInfo = (CGLGraphicsConfigInfo *) - jlong_to_ptr(pConfigInfo); - if (cglInfo == NULL) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: cgl config info is null"); - return JNI_FALSE; - } - - // find the maximum allowable texture dimensions (this value ultimately - // determines our maximum pbuffer size) - int pbMax = 0; - j2d_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &pbMax); - - int pbWidth = 0; - int pbHeight = 0; - if (OGLC_IS_CAP_PRESENT(cglInfo->context, CAPS_TEXNONPOW2)) { - // use non-power-of-two dimensions directly - pbWidth = (width <= pbMax) ? width : 0; - pbHeight = (height <= pbMax) ? height : 0; - } else { - // find the appropriate power-of-two dimensions - pbWidth = OGLSD_NextPowerOfTwo(width, pbMax); - pbHeight = OGLSD_NextPowerOfTwo(height, pbMax); - } - - J2dTraceLn3(J2D_TRACE_VERBOSE, " desired pbuffer dimensions: w=%d h=%d max=%d", pbWidth, pbHeight, pbMax); - - // if either dimension is 0, we cannot allocate a pbuffer/texture with the - // requested dimensions - if (pbWidth == 0 || pbHeight == 0) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: dimensions too large"); - return JNI_FALSE; - } - - int format = isOpaque ? GL_RGB : GL_RGBA; - -JNF_COCOA_ENTER(env); - - cglsdo->pbuffer = - [[NSOpenGLPixelBuffer alloc] - initWithTextureTarget: GL_TEXTURE_2D - textureInternalFormat: format - textureMaxMipMapLevel: 0 - pixelsWide: pbWidth - pixelsHigh: pbHeight]; - if (cglsdo->pbuffer == nil) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: could not create pbuffer"); - return JNI_FALSE; - } - - // make sure the actual dimensions match those that we requested - GLsizei actualWidth = [cglsdo->pbuffer pixelsWide]; - GLsizei actualHeight = [cglsdo->pbuffer pixelsHigh]; - if (actualWidth != pbWidth || actualHeight != pbHeight) { - J2dRlsTraceLn2(J2D_TRACE_ERROR, "CGLSurfaceData_initPbuffer: actual (w=%d h=%d) != requested", actualWidth, actualHeight); - [cglsdo->pbuffer release]; - return JNI_FALSE; - } - - GLuint texID = 0; - j2d_glGenTextures(1, &texID); - j2d_glBindTexture(GL_TEXTURE_2D, texID); - - oglsdo->drawableType = OGLSD_PBUFFER; - oglsdo->isOpaque = isOpaque; - oglsdo->width = width; - oglsdo->height = height; - oglsdo->textureID = texID; - oglsdo->textureWidth = pbWidth; - oglsdo->textureHeight = pbHeight; - oglsdo->activeBuffer = GL_FRONT; - oglsdo->needsInit = JNI_TRUE; - - OGLSD_INIT_TEXTURE_FILTER(oglsdo, GL_NEAREST); - -JNF_COCOA_EXIT(env); - - return JNI_TRUE; -} - #pragma mark - #pragma mark "--- CGLSurfaceData methods - Mac OS X specific ---" diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.h openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.h --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.h 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.h 2021-09-01 14:33:15.000000000 +0000 @@ -26,7 +26,7 @@ #ifndef __THREADUTILITIES_H #define __THREADUTILITIES_H -#import +#include #import "AWT_debug.h" diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.m openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.m --- openjdk-8-8u292-b10/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.m 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/macosx/native/sun/osxapp/ThreadUtilities.m 2021-09-01 14:33:15.000000000 +0000 @@ -36,7 +36,7 @@ static jobject appkitThreadGroup = NULL; static BOOL awtEmbedded = NO; -inline void attachCurrentThread(void** env) { +static inline void attachCurrentThread(void** env) { if ([NSThread isMainThread]) { JavaVMAttachArgs args; args.version = JNI_VERSION_1_4; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/back/eventHandler.c openjdk-8-8u312-b07/=unpacked-tar3=/src/share/back/eventHandler.c --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/back/eventHandler.c 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/back/eventHandler.c 2021-09-01 14:33:15.000000000 +0000 @@ -1685,7 +1685,7 @@ eventHandler_createPermanentInternal(EventIndex ei, HandlerFunction func) { return createInternal(ei, func, NULL, - NULL, NULL, (jlocation)NULL, JNI_TRUE); + NULL, NULL, 0, JNI_TRUE); } HandlerNode * @@ -1694,7 +1694,7 @@ jthread thread) { return createInternal(ei, func, thread, - NULL, NULL, (jlocation)NULL, JNI_FALSE); + NULL, NULL, 0, JNI_FALSE); } HandlerNode * diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/back/log_messages.c openjdk-8-8u312-b07/=unpacked-tar3=/src/share/back/log_messages.c --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/back/log_messages.c 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/back/log_messages.c 2021-09-01 14:33:15.000000000 +0000 @@ -56,17 +56,24 @@ static void get_time_stamp(char *tbuf, size_t ltbuf) { - char format[MAXLEN_TIMESTAMP+1]; + char timestamp_prefix[MAXLEN_TIMESTAMP+1]; + char timestamp_postfix[MAXLEN_TIMESTAMP+1]; unsigned millisecs = 0; time_t t = 0; GETMILLSECS(millisecs); - if ( time(&t) == (time_t)(-1) ) + if ( time(&t) == (time_t)(-1) ) { t = 0; - (void)strftime(format, sizeof(format), - /* Break this string up for SCCS's sake */ - "%" "d.%" "m.%" "Y %" "T.%%.3d %" "Z", localtime(&t)); - (void)snprintf(tbuf, ltbuf, format, (int)(millisecs)); + } + /* Break this up so that the format strings are string literals + and we avoid a compiler warning. */ + (void)strftime(timestamp_prefix, sizeof(timestamp_prefix), + "%d.%m.%Y %T", localtime(&t)); + (void)strftime(timestamp_postfix, sizeof(timestamp_postfix), + "%Z", localtime(&t)); + (void)snprintf(tbuf, ltbuf, + "%s.%.3d %s", timestamp_prefix, + (int)(millisecs), timestamp_postfix); } /* Get basename of filename */ @@ -175,7 +182,7 @@ "LOC=%s;PID=%d;THR=t@%d", location_stamp, (int)processPid, - (int)tid); + (int)(intptr_t)tid); /* Construct message string. */ va_start(ap, format); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/back/SDE.c openjdk-8-8u312-b07/=unpacked-tar3=/src/share/back/SDE.c --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/back/SDE.c 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/back/SDE.c 2021-09-01 14:33:15.000000000 +0000 @@ -48,8 +48,6 @@ #define BASE_STRATUM_NAME "Java" #define null NULL -#define true JNI_TRUE -#define false JNI_FALSE #define String char * #define private static @@ -147,7 +145,7 @@ defaultStratumId = null; defaultStratumIndex = -1; baseStratumIndex = -2; /* so as not to match -1 above */ - sourceMapIsValid = false; + sourceMapIsValid = JNI_FALSE; if (getSourceDebugExtension(clazz, &sourceDebugExtension) == JVMTI_ERROR_NONE) { @@ -667,7 +665,7 @@ jplsFilename = readLine(); defaultStratumId = readLine(); createJavaStratum(); - while (true) { + while (1) { if (sdeRead() != '*') { syntax("expected '*'"); } @@ -684,7 +682,7 @@ case 'E': /* set end points */ storeStratum("*terminator*"); - sourceMapIsValid = true; + sourceMapIsValid = JNI_TRUE; return; default: ignoreSection(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/PBES2Parameters.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/PBES2Parameters.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/PBES2Parameters.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/PBES2Parameters.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2018, 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 @@ -26,14 +26,12 @@ package com.sun.crypto.provider; import java.io.*; -import java.math.BigInteger; import java.security.NoSuchAlgorithmException; import java.security.AlgorithmParametersSpi; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidParameterSpecException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.PBEParameterSpec; -import sun.misc.HexDumpEncoder; import sun.security.util.*; /** @@ -259,26 +257,25 @@ String kdfAlgo = null; String cipherAlgo = null; - DerValue pBES2Algorithms = new DerValue(encoded); - if (pBES2Algorithms.tag != DerValue.tag_Sequence) { - throw new IOException("PBE parameter parsing error: " - + "not an ASN.1 SEQUENCE tag"); - } - if (!pkcs5PBES2_OID.equals(pBES2Algorithms.data.getOID())) { - throw new IOException("PBE parameter parsing error: " - + "expecting the object identifier for PBES2"); - } - if (pBES2Algorithms.tag != DerValue.tag_Sequence) { + DerValue pBES2_params = new DerValue(encoded); + if (pBES2_params.tag != DerValue.tag_Sequence) { throw new IOException("PBE parameter parsing error: " + "not an ASN.1 SEQUENCE tag"); } + DerValue kdf = pBES2_params.data.getDerValue(); - DerValue pBES2_params = pBES2Algorithms.data.getDerValue(); - if (pBES2_params.tag != DerValue.tag_Sequence) { - throw new IOException("PBE parameter parsing error: " - + "not an ASN.1 SEQUENCE tag"); + // Before JDK-8202837, PBES2-params was mistakenly encoded like + // an AlgorithmId which is a sequence of its own OID and the real + // PBES2-params. If the first DerValue is an OID instead of a + // PBES2-KDFs (which should be a SEQUENCE), we are likely to be + // dealing with this buggy encoding. Skip the OID and treat the + // next DerValue as the real PBES2-params. + if (kdf.getTag() == DerValue.tag_ObjectId) { + pBES2_params = pBES2_params.data.getDerValue(); + kdf = pBES2_params.data.getDerValue(); } - kdfAlgo = parseKDF(pBES2_params.data.getDerValue()); + + kdfAlgo = parseKDF(kdf); if (pBES2_params.tag != DerValue.tag_Sequence) { throw new IOException("PBE parameter parsing error: " @@ -291,7 +288,6 @@ } private String parseKDF(DerValue keyDerivationFunc) throws IOException { - String kdfAlgo = null; if (!pkcs5PBKDF2_OID.equals(keyDerivationFunc.data.getOID())) { throw new IOException("PBE parameter parsing error: " @@ -316,34 +312,41 @@ + "not an ASN.1 OCTET STRING tag"); } iCount = pBKDF2_params.data.getInteger(); - DerValue keyLength = pBKDF2_params.data.getDerValue(); - if (keyLength.tag == DerValue.tag_Integer) { - keysize = keyLength.getInteger() * 8; // keysize (in bits) - } - if (pBKDF2_params.tag == DerValue.tag_Sequence) { - DerValue prf = pBKDF2_params.data.getDerValue(); - kdfAlgo_OID = prf.data.getOID(); - if (hmacWithSHA1_OID.equals(kdfAlgo_OID)) { - kdfAlgo = "HmacSHA1"; - } else if (hmacWithSHA224_OID.equals(kdfAlgo_OID)) { - kdfAlgo = "HmacSHA224"; - } else if (hmacWithSHA256_OID.equals(kdfAlgo_OID)) { - kdfAlgo = "HmacSHA256"; - } else if (hmacWithSHA384_OID.equals(kdfAlgo_OID)) { - kdfAlgo = "HmacSHA384"; - } else if (hmacWithSHA512_OID.equals(kdfAlgo_OID)) { - kdfAlgo = "HmacSHA512"; - } else { - throw new IOException("PBE parameter parsing error: " - + "expecting the object identifier for a HmacSHA key " - + "derivation function"); + // keyLength INTEGER (1..MAX) OPTIONAL, + if (pBKDF2_params.data.available() > 0) { + DerValue keyLength = pBKDF2_params.data.getDerValue(); + if (keyLength.tag == DerValue.tag_Integer) { + keysize = keyLength.getInteger() * 8; // keysize (in bits) } - if (prf.data.available() != 0) { - // parameter is 'NULL' for all HmacSHA KDFs - DerValue parameter = prf.data.getDerValue(); - if (parameter.tag != DerValue.tag_Null) { + } + // prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1 + String kdfAlgo = "HmacSHA1"; + if (pBKDF2_params.data.available() > 0) { + if (pBKDF2_params.tag == DerValue.tag_Sequence) { + DerValue prf = pBKDF2_params.data.getDerValue(); + kdfAlgo_OID = prf.data.getOID(); + if (hmacWithSHA1_OID.equals(kdfAlgo_OID)) { + kdfAlgo = "HmacSHA1"; + } else if (hmacWithSHA224_OID.equals(kdfAlgo_OID)) { + kdfAlgo = "HmacSHA224"; + } else if (hmacWithSHA256_OID.equals(kdfAlgo_OID)) { + kdfAlgo = "HmacSHA256"; + } else if (hmacWithSHA384_OID.equals(kdfAlgo_OID)) { + kdfAlgo = "HmacSHA384"; + } else if (hmacWithSHA512_OID.equals(kdfAlgo_OID)) { + kdfAlgo = "HmacSHA512"; + } else { throw new IOException("PBE parameter parsing error: " - + "not an ASN.1 NULL tag"); + + "expecting the object identifier for a HmacSHA key " + + "derivation function"); + } + if (prf.data.available() != 0) { + // parameter is 'NULL' for all HmacSHA KDFs + DerValue parameter = prf.data.getDerValue(); + if (parameter.tag != DerValue.tag_Null) { + throw new IOException("PBE parameter parsing error: " + + "not an ASN.1 NULL tag"); + } } } } @@ -396,8 +399,6 @@ protected byte[] engineGetEncoded() throws IOException { DerOutputStream out = new DerOutputStream(); - DerOutputStream pBES2Algorithms = new DerOutputStream(); - pBES2Algorithms.putOID(pkcs5PBES2_OID); DerOutputStream pBES2_params = new DerOutputStream(); @@ -407,7 +408,10 @@ DerOutputStream pBKDF2_params = new DerOutputStream(); pBKDF2_params.putOctetString(salt); // choice: 'specified OCTET STRING' pBKDF2_params.putInteger(iCount); - pBKDF2_params.putInteger(keysize / 8); // derived key length (in octets) + + if (keysize > 0) { + pBKDF2_params.putInteger(keysize / 8); // derived key length (in octets) + } DerOutputStream prf = new DerOutputStream(); // algorithm is id-hmacWithSHA1/SHA224/SHA256/SHA384/SHA512 @@ -431,8 +435,7 @@ } pBES2_params.write(DerValue.tag_Sequence, encryptionScheme); - pBES2Algorithms.write(DerValue.tag_Sequence, pBES2_params); - out.write(DerValue.tag_Sequence, pBES2Algorithms); + out.write(DerValue.tag_Sequence, pBES2_params); return out.toByteArray(); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/RSACipher.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/RSACipher.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/RSACipher.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/crypto/provider/RSACipher.java 2021-09-01 14:33:15.000000000 +0000 @@ -25,6 +25,7 @@ package com.sun.crypto.provider; +import java.util.Arrays; import java.util.Locale; import java.security.*; @@ -346,28 +347,40 @@ throw new IllegalBlockSizeException("Data must not be longer " + "than " + buffer.length + " bytes"); } + byte[] paddingCopy = null; + byte[] result = null; try { - byte[] data; switch (mode) { case MODE_SIGN: - data = padding.pad(buffer, 0, bufOfs); - return RSACore.rsa(data, privateKey, true); + paddingCopy = padding.pad(buffer, 0, bufOfs); + result = RSACore.rsa(paddingCopy, privateKey, true); + break; case MODE_VERIFY: byte[] verifyBuffer = RSACore.convert(buffer, 0, bufOfs); - data = RSACore.rsa(verifyBuffer, publicKey); - return padding.unpad(data); + paddingCopy = RSACore.rsa(verifyBuffer, publicKey); + result = padding.unpad(paddingCopy); + break; case MODE_ENCRYPT: - data = padding.pad(buffer, 0, bufOfs); - return RSACore.rsa(data, publicKey); + paddingCopy = padding.pad(buffer, 0, bufOfs); + result = RSACore.rsa(paddingCopy, publicKey); + break; case MODE_DECRYPT: byte[] decryptBuffer = RSACore.convert(buffer, 0, bufOfs); - data = RSACore.rsa(decryptBuffer, privateKey, false); - return padding.unpad(data); + paddingCopy = RSACore.rsa(decryptBuffer, privateKey, false); + result = padding.unpad(paddingCopy); + break; default: throw new AssertionError("Internal error"); } + return result; } finally { + Arrays.fill(buffer, 0, bufOfs, (byte)0); bufOfs = 0; + if (paddingCopy != null // will not happen + && paddingCopy != buffer // already cleaned + && paddingCopy != result) { // DO NOT CLEAN, THIS IS RESULT! + Arrays.fill(paddingCopy, (byte)0); + } } } @@ -403,6 +416,7 @@ byte[] result = doFinal(); int n = result.length; System.arraycopy(result, 0, out, outOfs, n); + Arrays.fill(result, (byte)0); return n; } @@ -413,15 +427,19 @@ if ((encoded == null) || (encoded.length == 0)) { throw new InvalidKeyException("Could not obtain encoded key"); } - if (encoded.length > buffer.length) { - throw new InvalidKeyException("Key is too long for wrapping"); - } - update(encoded, 0, encoded.length); try { - return doFinal(); - } catch (BadPaddingException e) { - // should not occur - throw new InvalidKeyException("Wrapping failed", e); + if (encoded.length > buffer.length) { + throw new InvalidKeyException("Key is too long for wrapping"); + } + update(encoded, 0, encoded.length); + try { + return doFinal(); + } catch (BadPaddingException e) { + // should not occur + throw new InvalidKeyException("Wrapping failed", e); + } + } finally { + Arrays.fill(encoded, (byte)0); } } @@ -451,20 +469,26 @@ throw new InvalidKeyException("Unwrapping failed", e); } - if (isTlsRsaPremasterSecret) { - if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { - throw new IllegalStateException( - "No TlsRsaPremasterSecretParameterSpec specified"); + try { + if (isTlsRsaPremasterSecret) { + if (!(spec instanceof TlsRsaPremasterSecretParameterSpec)) { + throw new IllegalStateException( + "No TlsRsaPremasterSecretParameterSpec specified"); + } + + // polish the TLS premaster secret + encoded = KeyUtil.checkTlsPreMasterSecretKey( + ((TlsRsaPremasterSecretParameterSpec) spec).getClientVersion(), + ((TlsRsaPremasterSecretParameterSpec) spec).getServerVersion(), + random, encoded, (failover != null)); } - // polish the TLS premaster secret - encoded = KeyUtil.checkTlsPreMasterSecretKey( - ((TlsRsaPremasterSecretParameterSpec)spec).getClientVersion(), - ((TlsRsaPremasterSecretParameterSpec)spec).getServerVersion(), - random, encoded, (failover != null)); + return ConstructKeys.constructKey(encoded, algorithm, type); + } finally { + if (encoded != null) { + Arrays.fill(encoded, (byte) 0); + } } - - return ConstructKeys.constructKey(encoded, algorithm, type); } // see JCE spec diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReader.java 2021-09-01 14:33:15.000000000 +0000 @@ -514,6 +514,13 @@ height = Math.abs(height); } + if (metadata.compression == BI_RGB) { + long imageDataSize = (width * height * (bitsPerPixel / 8)); + if (imageDataSize > (bitmapFileSize - bitmapOffset)) { + throw new IIOException(I18N.getString("BMPImageReader9")); + } + } + // Reset Image Layout so there's only one tile. //Define the color space ColorSpace colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties 2021-09-01 14:33:15.000000000 +0000 @@ -23,6 +23,7 @@ BMPImageReader5=Input has not been set. BMPImageReader6=Unable to read the image header. BMPImageReader7=Invalid bitmap offset. +BMPImageReader9=Invalid width/height for BI_RGB image data. BMPImageWriter0=Output is not an ImageOutputStream. BMPImageWriter1=The image region to be encoded is empty. BMPImageWriter2=Only 1 or 3 band image is encoded. diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java 2021-09-01 14:33:15.000000000 +0000 @@ -1305,14 +1305,18 @@ this.pixelStream = new DataInputStream(is); /* - * NB: the PNG spec declares that valid range for width + * PNG spec declares that valid range for width * and height is [1, 2^31-1], so here we may fail to allocate * a buffer for destination image due to memory limitation. * - * However, the recovery strategy for this case should be - * defined on the level of application, so we will not - * try to estimate the required amount of the memory and/or - * handle OOM in any way. + * If the read operation triggers OutOfMemoryError, the same + * will be wrapped in an IIOException at PNGImageReader.read + * method. + * + * The recovery strategy for this case should be defined at + * the level of application, so we will not try to estimate + * the required amount of the memory and/or handle OOM in + * any way. */ theImage = getDestination(param, getImageTypes(0), @@ -1611,7 +1615,16 @@ throw new IndexOutOfBoundsException("imageIndex != 0!"); } - readImage(param); + try { + readImage(param); + } catch (IOException | + IllegalStateException | + IllegalArgumentException e) + { + throw e; + } catch (Throwable e) { + throw new IIOException("Caught exception during read: ", e); + } return theImage; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/Obj.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/Obj.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/Obj.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/Obj.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2021, 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 @@ -468,6 +468,12 @@ // Empty content refAddrList.setElementAt(new StringRefAddr(type, null), posn); } else if (val.charAt(start) == separator) { + // Check if deserialization of binary RefAddr is allowed from + // 'javaReferenceAddress' LDAP attribute. + if (!VersionHelper12.isSerialDataAllowed()) { + throw new NamingException("Object deserialization is not allowed"); + } + // Double separators indicate a non-StringRefAddr // Content is a Base64-encoded serialized RefAddr diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/jndi/ldap/VersionHelper12.java 2021-09-01 14:33:15.000000000 +0000 @@ -73,7 +73,7 @@ /** * Returns true if deserialization of objects from 'javaSerializedData' - * LDAP attribute is allowed. + * and 'javaReferenceAddress' LDAP attributes is allowed. * * @return true if deserialization is allowed; false - otherwise */ diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/media/sound/DirectAudioDevice.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/media/sound/DirectAudioDevice.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/media/sound/DirectAudioDevice.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/media/sound/DirectAudioDevice.java 2021-09-01 14:33:15.000000000 +0000 @@ -1379,18 +1379,14 @@ // pre-empted while another thread changes doIO and notifies, // before we wait (so we sleep in wait forever). synchronized(lock) { - if (!doIO) { + while (!doIO && thread == curThread) { try { lock.wait(); - } catch(InterruptedException ie) { - } finally { - if (thread != curThread) { - break; - } + } catch (InterruptedException ignored) { } } } - while (doIO) { + while (doIO && thread == curThread) { if (newFramePosition >= 0) { clipBytePosition = newFramePosition * frameSize; newFramePosition = -1; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/media/sound/SoftMainMixer.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/media/sound/SoftMainMixer.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/media/sound/SoftMainMixer.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/media/sound/SoftMainMixer.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2020, 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 @@ -629,8 +629,8 @@ if (!hasactivevoices) { synchronized (control_mutex) { if (stoppedMixers != null) { - if (stoppedMixers.contains(cmixer)) { - stoppedMixers.remove(cmixer); + if (stoppedMixers.contains(cmixer.mixer)) { + stoppedMixers.remove(cmixer.mixer); cmixer.mixer.stop(); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/security/auth/module/Krb5LoginModule.java 2021-09-01 14:33:15.000000000 +0000 @@ -684,9 +684,11 @@ } if (cred != null) { - // get the principal name from the ticket cache - if (principal == null) { - principal = cred.getClient(); + // get the principal name from the ticket cache + if (principal == null) { + principal = cred.getProxy() != null + ? cred.getProxy().getClient() + : cred.getClient(); } } if (debug) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/security/ntlm/NTLM.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/security/ntlm/NTLM.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/com/sun/security/ntlm/NTLM.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/com/sun/security/ntlm/NTLM.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2021, 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 @@ -149,7 +149,7 @@ int readShort(int offset) throws NTLMException { try { return (internal[offset] & 0xff) + - ((internal[offset+1] & 0xff << 8)); + (((internal[offset+1] & 0xff) << 8)); } catch (ArrayIndexOutOfBoundsException ex) { throw new NTLMException(NTLMException.PACKET_READ_ERROR, "Input message incorrect size"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/awt/datatransfer/MimeType.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/awt/datatransfer/MimeType.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/awt/datatransfer/MimeType.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/awt/datatransfer/MimeType.java 2021-09-01 14:33:15.000000000 +0000 @@ -25,6 +25,7 @@ package java.awt.datatransfer; +import java.io.ByteArrayOutputStream; import java.io.Externalizable; import java.io.ObjectOutput; import java.io.ObjectInput; @@ -326,9 +327,12 @@ ClassNotFoundException { String s = in.readUTF(); if (s == null || s.length() == 0) { // long mime type - byte[] ba = new byte[in.readInt()]; - in.readFully(ba); - s = new String(ba); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int len = in.readInt(); + while (len-- > 0) { + baos.write(in.readByte()); + } + s = baos.toString(); } try { parse(s); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/beans/IndexedPropertyDescriptor.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/beans/IndexedPropertyDescriptor.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/beans/IndexedPropertyDescriptor.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/beans/IndexedPropertyDescriptor.java 2021-09-01 14:33:15.000000000 +0000 @@ -429,7 +429,7 @@ /** * Package-private constructor. * Merge two property descriptors. Where they conflict, give the - * second argument (y) priority over the first argumnnt (x). + * second argument (y) priority over the first argument (x). * * @param x The first (lower priority) PropertyDescriptor * @param y The second (higher priority) PropertyDescriptor @@ -437,39 +437,37 @@ IndexedPropertyDescriptor(PropertyDescriptor x, PropertyDescriptor y) { super(x,y); + Method tr = null; + Method tw = null; + if (x instanceof IndexedPropertyDescriptor) { - IndexedPropertyDescriptor ix = (IndexedPropertyDescriptor)x; - try { - Method xr = ix.getIndexedReadMethod(); - if (xr != null) { - setIndexedReadMethod(xr); - } + IndexedPropertyDescriptor ix = (IndexedPropertyDescriptor) x; + tr = ix.getIndexedReadMethod(); + tw = ix.getIndexedWriteMethod(); + } + if (y instanceof IndexedPropertyDescriptor) { + IndexedPropertyDescriptor iy = (IndexedPropertyDescriptor) y; + Method yr = iy.getIndexedReadMethod(); + if (isAssignable(tr, yr)) { + tr = yr; + } - Method xw = ix.getIndexedWriteMethod(); - if (xw != null) { - setIndexedWriteMethod(xw); - } - } catch (IntrospectionException ex) { - // Should not happen - throw new AssertionError(ex); + Method yw = iy.getIndexedWriteMethod(); + if (isAssignable(tw, yw)) { + tw = yw; } } - if (y instanceof IndexedPropertyDescriptor) { - IndexedPropertyDescriptor iy = (IndexedPropertyDescriptor)y; - try { - Method yr = iy.getIndexedReadMethod(); - if (yr != null && yr.getDeclaringClass() == getClass0()) { - setIndexedReadMethod(yr); - } - Method yw = iy.getIndexedWriteMethod(); - if (yw != null && yw.getDeclaringClass() == getClass0()) { - setIndexedWriteMethod(yw); - } - } catch (IntrospectionException ex) { - // Should not happen - throw new AssertionError(ex); + try { + if(tr != null) { + setIndexedReadMethod(tr); + } + if(tw != null) { + setIndexedWriteMethod(tw); } + } catch(IntrospectionException ex) { + // Should not happen + throw new AssertionError(ex); } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/beans/PropertyDescriptor.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/beans/PropertyDescriptor.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/beans/PropertyDescriptor.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/beans/PropertyDescriptor.java 2021-09-01 14:33:15.000000000 +0000 @@ -715,7 +715,7 @@ appendTo(sb, "writeMethod", this.writeMethodRef.get()); } - private boolean isAssignable(Method m1, Method m2) { + boolean isAssignable(Method m1, Method m2) { if (m1 == null) { return true; // choose second method } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/lang/Character.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/lang/Character.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/lang/Character.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/lang/Character.java 2021-09-01 14:33:15.000000000 +0000 @@ -2571,7 +2571,7 @@ "ARABIC MATHEMATICAL ALPHABETIC SYMBOLS", "ARABICMATHEMATICALALPHABETICSYMBOLS"); - private static final int blockStarts[] = { + private static final int[] blockStarts = { 0x0000, // 0000..007F; Basic Latin 0x0080, // 0080..00FF; Latin-1 Supplement 0x0100, // 0100..017F; Latin Extended-A @@ -4368,7 +4368,7 @@ UNKNOWN }; - private static HashMap aliases; + private static final HashMap aliases; static { aliases = new HashMap<>(128); aliases.put("ARAB", ARABIC); @@ -4651,8 +4651,7 @@ * @return a string representation of this object. */ public String toString() { - char buf[] = {value}; - return String.valueOf(buf); + return String.valueOf(value); } /** diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/net/URLClassLoader.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/net/URLClassLoader.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/net/URLClassLoader.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/net/URLClassLoader.java 2021-09-01 14:33:15.000000000 +0000 @@ -369,6 +369,11 @@ return defineClass(name, res); } catch (IOException e) { throw new ClassNotFoundException(name, e); + } catch (ClassFormatError e2) { + if (res.getDataError() != null) { + e2.addSuppressed(res.getDataError()); + } + throw e2; } } else { return null; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/net/URL.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/net/URL.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/net/URL.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/net/URL.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2021, 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 @@ -214,7 +214,7 @@ * The host's IP address, used in equals and hashCode. * Computed on demand. An uninitialized or unknown hostAddress is null. */ - transient InetAddress hostAddress; + private transient InetAddress hostAddress; /** * The URLStreamHandler for this URL. @@ -744,6 +744,31 @@ } /** + * Returns the address of the host represented by this URL. + * A {@link SecurityException} or an {@link UnknownHostException} + * while getting the host address will result in this method returning + * {@code null} + * + * @return an {@link InetAddress} representing the host + */ + synchronized InetAddress getHostAddress() { + if (hostAddress != null) { + return hostAddress; + } + + if (host == null || host.isEmpty()) { + return null; + } + try { + hostAddress = InetAddress.getByName(host); + } catch (UnknownHostException | SecurityException ex) { + return null; + } + return hostAddress; + } + + + /** * Gets the query part of this {@code URL}. * * @return the query part of this {@code URL}, diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/net/URLStreamHandler.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/net/URLStreamHandler.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/net/URLStreamHandler.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/net/URLStreamHandler.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2021, 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 @@ -430,23 +430,8 @@ * IP address. * @since 1.3 */ - protected synchronized InetAddress getHostAddress(URL u) { - if (u.hostAddress != null) - return u.hostAddress; - - String host = u.getHost(); - if (host == null || host.equals("")) { - return null; - } else { - try { - u.hostAddress = InetAddress.getByName(host); - } catch (UnknownHostException ex) { - return null; - } catch (SecurityException se) { - return null; - } - } - return u.hostAddress; + protected InetAddress getHostAddress(URL u) { + return u.getHostAddress(); } /** diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/time/zone/ZoneRules.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/time/zone/ZoneRules.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/time/zone/ZoneRules.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/time/zone/ZoneRules.java 2021-09-01 14:33:15.000000000 +0000 @@ -420,7 +420,10 @@ } /** - * Reads the state from the stream. + * Reads the state from the stream. The 1,024 limit to the lengths + * of stdTrans and savSize is intended to be the size well enough + * to accommodate the max number of transitions in current tzdb data + * (203 for Asia/Tehran). * * @param in the input stream, not null * @return the created object, not null @@ -428,6 +431,9 @@ */ static ZoneRules readExternal(DataInput in) throws IOException, ClassNotFoundException { int stdSize = in.readInt(); + if (stdSize > 1024) { + throw new InvalidObjectException("Too many transitions"); + } long[] stdTrans = (stdSize == 0) ? EMPTY_LONG_ARRAY : new long[stdSize]; for (int i = 0; i < stdSize; i++) { @@ -438,6 +444,9 @@ stdOffsets[i] = Ser.readOffset(in); } int savSize = in.readInt(); + if (savSize > 1024) { + throw new InvalidObjectException("Too many saving offsets"); + } long[] savTrans = (savSize == 0) ? EMPTY_LONG_ARRAY : new long[savSize]; for (int i = 0; i < savSize; i++) { @@ -448,6 +457,9 @@ savOffsets[i] = Ser.readOffset(in); } int ruleSize = in.readByte(); + if (ruleSize > 16) { + throw new InvalidObjectException("Too many transition rules"); + } ZoneOffsetTransitionRule[] rules = (ruleSize == 0) ? EMPTY_LASTRULES : new ZoneOffsetTransitionRule[ruleSize]; for (int i = 0; i < ruleSize; i++) { diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/HashMap.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/HashMap.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/HashMap.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/HashMap.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -27,6 +27,7 @@ import java.io.IOException; import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.io.Serializable; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -1370,23 +1371,28 @@ * could not be found * @throws IOException if an I/O error occurs */ - private void readObject(java.io.ObjectInputStream s) + private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { - // Read in the threshold (ignored), loadfactor, and any hidden stuff - s.defaultReadObject(); + + ObjectInputStream.GetField fields = s.readFields(); + + // Read loadFactor (ignore threshold) + float lf = fields.get("loadFactor", 0.75f); + if (lf <= 0 || Float.isNaN(lf)) + throw new InvalidObjectException("Illegal load factor: " + lf); + + lf = Math.min(Math.max(0.25f, lf), 4.0f); + HashMap.UnsafeHolder.putLoadFactor(this, lf); + reinitialize(); - if (loadFactor <= 0 || Float.isNaN(loadFactor)) - throw new InvalidObjectException("Illegal load factor: " + - loadFactor); + s.readInt(); // Read and ignore number of buckets int mappings = s.readInt(); // Read number of mappings (size) - if (mappings < 0) - throw new InvalidObjectException("Illegal mappings count: " + - mappings); - else if (mappings > 0) { // (if zero, use defaults) - // Size the table using given load factor only if within - // range of 0.25...4.0 - float lf = Math.min(Math.max(0.25f, loadFactor), 4.0f); + if (mappings < 0) { + throw new InvalidObjectException("Illegal mappings count: " + mappings); + } else if (mappings == 0) { + // use defaults + } else if (mappings > 0) { float fc = (float)mappings / lf + 1.0f; int cap = ((fc < DEFAULT_INITIAL_CAPACITY) ? DEFAULT_INITIAL_CAPACITY : @@ -1415,6 +1421,24 @@ } } + // Support for resetting final field during deserializing + private static final class UnsafeHolder { + private UnsafeHolder() { throw new InternalError(); } + private static final sun.misc.Unsafe unsafe + = sun.misc.Unsafe.getUnsafe(); + private static final long LF_OFFSET; + static { + try { + LF_OFFSET = unsafe.objectFieldOffset(HashMap.class.getDeclaredField("loadFactor")); + } catch (NoSuchFieldException nfe) { + throw new InternalError(); + } + } + static void putLoadFactor(HashMap map, float lf) { + unsafe.putFloat(map, LF_OFFSET, lf); + } + } + /* ------------------------------------------------------------ */ // iterators diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/HashSet.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/HashSet.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/HashSet.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/HashSet.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -294,8 +294,8 @@ */ private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, ClassNotFoundException { - // Read in any hidden serialization magic - s.defaultReadObject(); + // Consume and ignore stream fields (currently zero). + s.readFields(); // Read capacity and verify non-negative. int capacity = s.readInt(); @@ -310,12 +310,13 @@ throw new InvalidObjectException("Illegal load factor: " + loadFactor); } + // Clamp load factor to range of 0.25...4.0. + loadFactor = Math.min(Math.max(0.25f, loadFactor), 4.0f); // Read size and verify non-negative. int size = s.readInt(); if (size < 0) { - throw new InvalidObjectException("Illegal size: " + - size); + throw new InvalidObjectException("Illegal size: " + size); } // Set the capacity according to the size and load factor ensuring that // the HashMap is at least 25% full but clamping to maximum capacity. diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/jar/JarFile.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/jar/JarFile.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/jar/JarFile.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/jar/JarFile.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -74,6 +74,8 @@ private JarVerifier jv; private boolean jvInitialized; private boolean verify; + // The maximum size of array to allocate. Some VMs reserve some header words in an array. + private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8; // indicates if Class-Path attribute present (only valid if hasCheckedSpecialAttributes true) private boolean hasClassPathAttribute; @@ -85,6 +87,9 @@ SharedSecrets.setJavaUtilJarAccess(new JavaUtilJarAccessImpl()); } + private static final sun.misc.JavaUtilZipFileAccess JUZFA = + sun.misc.SharedSecrets.getJavaUtilZipFileAccess(); + /** * The JAR manifest file name. */ @@ -192,7 +197,13 @@ if (verify) { byte[] b = getBytes(manEntry); if (!jvInitialized) { - jv = new JarVerifier(b); + if (JUZFA.getManifestNum(this) == 1) { + jv = new JarVerifier(manEntry.getName(), b); + } else { + if (JarVerifier.debug != null) { + JarVerifier.debug.println("Multiple MANIFEST.MF found. Treat JAR file as unsigned"); + } + } } man = new Manifest(jv, new ByteArrayInputStream(b)); } else { @@ -422,7 +433,11 @@ */ private byte[] getBytes(ZipEntry ze) throws IOException { try (InputStream is = super.getInputStream(ze)) { - int len = (int)ze.getSize(); + long uncompressedSize = ze.getSize(); + if (uncompressedSize > MAX_ARRAY_SIZE) { + throw new IOException("Unsupported size: " + uncompressedSize); + } + int len = (int)uncompressedSize; byte[] b = IOUtils.readAllBytes(is); if (len != -1 && b.length != len) throw new EOFException("Expected:" + len + ", read:" + b.length); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/jar/JarInputStream.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/jar/JarInputStream.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/jar/JarInputStream.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/jar/JarInputStream.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -95,7 +95,7 @@ man.read(new ByteArrayInputStream(bytes)); closeEntry(); if (doVerify) { - jv = new JarVerifier(bytes); + jv = new JarVerifier(e.getName(), bytes); mev = new ManifestEntryVerifier(man); } return (JarEntry)super.getNextEntry(); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/jar/JarVerifier.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/jar/JarVerifier.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/jar/JarVerifier.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/jar/JarVerifier.java 2021-09-01 14:33:15.000000000 +0000 @@ -84,6 +84,9 @@ /** the bytes for the manDig object */ byte manifestRawBytes[] = null; + /** the manifest name this JarVerifier is created upon */ + final String manifestName; + /** controls eager signature validation */ boolean eagerValidation; @@ -93,7 +96,8 @@ /** collect -DIGEST-MANIFEST values for blacklist */ private List manifestDigests; - public JarVerifier(byte rawBytes[]) { + public JarVerifier(String name, byte rawBytes[]) { + manifestName = name; manifestRawBytes = rawBytes; sigFileSigners = new Hashtable<>(); verifiedSigners = new Hashtable<>(); @@ -180,7 +184,7 @@ // only set the jev object for entries that have a signature // (either verified or not) - if (!name.equals(JarFile.MANIFEST_NAME)) { + if (!name.equalsIgnoreCase(JarFile.MANIFEST_NAME)) { if (sigFileSigners.get(name) != null || verifiedSigners.get(name) != null) { mev.setEntry(name, je); @@ -272,7 +276,8 @@ } sfv.setSignatureFile(bytes); - sfv.process(sigFileSigners, manifestDigests); + sfv.process(sigFileSigners, manifestDigests, + manifestName); } } return; @@ -315,7 +320,7 @@ sfv.setSignatureFile(bytes); } } - sfv.process(sigFileSigners, manifestDigests); + sfv.process(sigFileSigners, manifestDigests, manifestName); } catch (IOException ioe) { // e.g. sun.security.pkcs.ParsingException @@ -430,9 +435,9 @@ manDig = null; // MANIFEST.MF is always treated as signed and verified, // move its signers from sigFileSigners to verifiedSigners. - if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) { - CodeSigner[] codeSigners = sigFileSigners.remove(JarFile.MANIFEST_NAME); - verifiedSigners.put(JarFile.MANIFEST_NAME, codeSigners); + if (sigFileSigners.containsKey(manifestName)) { + CodeSigner[] codeSigners = sigFileSigners.remove(manifestName); + verifiedSigners.put(manifestName, codeSigners); } } @@ -886,7 +891,7 @@ */ boolean isTrustedManifestEntry(String name) { // How many signers? MANIFEST.MF is always verified - CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME); + CodeSigner[] forMan = verifiedSigners.get(manifestName); if (forMan == null) { return true; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/logging/FileHandler.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/logging/FileHandler.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/logging/FileHandler.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/logging/FileHandler.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2021, 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 @@ -36,6 +36,7 @@ import java.io.OutputStream; import java.nio.channels.FileChannel; import java.nio.channels.OverlappingFileLockException; +import java.nio.file.AccessDeniedException; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.LinkOption; @@ -478,6 +479,22 @@ channel = FileChannel.open(lockFilePath, CREATE_NEW, WRITE); fileCreated = true; + } catch (AccessDeniedException ade) { + // This can be either a temporary, or a more permanent issue. + // The lock file might be still pending deletion from a previous run + // (temporary), or the parent directory might not be accessible, + // not writable, etc.. + // If we can write to the current directory, and this is a regular file, + // let's try again. + if (Files.isRegularFile(lockFilePath, LinkOption.NOFOLLOW_LINKS) + && isParentWritable(lockFilePath)) { + // Try again. If it doesn't work, then this will + // eventually ensure that we increment "unique" and + // use another file name. + continue; + } else { + throw ade; // no need to retry + } } catch (FileAlreadyExistsException ix) { // This may be a zombie file left over by a previous // execution. Reuse it - but only if we can actually diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/zip/ZipFile.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/zip/ZipFile.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/java/util/zip/ZipFile.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/java/util/zip/ZipFile.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2021, 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 @@ -42,6 +42,7 @@ import java.util.Spliterator; import java.util.Spliterators; import java.util.WeakHashMap; +import java.util.jar.JarFile; import java.util.stream.Stream; import java.util.stream.StreamSupport; @@ -63,6 +64,7 @@ private final int total; // total number of entries private final boolean locsig; // if zip file starts with LOCSIG (usually true) private volatile boolean closeRequested = false; + private int manifestNum = 0; // number of META-INF/MANIFEST.MF, case insensitive private static final int STORED = ZipEntry.STORED; private static final int DEFLATED = ZipEntry.DEFLATED; @@ -211,6 +213,7 @@ Integer.toHexString(mode)); } String name = file.getPath(); + file = new File(name); SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkRead(name); @@ -228,6 +231,7 @@ this.name = name; this.total = getTotal(jzfile); this.locsig = startsWithLOC(jzfile); + this.manifestNum = getManifestNum(jzfile); } /** @@ -800,6 +804,9 @@ public boolean startsWithLocHeader(ZipFile zip) { return zip.startsWithLocHeader(); } + public int getManifestNum(JarFile jar) { + return ((ZipFile)jar).getManifestNum(); + } } ); } @@ -812,10 +819,23 @@ return locsig; } + /* + * Returns the number of the META-INF/MANIFEST.MF entries, case insensitive. + * When this number is greater than 1, JarVerifier will treat a file as + * unsigned. + */ + private int getManifestNum() { + synchronized (this) { + ensureOpen(); + return manifestNum; + } + } + private static native long open(String name, int mode, long lastModified, boolean usemmap) throws IOException; private static native int getTotal(long jzfile); private static native boolean startsWithLOC(long jzfile); + private static native int getManifestNum(long jzfile); private static native int read(long jzfile, long jzentry, long pos, byte[] b, int off, int len); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/crypto/spec/IvParameterSpec.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/crypto/spec/IvParameterSpec.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/crypto/spec/IvParameterSpec.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/crypto/spec/IvParameterSpec.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2021, 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 @@ -76,13 +76,16 @@ if (iv == null) { throw new IllegalArgumentException("IV missing"); } - if (iv.length - offset < len) { - throw new IllegalArgumentException - ("IV buffer too short for given offset/length combination"); + if (offset < 0) { + throw new ArrayIndexOutOfBoundsException("offset is negative"); } if (len < 0) { throw new ArrayIndexOutOfBoundsException("len is negative"); } + if (iv.length - offset < len) { + throw new IllegalArgumentException + ("IV buffer too short for given offset/length combination"); + } this.iv = new byte[len]; System.arraycopy(iv, offset, this.iv, 0, len); } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/crypto/spec/RC5ParameterSpec.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/crypto/spec/RC5ParameterSpec.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/crypto/spec/RC5ParameterSpec.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/crypto/spec/RC5ParameterSpec.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2021, 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 @@ -114,7 +114,12 @@ this.version = version; this.rounds = rounds; this.wordSize = wordSize; - if (iv == null) throw new IllegalArgumentException("IV missing"); + if (iv == null) { + throw new IllegalArgumentException("IV missing"); + } + if (offset < 0) { + throw new ArrayIndexOutOfBoundsException("offset is negative"); + } int blockSize = (wordSize / 8) * 2; if (iv.length - offset < blockSize) { throw new IllegalArgumentException("IV too short"); diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/crypto/spec/SecretKeySpec.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/crypto/spec/SecretKeySpec.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/crypto/spec/SecretKeySpec.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/crypto/spec/SecretKeySpec.java 2021-09-01 14:33:15.000000000 +0000 @@ -144,13 +144,16 @@ if (key.length == 0) { throw new IllegalArgumentException("Empty key"); } - if (key.length-offset < len) { - throw new IllegalArgumentException - ("Invalid offset/length combination"); + if (offset < 0) { + throw new ArrayIndexOutOfBoundsException("offset is negative"); } if (len < 0) { throw new ArrayIndexOutOfBoundsException("len is negative"); } + if (key.length - offset < len) { + throw new IllegalArgumentException + ("Invalid offset/length combination"); + } this.key = new byte[len]; System.arraycopy(key, offset, this.key, 0, len); this.algorithm = algorithm; diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/JComboBox.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/JComboBox.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/JComboBox.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/JComboBox.java 2021-09-01 14:33:15.000000000 +0000 @@ -568,6 +568,8 @@ if (!found) { return; } + + getEditor().setItem(anObject); } // Must toggle the state of this flag since this method @@ -1307,16 +1309,12 @@ * do not call or override. */ public void actionPerformed(ActionEvent e) { - ComboBoxEditor editor = getEditor(); - if ((editor != null) && (e != null) && (editor == e.getSource() - || editor.getEditorComponent() == e.getSource())) { - setPopupVisible(false); - getModel().setSelectedItem(editor.getItem()); - String oldCommand = getActionCommand(); - setActionCommand("comboBoxEdited"); - fireActionEvent(); - setActionCommand(oldCommand); - } + setPopupVisible(false); + getModel().setSelectedItem(getEditor().getItem()); + String oldCommand = getActionCommand(); + setActionCommand("comboBoxEdited"); + fireActionEvent(); + setActionCommand(oldCommand); } /** diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/JList.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/JList.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/JList.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/JList.java 2021-09-01 14:33:15.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -3308,7 +3308,6 @@ } s.add(AccessibleState.SELECTABLE); - s.add(AccessibleState.VISIBLE); if (parent.isFocusOwner() && (indexInParent == parent.getLeadSelectionIndex())) { s.add(AccessibleState.ACTIVE); @@ -3321,6 +3320,11 @@ } else if (s.contains(AccessibleState.SHOWING)) { s.remove(AccessibleState.SHOWING); } + if (this.isVisible()) { + s.add(AccessibleState.VISIBLE); + } else if (s.contains(AccessibleState.VISIBLE)) { + s.remove(AccessibleState.VISIBLE); + } s.add(AccessibleState.TRANSIENT); // cell-rendered return s; } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFParser.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFParser.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFParser.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFParser.java 2021-09-01 14:33:15.000000000 +0000 @@ -232,25 +232,52 @@ currentCharacters.append(ch); } else { /* TODO: Test correct behavior of \bin keyword */ + if (pendingKeyword.equals("bin")) { /* magic layer-breaking kwd */ - long parameter = Long.parseLong(currentCharacters.toString()); + long parameter = 0L; + try { + parameter = Long.parseLong(currentCharacters.toString()); + } catch (NumberFormatException e) { + warning("Illegal number format " + currentCharacters.toString() + + " in \bin tag"); + pendingKeyword = null; + currentCharacters = new StringBuffer(); + state = S_text; + // Delimiters here are interpreted as text too + if (!Character.isWhitespace(ch)) + write(ch); + break; + } pendingKeyword = null; state = S_inblob; + int maxBytes = 4 * 1024 * 1024; binaryBytesLeft = parameter; - if (binaryBytesLeft > Integer.MAX_VALUE) - binaryBuf = new ByteArrayOutputStream(Integer.MAX_VALUE); - else - binaryBuf = new ByteArrayOutputStream((int)binaryBytesLeft); + + if (binaryBytesLeft > maxBytes) { + binaryBuf = new ByteArrayOutputStream(maxBytes); + } else if (binaryBytesLeft < 0) { + binaryBytesLeft = 0; + binaryBuf = new ByteArrayOutputStream((int)binaryBytesLeft); + } else { + binaryBuf = new ByteArrayOutputStream((int) binaryBytesLeft); + } savedSpecials = specialsTable; specialsTable = allSpecialsTable; break; } - int parameter = Integer.parseInt(currentCharacters.toString()); - ok = handleKeyword(pendingKeyword, parameter); - if (!ok) - warning("Unknown keyword: " + pendingKeyword + - " (param " + currentCharacters + ")"); + int parameter = 0; + try { + parameter = Integer.parseInt(currentCharacters.toString()); + ok = handleKeyword(pendingKeyword, parameter); + if (!ok) { + warning("Unknown keyword: " + pendingKeyword + + " (param " + currentCharacters + ")"); + } + } catch (NumberFormatException e) { + warning("Illegal number format " + currentCharacters.toString() + + " in " + pendingKeyword + " tag"); + } pendingKeyword = null; currentCharacters = new StringBuffer(); state = S_text; @@ -279,14 +306,16 @@ } break; case S_inblob: - binaryBuf.write(ch); - binaryBytesLeft --; + if (binaryBytesLeft > 0) { + binaryBuf.write(ch); + binaryBytesLeft--; + } if (binaryBytesLeft == 0) { - state = S_text; - specialsTable = savedSpecials; - savedSpecials = null; - handleBinaryBlob(binaryBuf.toByteArray()); - binaryBuf = null; + state = S_text; + specialsTable = savedSpecials; + savedSpecials = null; + handleBinaryBlob(binaryBuf.toByteArray()); + binaryBuf = null; } } } diff -Nru openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFReader.java openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFReader.java --- openjdk-8-8u292-b10/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFReader.java 2021-02-18 17:34:20.000000000 +0000 +++ openjdk-8-8u312-b07/=unpacked-tar3=/src/share/classes/javax/swing/text/rtf/RTFReader.java 2021-09-01 14:33:15.000000000 +0000 @@ -66,12 +66,12 @@ Dictionary fontTable; /** This array maps color indices to Color objects. */ Color[] colorTable; - /** This array maps character style numbers to Style objects. */ - Style[] characterStyles; - /** This array maps paragraph style numbers to Style objects. */ - Style[] paragraphStyles; - /** This array maps section style numbers to Style objects. */ - Style[] sectionStyles; + /** This Map maps character style numbers to Style objects. */ + Map characterStyles; + /** This Map maps paragraph style numbers to Style objects. */ + Map paragraphStyles; + /** This Map maps section style numbers to Style objects. */ + Map sectionStyles; /** This is the RTF version number, extracted from the \rtf keyword. * The version information is currently not used. */ @@ -832,9 +832,9 @@ public void close() { - Vector